home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / CBuilder5 / INSTALL / DATA1.CAB / Program_Built_Files / Include / sna_dlc.h < prev    next >
C/C++ Source or Header  |  2000-02-01  |  16KB  |  341 lines

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