home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / NCB.H < prev    next >
C/C++ Source or Header  |  1997-09-05  |  9KB  |  170 lines

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