home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / header45.zip / ncb.h < prev    next >
C/C++ Source or Header  |  1999-04-29  |  9KB  |  172 lines

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