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

模拟服务器

开发平台:

C/C++

  1. /* sna_dlc.h */
  2. /*
  3.  * (C) Copyright Data Connection Limited 1989-1992.
  4.  * Copyright (c) Microsoft Corporation.  All rights reserved.
  5.  * All Rights Reserved.
  6.  */
  7. #ifndef SNA_DLCH_INCLUDED
  8. #define SNA_DLCH_INCLUDED
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /*****************************************************************************/
  13. /* Type definitions for message fields                                       */
  14. /*****************************************************************************/
  15. typedef signed long   LONGINT;
  16. typedef signed short  INTEGER;
  17. typedef signed char   SENUMERATED;
  18. typedef signed short  LENUMERATED;
  19. typedef unsigned char SUBRNG0;
  20. typedef signed char   SUBRNG1;
  21. typedef signed short  SUBRNG2;
  22. typedef signed char   SET1;
  23. typedef signed short  SET2;
  24. typedef signed long   SET;
  25. typedef SET2          THFORMAT;
  26. #define VOID          void
  27. /*****************************************************************************/
  28. /* Element offset and length definitions                                     */
  29. /*****************************************************************************/
  30. #define SBCBELT1 1
  31. #define SBCBELT3 13
  32. #define SNANBEDA 268     /* LENGTH OF BUFFER ELEMENT */
  33. /*****************************************************************************/
  34. /* POINTERS TO STRUCTURES IN SBTBUFPT                                        */
  35. /*****************************************************************************/
  36. #ifdef WIN32_SUPPORT
  37. #define PTRBFELT struct bufelt *
  38. #define PTRBFHDR struct bufhdr *
  39. #else
  40. #define PTRBFELT struct bufelt far *
  41. #define PTRBFHDR struct bufhdr far *
  42. #endif
  43. /*****************************************************************************/
  44. /* SIZE OF BUFFER HEADER:                                                    */
  45. /*   - 10 BYTES FOR FIXED PART                                               */
  46. /*   - 16 BYTES FOR VARIANT PART                                             */
  47. /*   - 2  BYTES FOR MATTERHORN EXTRA                                         */
  48. /*****************************************************************************/
  49. #define SVBUFSIZ 26
  50. /*****************************************************************************/
  51. /* OPEN MESSAGE TYPE DECLARATIONS                                            */
  52. /*****************************************************************************/
  53.      typedef struct tpophdr{                          /* OPEN MESSAGE HEADER */
  54.                       CHAR     openqual;
  55. #define REQU     1
  56. #define RSPOK    2
  57. #define RSPERR   3
  58. #define CONFOK   4
  59. #define CONFERR  5
  60.                       CHAR     opentype;
  61. #define LINK     16
  62. #define STAT     17
  63.                       CHAR     appltype;
  64.                       CHAR     opluno;              /* INTERFACE USER NUMBER */
  65.                       INTEGER  opresid;             /* INTERFACE USER ID     */
  66.                       union {
  67.                         struct {INTEGER  B03;
  68.                                 INTEGER  B04;
  69.                                 CHAR     B05;
  70.                                 CHAR     B06;}B02;
  71.                         struct {INTEGER  B08;
  72.                                 INTEGER  B09;}B07;
  73.                     }B01;}
  74. #define icreditr B01.B02.B03           /* Initial Credit for Receive       */
  75. #define icredits B01.B02.B04           /* Initial Credit for Send          */
  76. #define opninfo1 B01.B02.B05           /* Negotiable BIND indicator (FMI)  */
  77. #define opnpad1  B01.B02.B06           /* Open (SSCP) Force type           */
  78. #define operr1   B01.B07.B08
  79. #define ERINIFAIL    0x0001            /* Hardware initialisation failed   */
  80. #define ERLKNOTOPEN  0x0003            /* Link not open                    */
  81. #define ERSTATOPEN   0x0005            /* Station already open             */
  82. #define ERNOCB       0x0006            /* Station control blocks depleted  */
  83. #define ERINVINDX    0x0007            /* Invalid link index               */
  84. #define ERMAXSTAT    0x0008            /* No more stations/link allowed    */
  85. #define ERINVXID     0x0008            /* Invalid XID length               */
  86. #define ERDIFADDR    0x0009            /* Address different from RQ-OP-STN */
  87. #define ERLINKOPN    0x0009            /* Link already open                */
  88. #define ERBADADDR    0x000A            /* Invalid DLC address              */
  89. #define ERLCCERR     0x000A            /* LCC error; fatal hardware failure*/
  90. #define ERBADINDX    0x000B            /* Invalid link index               */
  91. #define ERBADOPN     0x000C            /* Open(LINK) has insufficient data */
  92. #define ERCONNTO     0x000D            /* Link connection timeout          */
  93. #define ERNORES      0x000E            /* No resources free                */
  94. #define EROPNPND     0x0011            /* Close(LINK) arrived, Open pending*/
  95. #define ERDUPREQ     0x0012            /* Duplicate request                */
  96. #define ERNOINC      0x0A11            /* Can't accept incoming call       */
  97. #define operr2   B01.B07.B09
  98.                     TPOPHDR;
  99. #define SNA          0
  100. #define APPL         1
  101. #define AMOD         2
  102. #define DLC          3
  103. /*****************************************************************************/
  104. /* CLOSE MESSAGE TYPE DECLARATIONS                                           */
  105. /*****************************************************************************/
  106.      typedef struct tpclhdr{                         /* CLOSE MESSAGE HEADER */
  107.                       CHAR     closqual;    /* Close message qualifier       */
  108.                       CHAR     clstype;     /* Close message connection type */
  109.                       CHAR     clsctl;      /* For Close(PLU) only           */
  110. #define CLNORMAL 1
  111. #define CLBIND   2
  112. #define CLCFAERR 3
  113. #define CLPUINAC 4
  114. #define CLLUINAC 5
  115. #define CLLNKERR 6
  116. #define CLBFSHRT 7
  117. #define CLRCVCHK 8
  118. #define CLSLUTRM 9
  119.                       CHAR     clspad1;
  120.                       INTEGER  clspad2;
  121.                       INTEGER  clserr1;
  122.                       INTEGER  clserr2;
  123.                     }TPCLHDR;
  124. /*****************************************************************************/
  125. /* DLC MESSAGE TYPE DECLARATIONS                                             */
  126. /*****************************************************************************/
  127.      typedef struct tpddhdr{                      /* DLC DATA MESSAGE HEADER */
  128.                      INTEGER  ddpad1;   /* Pad                              */
  129.                      INTEGER  ddpad2;   /* Pad                              */
  130.                      INTEGER  ddpad3;   /* Pad                              */
  131.                      THFORMAT ddth01;   /* TH Flags                         */
  132.                      CHAR     dddaf;    /* DAF in the TH                    */
  133.                      CHAR     ddoaf;    /* OAF in the TH                    */
  134.                      INTEGER  ddseqno;  /* Sequence Number in the TH        */
  135.                    }TPDDHDR;
  136.      typedef struct tpdshdr{                      /* DLC DATA MESSAGE HEADER */
  137.                      CHAR     dstype;    /* DLC-Status type                  */
  138. #define SENDXID  0x1a
  139. #define RESOURCE 0x04
  140. #define OUTAGE   0x18
  141. #define STNCTCTD 0x17
  142. #define RQOPNSTN 0x16
  143.                      CHAR     dsqual;    /* Status Qualifier                 */
  144.                      /*BOOLEAN*/union {
  145.                        /*TRUE*/struct {CHAR     B0N;
  146.                                     CHAR     B0O;
  147.                                     INTEGER  B0P;
  148.                                     INTEGER  B0Q;
  149.                                     CHAR     B0R;}B0M;
  150.                        /*FALSE*/struct {INTEGER  B0T;}B0S;
  151.                    }B0L;}
  152. #define dsuptype B0L.B0M.B0N             /* Status Qualifier                 */
  153. #define dsmdset  B0L.B0M.B0N             /* RECFMS Counter Type              */
  154. #define dsupcntr B0L.B0M.B0O             /* Req-Opn-Station Set-Mode flag    */
  155. #define dspad    B0L.B0M.B0P             /* RECFMS Counter Value             */
  156. #define dserror  B0L.B0M.B0Q             /* Pad                              */
  157. #define dsoutsq  B0L.B0M.B0R             /* Internal value for Counter       */
  158. #define dlccred  B0L.B0S.B0T             /* Outage Sub-qualifier             */
  159.                    TPDSHDR;              /* DLC-Status Credit Increment      */
  160. /*****************************************************************************/
  161. /* SNAP-LINK HMOD MESSAGE TYPE DECLARATIONS                                  */
  162. /*****************************************************************************/
  163.      typedef struct tpdlhdr{                         /* HMOD  MESSAGE HEADER */
  164.                       CHAR     dlcnr;    /* N(R) Value                       */
  165.                       CHAR     dlcns;    /* N(S) Value                       */
  166.                       INTEGER  dlclkidx; /* Link Index                       */
  167.                       CHAR     dlcerst1; /* Error Status 1                   */
  168.                       CHAR     dlcerst2; /* Error Status 2                   */
  169.                     }TPDLHDR;
  170. /*****************************************************************************/
  171. /* MAIN DEFINITION OF MESSAGE HEADER                                         */
  172. /*****************************************************************************/
  173.      typedef struct bufhdr{
  174.                      PTRBFHDR nxtqptr;
  175.                      PTRBFELT hdreptr;
  176.                      CHAR     numelts;
  177.                      CHAR     msgtype;
  178. #define OPENMSG  1
  179. #define CLOSEMSG 2
  180. #define DLCSTAT  17
  181. #define DLCDATA  16
  182.                      CHAR     srcl;
  183.                      CHAR     srcp;
  184. #define SLPROD   22
  185.                      INTEGER  srci;
  186.                      CHAR     destl;
  187.                      CHAR     destp;
  188.                      INTEGER  desti;
  189.                      union {
  190.                        struct {TPOPHDR  B1C;}B1B;
  191.                        struct {TPCLHDR  B1E;}B1D;
  192.                        struct {TPDDHDR  B1G;}B1F;
  193.                        struct {TPDSHDR  B1I;}B1H;
  194.                        struct {TPDLHDR  B1K;}B1J;
  195.                      }B0Y;}
  196. #define ophdr    B0Y.B1B.B1C
  197. #define clhdr    B0Y.B1D.B1E
  198. #define ddhdr    B0Y.B1F.B1G
  199. #define dshdr    B0Y.B1H.B1I
  200. #define dlhdr    B0Y.B1J.B1K
  201.                      BUFHDR;
  202. /*****************************************************************************/
  203. /* MAIN DEFINITION OF MESSAGE ELEMENT                                        */
  204. /*****************************************************************************/
  205. /**STRUCT+********************************************************************/
  206. /* Structure: BUFELT                                                         */
  207. /*                                                                           */
  208. /* Description: Main definition of SNAPS Buffer Element                      */
  209. /*****************************************************************************/
  210.      typedef struct bufelt{
  211.                      PTRBFELT elteptr;   /* Pointer to next element in buffer*/
  212.                      INTEGER  startd;    /* Offset (from 1) of start of data */
  213.                      INTEGER  endd;      /* Offset (from 1) of last data byte*/
  214.                      CHAR     trpad;
  215.                      CHAR     dataru[268]; /* The data bytes themselves      */
  216.                      } BUFELT;
  217. /**STRUCT-********************************************************************/
  218. /*****************************************************************************/
  219. /* IF Win32 environment THEN                                                 */
  220. /*   IF intel format THEN                                                    */
  221. /*     define flipping macros                                                */
  222. /*     define anti-flipping macros to NOP                                    */
  223. /*****************************************************************************/
  224. #ifdef WIN32
  225. #ifndef NON_INTEL_BYTE_ORDER
  226. #define PFLIPI(X) (unsigned short)_rotl(((unsigned short)(X))*(unsigned long)0x00010001,8)
  227. #define PFLIPL(X) MAKEULONG(PFLIPI(HIUSHORT(X)),PFLIPI(LOUSHORT(X)))
  228. #define PANTIFLIPI(X) (X)
  229. /*****************************************************************************/
  230. /* ELSE (non-intel)                                                          */
  231. /*   set flipping to nop for now                                             */
  232. /*   set anti-flipping on                                                    */
  233. /*****************************************************************************/
  234. #else
  235. #define PFLIPI(X)  (X)
  236. #define PFLIPL(X)  (X)
  237. #define PANTIFLIPI(X) (unsigned short)_rotl((unsigned short)(X),8)
  238. #endif
  239. /*****************************************************************************/
  240. /* ELSE (not Win32, must be Intel environment)                               */
  241. /*   define flipping macros                                                  */
  242. /*****************************************************************************/
  243. #else
  244. #define PFLIPI(X) (unsigned short)_rotl((unsigned short)(X),8)
  245. #define PFLIPL(X) MAKEULONG(PFLIPI(HIUSHORT(X)),PFLIPI(LOUSHORT(X)))
  246. #define PANTIFLIPI(X) (X)
  247. #endif
  248. /*****************************************************************************/
  249. /* Buffer pool access routines                                               */
  250. /*****************************************************************************/
  251. #ifdef WIN32_SUPPORT
  252.   #ifdef OLD_IHV_PROTOS
  253.     extern PTRBFHDR WINAPI     sepdbubl (USHORT);
  254.     extern VOID     WINAPI     sepdburl (PTRBFHDR);
  255.     extern VOID     WINAPI     sbpibegt (PTRBFELT *);
  256.     extern VOID     WINAPI     sbpiberl (PTRBFELT *);
  257.   #else
  258.     extern PTRBFHDR WINAPI     SNAGetBuffer     (USHORT);
  259.     extern VOID     WINAPI     SNAReleaseBuffer (PTRBFHDR);
  260.     extern VOID     WINAPI     SNAGetElement    (PTRBFELT *);
  261.     extern VOID     WINAPI     SNAReleaseElement(PTRBFELT *);
  262.   #endif
  263. #else
  264.   extern PTRBFHDR far  sepdbubl (USHORT);
  265.   extern VOID     far  sepdburl (PTRBFHDR);
  266.   extern VOID     far  sbpibegt (PTRBFELT far *);
  267.   extern VOID     far  sbpiberl (PTRBFELT far *);
  268. #endif
  269. #ifdef WIN32_SUPPORT
  270. extern CHAR        WINAPI  snpugetc(PTRBFELT, INTEGER);
  271. extern VOID        WINAPI  snpuputc(PTRBFELT, INTEGER, CHAR);
  272. extern INTEGER     WINAPI  snpugeti(PTRBFELT, INTEGER);
  273. extern VOID        WINAPI  snpuputi(PTRBFELT, INTEGER, INTEGER);
  274. extern VOID        WINAPI  snpugetl(PTRBFELT, INTEGER, LONGINT *);
  275. extern VOID        WINAPI  snpuputl(PTRBFELT, INTEGER, LONGINT);
  276. #else
  277. extern CHAR     far  snpugetc(PTRBFELT, INTEGER);
  278. extern VOID     far  snpuputc(PTRBFELT, INTEGER, CHAR);
  279. extern INTEGER  far  snpugeti(PTRBFELT, INTEGER);
  280. extern VOID     far  snpuputi(PTRBFELT, INTEGER, INTEGER);
  281. extern VOID     far  snpugetl(PTRBFELT, INTEGER, LONGINT FAR *);
  282. extern VOID     far  snpuputl(PTRBFELT, INTEGER, LONGINT);
  283. #endif
  284. /*****************************************************************************/
  285. /* Include the remainder of SNA Services definitions                         */
  286. /*****************************************************************************/
  287. #include <sna_cnst.h>
  288. #ifdef __cplusplus
  289. }
  290. #endif
  291. #endif
  292. /* End of file cs_dlc.h */