home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / n / netbioc.zip / NCB.H < prev    next >
C/C++ Source or Header  |  1992-03-01  |  7KB  |  185 lines

  1. /********************************************************************
  2.  *                                    *
  3.  *  About this file ...  NCB.H                        *
  4.  *                                    *
  5.  *  This file contains information about NCBs and NCB structure     *
  6.  *                                    *
  7.  *                                    *
  8.  *                                    *
  9.  *  History:    Alok Sinha  October, 1991    Created based on Lan   *
  10.  *                         Manager Programmer Tool*
  11.  *                         Kit  (PTK)            *
  12.  *                                    *
  13.  ********************************************************************/
  14.  
  15. #ifndef NETNCB_INCLUDED
  16.  
  17. #define NETNCB_INCLUDED 
  18.  
  19.  
  20. /**************************************************************** 
  21.  *                                *
  22.  *          Data structure templates            *
  23.  *                                *
  24.  ****************************************************************/
  25.  
  26. #define NCBNAMSZ    16      /* absolute length of a net name    */
  27.  
  28. /*
  29.  * Network Control Block 
  30.  */
  31.  
  32. struct ncb {
  33.     unsigned char   ncb_command;        /* command code            */
  34.     unsigned char   ncb_retcode;        /* return code            */
  35.     unsigned char   ncb_lsn;            /* local session number        */
  36.     unsigned char   ncb_num;            /* number of our network name   */
  37.     char far *        ncb_buffer;         /* address of message buffer    */
  38.     unsigned short  ncb_length;         /* size of message buffer        */
  39.     char        ncb_callname[NCBNAMSZ]; /* blank-padded name of remote  */
  40.     char        ncb_name[NCBNAMSZ];     /* our blank-padded netname     */
  41.     unsigned char   ncb_rto;            /* rcv timeout/retry count        */
  42.     unsigned char   ncb_sto;            /* send timeout/sys timeout     */
  43.     unsigned long   ncb_post;            /* Async notification handle    */
  44.     unsigned char   ncb_lana_num;        /* lana (adapter) number        */
  45.     unsigned char   ncb_cmd_cplt;        /* 0xff => commmand pending     */
  46.     unsigned char   ncb_reserve[14];        /* reserved, used by BIOS        */
  47. };    /* ncb */
  48.  
  49. typedef struct ncb NCB;
  50.  
  51. struct findbuf {
  52.     unsigned short  usNumResponding;
  53.     unsigned char   reserved;
  54.     unsigned char   ucStatus;
  55.     unsigned char   ucLanHeaderLength;
  56. };
  57. typedef struct findbuf FINDBUF;
  58.  
  59. #define MAX_HEADER_LEN     33
  60. #define MAX_NODE     5
  61. #define FIND_BUFFER_LENGTH ( sizeof ( FINDBUF) + MAX_HEADER_LEN * MAX_NODE)
  62.  
  63. /**************************************************************** 
  64.  *                                *
  65.  *          Special values and constants            *
  66.  *                                *
  67.  ****************************************************************/
  68.  
  69. /*
  70.  *    NCB Command codes
  71.  */
  72.  
  73. #define NCBCALL     0x10        /* NCB CALL                */
  74. #define NCBLISTEN    0x11        /* NCB LISTEN                */
  75. #define NCBHANGUP    0x12        /* NCB HANG UP                */
  76. #define NCBSEND     0x14        /* NCB SEND                */
  77. #define NCBRECV     0x15        /* NCB RECEIVE                */
  78. #define NCBRECVANY    0x16        /* NCB RECEIVE ANY            */
  79. #define NCBCHAINSEND    0x17        /* NCB CHAIN SEND            */
  80. #define NCBDGSEND    0x20        /* NCB SEND DATAGRAM            */
  81. #define NCBDGRECV    0x21        /* NCB RECEIVE DATAGRAM         */
  82. #define NCBDGSENDBC    0x22        /* NCB SEND BROADCAST DATAGRAM        */
  83. #define NCBDGRECVBC    0x23        /* NCB RECEIVE BROADCAST DATAGRAM   */
  84. #define NCBADDNAME    0x30        /* NCB ADD NAME             */
  85. #define NCBDELNAME    0x31        /* NCB DELETE NAME            */
  86. #define NCBRESET    0x32        /* NCB RESET                */
  87. #define NCBASTAT    0x33        /* NCB ADAPTER STATUS            */
  88. #define NCBSSTAT    0x34        /* NCB SESSION STATUS            */
  89. #define NCBCANCEL    0x35        /* NCB CANCEL                */
  90. #define NCBADDGRNAME    0x36        /* NCB ADD GROUP NAME            */
  91. #define NCBUNLINK    0x70        /* NCB UNLINK                */
  92. #define NCBSENDNA    0x71        /* NCB SEND NO ACK            */
  93. #define NCBCHAINSENDNA    0x72        /* NCB CHAIN SEND NO ACK        */
  94. #define NCBFINDNAME    0x78        /* NCB FIND NAME            */
  95.  
  96. #define ASYNCH        0x80        /* high bit set == asynchronous     */
  97.  
  98. /*
  99.  *    NCB Return codes
  100.  */
  101.  
  102. #define NRC_GOODRET    0x00    /* good return                     */
  103. #define NRC_BUFLEN    0x01    /* illegal buffer length             */
  104. #define NRC_BFULL    0x02    /* buffers full, no receive issued         */
  105. #define NRC_ILLCMD    0x03    /* illegal command                 */
  106. #define NRC_CMDTMO    0x05    /* command timed out                 */
  107. #define NRC_INCOMP    0x06    /* message incomplete, issue another command */
  108. #define NRC_BADDR    0x07    /* illegal buffer address             */
  109. #define NRC_SNUMOUT    0x08    /* session number out of range             */
  110. #define NRC_NORES    0x09    /* no resource available             */
  111. #define NRC_SCLOSED    0x0a    /* session closed                 */
  112. #define NRC_CMDCAN    0x0b    /* command cancelled                 */
  113. #define NRC_DMAFAIL    0x0c    /* PC DMA failed                 */
  114. #define NRC_DUPNAME    0x0d    /* duplicate name                 */
  115. #define NRC_NAMTFUL    0x0e    /* name table full                 */
  116. #define NRC_ACTSES    0x0f    /* no deletions, name has active sessions    */
  117. #define NRC_INVALID    0x10    /* name not found or no valid name         */
  118. #define NRC_LOCTFUL    0x11    /* local session table full             */
  119. #define NRC_REMTFUL    0x12    /* remote session table full             */
  120. #define NRC_ILLNN    0x13    /* illegal name number                 */
  121. #define NRC_NOCALL    0x14    /* no callname                     */
  122. #define NRC_NOWILD    0x15    /* cannot put * in NCB_NAME             */
  123. #define NRC_INUSE    0x16    /* name in use on remote adapter         */
  124. #define NRC_NAMERR    0x17    /* called name cannot == name or name #      */
  125. #define NRC_SABORT    0x18    /* session ended abnormally             */
  126. #define NRC_NAMCONF    0x19    /* name conflict detected             */
  127. #define NRC_IFBUSY    0x21    /* interface busy, IRET before retrying      */
  128. #define NRC_TOOMANY    0x22    /* too many commands outstanding, retry later*/
  129. #define NRC_BRIDGE    0x23    /* ncb_bridge field not 00 or 01         */
  130. #define NRC_CANOCCR    0x24    /* command completed while cancel occurring  */
  131. #define NRC_RESNAME    0x25    /* reserved name specified             */
  132. #define NRC_CANCEL    0x26    /* command not valid to cancel             */
  133. #define NRC_MULT    0x33    /* multiple requests for same session         */
  134. #define NRC_MAXAPPS    0x36    /* max number of applications exceeded         */
  135. #define NRC_NORESOURCES 0x38    /* requested resources are not available     */
  136. #define NRC_SYSTEM    0x40    /* system error                  */
  137. #define NRC_ROM     0x41    /* ROM checksum failure              */
  138. #define NRC_RAM     0x42    /* RAM test failure                 */
  139. #define NRC_DLF     0x43    /* digital loopback failure             */
  140. #define NRC_ALF     0x44    /* analog loopback failure             */
  141. #define NRC_IFAIL    0x45    /* interface failure                 */
  142. #define NRC_ADPTMALFN    0x50    /* network adapter malfunction             */
  143.  
  144. #define NRC_PENDING    0xff    /* asynchronous command is not yet finished  */
  145.  
  146.  
  147.  
  148. /*
  149.  *    Maximum datagram size
  150.  */
  151.  
  152. #define MAX_DG_SIZE 512
  153.  
  154. /*
  155.  *  OS/2 NetBios calls
  156.  */
  157. #if defined(OS2)
  158. /*
  159.  *    Open modes for NetBiosOpen.
  160.  */
  161.  
  162. #define    NB_REGULAR    1
  163. #define    NB_PRIVILEGED    2
  164. #define    NB_EXCLUSIVE    3
  165.  
  166. unsigned far pascal
  167.   NetBiosOpen ( char far *         pszDevName,
  168.                 char far *           pszReserved,
  169.                 unsigned short       usOpenOpt,
  170.                 unsigned short far * phDevName );
  171.  
  172. unsigned far pascal
  173.   NetBiosClose ( unsigned short hDevName,
  174.                  unsigned short usReserved );
  175.  
  176.  
  177. unsigned far pascal
  178.   NetBiosSubmit ( unsigned short   hDevName,
  179.                   unsigned short   usNcbOpt,
  180.                   struct ncb far * pNCB );
  181.  
  182. #endif /* (OS/2)      */
  183.  
  184. #endif /* NETNCB_INCLUDED */
  185.