home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / 3COMM.ZIP / H.ZIP / NCB.H < prev    next >
C/C++ Source or Header  |  1989-05-17  |  7KB  |  152 lines

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