home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / ckonbi.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  28KB  |  600 lines

  1. /*  C K O N B I  --  NetBios support  */
  2.  
  3. /*
  4.   COPYRIGHT NOTICE:
  5.  
  6.   Copyright (C) 1985, 2004, Trustees of Columbia University in the City of New
  7.   York.
  8. */
  9.  
  10. /*
  11.    developed by Jeffrey E Altman <jaltman@secure-endpoints.com>
  12.  
  13.    Supports:
  14.       Traditional NetBios interface:
  15.          IBM Lan Adapter and Protocol Support
  16.          IBM OS/2 Extended Services
  17.          IBM Communication Manager/2
  18.  
  19.       Newer Netbeui Interface:
  20.          Microsoft LAN Manager Requester
  21.          IBM LAN Server Requester
  22.          Novell Netware Requester
  23. */
  24.  
  25. #ifdef CK_NETBIOS
  26. #ifndef CKCMAI
  27. #ifndef CKONBI_H
  28. #define CKONBI_H
  29.  
  30. /*------------------------------------------------------------------*/
  31. /*             TYPE DEFINITIONS FOR DATA DECLARATIONS               */
  32. /*------------------------------------------------------------------*/
  33.  
  34.   typedef unsigned char byte;
  35.   typedef unsigned short word;
  36.   typedef unsigned long dword;
  37. #ifdef OS2ONLY
  38.   #pragma seg16(address)
  39.   typedef unsigned char * _Seg16 address;
  40.   #pragma seg16(HSEM16)
  41.   typedef void * _Seg16 HSEM16;
  42.   typedef HSEM16 * PHSEM16;
  43. #else /* OS2ONLY */
  44.   typedef unsigned char * address;
  45.   #define HSEM16 HANDLE
  46.   #define PHSEM16 PHANDLE
  47. #endif /* OS2ONLY */
  48.  
  49. /*----------------------------------------------------------------*/
  50. /*                       NETBIOS COMMAND CODES                    */
  51. /*----------------------------------------------------------------*/
  52.  
  53.      #define   NB_CALL_WAIT                                 0x0010
  54.      #define   NB_LISTEN_WAIT                               0x0011
  55.      #define   NB_HANG_UP_WAIT                              0x0012
  56.      #define   NB_SEND_WAIT                                 0x0014
  57.      #define   NB_RECEIVE_WAIT                              0x0015
  58.      #define   NB_RECEIVE_ANY_WAIT                          0x0016
  59.      #define   NB_CHAIN_SEND_WAIT                           0x0017
  60.      #define   NB_SEND_DATAGRAM_WAIT                        0x0020
  61.      #define   NB_RECEIVE_DATAGRAM_WAIT                     0x0021
  62.      #define   NB_SEND_BROADCAST_DATAGRAM_WAIT              0x0022
  63.      #define   NB_RECEIVE_BROADCAST_DATAGRAM_W              0x0023
  64.      #define   NB_ADD_NAME_WAIT                             0x0030
  65.      #define   NB_DELETE_NAME_WAIT                          0x0031
  66.      #define   NB_RESET_WAIT                                0x0032
  67.      #define   NB_STATUS_WAIT                               0x0033
  68.      #define   NB_SESSION_STATUS_WAIT                       0x0034
  69.      #define   NB_CANCEL_WAIT                               0x0035
  70.      #define   NB_ADD_GROUP_NAME_WAIT                       0x0036
  71.      #define   NB_ENUMERATE_LANA_NUM_WAIT                   0x0037
  72.      #define   NB_UNLINK_WAIT                               0x0070
  73.      #define   NB_SEND_NO_ACK_WAIT                          0x0071
  74.      #define   NB_CHAIN_SEND_NO_ACK_WAIT                    0x0072
  75.      #define   NB_LAN_STATUS_ALERT_WAIT                     0x0073
  76.      #define   NB_ACTION_WAIT                               0x0077
  77.      #define   NB_FIND_NAME_WAIT                            0x0078
  78.      #define   NB_TRACE_WAIT                                0x0079
  79.      #define   NB_CALL                                      0x0090
  80.      #define   NB_LISTEN                                    0x0091
  81.      #define   NB_HANG_UP                                   0x0092
  82.      #define   NB_SEND                                      0x0094
  83.      #define   NB_RECEIVE                                   0x0095
  84.      #define   NB_RECEIVE_ANY                               0x0096
  85.      #define   NB_CHAIN_SEND                                0x0097
  86.      #define   NB_SEND_DATAGRAM                             0x00A0
  87.      #define   NB_RECEIVE_DATAGRAM                          0x00A1
  88.      #define   NB_SEND_BROADCAST_DATAGRAM                   0x00A2
  89.      #define   NB_RECEIVE_BROADCAST_DATAGRAM                0x00A3
  90.      #define   NB_ADD_NAME                                  0x00B0
  91.      #define   NB_DELETE_NAME                               0x00B1
  92.      #define   NB_STATUS                                    0x00B3
  93.      #define   NB_SESSION_STATUS                            0x00B4
  94.      #define   NB_ADD_GROUP_NAME                            0x00B6
  95.      #define   NB_ENUMERATE_LANA_NUM                        0x00B7
  96.      #define   NB_UNLINK                                    0x00F0
  97.      #define   NB_SEND_NO_ACK                               0x00F1
  98.      #define   NB_CHAIN_SEND_NO_ACK                         0x00F2
  99.      #define   NB_LAN_STATUS_ALERT                          0x00F3
  100.      #define   NB_ACTION                                    0x00F7
  101.      #define   NB_FIND_NAME                                 0x00F8
  102.      #define   NB_TRACE                                     0x00F9
  103.  
  104.      #define   NB_INVALID_COMMAND_CODE                      0x00FF
  105.  
  106.  
  107. /*----------------------------------------------------------------*/
  108. /*                       NETBIOS RETURN CODES                     */
  109. /*----------------------------------------------------------------*/
  110.  
  111.      #define   NB_COMMAND_SUCCESSFUL                        0x0000
  112.      #define   NB_ILLEGAL_BUFFER_LEN                        0x0001
  113.      #define   NB_INVALID_COMMAND                           0x0003
  114.      #define   NB_COMMAND_TIME_OUT                          0x0005
  115.      #define   NB_MESSAGE_INCOMPLETE                        0x0006
  116.      #define   NB_DATA_NOT_RECEIVED                         0x0007
  117.      #define   NB_ILLEGAL_LOCAL_SESSION                     0x0008
  118.      #define   NB_NO_RES_AVAILABLE                          0x0009
  119.      #define   NB_SESSION_CLOSED                            0x000A
  120.      #define   NB_COMMAND_CANCELLED                         0x000B
  121.      #define   NB_DUPLICATE_NAME                            0x000D
  122.      #define   NB_NAME_TABLE_FULL                           0x000E
  123.      #define   NB_CMND_CMPL_DEREGISTERED                    0x000F
  124.      #define   NB_SESSION_TABLE_FULL                        0x0011
  125.      #define   NB_SES_OPEN_REJECTED                         0x0012
  126.      #define   NB_ILLEGAL_NAME_NUMBER                       0x0013
  127.      #define   NB_REMOTE_NAME_NOT_FOUND                     0x0014
  128.      #define   NB_LOCAL_NAME_NOT_FOUND                      0x0015
  129.      #define   NB_NAME_IN_USE                               0x0016
  130.      #define   NB_NAME_DELETED                              0x0017
  131.      #define   NB_SESSION_ENDED_ABNORMALLY                  0x0018
  132.      #define   NB_NAME_CONFLICT                             0x0019
  133.      #define   NB_INTERFACE_BUSY                            0x0021
  134.      #define   NB_MAX_CMNDS_EXCEEDED                        0x0022
  135.      #define   NB_INVALID_ADAPTER                           0x0023
  136.      #define   NB_CMND_ALREADY_COMPLETED                    0x0024
  137.      #define   NB_CMND_INVALID_TO_CANCEL                    0x0026
  138.      #define   NB_NAME_DEFINED_BY_OTHERS                    0x0030
  139.      #define   NB_ENVIRONMENT_NOT_DEFINED                   0x0034
  140.      #define   NB_NO_OS_RESOURCES                           0x0035
  141.      #define   NB_MAX_APPL_EXCEEDED                         0x0036
  142.      #define   NB_NO_SAP_AVAILABLE                          0x0037
  143.      #define   NB_INADEQUATE_RESOURCES                      0x0038
  144.      #define   NB_INVALID_NCB_ADDRESS                       0x0039
  145.      #define   NB_RESET_INVALID                             0x003A
  146.      #define   NB_INVALID_DD_ID                             0x003B
  147.      #define   NB_SEGMENT_LOCK_UNSUCCESSFUL                 0x003C
  148.      #define   NB_DD_OPEN_ERROR                             0x003F
  149.      #define   NB_OS_ERROR_DETECTED                         0x0040
  150.      #define   NB_PERM_RING_STATUS                          0x004F
  151.  
  152.      #define   NB_UNEXPECTED_CCB_ERROR                      0x00F6
  153.      #define   NB_ADAPTER_OPEN_ERROR                        0x00F8
  154.      #define   NB_ADAPTER_HANDLER_ERROR                     0x00F9
  155.      #define   NB_ADAPTER_CHECK                             0x00FA
  156.      #define   NB_CODE_NOT_OPERATIONAL                      0x00FB
  157.      #define   NB_OPEN_FAILURES                             0x00FC
  158.      #define   NB_UNEXPECTED_CLOSE                          0x00FD
  159.  
  160.      #define   NB_COMMAND_IN_PROCESS                        0x00FF
  161.  
  162. /*------------------------------------------------------------------*/
  163. /*               NETBIOS NCB SESSION STATES                         */
  164. /*------------------------------------------------------------------*/
  165.  
  166.      #define   NB_SESSION_STATE_CLOSED                      0x0000
  167.      #define   NB_SESSION_STATE_LISTEN_PENDING              0x0001
  168.      #define   NB_SESSION_STATE_CALL_PENDING                0x0002
  169.      #define   NB_SESSION_STATE_SESSION_ACTIVE              0x0003
  170.      #define   NB_SESSION_STATE_HANGUP_PENDING              0x0004
  171.      #define   NB_SESSION_STATE_HANGUP_COMPLETE             0x0005
  172.      #define   NB_SESSION_STATE_SESSION_ABORTED             0x0006
  173.  
  174. #define NETBIOS_NAME_LEN 16
  175.  
  176. #ifdef OS2ONLY
  177. /*------------------------------------------------------------------*/
  178. /*               NETBIOS NCB DATA DECLARATIONS                      */
  179. /*------------------------------------------------------------------*/
  180.  
  181. struct     network_control_block
  182.  {
  183.   byte       ncb_command;               /* Netbios command code      */
  184.   byte       ncb_retcode;               /* Return code               */
  185.   byte       ncb_lsn;                   /* Local session number      */
  186.   byte       ncb_num;                   /* Number of application name*/
  187.   address    ncb_buffer_address;        /* Address of message buffer */
  188.   word       ncb_length;                /* length of message buffer  */
  189.   byte       ncb_callname[16];          /* Destination name          */
  190.   byte       ncb_name[16];              /* Source name               */
  191.   byte       ncb_rto;                   /* Receive timeout           */
  192.   byte       ncb_sto;                   /* Send timeout              */
  193.   union                                 /* Offset 44 parameters      */
  194.    {
  195.    address   ncb_post_address;          /* Address of post routine   */
  196.    HSEM16    ncb_post_handle;           /* Handle to event semaphore */
  197.    struct
  198.     {
  199.     word     ncb_post_addr_offset;      /* Offset of post routine    */
  200.     word     ncb_dd_id;                 /* Device driver ID          */
  201.     } DD;
  202.    } off44;
  203.   byte       ncb_lana_num;              /* Adapter number            */
  204.   byte       ncb_cmd_cplt;              /* Command status            */
  205.   byte       ncb_reserve[14];           /* Reserved (except RESET)   */
  206.  };
  207.  
  208.  
  209. struct     ncb_status_information
  210.  {
  211.   byte       burned_in_addr[6];         /* Adapter's burned in addr  */
  212.   byte       reserved1[2];              /* RESERVED always X'0000'   */
  213.   word       software_level_number;     /* X'FFnn' - nn is level num */
  214.   word       reporting_period;          /* reporting period (minutes)*/
  215.   word       frmr_frames_received;      /* Number of FRMR received   */
  216.   word       frmr_frames_sent;          /* Number of FRMR sent       */
  217.   word       bad_iframes_received;      /* # bad Iframes received    */
  218.   word       aborted_transmissions;     /* # aborted transmits       */
  219.   dword      packets_transmitted;       /* # Successfully transmitted*/
  220.   dword      packets_received;          /* # Successfully received   */
  221.   word       bad_iframes_transmitted;   /* # bad Iframes transmitted */
  222.   word       lost_data_count;           /* Lost SAP buffer data cnt  */
  223.   word       t1_expiration_count;       /* Number of T1 expirations  */
  224.   word       ti_expiration_count;       /* Number of Ti expirations  */
  225.   address    extended_status_table;     /* Address of extended status*/
  226.   word       number_of_free_ncbs;       /* Number of NCBs available  */
  227.   word       max_configured_ncbs;       /* Configured NCB maximum    */
  228.   word       max_allowed_ncbs;          /* Maximum NCBs (always 255) */
  229.   word       busy_condition_count;      /* Local station busy count  */
  230.   word       max_datagram_size;         /* Maximum datagram packet   */
  231.   word       pending_sessions;          /* Number of pending sessions*/
  232.   word       max_configured_sessions;   /* Configured session maximum*/
  233.   word       max_allowed_sessions;      /* Maximum sessions (254)    */
  234.   word       max_data_packet_size;      /* Maximum session packet    */
  235.   word       number_of_names_present;   /* Number of names in table  */
  236.  };
  237.  
  238.  
  239. struct     ncb_extended_status
  240.  {
  241.   byte       reserved[40];              /* RESERVED                  */
  242.   byte       local_adapter_address[6];  /* Adapter's local address   */
  243.  };
  244.  
  245.  
  246. struct     ncb_session_status
  247.  {
  248.   byte       name_number_of_sessions;   /* Name number for sessions  */
  249.   byte       sessions_using_name;       /* # of sessions using name  */
  250.   byte       active_rcv_datagrams;      /* # of receive datagrams out*/
  251.   byte       active_receive_anys;       /* # of RECEIVE.ANY cmnds out*/
  252.   byte       local_session_number;      /* Local session number      */
  253.   byte       session_state;             /* State of session          */
  254.   byte       local_name[16];            /* Local name                */
  255.   byte       remote_name[16];           /* Remote name               */
  256.   byte       active_receives;           /* # of RECEIVE cmnds out    */
  257.   byte       active_sends;              /* # of SEND, CHAIN.SEND out */
  258.  };
  259.  
  260.  
  261. struct     ncb_find_name_info
  262.  {
  263.   word       nodes_responding;          /* Number of nodes responding*/
  264.   byte       reserved;                  /* RESERVED                  */
  265.   byte       name_status;               /* Unique/Group name flag    */
  266.  };
  267.  
  268.  
  269. struct     ncb_lan_header_entry
  270.  {
  271.   byte       lan_entry_length;          /* Length of entry           */
  272.   byte       lan_pcf0;                  /* Physical control field 0  */
  273.   byte       lan_pcf1;                  /* Physical control field 1  */
  274.   byte       lan_destination_addr[6];   /* Destination address       */
  275.   byte       lan_source_addr[6];        /* Source address            */
  276.   byte       lan_routing_info[18];      /* Routing information       */
  277.  };
  278.  
  279. struct     ncb_chain_send
  280.  {
  281.   byte       ncb_command;               /* Netbios command code      */
  282.   byte       ncb_retcode;               /* Return code               */
  283.   byte       ncb_lsn;                   /* Local session number      */
  284.   byte       not_used1;                 /* Not used                  */
  285.   address    ncb_buffer_address;        /* Address of message buffer */
  286.   word       ncb_length;                /* Length of message buffer  */
  287.   word       buffer_two_length;         /* Length of second buffer   */
  288.   address    buffer_two_address;        /* Address to second buffer  */
  289.   byte       reserved[10];              /* RESERVED                  */
  290.   byte       not_used2[18];             /* Not used                  */
  291.   union                                 /* Offset 44 parameters      */
  292.    {
  293.    address   ncb_post_address;          /* Address of post routine   */
  294.    struct
  295.     {
  296.     word     ncb_post_addr_offset;      /* Offset of post routine    */
  297.     word     ncb_dd_id;                 /* Device driver ID          */
  298.     } DD;
  299.    } off44 ;
  300.   byte       ncb_lana_num;              /* Adapter number            */
  301.   byte       ncb_cmd_cplt;              /* Command status            */
  302.   byte       ncb_reserve[14];           /* Reserved                  */
  303.  };
  304.  
  305.  
  306. struct     ncb_reset
  307.  {
  308.   byte       ncb_command;               /* Netbios command code      */
  309.   byte       ncb_retcode;               /* Return code               */
  310.   byte       ncb_lsn;                   /* Local session number      */
  311.   byte       ncb_num;                   /* Number of application name*/
  312.   address    dd_name_address;           /* Device drive name address */
  313.   byte       not_used1[2];              /* Not used                  */
  314.   byte       req_sessions;              /* # of sessions requested   */
  315.   byte       req_commands;              /* # of commands requested   */
  316.   byte       req_names;                 /* # of names requested      */
  317.   byte       req_name_one;              /* Name number one request   */
  318.   byte       not_used2[12];             /* Not used                  */
  319.   byte       act_sessions;              /* # of sessions obtained    */
  320.   byte       act_commands;              /* # of commands obtained    */
  321.   byte       act_names;                 /* # of names obtained       */
  322.   byte       act_name_one;              /* Name number one response  */
  323.   byte       not_used3[4];              /* Not used                  */
  324.   byte       load_session;              /* Number of sessions at load*/
  325.   byte       load_commands;             /* Number of commands at load*/
  326.   byte       load_names;                /* Number of names at load   */
  327.   byte       load_stations;             /* Number of stations at load*/
  328.   byte       not_used4[2];              /* Not used                  */
  329.   byte       load_remote_names;         /* Number of remote names    */
  330.   byte       not_used5[5];              /* Not used                  */
  331.   word       ncb_dd_id;                 /* NCB device driver ID      */
  332.   byte       ncb_lana_num;              /* Adapter number            */
  333.   byte       not_used6;                 /* Not used                  */
  334.   byte       ncb_reserve[14];           /* NCB error information     */
  335.  };
  336.  
  337. /*------------------------------------------------------------------*/
  338. /*               NETBIOS TRACE DATA DECLARATIONS                    */
  339. /*------------------------------------------------------------------*/
  340.  
  341. struct     ncb_entry_header
  342.  {
  343.   byte       trace_adapter_number;      /* Adapter number for trace  */
  344.   byte       trace_environment_id;      /* Trace environment ID      */
  345.   byte       trace_type;                /* Trace type                */
  346.   byte       trace_modifier;            /* Trace modifier            */
  347.   byte       reserved[4];               /* RESERVED                  */
  348.  };
  349.  
  350. struct     ncb_trace_ncb
  351.  {
  352.   struct     ncb_entry_header common;   /* Trace entry header        */
  353.   byte       byte_preceding_ncb;        /* Byte preceding NCB        */
  354.   byte       byte_following_ncb;        /* Byte following NCB        */
  355.   address    post_address;              /* Address of post routine   */
  356.   address    data_address;              /* Address of data           */
  357.   byte       data_sample[16];           /* Sample of data at address */
  358.  };
  359.  
  360.  
  361. struct     ncb_trace_status
  362.  {
  363.   struct     ncb_entry_header common;   /* Trace entry header        */
  364.   word       ds_register;               /* DS register contents      */
  365.   word       ss_register;               /* SS register contents      */
  366.   word       sp_register;               /* SP register contents      */
  367.   address    data_address;              /* Address of data           */
  368.  };
  369.  
  370.  
  371. struct     ncb_trace_ring_status
  372.  {
  373.   struct     ncb_trace_status common;   /* Trace entry header        */
  374.   word       ring_status;               /* Ring status               */
  375.  };
  376.  
  377.  
  378. struct     ncb_system_action
  379.  {
  380.   struct     ncb_trace_status common;   /* Trace entry header        */
  381.   byte       system_action_id;          /* System action ID          */
  382.   byte       sap_value;                 /* SAP value affected        */
  383.  };
  384.  
  385.  
  386. struct     ncb_trace_pc_error
  387.  {
  388.   struct     ncb_trace_status common;   /* Trace entry header        */
  389.   word       error_code;                /* PC-Detected error code    */
  390.  };
  391.  
  392.  
  393. struct     ncb_trace_adapter_status
  394.  {
  395.   struct     ncb_trace_status common;   /* Trace entry header        */
  396.   word       status_code;               /* Adapter Check reason code */
  397.  };
  398.  
  399.  
  400. struct     ncb_trace_dlc_status
  401.  {
  402.   struct     ncb_trace_status common;   /* Trace entry header        */
  403.   word       station_id;                /* Station ID                */
  404.   word       dlc_status;                /* DLC Status code           */
  405.   byte       frmr_data[5];              /* FRMR data                 */
  406.   byte       access_priority;           /* Access priority           */
  407.   byte       remote_node_addr[6];       /* Remote node address       */
  408.  };
  409.  
  410.  
  411. struct     ncb_trace_return_code
  412.  {
  413.   struct     ncb_trace_status common;   /* Trace entry header        */
  414.   byte       msg_header_xmit[16];       /* Message header transmitted*/
  415.  };
  416.  
  417.  
  418. struct     ncb_trace_receive
  419.  {
  420.   struct     ncb_trace_status common;   /* Trace entry header        */
  421.   byte       msg_header_rcv[16];        /* Message header received   */
  422.  };
  423.  
  424.  
  425. struct     ncb_trace_ccb
  426.  {
  427.   struct     ncb_trace_status common;   /* Trace entry header        */
  428.   byte       ccb_data[16];              /* CCB data structure        */
  429.  };
  430.  
  431. extern unsigned NETBIOS (char *);
  432. #pragma linkage(NETBIOS, far16 pascal)
  433.  
  434. union ncb_types
  435.    {
  436.    struct fncb {
  437.        struct network_control_block bncb;
  438.        HSEM16 ncb_semaphore;
  439.    } basic_ncb;
  440.    struct ncb_chain_send send;
  441.    struct ncb_reset reset;
  442.    };
  443.  
  444. /****************************************************************
  445.  *                                                              *
  446.  *              Begin NETBEUI declarations and constants        *
  447.  *                                                              *
  448.  ****************************************************************/
  449.  
  450. #define DEVLEN 8
  451.  
  452. typedef struct netbios_info_0 {
  453.     char           nb0_net_name[NETBIOS_NAME_LEN+1];
  454. } NETINFO0, *PNETINFO0;      /* netbios_info_0 */
  455.  
  456. typedef struct netbios_info_1 {
  457.     char           nb1_net_name[NETBIOS_NAME_LEN+1];
  458.     char           nb1_driver_name[DEVLEN+1];/* OS/2 device driver name  */
  459.     unsigned char  nb1_lana_num;       /* LAN adapter number of this net */
  460.     char           nb1_pad_1;
  461.     unsigned short nb1_driver_type;
  462.     unsigned short nb1_net_status;
  463.     unsigned long  nb1_net_bandwidth;  /* Network bandwidth, bits/second */
  464.     unsigned short nb1_max_sess;       /* Max number of sessions         */
  465.     unsigned short nb1_max_ncbs;       /* Max number of outstanding NCBs */
  466.     unsigned short nb1_max_names;      /* Max number of names            */
  467. } NETINFO1, *PNETINFO1;      /* netbios_info_1 */
  468.  
  469. /****************************************************************
  470.  *                                                              *
  471.  *              Special values and constants                    *
  472.  *                                                              *
  473.  ****************************************************************/
  474.  
  475.  
  476. /*
  477.  *      Driver types (nb1_driver_type).
  478.  */
  479.  
  480. #define NB_TYPE_NCB     1
  481. #define NB_TYPE_MCB     2
  482.  
  483. /*
  484.  *      Bits defined in nb1_net_status.
  485.  */
  486.  
  487. #define NB_LAN_FLAGS_MASK       0x3FFF  /* Mask for LAN Flags */
  488. #define NB_LAN_MANAGED          0x0001  /* LAN is managed by redirector */
  489. #define NB_LAN_LOOPBACK         0x0002  /* LAN is a loopback driver */
  490. #define NB_LAN_SENDNOACK        0x0004  /* LAN allows SendNoAck NCBs */
  491. #define NB_LAN_LMEXT            0x0008  /* LAN supports LAN Manager
  492.                                                             extended NCBs */
  493. #define NB_LAN_INTNCB           0x0010  /* LAN allows NCB submission at */
  494.                                         /* interrupt time (from NCBDone) */
  495. #define NB_LAN_NORESET          0x0040
  496.  
  497. #define NB_OPEN_MODE_MASK       0xC000  /* Mask for NetBios Open Modes */
  498. #define NB_OPEN_REGULAR         0x4000  /* NetBios opened in Regular mode */
  499. #define NB_OPEN_PRIVILEGED      0x8000  /* NetBios opened in Privileged mode */
  500. #define NB_OPEN_EXCLUSIVE       0xC000  /* NetBios opened in Exclusive mode */
  501.  
  502. /*
  503.  *      Open modes for NetBiosOpen.
  504.  */
  505.  
  506. #define NB_REGULAR      1
  507. #define NB_PRIVILEGED   2
  508. #define NB_EXCLUSIVE    3
  509.  
  510. #define NCBSIZE sizeof(union ncb_types)
  511. #define BNCBSIZE sizeof(struct network_control_block)
  512. typedef union ncb_types NCB;
  513. typedef union ncb_types * PNCB, * _Seg16 PNCB16 ;
  514. typedef struct ncb_status_information STATUSINFO, *PSTATUSINFO;
  515. typedef struct ncb_session_status SESSIONINFO, *PSESSIONINFO;
  516. typedef struct ncb_find_name FINDNAMEINFO, *PFINDNAMEINFO;
  517. typedef struct pbuf2 { USHORT Length; PBYTE Buffer; } *PBuf2;
  518. #else /* OS2ONLY */
  519. #define NCBSIZE sizeof(NCB)
  520. #define BNCBSIZE sizeof(NCB)
  521. typedef ADAPTER_STATUS STATUSINFO, *PSTATUSINFO;
  522. typedef SESSION_HEADER SESSIONINFO, *PSESSIONINFO;
  523. typedef FIND_NAME_HEADER FINDNAMEINFO, *PFINDNAMEINFO;
  524. typedef struct pbuf2 { USHORT Length; PBYTE Buffer; } *PBuf2;
  525. #endif /* OS2ONLY */
  526.  
  527. USHORT NCBAddGroupName(BOOL Netbeui, PNCB Ncb,USHORT lana,PBYTE name);
  528. USHORT NCBAddName(BOOL Netbeui, PNCB Ncb,USHORT lana,PBYTE name);
  529. USHORT NCBCall(BOOL Netbeui, PNCB Ncb,USHORT lana,PBYTE lclname,
  530.    PBYTE rmtname,USHORT recv_timeout,USHORT send_timeout,BOOL wait);
  531. USHORT NCBCancel(BOOL Netbeui, PNCB Ncb,USHORT lana,PNCB NcbToCancel);
  532. USHORT NCBChainSend(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  533.    PBYTE message,USHORT length,PBYTE Buffer2, USHORT Length2,BOOL wait);
  534. USHORT NCBChainSendNoAck(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  535.    PBYTE message,USHORT length,PBYTE Buffer2, USHORT Length2,BOOL wait);
  536. USHORT NCBClose(BOOL Netbeui, PNCB Ncb,USHORT lana);
  537. USHORT NCBConfig(BOOL Netbeui, PNCB Ncb,USHORT lana,PUSHORT sessions,
  538.    PUSHORT commands,PUSHORT names);
  539. USHORT NCBDeleteName(BOOL Netbeui, PNCB Ncb,USHORT lana,PBYTE lclname);
  540. USHORT NCBHangup(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn);
  541. USHORT NCBListen(BOOL Netbeui, PNCB Ncb,USHORT lana,PBYTE lclname,
  542.    PBYTE rmtname,USHORT recv_timeout,USHORT send_timeout,BOOL wait);
  543. USHORT NCBReceive(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,PBYTE buffer,
  544.    USHORT length,BOOL wait);
  545. USHORT NCBReceiveAny(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  546.    PBYTE buffer,USHORT length,BOOL wait);
  547. USHORT NCBReceiveBroadcast(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  548.    PBYTE buffer,USHORT length,BOOL wait);
  549. USHORT NCBReceiveDatagram(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  550.    PBYTE buffer,USHORT length,BOOL wait);
  551. USHORT NCBReset(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT sessions,
  552.    USHORT commands,USHORT names);
  553. USHORT NCBSend(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,PBYTE message,
  554.    USHORT length,BOOL wait);
  555. USHORT NCBSendBroadcast(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  556.    PBYTE message,USHORT length,BOOL wait);
  557. USHORT NCBSendDatagram(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  558.    PBYTE rmtname,PBYTE message,USHORT length,BOOL wait);
  559. USHORT NCBSendNoAck(BOOL Netbeui, PNCB Ncb,USHORT lana,USHORT lsn,
  560.    PBYTE message,USHORT length,BOOL wait);
  561. USHORT NCBStatus(BOOL Netbeui, PNCB Ncb, USHORT lana, PBYTE callname,
  562.    PSTATUSINFO pInfo, word length, BOOL wait );
  563. USHORT NCBSessionStatus(BOOL Netbeui, PNCB Ncb, USHORT lana, PBYTE lclname,
  564.    PSESSIONINFO pInfo, word length, BOOL wait );
  565. USHORT NCBFindName( BOOL Netbeui, PNCB Ncb, USHORT lana, PFINDNAMEINFO pInfo,
  566.    USHORT length, BOOL wait ) ;
  567. VOID NCBCancelOutstanding( VOID );
  568.  
  569. #ifdef OS2ONLY
  570. USHORT netbios_avail(BOOL Netbeui);
  571. USHORT loadapi(PSZ module, PSZ proc, PFN FAR *addr);
  572. #endif /* OS2ONLY */
  573.  
  574. #define NB_ADAPTERS 4               /* number of virtual adapters */
  575. #define NB_LSN 2                    /* number of NetBios sessions */
  576. #define NB_NCB MAXWS+3              /* number of outstanding NCBs */
  577. #define NB_NAMES 2                  /* number of names            */
  578. #define NB_RECV_TIMEOUT 0           /* seconds                    */
  579. #define NB_SEND_TIMEOUT 0           /* seconds                    */
  580.  
  581. extern BOOL NetbeuiAPI ;
  582. extern USHORT netbiosAvail ;
  583. _PROTOTYP( void os2_netbiosinit, (void) ) ;
  584. _PROTOTYP( void os2_netbioscleanup,(void) ) ;
  585.  
  586.  
  587. #ifdef OS2ONLY
  588. /* Declarations of 16-bit Semaphore interface */
  589.  
  590. APIRET16 APIENTRY16 Dos16CreateSem( USHORT, PHSEM16, PSZ ) ;
  591. APIRET16 APIENTRY16 Dos16SemWait( HSEM16, LONG ) ;
  592. APIRET16 APIENTRY16 Dos16SemSet( HSEM16 ) ;
  593. APIRET16 APIENTRY16 Dos16SemClear( HSEM16 ) ;
  594. APIRET16 APIENTRY16 Dos16CloseSem( HSEM16 ) ;
  595. #endif /* OS2ONLY */
  596.  
  597. #endif /* CKONBI_H */
  598. #endif /* CKCMAI */
  599. #endif /* CK_NETBIOS */
  600.