Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
7.1 KiB

4 years ago
  1. /*
  2. * CM.H - definitions for connection manager
  3. */
  4. #ifndef _CM_
  5. #define _CM_
  6. #include <ndistapi.h>
  7. #include <cm_pub.h>
  8. /* error codes */
  9. #define CM_E_SUCC 0 /* success, ok */
  10. #define CM_E_NOSLOT 1 /* no slot available error */
  11. #define CM_E_BUSY 2 /* cm context is busy */
  12. #define CM_E_NOSUCH 3 /* no such object */
  13. #define CM_E_BADCHAN 4 /* bad channel argument */
  14. #define CM_E_IDD 5 /* idd command errored */
  15. #define CM_E_NOMEM 6 /* ran out of memory */
  16. #define CM_E_NOTIMPL 7 /* functionalit not implemented yet */
  17. #define CM_E_BADPARAM 8 /* bad parameter */
  18. #define CM_E_BADSTATE 9 /* bad state */
  19. #define CM_E_BADUUS 10 /* bad user-to-user signalling packet */
  20. #define CM_E_BADPORT 11 /* bad nai given */
  21. //
  22. // q931 switch styles
  23. //
  24. #define CM_SWITCHSTYLE_NONE 0 // no style
  25. #define CM_SWITCHSTYLE_AUTO 1 // auto detect
  26. #define CM_SWITCHSTYLE_NI1 2 // national isdn 1
  27. #define CM_SWITCHSTYLE_ATT 3 // at&t 5ess
  28. #define CM_SWITCHSTYLE_NTI 4 // northern telecom dms100
  29. #define CM_SWITCHSTYLE_NET3 5 // net3 (europe)
  30. #define CM_SWITCHSTYLE_1TR6 6 // 1tr6 (german)
  31. #define CM_SWITCHSTYLE_VN3 7 // vn3 (france)
  32. #define CM_SWITCHSTYLE_INS64 8 // ins64 (japan)
  33. //
  34. // local cm def's
  35. //
  36. /* map a channel to signaling idd port */
  37. #define CM_PORT(_chan) ((_chan)->lterm + IDD_PORT_CM0_TX)
  38. /* user to user signaling structure (!must be byte alligned!) */
  39. #pragma pack(2)
  40. typedef struct
  41. {
  42. CHAR dst_addr[6]; /* destination address */
  43. CHAR src_addr[6]; /* source address */
  44. USHORT pkt_type; /* packet type field */
  45. #define CM_PKT_TYPE 0x5601 /* - private packet type */
  46. UCHAR prot_desc; /* protocol descriptor field */
  47. #define CM_PROT_DESC 0x78 /* - private protoocl descriptor */
  48. UCHAR opcode; /* opcode fields */
  49. #define CM_ASSOC_RQ 0x01 /* - request for chan/conn assoc */
  50. #define CM_ASSOC_ACK 0x02 /* - assoc ack'ed */
  51. #define CM_ASSOC_NACK 0x03 /* - assoc not ack'ed */
  52. UCHAR cause; /* cause value, to assist in diag */
  53. #define CM_NO_PROF 0x01 /* - no matching profile */
  54. #define CM_NO_CONN 0x02 /* - no connection slot avail */
  55. #define CM_NO_CHAN 0x03 /* - no channel slot avail */
  56. #define CM_DUP_CONN 0x04 /* - dup conn name */
  57. UCHAR conn; /* connection index */
  58. UCHAR channum; /* # of channels in connections */
  59. UCHAR chan; /* channel index */
  60. CHAR lname[24]; /* local profile name */
  61. ULONG option_0; // uus option fields
  62. #define UUS_0_COMPRESSION 0x00004000
  63. #define COMP_TX_ENA 0x01
  64. #define COMP_RX_ENA 0x02
  65. ULONG option_1;
  66. CHAR rname[24]; /* remote profile name */
  67. ULONG option_2;
  68. ULONG option_3;
  69. UCHAR chksum; /* zero checksum field */
  70. } CM_UUS;
  71. #pragma pack()
  72. /* C compiler fails go generate odd sized structures!, must defined by self */
  73. #define CM_UUS_SIZE (sizeof(CM_UUS) - 1)
  74. /* special channel ustates */
  75. #define CM_US_UNDEF (USHORT)(-1) /* undefined, not known yet */
  76. #define CM_US_WAIT_CID (USHORT)(-2) /* waiting for a cid */
  77. #define CM_US_GAVE_UP (USHORT)(-4) /* gave up on this channel */
  78. #define CM_US_WAIT_CONN 50 /* connected, waiting on other */
  79. #define CM_US_UUS_SEND 51 /* sending uus now */
  80. #define CM_US_UUS_OKED 52 /* uus oked by side, wait on other */
  81. #define CM_US_CONN 53 /* connected */
  82. /* CM class operation prototypes */
  83. INT cm_init(VOID);
  84. INT cm_term(VOID);
  85. INT cm_register_idd(VOID* idd);
  86. INT cm_deregister_idd(VOID* idd);
  87. /* CM object operation prototypes */
  88. INT cm_create(VOID** cm_1, NDIS_HANDLE AdapterHandle);
  89. INT cm_destroy(VOID* cm_1);
  90. INT cm_set_profile(VOID* cm_1, CM_PROF* prof);
  91. INT cm_get_profile(VOID* cm_1, CM_PROF* prof);
  92. INT cm_listen(VOID* cm_1);
  93. INT cm_connect(VOID* cm_1);
  94. INT cm_disconnect(VOID* cm_1);
  95. INT cm_get_status(VOID* cm_1, CM_STATUS* stat);
  96. INT cm_report_frame(VOID* cm_1, BOOL is_rx, CHAR* buf, ULONG len);
  97. /* prototypes for internal functions */
  98. VOID cm__q931_handler(IDD* idd, USHORT chan, ULONG Reserved, IDD_MSG* msg);
  99. VOID cm__q931_bchan_handler(VOID* idd, USHORT chan, ULONG RxFrameType, IDD_XMSG* msg);
  100. VOID cm__q931_cmpl_handler(VOID* idd, USHORT chan, IDD_MSG* msg);
  101. INT cm__elem_rq(VOID* idd, USHORT port, CHAR* elem, USHORT elem_num);
  102. INT cm__initiate_conn(CM* cm);
  103. INT cm__disc_rq(CM_CHAN* chan);
  104. INT cm__est_rq(CM_CHAN* chan);
  105. INT cm__est_rsp(CM_CHAN* chan);
  106. INT cm__est_ignore(PVOID idd, USHORT cid, USHORT lterm);
  107. INT cm__deactivate_conn(CM* cm, BOOL by_idle_timer);
  108. INT cm__activate_conn(CM* cm, ULONG CompressionFlag);
  109. INT cm__bchan_ctrl(CM_CHAN* chan, BOOL turn_on);
  110. INT cm__bchan_ctrl_comp(CM_CHAN *chan, ULONG CompressionFlag);
  111. CM_CHAN* cm__map_chan(VOID* idd, USHORT lterm, USHORT cid);
  112. CM_CHAN* cm__map_bchan_chan(VOID* idd, USHORT port);
  113. INT cm__ans_est_ind(CM_CHAN* chan, IDD_MSG* msg, VOID* idd, USHORT lterm);
  114. INT cm__org_cid_ind(CM_CHAN* chan, IDD_MSG* msg);
  115. INT cm__org_state_ind(CM_CHAN* chan, IDD_MSG* msg);
  116. INT cm__ans_state_ind(CM_CHAN* chan, IDD_MSG* msg);
  117. INT cm__org_elem_ind(CM_CHAN* chan, IDD_MSG* msg);
  118. INT cm__org_data_ind(CM_CHAN* chan, IDD_MSG* msg);
  119. INT cm__ans_data_ind(CM_CHAN* chan, IDD_MSG* msg);
  120. UCHAR cm__calc_chksum(VOID* buf_1, INT len);
  121. CM* cm__get_conn(ULONG conn_index);
  122. INT cm__get_next_chan(CM_CHAN* chan);
  123. INT cm__tx_uus_pkt(CM_CHAN *chan, UCHAR opcode, UCHAR cause);
  124. INT cm__get_bchan(IDD_MSG* msg, USHORT* bchan);
  125. INT cm__get_type(IDD_MSG* msg, USHORT* type);
  126. INT cm__get_addr(IDD_MSG* msg, CHAR addr[32]);
  127. ULONG cm__type2speed(USHORT type);
  128. UCHAR *cm__q931_elem(VOID* ptr_1, INT len, UCHAR elem);
  129. INT cm__timer_tick(CM* cm);
  130. CM_CHAN *cm__chan_alloc(VOID);
  131. VOID cm__chan_free(CM_CHAN* chan);
  132. BOOL cm__chan_foreach(BOOL (*func)(), VOID* a1, VOID* a2);
  133. BOOL cm__inc_chan_num(CM_CHAN* chan, CM_CHAN* ref_chan, ULONG *chan_num);
  134. BOOL cm__add_chan(CM_CHAN* chan, CM_CHAN* ref_chan, CM* cm);
  135. CM* cm__find_listen_conn(CHAR* lname, CHAR* rname, CHAR* addr, VOID*);
  136. VOID ChannelInit(VOID);
  137. VOID ChannelTerm(VOID);
  138. VOID cm__ppp_conn(VOID *idd, USHORT port);
  139. INT WanLineup(VOID* cm_1, NDIS_HANDLE Endpoint);
  140. INT WanLinedown(VOID* cm_1);
  141. ULONG EnumCmInSystem(VOID);
  142. ULONG EnumCmPerAdapter(ADAPTER*);
  143. INT IoEnumCm(VOID* cmd_1);
  144. VOID* CmGetMtl(VOID* cm_1);
  145. UCHAR* GetDstAddr(VOID *cm_1);
  146. UCHAR* GetSrcAddr(VOID *cm_1);
  147. VOID CmPollFunction(VOID *a1, ADAPTER *Adapter, VOID *a3, VOID *a4);
  148. VOID CmSetSwitchStyle(CHAR *SwitchStyle);
  149. #endif /* _CM_ */