WinLua.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:36k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*****************************************************************************/
  2. /* winlua.h   - include file for LUA API.                                    */
  3. /*                                                                           */
  4. /* (C) Copyright Data Connection Ltd. 1990 - 2000                            */
  5. /* Copyright (c) Microsoft Corporation.  All rights reserved.                */
  6. /*****************************************************************************/
  7. #ifndef LUA_CH_INCLUDED
  8. #define LUA_CH_INCLUDED
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /*****************************************************************************/
  13. /* define type conversion macros                                             */
  14. /*****************************************************************************/
  15. #define LUA_LO_UC(w)    ((unsigned char)(((unsigned short)(w)) & 0xFF))
  16. #define LUA_HI_UC(w)    ((unsigned char)(((unsigned short)(w) >> 8)  
  17.                             & 0xff))
  18. #define LUA_MAKUS(l, h) (((unsigned short)(l)) |                     
  19.                           ((unsigned short)(h)) << 8)
  20. #define LUA_MAKUL(l, h) ((unsigned long)(((unsigned short)(l))|      
  21.                           ((unsigned long)((unsigned short)(h))) << 16))
  22. #define LUA_LO_US(l)   ((unsigned short)(((unsigned long)(l)) & 0xFFFF))
  23. #define LUA_HI_US(l)    ((unsigned short)(((unsigned long)(l) >> 16) 
  24.                            & 0xffff))
  25. /*****************************************************************************/
  26. /* IF non-Intel THEN                                                         */
  27. /*   set flipping to nop for now                                             */
  28. /*   reverse order of bit fields                                             */
  29. /*****************************************************************************/
  30. #ifdef NON_INTEL_BYTE_ORDER
  31. #define LUA_FLIPI(X)  (X)
  32. #define LUA_FLIPL(X)  (X)
  33. #define LUA_FLIPRQD
  34. /*****************************************************************************/
  35. /* ELSE (Intel environment)                                                  */
  36. /*   define flipping macros                                                  */
  37. /*****************************************************************************/
  38. #else
  39. #define LUA_FLIPI(X) LUA_MAKUS(LUA_HI_UC(X),LUA_LO_UC(X))
  40. #define LUA_FLIPL(X) LUA_MAKUL(LUA_FLIPI(LUA_HI_US(X)),           
  41.                                  LUA_FLIPI(LUA_LO_US(X)))
  42. #endif
  43. /*****************************************************************************/
  44. /* Keywords used for single sign-on.                                         */
  45. /*****************************************************************************/
  46. #define SSO_3270_USERNAME      "MS$SAMEU"
  47. #define SSO_3270_PASSWORD      "MS$SAMEP"
  48. /*****************************************************************************/
  49. /* LUA VERB TYPES                                                            */
  50. /*****************************************************************************/
  51. #define LUA_VERB_RUI                      LUA_FLIPI(0x5200)
  52. #define LUA_VERB_SLI                      LUA_FLIPI(0x5200)
  53. /*****************************************************************************/
  54. /* LUA OPCODES ( RUI and SLI )                                               */
  55. /*****************************************************************************/
  56. #define LUA_OPCODE_RUI_INIT               LUA_FLIPI(0x0180)
  57. #define LUA_OPCODE_RUI_TERM               LUA_FLIPI(0x0280)
  58. #define LUA_OPCODE_RUI_READ               LUA_FLIPI(0x0380)
  59. #define LUA_OPCODE_RUI_WRITE              LUA_FLIPI(0x0480)
  60. #define LUA_OPCODE_RUI_PURGE              LUA_FLIPI(0x0580)
  61. #define LUA_OPCODE_RUI_BID                LUA_FLIPI(0x0680)
  62. #define LUA_OPCODE_SLI_OPEN               LUA_FLIPI(0x0100)
  63. #define LUA_OPCODE_SLI_CLOSE              LUA_FLIPI(0x0200)
  64. #define LUA_OPCODE_SLI_RECEIVE            LUA_FLIPI(0x0300)
  65. #define LUA_OPCODE_SLI_SEND               LUA_FLIPI(0x0400)
  66. #define LUA_OPCODE_SLI_PURGE              LUA_FLIPI(0x0500)
  67. #define LUA_OPCODE_SLI_BID                LUA_FLIPI(0x0600)
  68. #define LUA_OPCODE_SLI_SEND_EX            LUA_FLIPI(0x0700)
  69. #define LUA_OPCODE_SLI_RECEIVE_EX         LUA_FLIPI(0x0800)
  70. #define LUA_OPCODE_SLI_BIND_ROUTINE       LUA_FLIPI(0x1100)
  71. #define LUA_OPCODE_SLI_STSN_ROUTINE       LUA_FLIPI(0x1200)
  72. #define LUA_OPCODE_SLI_CRV_ROUTINE        LUA_FLIPI(0x1300)
  73. /*****************************************************************************/
  74. /* LUA PRIMARY RETURN CODES                                                  */
  75. /*****************************************************************************/
  76. #define LUA_OK                            0x0000
  77. #define LUA_PARAMETER_CHECK               LUA_FLIPI(0x0001)
  78. #define LUA_STATE_CHECK                   LUA_FLIPI(0x0002)
  79. #define LUA_SESSION_FAILURE               LUA_FLIPI(0x000F)
  80. #define LUA_UNSUCCESSFUL                  LUA_FLIPI(0x0014)
  81. #define LUA_NEGATIVE_RSP                  LUA_FLIPI(0x0018)
  82. #define LUA_CANCELLED                     LUA_FLIPI(0x0021)
  83. #define LUA_IN_PROGRESS                   LUA_FLIPI(0x0030)
  84. #define LUA_STATUS                        LUA_FLIPI(0x0040)
  85. #define LUA_COMM_SUBSYSTEM_ABENDED        LUA_FLIPI(0xF003)
  86. #define LUA_COMM_SUBSYSTEM_NOT_LOADED     LUA_FLIPI(0xF004)
  87. #define LUA_INVALID_VERB_SEGMENT          LUA_FLIPI(0xF008)
  88. #define LUA_UNEXPECTED_DOS_ERROR          LUA_FLIPI(0xF011)
  89. #define LUA_STACK_TOO_SMALL               LUA_FLIPI(0xF015)
  90. #define LUA_INVALID_VERB                  0xFFFF
  91. /*****************************************************************************/
  92. /* LUA SECONDARY RETURN CODES                                                */
  93. /*****************************************************************************/
  94. #define LUA_SEC_RC_OK                     LUA_FLIPL(0x00000000)
  95. #define LUA_INVALID_LUNAME                LUA_FLIPL(0x00000001)
  96. #define LUA_BAD_SESSION_ID                LUA_FLIPL(0x00000002)
  97. #define LUA_DATA_TRUNCATED                LUA_FLIPL(0x00000003)
  98. #define LUA_BAD_DATA_PTR                  LUA_FLIPL(0x00000004)
  99. #define LUA_DATA_SEG_LENGTH_ERROR         LUA_FLIPL(0x00000005)
  100. #define LUA_RESERVED_FIELD_NOT_ZERO       LUA_FLIPL(0x00000006)
  101. #define LUA_INVALID_POST_HANDLE           LUA_FLIPL(0x00000007)
  102. #define LUA_PURGED                        LUA_FLIPL(0x0000000C)
  103. #define LUA_BID_VERB_SEG_ERROR            LUA_FLIPL(0x0000000F)
  104. #define LUA_NO_PREVIOUS_BID_ENABLED       LUA_FLIPL(0x00000010)
  105. #define LUA_NO_DATA                       LUA_FLIPL(0x00000011)
  106. #define LUA_BID_ALREADY_ENABLED           LUA_FLIPL(0x00000012)
  107. #define LUA_VERB_RECORD_SPANS_SEGMENTS    LUA_FLIPL(0x00000013)
  108. #define LUA_INVALID_FLOW                  LUA_FLIPL(0x00000014)
  109. #define LUA_NOT_ACTIVE                    LUA_FLIPL(0x00000015)
  110. #define LUA_VERB_LENGTH_INVALID           LUA_FLIPL(0x00000016)
  111. #define LUA_REQUIRED_FIELD_MISSING        LUA_FLIPL(0x00000019)
  112. #define LUA_READY                         LUA_FLIPL(0x00000030)
  113. #define LUA_NOT_READY                     LUA_FLIPL(0x00000031)
  114. #define LUA_INIT_COMPLETE                 LUA_FLIPL(0x00000032)
  115. #define LUA_SESSION_END_REQUESTED         LUA_FLIPL(0x00000033)
  116. #define LUA_NO_SLI_SESSION                LUA_FLIPL(0x00000034)
  117. #define LUA_SESSION_ALREADY_OPEN          LUA_FLIPL(0x00000035)
  118. #define LUA_INVALID_OPEN_INIT_TYPE        LUA_FLIPL(0x00000036)
  119. #define LUA_INVALID_OPEN_DATA             LUA_FLIPL(0x00000037)
  120. #define LUA_UNEXPECTED_SNA_SEQUENCE       LUA_FLIPL(0x00000038)
  121. #define LUA_NEG_RSP_FROM_BIND_ROUTINE     LUA_FLIPL(0x00000039)
  122. #define LUA_NEG_RSP_FROM_CRV_ROUTINE      LUA_FLIPL(0x0000003A)
  123. #define LUA_NEG_RSP_FROM_STSN_ROUTINE     LUA_FLIPL(0x0000003B)
  124. #define LUA_CRV_ROUTINE_REQUIRED          LUA_FLIPL(0x0000003C)
  125. #define LUA_STSN_ROUTINE_REQUIRED         LUA_FLIPL(0x0000003D)
  126. #define LUA_INVALID_OPEN_ROUTINE_TYPE     LUA_FLIPL(0x0000003E)
  127. #define LUA_MAX_NUMBER_OF_SENDS           LUA_FLIPL(0x0000003F)
  128. #define LUA_SEND_ON_FLOW_PENDING          LUA_FLIPL(0x00000040)
  129. #define LUA_INVALID_MESSAGE_TYPE          LUA_FLIPL(0x00000041)
  130. #define LUA_RECEIVE_ON_FLOW_PENDING       LUA_FLIPL(0x00000042)
  131. #define LUA_DATA_LENGTH_ERROR             LUA_FLIPL(0x00000043)
  132. #define LUA_CLOSE_PENDING                 LUA_FLIPL(0x00000044)
  133. #define LUA_NEGATIVE_RSP_CHASE            LUA_FLIPL(0x00000046)
  134. #define LUA_NEGATIVE_RSP_SHUTC            LUA_FLIPL(0x00000047)
  135. #define LUA_NEGATIVE_RSP_RSHUTD           LUA_FLIPL(0x00000048)
  136. #define LUA_NO_RECEIVE_TO_PURGE           LUA_FLIPL(0x0000004A)
  137. #define LUA_CANCEL_COMMAND_RECEIVED       LUA_FLIPL(0x0000004D)
  138. #define LUA_RUI_WRITE_FAILURE             LUA_FLIPL(0x0000004E)
  139. #define LUA_SLI_BID_PENDING               LUA_FLIPL(0x00000051)
  140. #define LUA_SLI_PURGE_PENDING             LUA_FLIPL(0x00000052)
  141. #define LUA_PROCEDURE_ERROR               LUA_FLIPL(0x00000053)
  142. #define LUA_INVALID_SLI_ENCR_OPTION       LUA_FLIPL(0x00000054)
  143. #define LUA_RECEIVED_UNBIND               LUA_FLIPL(0x00000055)
  144. #define LUA_DATA_INCOMPLETE               LUA_FLIPL(0x00000060)
  145. #define LUA_SLI_LOGIC_ERROR               LUA_FLIPL(0x0000007F)
  146. #define LUA_TERMINATED                    LUA_FLIPL(0x00000080)
  147. #define LUA_NO_RUI_SESSION                LUA_FLIPL(0x00000081)
  148. #define LUA_DUPLICATE_RUI_INIT            LUA_FLIPL(0x00000082)
  149. #define LUA_INVALID_PROCESS               LUA_FLIPL(0x00000083)
  150. #define LUA_API_MODE_CHANGE               LUA_FLIPL(0x00000085)
  151. #define LUA_COMMAND_COUNT_ERROR           LUA_FLIPL(0x00000087)
  152. #define LUA_NO_READ_TO_PURGE              LUA_FLIPL(0x00000088)
  153. #define LUA_MULTIPLE_WRITE_FLOWS          LUA_FLIPL(0x00000089)
  154. #define LUA_DUPLICATE_READ_FLOW           LUA_FLIPL(0x0000008A)
  155. #define LUA_DUPLICATE_WRITE_FLOW          LUA_FLIPL(0x0000008B)
  156. #define LUA_LINK_NOT_STARTED              LUA_FLIPL(0x0000008C)
  157. #define LUA_INVALID_ADAPTER               LUA_FLIPL(0x0000008D)
  158. #define LUA_ENCR_DECR_LOAD_ERROR          LUA_FLIPL(0x0000008E)
  159. #define LUA_ENCR_DECR_PROC_ERROR          LUA_FLIPL(0x0000008F)
  160. #define LUA_NEG_NOTIFY_RSP                LUA_FLIPL(0x000000BE)
  161. #define LUA_RUI_LOGIC_ERROR               LUA_FLIPL(0x000000BF)
  162. #define LUA_LU_INOPERATIVE                LUA_FLIPL(0x000000FF)
  163. /*****************************************************************************/
  164. /* THE FOLLOWING SECONDARY RETURN CODES ARE SNA SENSE CODES                  */
  165. /*****************************************************************************/
  166. #define LUA_NON_UNIQ_ID                   LUA_FLIPL(0xC0001001)
  167. #define LUA_NON_UNIQ_NAU_AD               LUA_FLIPL(0xC0001002)
  168. #define LUA_INV_NAU_ADDR                  LUA_FLIPL(0xC0002001)
  169. #define LUA_INV_ADPT_NUM                  LUA_FLIPL(0xC0002002)
  170. #define LUA_RESOURCE_NOT_AVAILABLE        LUA_FLIPL(0x08010000)
  171. #define LUA_SESSION_LIMIT_EXCEEDED        LUA_FLIPL(0x08050000)
  172. #define LUA_SLU_SESSION_LIMIT_EXCEEDED    LUA_FLIPL(0x0805000A)
  173. #define LUA_MODE_INCONSISTENCY            LUA_FLIPL(0x08090000)
  174. #define LUA_BRACKET_RACE_ERROR            LUA_FLIPL(0x080B0000)
  175. #define LUA_INSUFFICIENT_RESOURCES        LUA_FLIPL(0x08120000)
  176. #define LUA_BB_REJECT_NO_RTR              LUA_FLIPL(0x08130000)
  177. #define LUA_BB_REJECT_RTR                 LUA_FLIPL(0x08140000)
  178. #define LUA_RECEIVER_IN_TRANSMIT_MODE     LUA_FLIPL(0x081B0000)
  179. #define LUA_REQUEST_NOT_EXECUTABLE        LUA_FLIPL(0x081C0000)
  180. #define LUA_INVALID_SESSION_PARAMETERS    LUA_FLIPL(0x08210000)
  181. #define LUA_UNIT_OF_WORK_ABORTED          LUA_FLIPL(0x08240000)
  182. #define LUA_FM_FUNCTION_NOT_SUPPORTED     LUA_FLIPL(0x08260000)
  183. #define LUA_LU_COMPONENT_DISCONNECTED     LUA_FLIPL(0x08310000)
  184. #define LUA_INVALID_PARAMETER_FLAGS       LUA_FLIPL(0x08330000)
  185. #define LUA_INVALID_PARAMETER             LUA_FLIPL(0x08350000)
  186. #define LUA_NEGOTIABLE_BIND_ERROR         LUA_FLIPL(0x08350001)
  187. #define LUA_BIND_FM_PROFILE_ERROR         LUA_FLIPL(0x08350002)
  188. #define LUA_BIND_TS_PROFILE_ERROR         LUA_FLIPL(0x08350003)
  189. #define LUA_BIND_LU_TYPE_ERROR            LUA_FLIPL(0x0835000E)
  190. #define LUA_CRYPTOGRAPHY_INOPERATIVE      LUA_FLIPL(0x08480000)
  191. #define LUA_REQ_RESOURCES_NOT_AVAIL       LUA_FLIPL(0x084B0000)
  192. #define LUA_SSCP_LU_SESSION_NOT_ACTIVE    LUA_FLIPL(0x08570000)
  193. #define LUA_SYNC_EVENT_RESPONSE           LUA_FLIPL(0x08670000)
  194. #define LUA_REC_CORR_TABLE_FULL           LUA_FLIPL(0x08780001)
  195. #define LUA_SEND_CORR_TABLE_FULL          LUA_FLIPL(0x08780002)
  196. #define LUA_SESSION_SERVICE_PATH_ERROR    LUA_FLIPL(0x087D0000)
  197. #define LUA_RU_DATA_ERROR                 LUA_FLIPL(0x10010000)
  198. #define LUA_RU_LENGTH_ERROR               LUA_FLIPL(0x10020000)
  199. #define LUA_FUNCTION_NOT_SUPPORTED        LUA_FLIPL(0x10030000)
  200. #define LUA_HDX_BRACKET_STATE_ERROR       LUA_FLIPL(0x10050121)
  201. #define LUA_RESPONSE_ALREADY_SENT         LUA_FLIPL(0x10050122)
  202. #define LUA_EXR_SENSE_INCORRECT           LUA_FLIPL(0x10050123)
  203. #define LUA_RESPONSE_OUT_OF_ORDER         LUA_FLIPL(0x10050124)
  204. #define LUA_CHASE_RESPONSE_REQUIRED       LUA_FLIPL(0x10050125)
  205. #define LUA_CATEGORY_NOT_SUPPORTED        LUA_FLIPL(0x10070000)
  206. #define LUA_INCORRECT_SEQUENCE_NUMBER     LUA_FLIPL(0x20010000)
  207. #define LUA_CHAINING_ERROR                LUA_FLIPL(0x20020000)
  208. #define LUA_BRACKET                       LUA_FLIPL(0x20030000)
  209. #define LUA_DIRECTION                     LUA_FLIPL(0x20040000)
  210. #define LUA_DATA_TRAFFIC_RESET            LUA_FLIPL(0x20050000)
  211. #define LUA_DATA_TRAFFIC_QUIESCED         LUA_FLIPL(0x20060000)
  212. #define LUA_DATA_TRAFFIC_NOT_RESET        LUA_FLIPL(0x20070000)
  213. #define LUA_NO_BEGIN_BRACKET              LUA_FLIPL(0x20080000)
  214. #define LUA_SC_PROTOCOL_VIOLATION         LUA_FLIPL(0x20090000)
  215. #define LUA_IMMEDIATE_REQ_MODE_ERROR      LUA_FLIPL(0x200A0000)
  216. #define LUA_QUEUED_RESPONSE_ERROR         LUA_FLIPL(0x200B0000)
  217. #define LUA_ERP_SYNC_EVENT_ERROR          LUA_FLIPL(0x200C0000)
  218. #define LUA_RSP_BEFORE_SENDING_REQ        LUA_FLIPL(0x200D0000)
  219. #define LUA_RSP_CORRELATION_ERROR         LUA_FLIPL(0x200E0000)
  220. #define LUA_RSP_PROTOCOL_ERROR            LUA_FLIPL(0x200F0000)
  221. #define LUA_INVALID_SC_OR_NC_RH           LUA_FLIPL(0x40010000)
  222. #define LUA_BB_NOT_ALLOWED                LUA_FLIPL(0x40030000)
  223. #define LUA_EB_NOT_ALLOWED                LUA_FLIPL(0x40040000)
  224. #define LUA_EXCEPTION_RSP_NOT_ALLOWED     LUA_FLIPL(0x40060000)
  225. #define LUA_DEFINITE_RSP_NOT_ALLOWED      LUA_FLIPL(0x40070000)
  226. #define LUA_PACING_NOT_SUPPORTED          LUA_FLIPL(0x40080000)
  227. #define LUA_CD_NOT_ALLOWED                LUA_FLIPL(0x40090000)
  228. #define LUA_NO_RESPONSE_NOT_ALLOWED       LUA_FLIPL(0x400A0000)
  229. #define LUA_CHAINING_NOT_SUPPORTED        LUA_FLIPL(0x400B0000)
  230. #define LUA_BRACKETS_NOT_SUPPORTED        LUA_FLIPL(0x400C0000)
  231. #define LUA_CD_NOT_SUPPORTED              LUA_FLIPL(0x400D0000)
  232. #define LUA_INCORRECT_USE_OF_FI           LUA_FLIPL(0x400F0000)
  233. #define LUA_ALTERNATE_CODE_NOT_SUPPORT    LUA_FLIPL(0x40100000)
  234. #define LUA_INCORRECT_RU_CATEGORY         LUA_FLIPL(0x40110000)
  235. #define LUA_INCORRECT_REQUEST_CODE        LUA_FLIPL(0x40120000)
  236. #define LUA_INCORRECT_SPEC_OF_SDI_RTI     LUA_FLIPL(0x40130000)
  237. #define LUA_INCORRECT_DR1I_DR2I_ERI       LUA_FLIPL(0x40140000)
  238. #define LUA_INCORRECT_USE_OF_QRI          LUA_FLIPL(0x40150000)
  239. #define LUA_INCORRECT_USE_OF_EDI          LUA_FLIPL(0x40160000)
  240. #define LUA_INCORRECT_USE_OF_PDI          LUA_FLIPL(0x40170000)
  241. #define LUA_NAU_INOPERATIVE               LUA_FLIPL(0x80030000)
  242. #define LUA_NO_SESSION                    LUA_FLIPL(0x80050000)
  243. /*****************************************************************************/
  244. /* LUA_RH.RUC masks                                                          */
  245. /*****************************************************************************/
  246. #define  LUA_RH_FMD                       0
  247. #define  LUA_RH_NC                        1
  248. #define  LUA_RH_DFC                       2
  249. #define  LUA_RH_SC                        3
  250. /*****************************************************************************/
  251. /* LUA MESSAGE TYPES                                                         */
  252. /*****************************************************************************/
  253. #define LUA_MESSAGE_TYPE_LU_DATA          0x01
  254. #define LUA_MESSAGE_TYPE_SSCP_DATA        0x11
  255. #define LUA_MESSAGE_TYPE_RSP              0x02
  256. #define LUA_MESSAGE_TYPE_BID              0xC8
  257. #define LUA_MESSAGE_TYPE_BIND             0x31
  258. #define LUA_MESSAGE_TYPE_BIS              0x70
  259. #define LUA_MESSAGE_TYPE_CANCEL           0x83
  260. #define LUA_MESSAGE_TYPE_CHASE            0x84
  261. #define LUA_MESSAGE_TYPE_CLEAR            0xA1
  262. #define LUA_MESSAGE_TYPE_CRV              0xD0
  263. #define LUA_MESSAGE_TYPE_LUSTAT_LU        0x04
  264. #define LUA_MESSAGE_TYPE_LUSTAT_SSCP      0x14
  265. #define LUA_MESSAGE_TYPE_QC               0x81
  266. #define LUA_MESSAGE_TYPE_QEC              0x80
  267. #define LUA_MESSAGE_TYPE_RELQ             0x82
  268. #define LUA_MESSAGE_TYPE_RQR              0xA3
  269. #define LUA_MESSAGE_TYPE_RTR              0x05
  270. #define LUA_MESSAGE_TYPE_SBI              0x71
  271. #define LUA_MESSAGE_TYPE_SHUTD            0xC0
  272. #define LUA_MESSAGE_TYPE_SIGNAL           0xC9
  273. #define LUA_MESSAGE_TYPE_SDT              0xA0
  274. #define LUA_MESSAGE_TYPE_STSN             0xA2
  275. #define LUA_MESSAGE_TYPE_UNBIND           0x32
  276. /*****************************************************************************/
  277. /* LUA INIT TYPES (Used for SLI only)                                        */
  278. /*****************************************************************************/
  279. #define LUA_INIT_TYPE_SEC_IS              0x01
  280. #define LUA_INIT_TYPE_SEC_LOG             0x02
  281. #define LUA_INIT_TYPE_PRIM                0x03
  282. #define LUA_INIT_TYPE_PRIM_SSCP           0x04
  283. /*****************************************************************************/
  284. /* LUA SLI_OPEN EXTENSION ROUTINE TYPES                                      */
  285. /*****************************************************************************/
  286. #define LUA_ROUTINE_TYPE_BIND             0x01
  287. #define LUA_ROUTINE_TYPE_CRV              0x02
  288. #define LUA_ROUTINE_TYPE_STSN             0x03
  289. #define LUA_ROUTINE_TYPE_END              0x00
  290. /*****************************************************************************/
  291. /* LUA VERB RECORD STRUCTURES                                                */
  292. /*****************************************************************************/
  293. /*****************************************************************************/
  294. /* If Win32 environment then ensure that packing is correct                  */
  295. /*****************************************************************************/
  296. #ifdef WIN32
  297. #pragma pack(4)
  298. #endif
  299. /*****************************************************************************/
  300. /* Transmission header structure                                             */
  301. /*****************************************************************************/
  302. struct LUA_TH
  303.       {
  304. #ifdef LUA_FLIPRQD
  305.       unsigned char    flags_fid  : 4;        /* Format Identification Type 2*/
  306.       unsigned char    flags_mpf  : 2;        /* Segmenting Mapping Field    */
  307.       unsigned char    flags_odai : 1;        /* OAF-DAF Assignor Indicator  */
  308.       unsigned char    flags_efi  : 1;        /* Expedited Flow Indicator    */
  309. #else
  310.       unsigned char    flags_efi  : 1;        /* Expedited Flow Indicator    */
  311.       unsigned char    flags_odai : 1;        /* OAF-DAF Assignor Indicator  */
  312.       unsigned char    flags_mpf  : 2;        /* Segmenting Mapping Field    */
  313.       unsigned char    flags_fid  : 4;        /* Format Identification Type 2*/
  314. #endif
  315.       unsigned char               : 8;        /* Reserved Field              */
  316.       unsigned char    daf;                   /* Destination Address Field   */
  317.       unsigned char    oaf;                   /* Originating Address Field   */
  318.       unsigned char    snf[2];                /* Sequence Number Field       */
  319.       };
  320. /*****************************************************************************/
  321. /* Request/Response unit header strcuture                                    */
  322. /*****************************************************************************/
  323. struct LUA_RH
  324.       {
  325. #ifdef LUA_FLIPRQD
  326.       unsigned char    rri  : 1;              /* Request-Response Indicator  */
  327.       unsigned char    ruc  : 2;              /* RU Category                 */
  328.       unsigned char         : 1;              /* Reserved Field              */
  329.       unsigned char    fi   : 1;              /* Format Indicator            */
  330.       unsigned char    sdi  : 1;              /* Sense Data Included Ind     */
  331.       unsigned char    bci  : 1;              /* Begin Chain Indicator       */
  332.       unsigned char    eci  : 1;              /* End Chain Indicator         */
  333. #else
  334.       unsigned char    eci  : 1;              /* End Chain Indicator         */
  335.       unsigned char    bci  : 1;              /* Begin Chain Indicator       */
  336.       unsigned char    sdi  : 1;              /* Sense Data Included Ind     */
  337.       unsigned char    fi   : 1;              /* Format Indicator            */
  338.       unsigned char         : 1;              /* Reserved Field              */
  339.       unsigned char    ruc  : 2;              /* RU Category                 */
  340.       unsigned char    rri  : 1;              /* Request-Response Indicator  */
  341. #endif
  342. #ifdef LUA_FLIPRQD
  343.       unsigned char    dr1i : 1;              /* DR 1 Indicator              */
  344.       unsigned char         : 1;              /* Reserved Field              */
  345.       unsigned char    dr2i : 1;              /* DR 2 Indicator              */
  346.       unsigned char    ri   : 1;              /* Response Indicator          */
  347.       unsigned char         : 2;              /* Reserved Field              */
  348.       unsigned char    qri  : 1;              /* Queued Response Indicator   */
  349.       unsigned char    pi   : 1;              /* Pacing Indicator            */
  350. #else
  351.       unsigned char    pi   : 1;              /* Pacing Indicator            */
  352.       unsigned char    qri  : 1;              /* Queued Response Indicator   */
  353.       unsigned char         : 2;              /* Reserved Field              */
  354.       unsigned char    ri   : 1;              /* Response Indicator          */
  355.       unsigned char    dr2i : 1;              /* DR 2 Indicator              */
  356.       unsigned char         : 1;              /* Reserved Field              */
  357.       unsigned char    dr1i : 1;              /* DR 1 Indicator              */
  358. #endif
  359. #ifdef LUA_FLIPRQD
  360.       unsigned char    bbi  : 1;              /* Begin Bracket Indicator     */
  361.       unsigned char    ebi  : 1;              /* End Bracket Indicator       */
  362.       unsigned char    cdi  : 1;              /* Change Direction Indicator  */
  363.       unsigned char         : 1;              /* Reserved Field              */
  364.       unsigned char    csi  : 1;              /* Code Selection Indicator    */
  365.       unsigned char    edi  : 1;              /* Enciphered Data Indicator   */
  366.       unsigned char    pdi  : 1;              /* Padded Data Indicator       */
  367.       unsigned char         : 1;              /* Reserved Field              */
  368. #else
  369.       unsigned char         : 1;              /* Reserved Field              */
  370.       unsigned char    pdi  : 1;              /* Padded Data Indicator       */
  371.       unsigned char    edi  : 1;              /* Enciphered Data Indicator   */
  372.       unsigned char    csi  : 1;              /* Code Selection Indicator    */
  373.       unsigned char         : 1;              /* Reserved Field              */
  374.       unsigned char    cdi  : 1;              /* Change Direction Indicator  */
  375.       unsigned char    ebi  : 1;              /* End Bracket Indicator       */
  376.       unsigned char    bbi  : 1;              /* Begin Bracket Indicator     */
  377. #endif
  378.       };
  379. /*****************************************************************************/
  380. /* Structure for LUA_FLAG1                                                   */
  381. /*****************************************************************************/
  382. struct LUA_FLAG1                              /* LUA_FLAG1                   */
  383.       {
  384. #ifdef LUA_FLIPRQD
  385.       unsigned char  bid_enable  : 1;         /* Bid Enabled Indicator       */
  386.       unsigned char  reserv1     : 1;         /* reserved                    */
  387.       unsigned char  close_abend : 1;         /* Close Immediate Flag        */
  388.       unsigned char  nowait      : 1;         /* Don't Wait for Data Flag    */
  389.       unsigned char  sscp_exp    : 1;         /* SSCP expedited flow         */
  390.       unsigned char  sscp_norm   : 1;         /* SSCP normal flow            */
  391.       unsigned char  lu_exp      : 1;         /* LU expedited flow           */
  392.       unsigned char  lu_norm     : 1;         /* lu normal flow              */
  393. #else
  394.       unsigned char  lu_norm     : 1;         /* lu normal flow              */
  395.       unsigned char  lu_exp      : 1;         /* LU expedited flow           */
  396.       unsigned char  sscp_norm   : 1;         /* SSCP normal flow            */
  397.       unsigned char  sscp_exp    : 1;         /* SSCP expedited flow         */
  398.       unsigned char  nowait      : 1;         /* Don't Wait for Data Flag    */
  399.       unsigned char  close_abend : 1;         /* Close Immediate Flag        */
  400.       unsigned char  reserv1     : 1;         /* reserved                    */
  401.       unsigned char  bid_enable  : 1;         /* Bid Enabled Indicator       */
  402. #endif
  403.       };
  404. /*****************************************************************************/
  405. /* Structure for LUA_FLAG2                                                   */
  406. /*****************************************************************************/
  407. struct LUA_FLAG2                              /* LUA_FLAG2                   */
  408.       {
  409. #ifdef LUA_FLIPRQD
  410.       unsigned char  bid_enable  : 1;         /* Bid Enabled Indicator       */
  411.       unsigned char  async       : 1;         /* flags asynchronous verb
  412.                                                  completion                  */
  413.       unsigned char              : 2;         /* reserved                    */
  414.       unsigned char  sscp_exp    : 1;         /* SSCP expedited flow         */
  415.       unsigned char  sscp_norm   : 1;         /* SSCP normal flow            */
  416.       unsigned char  lu_exp      : 1;         /* LU expedited flow           */
  417.       unsigned char  lu_norm     : 1;         /* lu normal flow              */
  418. #else
  419.       unsigned char  lu_norm     : 1;         /* lu normal flow              */
  420.       unsigned char  lu_exp      : 1;         /* LU expedited flow           */
  421.       unsigned char  sscp_norm   : 1;         /* SSCP normal flow            */
  422.       unsigned char  sscp_exp    : 1;         /* SSCP expedited flow         */
  423.       unsigned char              : 2;         /* reserved                    */
  424.       unsigned char  async       : 1;         /* flags asynchronous verb
  425.                                                  completion                  */
  426.       unsigned char  bid_enable  : 1;         /* Bid Enabled Indicator       */
  427. #endif
  428.       };
  429. /*****************************************************************************/
  430. /* Structure for common verb header                                          */
  431. /*****************************************************************************/
  432.    struct LUA_COMMON
  433.      {
  434.     unsigned short lua_verb;                   /* Verb Code                  */
  435.     unsigned short lua_verb_length;            /* Length of Verb Record      */
  436.     unsigned short lua_prim_rc;                /* Primary Return Code        */
  437.     unsigned long  lua_sec_rc;                 /* Secondary Return Code      */
  438.     unsigned short lua_opcode;                 /* Verb Operation Code        */
  439.     unsigned long  lua_correlator;             /* User Correlation Field     */
  440.     unsigned char  lua_luname[8];              /* Local LU Name              */
  441.     unsigned short lua_extension_list_offset;  /* Offset of DLL Extention Lis*/
  442.     unsigned short lua_cobol_offset;           /* Offset of Cobol Extension  */
  443.     unsigned long  lua_sid;                    /* Session ID                 */
  444.     unsigned short lua_max_length;             /* Receive Buffer Length      */
  445.     unsigned short lua_data_length;            /* Data Length                */
  446.     char far       *lua_data_ptr;              /* Data Buffer Pointer        */
  447.     unsigned long  lua_post_handle;            /* Posting handle             */
  448.     struct LUA_TH  lua_th;                     /* LUA TH Fields              */
  449.     struct LUA_RH  lua_rh;                     /* LUA RH Fields              */
  450.     struct LUA_FLAG1 lua_flag1;                /* LUA_FLAG1                  */
  451.     unsigned char lua_message_type;            /* sna message command type   */
  452.     struct LUA_FLAG2 lua_flag2;                /* LUA_FLAG2                  */
  453.     unsigned char lua_resv56[7];               /* Reserved Field             */
  454.     unsigned char lua_encr_decr_option;        /* Cryptography Option        */
  455.      } ;
  456. /******************* COMMAND SPECIFIC VERB DEFINITIONS ***************/
  457. /*****************************************************************************/
  458. /* Structure for extension routines                                          */
  459. /*****************************************************************************/
  460. struct LUA_EXT_ENTRY
  461.        {
  462.         unsigned char lua_routine_type;       /* Extension Routine Type      */
  463.         unsigned char lua_module_name[9];     /* Extension Module Name       */
  464.         unsigned char lua_procedure_name[33]; /* Extension Procedure Name    */
  465.        } ;
  466. /*****************************************************************************/
  467. /* LUA SPECIFIC FIELDS FOR THE SLI_OPEN VERB                                 */
  468. /*****************************************************************************/
  469.    struct SLI_OPEN
  470.      {
  471.      unsigned char  lua_init_type;            /* Type of Session Initiation  */
  472.      unsigned char  lua_resv65;               /* Reserved Field              */
  473.      unsigned short lua_wait;                 /* Secondary Retry Wait Time   */
  474.      struct LUA_EXT_ENTRY  lua_open_extension[3];
  475.      unsigned char lua_ending_delim;          /* Extension List Delimiter    */
  476.      } ;
  477. /*****************************************************************************/
  478. /* LUA Specific fields for the SLI_SEND, SLI_SEND_EX verbs                   */
  479. /* LUA SPECIFIC FIELDS FOR THE SLI_OPEN, SLI_SEND, RUI_BID AND SLI_BID VERBS */
  480. /*                                                                           */
  481. /* !!!NOTE!!! - MUST Keep lua_sequence_number[2] the first field in the      */
  482. /*              SLI_SEND_EX_SPECIFIC structure                               */
  483. /*                                                                           */
  484. /* To support backward compatibility for Applications, the                   */
  485. /* lua_sequence_number array is included both in the union itself and as the */
  486. /* FIRST element of the SLI_SEND_EX_SPECIFIC structure (thus it refers to    */
  487. /* exactly the same variable in both cases.)                                 */
  488. /*****************************************************************************/
  489.    struct SLI_SEND_EX_SPECIFIC
  490.    {
  491.      unsigned char  lua_sequence_number[2]; /* This field **MUST** be first  */
  492.      unsigned long  lua_data_length_ex; /* data length field for SLI_SEND_EX */
  493.    } ;
  494.    struct SLI_RECEIVE_EX_SPECIFIC
  495.    {
  496.      unsigned long  lua_max_length_ex;     /*  max buffer for SLI_RECEIVE_EX */
  497.      unsigned long  lua_data_length_ex;    /* data length for SLI_RECEIVE_EX */
  498.    } ;
  499.    union LUA_SPECIFIC
  500.      {
  501.      struct   SLI_OPEN       open;
  502.      unsigned char           lua_sequence_number[2];     /* sequence number  */
  503.      struct   SLI_SEND_EX_SPECIFIC     send;          /* extra length fields */
  504.      struct   SLI_RECEIVE_EX_SPECIFIC  receive;       /* extra length fields */
  505.      unsigned char           lua_peek_data[12];          /* Data Pending     */
  506.      } ;
  507. /*****************************************************************************/
  508. /* GENERIC LUA VERB RECORD TYPEDEF DECLARATION                               */
  509. /*****************************************************************************/
  510.    typedef struct
  511.     {
  512.     struct LUA_COMMON       common;    /* common verb header command         */
  513.     union  LUA_SPECIFIC     specific;  /* command specific portion of record */
  514.     }  LUA_VERB_RECORD;
  515. #if (defined WINDOWS) || (defined WIN32)
  516. #ifdef WIN32
  517. // The callback routine registered by the TN3270 Service
  518. typedef BOOL (__stdcall *TN3270SERVICECALLBACK)(unsigned long);
  519. #endif // #ifdef WIN32
  520. /*****************************************************************************/
  521. /* Return codes from WinLUAStartup                                           */
  522. /*****************************************************************************/
  523. #define WLUASYSNOTREADY                 1
  524. #define WLUAVERNOTSUPPORTED             2
  525. #define WLUAINVALID                     3
  526. #define WLUAFAILURE                     4
  527. #define WLUAINITREJECT                  5
  528. #define WLUADESCRIPTION_LEN             40
  529. typedef struct
  530. {
  531.   WORD wVersion;
  532.   char szDescription[WLUADESCRIPTION_LEN + 1];
  533. } LUADATA;
  534. /*****************************************************************************/
  535. /* Return codes from WinLUA                                                  */
  536. /*****************************************************************************/
  537. #define WLUAINVALIDHANDLE               10
  538. #define WLUASTARTUPNOTCALLED            11
  539. #define WLUALINKINACTIVE                12
  540. #define WLUALINKACTIVATING              13
  541. #define WLUAPUINACTIVE                  14
  542. #define WLUAPUACTIVE                    15
  543. #define WLUAPUREACTIVATED               16
  544. #define WLUALUINACTIVE                  17
  545. #define WLUALUACTIVE                    18
  546. #define WLUALUREACTIVATED               19
  547. #define WLUASIDINVALID                  20
  548. #define WLUASIDZERO                     21
  549. #define WLUAALREADYACTIVE               22
  550. #define WLUANTFYINVALID                 23
  551. #define WLUAGLOBALHANDLER               24
  552. #define WLUAGETLU                       25
  553. #define WLUAUNKNOWN                     255
  554. #define WLUA_NTFY_EVENT                  1
  555. #define WLUA_NTFY_MSG_CORRELATOR         2
  556. #define WLUA_NTFY_MSG_SID                3
  557. #endif
  558. /*****************************************************************************/
  559. /* Function prototypes                                                       */
  560. /*****************************************************************************/
  561. #ifdef WIN32
  562.   #define LOADDS
  563. #else
  564.   #define LOADDS _loadds
  565. #endif
  566. #if (defined WINDOWS) || (defined WIN32)
  567. int  WINAPI LOADDS WinRUI        (HWND, LUA_VERB_RECORD FAR *);
  568. int  WINAPI LOADDS WinSLI        (HWND, LUA_VERB_RECORD FAR *);
  569. BOOL WINAPI LOADDS WinRUICleanup (void);
  570. BOOL WINAPI LOADDS WinSLICleanup (void);
  571. int  WINAPI LOADDS WinRUIStartup (WORD, LUADATA FAR *);
  572. int  WINAPI LOADDS WinSLIStartup (WORD, LUADATA FAR *);
  573. void WINAPI LOADDS RUI           (LUA_VERB_RECORD FAR *);
  574. void WINAPI LOADDS RUI_CALL      (LUA_VERB_RECORD FAR *);
  575. void WINAPI LOADDS SLI           (LUA_VERB_RECORD FAR *);
  576. int WINAPI LOADDS WinRUIGetLastInitStatus (DWORD  dwSid,
  577.                                     HANDLE hStatusHandle,
  578.                                     DWORD  dwNotifyType,
  579.                                     BOOL   bClearPrevious);
  580. int WINAPI GetLuaReturnCode      (struct LUA_COMMON FAR *, UINT, unsigned char FAR *);
  581. #else
  582. void pascal far _loadds RUI      (LUA_VERB_RECORD FAR *);
  583. #endif
  584. /*****************************************************************************/
  585. /* If Win32 environment then restore original packing format                 */
  586. /*****************************************************************************/
  587. #ifdef WIN32
  588. #pragma pack()
  589. #endif
  590. #ifdef __cplusplus
  591. }
  592. #endif
  593. #endif