home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / archives / ckc190.zip / ckonbi.h < prev    next >
C/C++ Source or Header  |  1994-07-22  |  28KB  |  576 lines

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