home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / wincsv.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  24KB  |  412 lines

  1. /* Copyright Data Connection Ltd. 1989                                       */
  2. /* acssvcc.h                                                                 */
  3. /* Copyright (c) 1989 Microsoft Corporation. All rights reserved.            */
  4. /*****************************************************************************/
  5. /*       Function prototypes for the Common Service Verbs                    */
  6. /*****************************************************************************/
  7. /*  3054  13/11/91  SW  Add pascal entry point function prototype            */
  8. /*  W32   15/04/92  CD  Add WIN32 support                                    */
  9. /*  WCSV  06/11/92  SW  Add prototype for WinCSV entry points                */
  10. /*  0998  11/06/93  SP  Add Async Transfer_MS_Data + wait for Host's Rsp     */
  11. /*  WCSV2 15/09/93  PP  Add WinCSV return codes                              */
  12. /*  RCFX2 26/07/94  SF  Ensure Secondary return code is a ULONG              */
  13. /*****************************************************************************/
  14.  
  15. #ifndef ACSSVCCH_INCLUDED
  16. #define ACSSVCCH_INCLUDED
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21.  
  22. #if (defined(WIN32) || defined(WINDOWS))
  23.  #define CSVENTRY WINAPI
  24. #else
  25.  #define CSVENTRY far pascal
  26. #endif
  27.  
  28.  
  29.  
  30. #if (defined(WIN32) || defined(WINDOWS))
  31. #define    WCSVDESCRIPTION_LEN    127                                      /*0998*/
  32.  
  33. typedef struct tagWCSVDATA                                             /*0998*/
  34. {                                                                      /*0998*/
  35.   WORD    wVersion;                                                    /*0998*/
  36.   char    szDescription[WCSVDESCRIPTION_LEN+1];                        /*0998*/
  37. } WCSVDATA, * PWCSVDATA, FAR * LPWCSVDATA;                             /*0998*/
  38.  
  39. extern void   CSVENTRY WinCSV(long);                                   /*0998*/
  40. extern HANDLE CSVENTRY WinAsyncCSV(HWND, long);                        /*0998*/
  41. extern int    CSVENTRY WinCSVCleanup(void);                            /*0998*/
  42. extern int    CSVENTRY WinCSVStartup(WORD wVersion, LPWCSVDATA lpData);/*0998*/
  43. extern int    CSVENTRY GetCsvReturnCode (struct  svc_hdr FAR *, UINT, unsigned char FAR *);
  44. /*WCSV2***********************************************************************/
  45. /* WinCSV return codes                                                       */
  46. /*****************************************************************************/
  47. #define WCSVINVALID         CSV_FLIPI(0x01F0) /* invalid parameter           */
  48. #define WCSVSYSNOTREADY     CSV_FLIPI(0x03F0) /* subsystem not started       */
  49. #define WCSVVERNOTSUPPORTED CSV_FLIPI(0x04F0) /* requested ver not supported */
  50.  
  51. #endif
  52.  
  53. extern void CSVENTRY ACSSVC(long);
  54. extern void CSVENTRY ACSSVC_C(long);
  55. extern void CSVENTRY ACSSVC_P(long);                                   /*3054*/
  56.  
  57. /*****************************************************************************/
  58. /* Ensure the correct packing of structures                                  */
  59. /*****************************************************************************/
  60. #ifdef WIN32
  61.   #pragma pack(4)
  62. #endif
  63.  
  64. /*****************************************************************************/
  65. /*                       VCB structures                                      */
  66. /*****************************************************************************/
  67.  
  68. struct svc_hdr
  69.   {
  70.   unsigned short opcode;           /* Verb identifying operation code.       */
  71.   unsigned char opext;             /* Reserved                               */
  72.   unsigned char reserv2;           /* Reserved.                              */
  73.   unsigned short primary_rc;       /* Primary return code from verb.         */
  74.   unsigned long secondary_rc;      /* Secondary (qualifying) return code.    */
  75.   };
  76.  
  77. struct convert
  78.   {
  79.   unsigned short opcode;           /* Verb identifying operation code.       */
  80.   unsigned char opext;             /* Reserved.                              */
  81.   unsigned char reserv2;           /* Reserved.                              */
  82.   unsigned short primary_rc;       /* Primary return code from verb.         */
  83.   unsigned long secondary_rc;      /* Secondary (qualifying) return code.    */
  84.   unsigned char direction;         /* Direction of conversion - ASCII to     */
  85.                                    /* EBCDIC or vice-versa.                  */
  86.   unsigned char char_set;          /* Character to use for the conversion    */
  87.                                    /* A, AE, or user-defined G.              */
  88.   unsigned short len;              /* Length of string to be converted.      */
  89. #ifdef WIN32
  90.   unsigned char     *source;       /* Pointer to string to be converted.     */
  91.   unsigned char     *target;       /* Address to put converted string at.    */
  92. #else
  93.   unsigned char far *source;       /* Pointer to string to be converted.     */
  94.   unsigned char far *target;       /* Address to put converted string at.    */
  95. #endif
  96.   };
  97.  
  98. struct define_trace
  99.   {
  100.   unsigned short opcode;           /* Verb identifying operation code.       */
  101.   unsigned char opext;             /* Reserved.                              */
  102.   unsigned char reserv2;           /* Reserved.                              */
  103.   unsigned short primary_rc;       /* Primary return code from verb.         */
  104.   unsigned long secondary_rc;      /* Secondary (qualifying) return code.    */
  105.   unsigned char reserv3[8];        /* Reserved.                              */
  106.   unsigned char dt_set;            /* Trace state to be set (on/off).        */
  107.   /***************************************************************************/
  108.   /* In the following fields, used for specifying which sorts of tracing is  */
  109.   /* required, only the most significant bit is currently used. Bits 1 to 7  */
  110.   /* are reserved. Bit 0 can be set to 'ignore' or to 'change'.              */
  111.   /***************************************************************************/
  112.   unsigned char appc;              /* Tracing for APPC.                      */
  113.   unsigned char reserv4;           /* Reserved.                              */
  114.   unsigned char srpi;              /* Tracing for SRPI.                      */
  115.   unsigned char sdlc;              /* Reserved.                              */
  116.   unsigned char tkn_rng_dlc;       /* Reserved.                              */
  117.   unsigned char pcnet_dlc;         /* Reserved.                              */
  118.   unsigned char dft;               /* Reserved.                              */
  119.   unsigned char acdi;              /* Reserved.                              */
  120.   unsigned char reserv5;           /* Reserved.                              */
  121.   unsigned char comm_serv;         /* Tracing for Comm_Serv_API.             */
  122.   unsigned char ehllapi;           /* Reserved.                              */
  123.   unsigned char x25_api;           /* Reserved.                              */
  124.   unsigned char x25_dlc;           /* Reserved.                              */
  125.   unsigned char twinax;            /* Reserved.                              */
  126.   unsigned char reserv6;           /* Reserved.                              */
  127.   unsigned char lua_api;           /* Reserved.                              */
  128.   unsigned char etherand;          /* Reserved.                              */
  129.   unsigned char subsym;            /* Reserved.                              */
  130.   unsigned char reserv7[8];        /* Reserved.                              */
  131.   unsigned char reset_trc;         /* Reserved.                              */
  132.   unsigned short trunc;            /* Truncation size for trace records.     */
  133.   unsigned short strg_size;        /* Reserved.                              */
  134.   unsigned char reserv8[1];        /* Reserved.                              */
  135.   unsigned char phys_link[8];      /* Reserved.                              */
  136.   unsigned char reserv9[56];       /* Reserved.                              */
  137.   };
  138.  
  139.  
  140.  
  141. struct get_cp_convert_table
  142.   {
  143.   unsigned short opcode;           /* Verb identifying operation code.       */
  144.   unsigned char opext;             /* Reserved.                              */
  145.   unsigned char reserv2;           /* Reserved.                              */
  146.   unsigned short primary_rc;       /* Primary return code from verb.         */
  147.   unsigned long secondary_rc;      /* Secondary (qualifying) return code.    */
  148.   unsigned short source_cp;        /* Source code page for conversion table. */
  149.   unsigned short target_cp;        /* Target code page for conversion table. */
  150. #ifdef WIN32
  151.   unsigned char     *conv_tbl_addr;/* Address to put conversion table at.    */
  152. #else
  153.   unsigned char far *conv_tbl_addr;/* Address to put conversion table at.    */
  154. #endif
  155.   unsigned char char_not_fnd;      /* Character not found option: either     */
  156.                                    /* substitute character or round trip.    */
  157.   unsigned char substitute_char;   /* Substitute character to use.           */
  158.   };
  159.  
  160.  
  161.  
  162. struct log_message
  163.   {
  164.   unsigned short opcode;           /* Verb identifying operation code.       */
  165.   unsigned char opext;             /* Reserved.                              */
  166.   unsigned char reserv2;           /* Reserved.                              */
  167.   unsigned short primary_rc;       /* Primary return code from verb.         */
  168.   unsigned long secondary_rc;      /* Secondary (qualifying) return code.    */
  169.   unsigned short msg_num;          /* Number of message to log.              */
  170.   unsigned char origntr_id[8];     /* ID of the originator of the message.   */
  171.   unsigned char msg_file_name[3];  /* Message file to search for the required*/
  172.                                    /* message number.                        */
  173.   unsigned char msg_act;           /* Message action - whether to inform     */
  174.                                    /* operator.                              */
  175.   unsigned short msg_ins_len;      /* Length of data for insertion in msg.   */
  176. #ifdef WIN32
  177.   unsigned char     *msg_ins_ptr;  /* Address of data for insertion in msg.  */
  178. #else
  179.   unsigned char far *msg_ins_ptr;  /* Address of data for insertion in msg.  */
  180. #endif
  181.   };
  182.  
  183. struct transfer_ms_data
  184.   {
  185.   unsigned short opcode;           /* Verb identifying operation code.       */
  186.   unsigned char data_type;         /* Data type supplied to the verb - can   */
  187.                                    /* be: user-defined; alert subvectors;    */
  188.                                    /* pdstats subvectors; NMVT.              */
  189.   unsigned char reserv2;           /* Reserved.                              */
  190.   unsigned short primary_rc;       /* Primary return code from verb.         */
  191.   unsigned long secondary_rc;      /* Secondary (qualifying) return code.    */
  192.   unsigned char options;           /* Verb options. Bits 3 - 7 are reserved. */
  193.                                    /* Bit 0: Time stamp subvector option.    */
  194.                                    /* Bit 1: Product set id subvector option.*/
  195.                                    /* Bit 2: Option to send NMVT to SSCP.    */
  196.                                    /* Bit 3: Option for local logging.       */
  197.   unsigned char reserv3;           /* Reserved.                              */
  198.   unsigned char origntr_id[8];     /* ID of originator of NMVT.              */
  199.   unsigned short dlen;             /* Length of data supplied to verb.       */
  200. #ifdef WIN32
  201.   unsigned char     *dptr;         /* Address at which supplied data resides.*/
  202. #else
  203.   unsigned char far *dptr;         /* Address at which supplied data resides.*/
  204. #endif
  205.   };
  206.  
  207.  
  208. struct set_user_log_queue
  209.   {
  210.   unsigned short opcode;           /* Verb operation code                    */
  211.   unsigned char opext;             /* Reserved.                              */
  212.   unsigned char reserv2;           /* Reserved.                              */
  213.   unsigned short primary_rc;       /* Primary RETURN_CODE                    */
  214.   unsigned long secondary_rc;      /* Secondary RETURN_CODE                  */
  215.   unsigned char reserv3[8];        /* Reserved.                              */
  216.   unsigned char queue_name[64];    /* Reserved.                              */
  217.   unsigned char forward;           /* Reserved.                              */
  218.   unsigned char suppress;          /* Reserved.                              */
  219.   unsigned char selection;         /* Reserved.                              */
  220.   unsigned short numbers[10];      /* Reserved.                              */
  221.   };
  222.  
  223.  
  224. struct copy_trace_to_file
  225.   {
  226.   unsigned short opcode;           /* Verb identifying operation code.       */
  227.   unsigned char opext;             /* Reserved.                              */
  228.   unsigned char reserv2;           /* Reserved.                              */
  229.   unsigned short primary_rc;       /* Primary return code from verb.         */
  230.   unsigned long secondary_rc;      /* Secondary (qualifying) return code.    */
  231.   unsigned char reserv3[8];        /* Reserved.                              */
  232.   unsigned char file_name[64];     /* Trace file name.                       */
  233.   unsigned char file_option;       /* File options. New or overwrite.        */
  234.   unsigned char reserv4[12];       /* Address at which supplied data resides.*/
  235.   };
  236.  
  237.  
  238. /*****************************************************************************/
  239. /* Return the packing to what the user set                                   */
  240. /*****************************************************************************/
  241. #ifdef WIN32
  242.   #pragma pack()
  243. #endif
  244.  
  245. /*****************************************************************************/
  246. /* ------------------------- macro definitions ----------------------------- */
  247. /*****************************************************************************/
  248.  
  249. /*************************************************************************W32*/
  250. /* define type conversion macros                                         *W32*/
  251. /*************************************************************************W32*/
  252. #ifndef CSVFLIPSET
  253. #define CSVFLIPSET
  254. #define CSV_LO_UC(w)    ((unsigned char)(((unsigned short)(w)) & 0xFF)) /*W32*/
  255. #define CSV_HI_UC(w)    ((unsigned char)(((unsigned short)(w) >> 8)  \
  256.                             & 0xff))                                    /*W32*/
  257. #define CSV_MAKUS(l, h) (((unsigned short)(l)) |                     \
  258.                           ((unsigned short)(h)) << 8)                   /*W32*/
  259. #define CSV_MAKUL(l, h) ((unsigned long)(((unsigned short)(l))|      \
  260.                           ((unsigned long)((unsigned short)(h))) << 16))/*W32*/
  261. #define CSV_LO_US(l)  ((unsigned short)(((unsigned long)(l)) & 0xFFFF)) /*W32*/
  262. #define CSV_HI_US(l)    ((unsigned short)(((unsigned long)(l) >> 16) \
  263.                            & 0xffff))                                   /*W32*/
  264.                                                                         /*W32*/
  265. /*************************************************************************W32*/
  266. /* IF non-Intel THEN                                                     *W32*/
  267. /*   set flipping to nop for now                                         *W32*/
  268. /*************************************************************************W32*/
  269. #ifdef NON_INTEL_BYTE_ORDER                                             /*W32*/
  270. #define CSV_FLIPI(X)  (X)                                               /*W32*/
  271. #define CSV_FLIPL(X)  (X)                                               /*W32*/
  272.                                                                         /*W32*/
  273. /*************************************************************************W32*/
  274. /* ELSE (Intel environment)                                              *W32*/
  275. /*   define flipping macros                                              *W32*/
  276. /*************************************************************************W32*/
  277. #else                                                                   /*W32*/
  278. #define CSV_FLIPI(X) CSV_MAKUS(CSV_HI_UC(X),CSV_LO_UC(X))               /*W32*/
  279. #define CSV_FLIPL(X) CSV_MAKUL(CSV_FLIPI(CSV_HI_US(X)),               \
  280.                                  CSV_FLIPI(CSV_LO_US(X)))               /*W32*/
  281. #endif                                                                  /*W32*/
  282. #endif
  283.  
  284. /*****************************************************************************/
  285. /*        Verb op codes.                                                     */
  286. /*****************************************************************************/
  287.  
  288.   #define SV_CONVERT                       CSV_FLIPI(0x1A00)
  289.   #define SV_DEFINE_TRACE                  CSV_FLIPI(0x1D00)
  290.   #define SV_GET_CP_CONVERT_TABLE          CSV_FLIPI(0x1900)
  291.   #define SV_LOG_MESSAGE                   CSV_FLIPI(0x1F00)
  292.   #define SV_TRANSFER_MS_DATA              CSV_FLIPI(0x1C00)
  293.  
  294.   #define SV_SET_USER_LOG_QUEUE            CSV_FLIPI(0x4B00)
  295.   #define SV_COPY_TRACE_TO_FILE            CSV_FLIPI(0x4C00)
  296.   #define SV_DEFINE_DUMP                   CSV_FLIPI(0x4D00)
  297.  
  298.  
  299. /*****************************************************************************/
  300. /*        Parameters for the Common Service Verbs.                           */
  301. /*****************************************************************************/
  302.  
  303.   #define SV_ADD                                     0
  304.   #define SV_CHANGE                                  1
  305.   #define SV_IGNORE                                  0
  306.   #define SV_NO_ADD                                  1
  307.   #define SV_NO_SEND                                 1
  308.   #define SV_SEND                                    0
  309.  
  310.   #define SV_A                                       0x01
  311.   #define SV_AE                                      0x00
  312.   #define SV_ALL                                     0x01
  313.   #define SV_ALERT_SUBVECTORS                        0x02
  314.   #define SV_ASCII_TO_EBCDIC                         0x00
  315.   #define SV_EBCDIC_TO_ASCII                         0x01
  316.   #define SV_FORWARD                                 0x02
  317.   #define SV_INTRV                                   0x00
  318.   #define SV_G                                       0x02
  319.   #define SV_LOG                                     0x00
  320.   #define SV_LOGS                                    0x00
  321.   #define SV_NMVT                                    0x01
  322.   #define SV_NO                                      0x00
  323.   #define SV_NO_INTRV                                0x01
  324.   #define SV_NO_LOG                                  0x01
  325.   #define SV_NONE                                    0x00
  326.   #define SV_OFF                                     0x00
  327.   #define SV_ON                                      0x01
  328.   #define SV_PDSTATS_SUBVECTORS                      0x03
  329.   #define SV_ROUND_TRIP                              0x01
  330.   #define SV_SOME                                    0x00
  331.   #define SV_SUBSTITUTE                              0x00
  332.   #define SV_SYSTEM_MESSAGES                         0x01
  333.   #define SV_USER_DEFINED                            0x00
  334.   #define SV_USER_MESSAGES                           0x02
  335.   #define SV_YES                                     0x01
  336.  
  337.  /****************************************************************************/
  338.  /*       Bit masks for enabling and disabling functions                     */
  339.  /****************************************************************************/
  340.   #define SV_BIT0                                    0x80        /* x....... */
  341.   #define SV_BIT1                                    0x40        /* .x...... */
  342.   #define SV_BIT2                                    0x20        /* ..x..... */
  343.   #define SV_BIT3                                    0x10        /* ...x.... */
  344.   #define SV_BIT4                                    0x08        /* ....x... */
  345.   #define SV_BIT5                                    0x04        /* .....x.. */
  346.   #define SV_BIT6                                    0x02        /* ......x. */
  347.   #define SV_BIT7                                    0x01        /* .......x */
  348.  
  349. /*****************************************************************************/
  350. /*        Return Codes from the Common Service Verbs.                        */
  351. /*****************************************************************************/
  352.  
  353.   #define SV_COMM_SUBSYSTEM_NOT_LOADED     CSV_FLIPI(0xF012)
  354.   #define SV_CONFIG_FILE_ERROR             CSV_FLIPI(0x0032)
  355.   #define SV_INVALID_VERB                  CSV_FLIPI(0xFFFF)
  356.   #define SV_INVALID_VERB_SEGMENT          CSV_FLIPI(0xF008)
  357.   #define SV_OK                            CSV_FLIPI(0x0000)
  358.   #define SV_PARAMETER_CHECK               CSV_FLIPI(0x0001)
  359.   #define SV_STATE_CHECK                   CSV_FLIPI(0x0002)
  360.   #define SV_UNEXPECTED_DOS_ERROR          CSV_FLIPI(0xF011)
  361.   #define SV_CANCELLED                     CSV_FLIPI(0x0021)           /*0998*/
  362.   #define SV_SERVER_RESOURCE_NOT_FOUND     CSV_FLIPI(0xF024)           /*0998*/
  363.   #define SV_SERVER_RESOURCES_LOST         CSV_FLIPI(0xF026)           /*0998*/
  364.   #define SV_THREAD_BLOCKING               CSV_FLIPI(0xF006)           /*0998*/
  365.  
  366.   #define SV_CONVERSION_ERROR              CSV_FLIPL(0x00000406)
  367.   #define SV_DATA_EXCEEDS_RU_SIZE          CSV_FLIPL(0x00000302)
  368.   #define SV_INVALID_CHARACTER_SET         CSV_FLIPL(0x00000402)
  369.   #define SV_INVALID_CHAR_NOT_FOUND        CSV_FLIPL(0x00000630)
  370.   #define SV_INVALID_DATA_SEGMENT          CSV_FLIPL(0x00000006)
  371.   #define SV_INVALID_DATA_TYPE             CSV_FLIPL(0x00000303)
  372.   #define SV_INVALID_DIRECTION             CSV_FLIPL(0x00000401)
  373.   #define SV_INVALID_FIRST_CHARACTER       CSV_FLIPL(0x00000404)
  374.   #define SV_INVALID_FORWARD               CSV_FLIPL(0x00000700)
  375.   #define SV_INVALID_MESSAGE_ACTION        CSV_FLIPL(0x00000621)
  376.   #define SV_INVALID_NMVT_ERROR            CSV_FLIPL(0x00000304)
  377.   #define SV_INVALID_QUEUE                 CSV_FLIPL(0x00000704)
  378.   #define SV_INVALID_RESET_TRACE           CSV_FLIPL(0x0000062F)
  379.   #define SV_INVALID_SELECTION             CSV_FLIPL(0x00000702)
  380.   #define SV_INVALID_SET                   CSV_FLIPL(0x00000624)
  381.   #define SV_INVALID_SOURCE_CODE_PAGE      CSV_FLIPL(0x00000631)
  382.   #define SV_INVALID_STORAGE_SIZE          CSV_FLIPL(0x00000627)
  383.   #define SV_INVALID_SUPPRESS              CSV_FLIPL(0x00000701)
  384.   #define SV_INVALID_TARGET_CODE_PAGE      CSV_FLIPL(0x00000632)
  385.   #define SV_PD_MENUS_IN_PROGRESS          CSV_FLIPL(0x0000062E)
  386.   #define SV_QUEUE_ALREADY_IN_EFFECT       CSV_FLIPL(0x00000705)
  387.   #define SV_SSCP_PU_SESSION_NOT_ACTIVE    CSV_FLIPL(0x00000301)
  388.   #define SV_TABLE_ERROR                   CSV_FLIPL(0x00000405)
  389.   #define SV_TOO_HIGH_A_NUMBER             CSV_FLIPL(0x00000703)
  390.   #define SV_SERVER_CONN_FAILURE           CSV_FLIPL(0x030000AB) /*0998**RCFX*/
  391.  
  392. /*****************************************************************************/
  393. /* The following constants are needed for EE12 enhancements but could not    */
  394. /* be found in the EE header file.                                           */
  395. /*****************************************************************************/
  396.   #define SV_NEW                                     0x00
  397.   #define SV_OVERWRITE                               0x01
  398.  
  399.   #define SV_OUTPUT_DEVICE_FULL            CSV_FLIPI(0x0031)
  400.   #define SV_FILE_ALREADY_EXISTS           CSV_FLIPI(0x0030)
  401.  
  402.   #define SV_TRACE_NOT_STOPPED             CSV_FLIPL(0x0000062A)
  403.   #define SV_INVALID_FILE_OPTION           CSV_FLIPL(0x0000062B)
  404.   #define SV_TRACE_BUFFER_EMPTY            CSV_FLIPL(0x0000062C)
  405.  
  406.  
  407. #ifdef __cplusplus
  408. }
  409. #endif
  410.  
  411. #endif
  412.