home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c004 / 4.ddi / NETBIOS / CTNBIO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-18  |  7.8 KB  |  235 lines

  1. /*
  2.  *    netbios version of c-tree
  3.  *    netbios data structures, cmd codes, err codes, etc
  4.  *
  5.  *    This program is the CONFIDENTIAL and PROPRIETARY property 
  6.  *    of FairCom(R) Corporation. Any unauthorized use, reproduction or
  7.  *    transfer of this program is strictly prohibited.
  8.  *
  9.  *      Copyright (c) 1987, 1988, 1989 FairCom Corporation
  10.  *    (Subject to limited distribution and
  11.  *     restricted disclosure only.)
  12.  *    *** ALL RIGHTS RESERVED ***
  13.  *
  14.  *    4006 West Broadway
  15.  *    Columbia, MO 65203
  16.  *
  17.  *
  18.  *    c-tree(R)    Version 4.3
  19.  *            Release C
  20.  *            February 7, 1989 17:30
  21.  *
  22.  */
  23.  
  24. /* 
  25.  *
  26.  * NOTE for MS-C compiler, the structure member alignment for the
  27.  * netbios data structures works out ok without having to use the
  28.  * pack structures (/Zp) switch
  29.  */
  30.  
  31.  
  32. /**************************
  33.  * NETWORK COMMAND BLOCKS *
  34.  **************************/
  35.  
  36. /*
  37.  * Network Control Block
  38.  *
  39.  * Notes: bufptr and anr are really 32 bit 8086 type pointers. they are
  40.  * treated as ULONGs to avoid model decisions here.
  41.  */
  42.  
  43. typedef struct ncb
  44. {
  45.     UTEXT  cmd;        /* command code NCBxxxx */
  46.     UTEXT  err;        /* error result NERRxxxx */
  47.     UTEXT  lsn;        /* session number */
  48.     UTEXT  namenum;        /* name number */
  49.     UTEXT far *bufptr;    /* buffer far pointer */
  50.     UCOUNT buflen;        /* buffer length  */
  51.     UTEXT  rname[16];    /* remote network name */
  52.     UTEXT  lname[16];    /* local  network name */
  53.     UTEXT  rto;        /* rec timeout in 500 ms incs - 0 forever */
  54.     UTEXT  sto;        /* send timeout - same */
  55.     UCOUNT (far *anr)();    /* ptr to asynch cmd complete routine */
  56.     UTEXT  lana;        /* netbios # */
  57.     UTEXT  doneflag;    /* 0xff when cmd in prog, != 0xff when done */
  58.     UTEXT  res[14];        /* not used */
  59. } NCB;
  60.  
  61. /*
  62.  *    Command Codes
  63.  */
  64.  
  65. #define NCBanr        0x80    /* or'd with cmd code for async mode */
  66.  
  67. #define NCBcall        0x10    /* make session */
  68. #define NCBlisten    0x11    /* listen for make session */
  69. #define NCBhangup    0x12    /* terminate session */
  70. #define NCBsend        0x14    /* send session data */
  71. #define NCBreceive    0x15    /* receive session data */
  72. #define NCBrecvany    0x16    /* receive for any session under name */
  73. #define NCBsendtwo    0x17    /* concat two blocks and send */
  74. #define NCBsenddgrm    0x20    /* send datagram */
  75. #define NCBrecvdgrm    0x21    /* receive datagram */
  76. #define NCBsendbcst     0x22    /* send broadcast */
  77. #define NCBrecvbcst     0x23    /* receive broadcast */
  78. #define NCBaddname    0x30    /* add name  */
  79. #define NCBdelname    0x31    /* delete name */
  80. #define NCBreset    0x32    /* reset netbios */
  81. #define NCBastatus    0x33    /* get network adapter status */
  82. #define NCBcstatus    0x34    /* get session status */
  83. #define NCBcancel    0x35    /* cancel a command */
  84.  
  85. /*
  86.  * Network Error Codes
  87.  */
  88.  
  89. #define NERRbadbuflen    0x01    /* illegal buffer length */
  90. #define NERRbadcmd    0x03    /* illegal NCB command */
  91. #define NERRcmdto    0x05    /* timed out */
  92. #define NERRmsgincompl    0x06    /* message incomplete */
  93. #define NERRinvlsn    0x08    /* invalid session id */
  94. #define NERRnoresrc    0x09    /* out of resources */
  95. #define NERRsesterm    0x0A    /* session terminated */
  96. #define NERRcmdcanc    0x0B    /* command cancelled */
  97. #define NERRdupname    0x0D    /* duplicate name */
  98. #define NERRnamefull    0x0E    /* name table full */
  99. #define NERRdelcanc    0x0F    /* cmd cancled because name deleted */
  100. #define NERRsesfull    0x11    /* session table full */
  101. #define NERRcallrej    0x12    /* call rejected */
  102. #define NERRinvnamnum    0x13    /* invalid name number */
  103. #define NERRnoanswer    0x14    /* no answer on a call */
  104. #define NERRinvname    0x15    /* name not found */
  105. #define NERRnamebusy    0x16    /* name in use */
  106. #define NERRsesabterm    0x18    /* session terminated abnormally */
  107. #define NERRnameconf    0x19    /* name conflict detected */
  108. #define NERRintfbusy    0x21    /* interface is temporarily busy */
  109. #define NERRtoomnycmd    0x22    /* command table temporarily full */
  110. #define NERRcmdcompl    0x24    /* command completed before cancel */
  111. #define NERRinvcanc    0x26    /* can't cancel that command */
  112. #define NERRnotdoneyet    0xff    /* error code until command completes */
  113.  
  114.  
  115.  
  116. /***********************************
  117.  * ADAPTER STATUS REPORTS ELEMENTS *
  118.  ***********************************/
  119.  
  120. /*
  121.  * individual names's status within a name status report
  122.  */
  123.  
  124. typedef struct nb_insts
  125. {
  126.     UTEXT name[16];        /* 0x00 name */
  127.     UTEXT namenum;        /* 0x10 name number */
  128.     UTEXT namestat;        /* 0x11 name status (INSTATxxx) */
  129. } NB_INSTS;
  130.  
  131. /*
  132.  * name state codes
  133.  */
  134.  
  135. #define INSTATclaiming        0    /* trying to register name */
  136. #define INSTATclaimed        4    /* registered name */
  137. #define INSTATdeclaimed     5    /* de-registered name */
  138. #define INSTATdupname        6    /* duplicate name */
  139. #define INSTATdupdeclaimed    7    /* duplicate name, dereg pending */
  140. #define INSTATgroupflag        0x80    /* group name flag */
  141.  
  142.  
  143. /*
  144.  * name status report format
  145.  */
  146.  
  147. typedef struct nb_asts
  148. {
  149.     UTEXT  nodename[6];    /* 00 board address (permanent node name) */
  150.     UTEXT  xjmpr;        /* 06 ext. jumper sts (bit 7 =jmpr w2, 6 = w1) */
  151.     UTEXT  teststs;        /* 07 last test status result */
  152.     UTEXT  majversion;    /* 08 major version num */
  153.     UTEXT  minversion;    /* 09 minor vers */
  154.     UCOUNT reportmins;    /* 0a time of reporting period in minutes */
  155.     UCOUNT numcrcs;        /* 0c number of crc errs */
  156.     UCOUNT numalign;    /* 0e number of alignment errors */
  157.     UCOUNT numcollision;    /* 10 number of collisions */
  158.     UCOUNT numaborts;    /* 12 number of aborted transmissions */
  159.     ULONG  paksent;        /* 14 number of packets sent */
  160.     ULONG  pakrecv;        /* 18 number of packets received */
  161.     UCOUNT resends;        /* 1c number of retransmissions */
  162.     UCOUNT nobuffs;        /* 1e number of times out of receive buffers */
  163.     UTEXT  res1[8];        /* 20 for internal use */
  164.     UCOUNT free_ncb;    /* 28 free ncbs */
  165.     UCOUNT max_confncb;    /* 2a configured max num of ncbs */
  166.     UCOUNT max_ncb;        /* 2c maximum number of ncbs */
  167.     UTEXT  res2[4];        /* 2e */
  168.     UCOUNT numpendses;    /* 32 number of active sessions */
  169.     UCOUNT max_confses;    /* 34 configured max allowable ses's */
  170.     UCOUNT max_ses;        /* 36 max possible ses's */
  171.     UCOUNT max_msg_size;    /* 38 maximum message data size */
  172.     UCOUNT numnames;    /* 3a number of names in name table */
  173.     NB_INSTS insts[16];    /* 3c  16 names' status */
  174. } NB_ASTS;
  175.  
  176.  
  177. /***********************************
  178.  * SESSION STATUS REPORTS ELEMENTS *
  179.  ***********************************/
  180.  
  181. /*
  182.  * sessions' status within a session status report
  183.  */
  184.  
  185. typedef struct nb_ivsts
  186. {
  187.     UTEXT lsn;        /* 00 local session number */
  188.     UTEXT state;        /* 01 state (IVSTATxxx) */
  189.     UTEXT lname[16];    /* 02 local name */
  190.     UTEXT rname[16];    /* 12 remote's name */
  191.     UTEXT numrv;        /* 22 num of receive cmds outstanding */
  192.     UTEXT numsn;        /* 23 num of send cmds outstanding */
  193. } NB_IVSTS;
  194.  
  195. /*
  196.  * session state codes
  197.  */
  198.  
  199. #define IVSTATlisten    1    /* listen pending */
  200. #define IVSTATcall    2    /* call in progress */
  201. #define IVSTATactive    3    /* session established */
  202. #define IVSTAThangup    4    /* hangup pending */
  203. #define IVSTAThungup    5    /* hangup completed */
  204. #define IVSTATaborted    6    /* session aborted */
  205.  
  206. /*
  207.  *  session status report format
  208.  */
  209.  
  210. typedef struct nb_vsts
  211. {
  212.     UTEXT namenum;        /* 00 name num of sessions being reported */
  213.     UTEXT numses;        /* 01 num of sessions */
  214.     UTEXT numrvdg;        /* 02 num of recv dgram and rcv bcasts out */
  215.     UTEXT numrvany;        /* 04 num of recv any's outstanding */
  216.     /***** IVSTS entries follow here, numses of them ****/
  217. } NB_VSTS;
  218.  
  219.  
  220. /*
  221.  * prototypes
  222.  */
  223.  
  224. UCOUNT nb_install_check(void);
  225. UCOUNT nb_adapter_stat(NCB *, UTEXT, UCOUNT(far *)(),UTEXT *,NB_ASTS *,UCOUNT);
  226. UCOUNT nb_addname(NCB *, UTEXT, UCOUNT(far *)(), UTEXT *);
  227. UCOUNT nb_delname(NCB *, UTEXT, UCOUNT(far *)(), UTEXT *);
  228. UCOUNT nb_listen(NCB *, UTEXT, UCOUNT(far *)(),UTEXT *, UTEXT *, UTEXT, UTEXT);
  229. UCOUNT nb_call(NCB *, UTEXT, UCOUNT(far *)(),UTEXT *, UTEXT *, UTEXT, UTEXT);
  230. UCOUNT nb_send(NCB *, UTEXT, UCOUNT(far *)(), UTEXT, UTEXT *, UCOUNT);
  231. UCOUNT nb_recv(NCB *, UTEXT, UCOUNT(far *)(), UTEXT, UTEXT *, UCOUNT);
  232. UCOUNT nb_recvany(NCB *, UTEXT, UCOUNT(far *)(), UTEXT, UTEXT *, UCOUNT);
  233. UCOUNT nb_hangup(NCB *, UTEXT, UCOUNT(far *)(), UTEXT);
  234. UCOUNT nb_cancel(NCB *, NCB *);
  235.