home *** CD-ROM | disk | FTP | other *** search
- /*
- * CopyRight 1995. Nicholas Poljakov all rights reserved.
- */
- #include <malloc.h>
- #include <stdio.h>
- #include <dos.h>
- #include <attlu.h>
- #include <state1.h>
-
- attachlu (lu_name,
- lsl,
- max_tps,
- tp_exit,
- n,
- p_pstr,
- rc,
- p_lu_id)
-
- char lu_name[8];
- int lsl ; /*lu session limit*/
- char max_tps;
- unsigned long tp_exit ;
- unsigned int n;
-
- struct pstr { /*structure partner*/
- char plu[8] ; /* str plu_name */
- int psl; /* str plu_s_limit */
- char mode_name[8] ; /* str mode_name */
- int max_ru_size; /* str ru_h_size */
- int pacing; /* str = */
- unsigned char lu_type;
- } *p_pstr;
-
- unsigned long *rc;
- char *p_lu_id;
-
- {
- union REGS inregs,outregs;
- struct SREGS segregs;
-
- struct attach_lu *ptr;
- struct plu *ptr_plu;
- struct plu_mode *ptr_mode;
- char *p;
- char *p1;
- char *p2;
- char _near *dp1;
- char _near *dp2;
- int i,t;
- unsigned int tl,l;
- char tplu[9];
-
- toup(lu_name);
- toup(p_pstr->plu);
- toup(p_pstr->mode_name);
- /* system("c:\lu62\lu.exe"); */ /* Set int68 handler */
- tl = n*(sizeof(struct plu) + sizeof(struct plu_mode));
- l = sizeof(struct attach_lu) + tl;
-
- if ((ptr = (char *)calloc(1, l)) == NULL) {
- *rc = PORT_BUSY; /* ¡ÑΓ ñ«ßΓπ»¡«⌐ »á¼∩Γ¿ */
- return(0);
- }
- ptr->verb_cd=Attach_lu; /* kod primitiv */
- /* ex not used */
- copy (ptr->lu_name,lu_name,8);
- ptr->lu_s_limit=lsl;
- ptr->max_tps=max_tps;
- ptr->tp_exit=tp_exit;
- ptr->lt_plu=tl;
- p2=p_pstr;
- t = sizeof(struct attach_lu);
- p =(char *)ptr + t;
- for (i=0;i<n ;i++) {
- p=p+i*(sizeof(struct plu) + sizeof(struct plu_mode));
- p1=p+sizeof(struct plu);
- p2=p2+i*sizeof(struct pstr);
- ptr_plu=p;
- ptr_mode=p1;
- p_pstr=p2;
- memset(tplu,0,9);
- memcpy(tplu,p_pstr->plu,8);
- copy(ptr_plu->plu_name,tplu,8);
- memcpy(tplu,p_pstr->mode_name,8);
- copy(ptr_mode->mode_name,tplu,8);
- ptr_plu->plu_s_limit=p_pstr->psl;
- ptr_plu->plu_a_num = p_pstr->lu_type;
- ptr_plu->rec_lt = sizeof(struct plu) + sizeof(struct plu_mode);
- ptr_mode->ru_h_size=p_pstr->max_ru_size;
- ptr_mode->pacing=p_pstr->pacing;
- }
-
- dp1 = FP_OFF( ptr );
- dp2 = FP_SEG( ptr );
- _asm
- {
- push ds
- mov dx, word ptr dp1[0]
- mov ax, word ptr dp2[0]
- mov ds, ax
- mov ax, Attach_lu
- int 68h
- pop ds
- }
-
- *rc = ptr->rc;
- memcpy(p_lu_id,ptr->lu_id,8);
- free(ptr);
- return(0);
- }
-