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

模拟服务器

开发平台:

C/C++

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