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

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