home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / armsdk20.zip / armsdk.exe / INCLUDE / ARM.H next >
C/C++ Source or Header  |  1997-11-19  |  9KB  |  284 lines

  1. #ifndef ARM_H_INCLUDED
  2. #define ARM_H_INCLUDED
  3.  
  4. /****************************************************************************/
  5. /* arm.h - ARM API Definitions                                              */
  6. /****************************************************************************/
  7.  
  8. #include <sys/types.h>     /* C types  definitions */
  9.  
  10. /*  Type definitions for various field sizes */
  11.  
  12. /*  64-bit integer compiler support                                         */
  13. /*                                                                          */
  14. /*  If a type declaration supporting 64 bit integer arithmatic is defined   */
  15. /*  for the target platform and compiler, the "INT64" #define should be set */
  16. /*  to that type declaration. E.g.,                                         */
  17. /*                                                                          */
  18. /*         #define INT64 long long                                          */
  19. /*                                                                          */
  20. /*  If 64 bit arithmatic is not supported on the target platform or         */
  21. /*  compiler, remove (or comment out) the "INT64" #define and structures    */
  22. /*  of two 32 bit values will be defined for the 64 bit fields.             */
  23.  
  24. /*
  25. #define INT64 long long
  26. */
  27.  
  28. typedef unsigned char  bit8 ;
  29. typedef short int16 ;
  30. typedef long  int32 ;
  31. typedef unsigned char  unsigned8 ;
  32. typedef unsigned short unsigned16 ;
  33. typedef unsigned long  unsigned32 ;
  34.  
  35. #ifdef INT64
  36. typedef INT64 int64 ;
  37. typedef unsigned INT64 unsigned64 ;
  38. #else
  39. typedef struct int64 {
  40.     int32   upper;
  41.     int32   lower;
  42. } int64 ;
  43.  
  44. typedef struct unsigned64 {
  45.     unsigned32   upper;
  46.     unsigned32   lower;
  47. } unsigned64 ;
  48. #endif
  49.  
  50.  
  51.  
  52. /***    Symbol definitions    ***/
  53.  
  54.  
  55. /*  Enumeration of transaction status completion codes */
  56.  
  57. enum arm_tran_status_e { ARM_GOOD = 0, ARM_ABORT, ARM_FAILED };
  58.  
  59.  
  60. /*  Enumeration of user data formats */
  61.  
  62. enum arm_userdata_e { ARM_Format1 = 1, ARM_Format2, ARM_Format101 = 101 };
  63.  
  64.  
  65. /*  Enumeration of metric types */
  66.  
  67. typedef enum arm_metric_type_e {
  68.         ARM_Counter32 = 1, ARM_Counter64, ARM_CntrDivr32,
  69.         ARM_Gauge32, ARM_Gauge64, ARM_GaugeDivr32, ARM_NumericID32,
  70.         ARM_NumericID64, ARM_String8, ARM_String32,
  71.         ARM_MetricTypeLast 
  72. } arm_metric_type_e;
  73.  
  74.  
  75. /***    Data definitions    ***/
  76.  
  77.  
  78. /*  User metric structures */
  79.  
  80. typedef struct arm_cntrdivr32_t {        /*  Counter32 + Divisor32  */
  81.     unsigned32  count;
  82.     unsigned32  divisor;
  83. } arm_cntrdivr32_t;
  84.  
  85. typedef struct arm_gaugedivr32_t {        /*  Gauge32 + Divisor32  */
  86.     int32         gauge;
  87.     unsigned32  divisor;
  88. } arm_gaugedivr32_t;
  89.  
  90.  
  91. /*  Union of user ARM_Format1 metric types */
  92.  
  93. typedef union arm_user_metric1_u {
  94.     unsigned32  counter32;          /*  Counter32  */
  95.     unsigned64  counter64;          /*  Counter64  */
  96.     arm_cntrdivr32_t cntrdivr32;       /*  Counter32 + Divisor32  */
  97.     int32    gauge32;            /*  Gauge32  */
  98.     int64    gauge64;            /*  Gauge64  */
  99.     arm_gaugedivr32_t gaugedivr32;      /*  Gauge32 + Divisor32  */
  100.     unsigned32  numericid32;        /*  NumericID32  */
  101.     unsigned64  numericid64;        /*  NumericID64  */
  102.     char        string8[8];         /*  String8  */
  103. } arm_user_metric1_u;
  104.  
  105.  
  106. /*  Application view of correlator */
  107.  
  108. typedef struct arm_app_correlator_t {
  109.     int16    length;        /*  Length of the correlator  */
  110.     char    agent_data[166];/*  Agent-specific data fields  */
  111. } arm_app_correlator_t;
  112.  
  113.  
  114. /*  User metrics ARM_Format1 structure definition */
  115.  
  116. typedef struct arm_user_data1_t {
  117.     int32         format;            /*  Version/format id (userdata_e)  */
  118.     bit8          flags[4];        /*  Flags for metrics' presence  */
  119.     arm_user_metric1_u metric[6];    /*  User metrics  */
  120.     char          string32[32];        /*  32 byte non-terminated string  */
  121.     arm_app_correlator_t correlator;    /*  Correlator  */
  122. } arm_user_data1_t;
  123.  
  124.  
  125. /*  User metrics ARM_Format2 structure definition */
  126.  
  127. typedef struct arm_user_data2_t {
  128.     int32         format;        /*  Version/format id (userdata_e)  */
  129.     char          string1020[1020];/*  1020 byte opaque blob  */
  130. } arm_user_data2_t;
  131.  
  132.  
  133. /*  User metric meta-data for ARM_Format101 structure */
  134.  
  135. typedef struct arm_user_meta101_t {
  136.     int32         type;        /*  Type of metric (arm_user_metric_e)  */
  137.     char          name[44];    /*  NULL-terminated string <= 44 char  */
  138. } arm_user_meta101_t;
  139.  
  140.  
  141. /*  User meta-data ARM_Format101 structure definition */
  142.  
  143. typedef struct arm_user_data101_t {
  144.     int32         format;        /*  Version/format id (userdata_e)  */
  145.     bit8          flags[4];    /*  Flags for which fields are present  */
  146.     arm_user_meta101_t meta[7];    /*  User metrics meta-data  */
  147. } arm_user_data101_t;
  148.  
  149.  
  150. /*  Flag bit definitions (within bit8 fields) */
  151.  
  152. /*  flags[0] in arm_user_data1_t passed in arm_start */
  153. #define ARM_CorrPar_f    0x80    /*  Correlator from parent  */
  154. #define ARM_CorrReq_f    0x40    /*  Request correlator generation  */
  155. #define ARM_CorrGen_f    0x20    /*  New correlator generated in data  */
  156. #define ARM_TraceReq_f    0x10    /*  User trace request  */
  157.  
  158. /*  flags[1] in arm_user_data101_t passed in arm_get_id and */
  159. /*  flags[1] in arm_user_data1_t passed in arm_start, arm_update and arm_end */
  160. #define ARM_Metric1_f     0x80    /*  Metric 1 present  */
  161. #define ARM_Metric2_f     0x40    /*  Metric 2 present  */
  162. #define ARM_Metric3_f     0x20    /*  Metric 3 present  */
  163. #define ARM_Metric4_f     0x10    /*  Metric 4 present  */
  164. #define ARM_Metric5_f     0x08    /*  Metric 5 present  */
  165. #define ARM_Metric6_f     0x04    /*  Metric 6 present  */
  166. #define ARM_AllMetrics_f 0xfc    /*  Metrics 1 - 6 present  */
  167. #define ARM_String1_f     0x02    /*  String 1 present  */
  168.  
  169.  
  170. #if defined  _WIN32
  171.  #include <windows.h>
  172.  #define ARM_API WINAPI
  173. #elif defined __OS2__
  174.  #define ARM_API _Pascal
  175. #elif defined _OS216
  176.  #define  arm_data_t char _far
  177.  #define  arm_ptr_t  char _far
  178.  #define ARM_API _far _pascal
  179. #elif defined _WIN16 || _WINDOWS
  180.  #include <windows.h>
  181.  typedef BOOL (FAR PASCAL _export * FPSTRCB) (LPSTR, LPVOID);
  182.  #define  arm_data_t char FAR
  183.  #define  arm_ptr_t  char FAR
  184.  #define ARM_API WINAPI
  185. #else  /* unix */
  186. #define ARM_API
  187. #endif
  188.  
  189.  
  190. #ifdef __cplusplus
  191. extern "C" {
  192. #endif /* __cplusplus */
  193.  
  194. #ifdef _PROTOTYPES
  195.  
  196. /***    Function prototypes    ***/
  197.  
  198. extern int32 ARM_API arm_init(
  199.     char*      appl_name,    /* application name              */
  200.     char*      appl_user_id,    /* Name of the application user  */
  201.     int32      flags,        /* Reserved = 0                  */
  202.     char*      data,        /* Reserved = NULL               */
  203.     int32      data_size);    /* Reserved = 0                  */
  204.  
  205.  
  206. extern int32 ARM_API arm_getid(
  207.     int32      appl_id,        /* application handle            */
  208.     char*      tran_name,    /* transaction name              */
  209.     char*      tran_detail,    /* transaction additional info   */
  210.     int32      flags,        /* Reserved = 0                  */
  211.     char*      data,        /* format definition of user metrics */
  212.     int32      data_size);    /* length of data buffer         */
  213.  
  214.  
  215. extern int32 ARM_API arm_start(
  216.     int32      tran_id,        /* transaction name identifier   */
  217.     int32      flags,            /* Reserved = 0                  */
  218.     char*      data,             /* user metrics data             */
  219.     int32      data_size);       /* length of data buffer         */
  220.  
  221.  
  222. extern int32 ARM_API arm_update(
  223.     int32      start_handle,    /* unique transaction handle     */
  224.     int32      flags,        /* Reserved = 0                  */
  225.     char*      data,        /* user metrics data             */
  226.     int32      data_size);    /* length of data buffer         */
  227.  
  228.  
  229. extern int32 ARM_API arm_stop(
  230.     int32      start_handle,    /* unique transaction handle     */
  231.     int32      tran_status,    /* Good=0, Abort=1, Failed=2     */
  232.     int32      flags,        /* Reserved = 0                  */
  233.     char*      data,        /* user metrics data             */
  234.     int32      data_size);    /* length of data buffer         */
  235.  
  236.  
  237. extern int32 ARM_API arm_end(
  238.     int32      appl_id,        /* application id                */
  239.     int32      flags,        /* Reserved = 0                  */
  240.     char*      data,        /* Reserved = NULL               */
  241.     int32      data_size);    /* Reserved = 0                  */
  242.  
  243.  
  244. #else  /* _PROTOTYPES */
  245.  
  246. extern int32     ARM_API arm_init();
  247. extern int32     ARM_API arm_getid();
  248. extern int32     ARM_API arm_start();
  249. extern int32     ARM_API arm_update();
  250. extern int32     ARM_API arm_stop();
  251. extern int32     ARM_API arm_end();
  252.  
  253. #endif /* _PROTOTYPES */
  254.  
  255. #ifdef __cplusplus
  256. }
  257. #endif /* __cplusplus */
  258.  
  259.  
  260. /*  Type definitions for compatibility with version 1.0 of the ARM API */
  261.  
  262. typedef int32        arm_appl_id_t;
  263.  
  264. typedef int32        arm_tran_id_t;
  265.  
  266. typedef int32        arm_start_handle_t;
  267.  
  268. typedef unsigned32   arm_flag_t;
  269.  
  270. typedef char         arm_data_t;
  271.  
  272. typedef int32        arm_data_sz_t;
  273.  
  274. typedef char         arm_ptr_t;
  275.  
  276. typedef int32        arm_ret_stat_t;
  277.  
  278. typedef int32        arm_status_t;
  279.  
  280.  
  281. #endif /* ARM_H_INCLUDED */
  282.  
  283.  
  284.