home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / old / ckermit5a190 / ckolat.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  13KB  |  325 lines

  1. #ifndef CKOLAT_H
  2. #define CKOLAT_H
  3.  
  4. /* Definitions for the C interface to the DECnet LAT protocol */
  5. /* Part of DEC PATHWORKS 2.0 for OS/2 */
  6.  
  7. #define uchar unsigned char
  8. #define uint  unsigned short
  9. #define ulong unsigned long
  10.  
  11. #define def_num_sessions    4    /* default # of sessions */
  12. #define max_num_sessions    10    /* maximum # of sessions */
  13. #define min_num_sessions    4    /* minimum # of sessions */
  14.  
  15. #define def_num_buffers        4    /* default number of buffers */
  16. #define max_num_buffers        8    /* maximum number of buffers */
  17. #define min_num_buffers        2    /* minimun number of buffers */
  18.  
  19. #define def_num_services    50    /* default number of services */
  20. #define max_num_services    2048    /* maximum number of services */
  21. #define min_num_services    10    /* minimum number of services */
  22.  
  23. #define def_num_retx        8    /* default number of retransmit */
  24. #define max_num_retx        255    /* maximum number of retransmit */
  25. #define min_num_retx        4    /* minimum number of retransmit */
  26.  
  27. #define SEND_CHAR    1        /* send a character */
  28. #define GET_CHAR    2        /* read a character */
  29. #define GET_CHAR_BLK    3        /* read a block of characters */
  30. #define GET_STATUS    4        /* slot status */
  31. #define START_SESSION    5        /* start a session */
  32. #define    START_SESS_PSW    6        /* start session with password */
  33. #define STOP_SESSION    7        /* stop a session */
  34. #define SEND_BREAK    8        /* send a break signal */
  35. #define ADD_PREFER_NODE    9        /* add preferred node */
  36. #define DEL_PREFER_NODE 10        /* delete preferred node */
  37. #define RESET_COUNTERS    11        /* reset lat counter */
  38. #define READ_COUNTERS    12        /* read lat internal counters */
  39. #define RESET_SERVICES    13        /* reset service index */
  40. #define READ_SERVICES    14        /* read a service entry */
  41. #define READ_SCB    15        /* read all of the scbs */
  42. #define READ_VCB    16        /* read all of the vcbs */
  43. #define READ_LMCB    17        /* read the lmcb */
  44. #define READ_LATINFO    18        /* read lat info */
  45. #define READ_SERVICE_ENTRY 19        /* read service entry info */
  46. #define SET_RETX_LIMIT    20        /* set retransmit limit in lmcb */
  47. #define SET_MULTI_STATE    21        /* set state of multicast receiver */
  48. #define SET_GROUP_CODE    22        /* enable a specific group code     */
  49. #define CLEAR_GROUP_CODE 23        /* clear a specific group code    */
  50.  
  51. /* Status of a remote service */
  52. #define UNREACH         0x01    /* the node for this service is unreachable */
  53.  
  54. /* State of service table */
  55. #define NOT_OVERFLOW    0x00    /* service table not in overflow state */
  56. #define OVERFLOW        0xFF    /* service table in overflow state     */
  57.  
  58. /* Multicast States */
  59. #define MULTICAST_ENABLE   0x00 /* enable the reception of multicast msgs  */
  60. #define MULTICAST_DISABLE  0xFF /* disable the reception of mutlicast msgs */
  61.  
  62. /* Wait Times */
  63. #define LAT_INDEFINITE_WAIT  -1     /* Wait until the desired event occurs  */
  64. #define LAT_IMMEDIATE_RETURN  0  /* Do not wait */
  65.  
  66. /* Masks for fields which may be set/shown in SET_SERVICE/GET_SERVICE call */
  67. #define SRV_FLAGS          0x0001  /* set/show flags field            */
  68. #define SRV_RATING         0x0002  /* set/show rating field           */
  69. #define SRV_IDENT          0x0004  /* set/show identification field   */
  70. #define SRV_PASSWORD       0x0008  /* set/show password field         */
  71. #define SRV_CURSESSIONS    0x0010  /* show current sessions field     */
  72. #define SRV_MAXSESSIONS    0x0020  /* set/show maximum sessions field */
  73. #define SRV_SERVICE        0x0040  /* show service namae              */
  74. #define SRV_SET_ALL \
  75.  (SRV_FLAGS|SRV_RATING|SRV_IDENT|SRV_PASSWORD|SRV_MAXSESSIONS)
  76. #define SRV_GET_ALL        (SRV_SET_ALL|SRV_SERVICE|SRV_CURSESSIONS)
  77.  
  78. /* Masks for flags field of service structure */
  79. #define SRV_ADVERTISE      0x01   /* send out service announcements   */
  80. #define SRV_ENABLE         0x02   /* enable service for connections   */
  81. #define SRV_SLAVE          0x04   /* allow incoming connections       */
  82.  
  83. /* Bit definitions of LatStatus in LAT_CB */
  84. #define LS_NoError        0x0000    /* No error for this function */
  85. #define LS_NoChar        0x8000    /* No character read */
  86. #define LS_CharNotSent        0x8000    /* Character not sent */
  87. #define LS_BrkNotSent        0x8000    /* Break not sent */
  88. #define LS_NotInRun        0x4000    /* Slot session not in run state */
  89. #define LS_TxBufEmpty        0x2000    /* Transmit buffer empty */
  90. #define LS_InvalidSize        0x1000    /* Bad size specified */
  91. #define LS_SesStart        0x0800    /* Session in starting state */
  92. #define LS_InvalidHdl        0x0400    /* Invalid session handle */
  93. #define LS_NoMoreSession     0x0400    /* No more slot session available */
  94. #define LS_TxBufBusy        0x0200    /* Unable to queue transmit data */
  95. #define LS_NoCircuit        0x0200    /* No more virtual circuit */
  96. #define LS_RxData        0x0100    /* Receive data available */
  97. #define LS_NoService        0x0100    /* Service name not found */
  98. #define LS_NoMoreService    0x0080    /* no more new service */
  99. #define LS_NoDLL        0x0040    /* No DLL handle    */
  100. #define LS_OtherError        0x0020    /* another error has happened */
  101. #define LS_IllegalFnc        0xFFFF    /* illegal function */
  102.  
  103. /* LAT_CB Session Status Word */
  104. #define SS_TxBufBusy        0x00    /* Slot session tx buffer busy */
  105. #define SS_Stopped        0x08    /* Slot session stopped! */
  106. #define SS_HostStop        0x10    /* Host sent stop slot */
  107.  
  108. #define IS_InitOK        0x0001    /* LAT driver init'ed */
  109. #define IS_SessionErr        0x0002    /* Session specifier error */
  110. #define IS_BufferErr        0x0004    /* Buffer specifier error */
  111. #define IS_ServiceErr        0x0008    /* Service specifier error */
  112. #define IS_ReTxErr        0x0010    /* Retransmit specifier error */
  113. #define IS_GetMemErr        0x0800    /* Allocate memory error */
  114. #define IS_LatPortailFailed    0x2000    /* Unable to open LAT portal */
  115. #define IS_NeedDll        0x4000    /* DLL driver needed */
  116. #define IS_AlreadyInit        0x8000    /* LAT driver already init'ed */
  117.  
  118. struct  lat_init {
  119.     uint    MaxSessions;        /* Maximum number of slot sessions */
  120.     uint    MaxBuffers;        /* Maximum buffers per session */
  121.     uint    MaxServices;        /* Maximum number of services */
  122.     uint    ReTxLimit;        /* Retransmit limit */
  123.     uint    InitStatus;        /* Initialization status */
  124. };
  125.  
  126. struct  lat_info {
  127.     uchar    vermjr;       /* Major LAT version number  */
  128.     uchar    vermir;       /* Minor LAT version number  */
  129.     uint    NSessions;    /* Maximum number of sessions */
  130.     uint    NBuffers;     /* Maximum number of buffers per session */
  131.     uint    NServices;    /* Maximum number of services */
  132.     uint    scbsize;      /* Memory used by each session (in bytes) */
  133. };
  134.  
  135. struct service_info {
  136.     uchar    node_leng;        /* node name length */
  137.     uchar    node_name[16];        /* node name string */
  138.     uchar    node_addr[6];        /* node address */
  139.     uchar    node_status;        /* node status */
  140.     uchar    serv_rate;        /* service rating */
  141.     uchar    serv_leng;        /* service length */
  142.     uchar    serv_name[16];        /* service string */
  143.     uchar    serv_status;        /* service status */
  144. };
  145.  
  146. struct    scb_info {
  147.     uint    scb_inuse;        /* scb inuse flag */
  148.     uint    reserved1;        /* reserved */
  149.     uint    reserved2;        /* reserved */
  150. };
  151.  
  152. struct    lat_cb    {
  153.     uchar    LatFunction;        /* function code */
  154.     uint    SessionHandle;        /* lat handle */
  155.     uint    SessionStatus;        /* Session status */
  156.     uint    StopReason;        /* Stop reason */
  157.     uint    BufferSize;        /* size of buffer */
  158.     ulong * _Seg16 BufferPtr;        /* pointer to buffer */
  159.     ulong    WaitTime;        /* waiting time */
  160.     uchar    CharByte;        /* I/O character */
  161.     uint    LatStatus;        /* function returned status */
  162. };
  163.  
  164. /*
  165.   The following structures are no longer used but are kept for backwards
  166.   compatibility.
  167. */
  168. struct    lmcb_struct {
  169.     uchar    lat_mess_retrans_limit;    /* retransmit limit */
  170.     uchar    group_enable[32];    /* group code */
  171.     uchar    num_active_circuit;    /* number of active circuits */
  172.     uchar    num_active_session;    /* number of active sessions */
  173.     uint    lat_min_rcv_datagram_size; /* minimun datagram size */
  174.     uchar    protocol_version;    /* protocol version */
  175.     uchar    protocol_eco;
  176.     uchar    max_sim_slots;        /* maximum slots on this circuit */
  177.     uchar    nbr_dl_bufs;        /* number datalink buffers minus 1 */
  178.     uchar    server_circuit_timer;    /* data transfer timer */
  179.     uchar    lat_keep_alive_timer;    /* keep alive timer (sec)*/
  180.     uint    facility_number;    /* Not used */
  181.     uint    product_code;        /* PC LAT server assigned code */
  182.     uchar    server_retransmit_timer; /* unacked retransmit timer(sec) */
  183.     uchar    lat_min_rcv_slot_size;    /* minimum slot size */
  184.     uchar    lat_min_rcv_att_slot_size; /* minimum attention slot size */
  185.     uchar    server_name_len;    /* lat server name length */
  186.     uchar    server_name[16];    /* lat server name */
  187. };
  188.  
  189. struct    node_entry {
  190.     uchar    node_name_len;
  191.     uchar    node_name[16];
  192.     uchar    node_address[6];
  193.     uchar    status_flag;
  194.     uchar    msg_incarnation;
  195.     uchar    node_change_flags;
  196. };
  197.  
  198. struct    vcb_struct {
  199.     uint    vc_state;        /* VC state         */
  200.     uchar    circuit_name[18];    /* circuit name     */
  201.     uchar    vc_type;        /* DCB type        */
  202.     uchar    vc_format;        /* FORMAT of portal    */
  203.     uchar    rem_address[6];        /* Remote adapter address */
  204.     uchar    loc_address[6];        /* local adapter address  */
  205.     uint    cp_typ;            /* Protocol type      */
  206.     uint    cpad;            /* padding          */
  207.     uchar    cctl;            /* mo' paddin'          */
  208.     uchar    cp_ident[5];        /* even mo' paddin'      */
  209.     uint    cportal_id;        /* portal number      */
  210.     ulong    unacked_xmtb;        /* unacked message */
  211.     uint    unacked_xmtb_len;
  212.     uchar    param_len[5];        /* even mo' paddin'      */
  213.     uchar    msg_typ;        /* message type */
  214.     uint    loc_cir_id;        /* local circuit ID */
  215.     uint    rem_cir_id;        /* remote circuit ID */
  216.     uchar    nxmt;            /* next message number to tx */
  217.     uchar    ack;            /* most recent message acked */
  218.     uchar    rrf;            /* response request flag */
  219.     uchar    dwf;            /* data waiting flag */
  220.     uchar    vc_status;        /* number of sessions */
  221.     uint    slot_index; /* index to first slot session on this circuit */
  222.     uint    last_xmit;  /* index to last slot tx'ed on this circuit */
  223.     uchar    retransmit_counter;    /* retransmits on this message */
  224.     uchar    uxmt;            /* unack'ed message # */
  225.     uchar    retransmit_timer_on;    /* re-transmit timer turned on */
  226.     uchar    retransmit_timer;    /* count down for retransmit */
  227.     uchar    balanced_mode_on;    /* balance mode active flag */
  228.     uint    balanced_mode_timer;    /* tick counts for lat_keep_alive */
  229.     uint    max_buf_size;        /* max tx buffer size */
  230.     uchar    max_circuit_sessions;    /* max circuits */
  231.     uint    disconnect_reason;    /* disconnect reason */
  232. };
  233.  
  234. struct    scb_struct {
  235.     uchar    service[18];        /* service name */
  236.     uchar    node[18];
  237.     uchar    port[18];
  238.     ulong    scb_sem;
  239.     uint    session_status;        /* session status word */
  240.     uint    stop_reason;        /* session stop reason */
  241.     uint    slot_state;        /* slot state 0=halted */
  242.     uchar    local_credits;        /* available credits to tx slots */
  243.     uint    vcb_offset;
  244.     uint    vcb_segment;
  245.     uint    back_slot;        /* index to back slot on this circ */
  246.     uint    forward_slot;        /* index to forward slot */
  247.     uchar    rem_slot_id;        /* remote slot connect ID */
  248.     uchar    loc_slot_id;        /* local slot ID */
  249.     uchar    slot_byte_count;    /* number of bytes in tx_slot_data */
  250.     uchar    remote_credits;        /* credits from remote node */
  251.     uchar     tx_slot_data[255];    /* data to be tx'ed */
  252.     uchar    num_slots;        /* number of slots in this buffer */
  253.     uchar    num_occupied;        /* number of slots in use */
  254.     uchar    next_rx_slot;        /* index to next slot to be used */
  255.     uchar    cur_buf_slot;        /* index to current slot in use */
  256.     uint    rx_slot_pntr;        /* offset to next char to be taken */
  257.     uint    slot_ptr_table[2];    /* pointers to the slots */
  258. };
  259.  
  260. struct flagbits {
  261.     unsigned SW_duplicate : 1;
  262.     unsigned SW_invalid_value : 1;
  263.     unsigned SW_found : 1;
  264. };
  265.  
  266. struct    service_entry {
  267.     uint    node_pointer;
  268.     uchar    service_rating;
  269.     uchar    service_name_len;
  270.     uchar    service_name[16];
  271.     uchar    service_status_flags;
  272. };
  273.  
  274. struct lat_count {
  275.     uint    n_count;    /* number of counters */
  276.     uint    ids[12];
  277.     ulong    c1;
  278.     ulong    c2;
  279.     ulong    c3;
  280.     ulong    c4;
  281.     ulong    c5;
  282.     ulong    c6;
  283.     ulong    c7;
  284.     ulong    c8;
  285.     ulong    c9;
  286.     ulong    c10;
  287.     ulong    c11;
  288.     ulong    c12;
  289.     ulong    c13;
  290.     ulong    c14;
  291. };
  292.  
  293. struct    lat_counter {
  294.     ulong    second_since_zeroed;
  295.     ulong    messages_transmitted;
  296.     ulong    messages_received;
  297.     ulong    messages_retransmitted;
  298.     ulong    out_of_seq_mess_received;
  299.     ulong    illegal_messages_received;
  300.     ulong    illegal_slots_received;
  301.     ulong    buf_que_entry_unavailable;
  302.     ulong    transmit_buffer_unavailable;
  303.     ulong    invalid_messages_received;
  304.     ulong    invalid_slot_received;
  305.     ulong    invalid_multicast_received;
  306. };
  307.  
  308. struct decnode {
  309.     unsigned char decnode_flags;
  310.     unsigned short decnode_address;
  311.     char decnode_name[7];
  312.     long decnode_pointer;
  313.     };
  314.  
  315. struct SIB {
  316.     char schar;        /* switch character */
  317.     short value;    /* switch value */
  318.     short defv;        /* default value */
  319.     short minv;        /* min value */
  320.     short maxv;        /* max value */
  321.     struct flagbits flags;        /* switch status flags */
  322. };
  323.  
  324. #endif /* CKOLAT_H */
  325.