httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject svn commit: r109477 - /httpd/mod_arm4/trunk/README /httpd/mod_arm4/trunk/arm4.h /httpd/mod_arm4/trunk/arm4dyn.h /httpd/mod_arm4/trunk/arm4os.h /httpd/mod_arm4/trunk/mod_arm4.c /httpd/mod_arm4/trunk/mod_arm4.dsp
Date Thu, 02 Dec 2004 08:38:44 GMT
Author: nd
Date: Thu Dec  2 00:34:11 2004
New Revision: 109477

URL: http://svn.apache.org/viewcvs?view=rev&rev=109477
Log:
svn:eol-style = native

Modified:
   httpd/mod_arm4/trunk/README   (contents, props changed)
   httpd/mod_arm4/trunk/arm4.h   (contents, props changed)
   httpd/mod_arm4/trunk/arm4dyn.h   (contents, props changed)
   httpd/mod_arm4/trunk/arm4os.h   (contents, props changed)
   httpd/mod_arm4/trunk/mod_arm4.c   (contents, props changed)
   httpd/mod_arm4/trunk/mod_arm4.dsp   (contents, props changed)

Modified: httpd/mod_arm4/trunk/README
Url: http://svn.apache.org/viewcvs/httpd/mod_arm4/trunk/README?view=diff&rev=109477&p1=httpd/mod_arm4/trunk/README&r1=109476&p2=httpd/mod_arm4/trunk/README&r2=109477
==============================================================================
--- httpd/mod_arm4/trunk/README	(original)
+++ httpd/mod_arm4/trunk/README	Thu Dec  2 00:34:11 2004
@@ -1,6 +1,6 @@
-** Use apxs to compile on Unix platforms **
-
-This works for me on Linux and AIX:
-  apxs -c mod_arm4.c
-  apxs -i -n mod_arm4 mod_arm4.la
-
+** Use apxs to compile on Unix platforms **
+
+This works for me on Linux and AIX:
+  apxs -c mod_arm4.c
+  apxs -i -n mod_arm4 mod_arm4.la
+

Modified: httpd/mod_arm4/trunk/arm4.h
Url: http://svn.apache.org/viewcvs/httpd/mod_arm4/trunk/arm4.h?view=diff&rev=109477&p1=httpd/mod_arm4/trunk/arm4.h&r1=109476&p2=httpd/mod_arm4/trunk/arm4.h&r2=109477
==============================================================================
--- httpd/mod_arm4/trunk/arm4.h	(original)
+++ httpd/mod_arm4/trunk/arm4.h	Thu Dec  2 00:34:11 2004
@@ -1,642 +1,642 @@
-/* ------------------------------------------------------------------------- */
-/*                                                                           */
-/* Copyright (c) 2003 The Open Group                                         */
-/*                                                                           */
-/* Permission is hereby granted, free of charge, to any person obtaining a   */
-/* copy of this software (the "Software"), to deal in the Software without   */
-/* restriction, including without limitation the rights to use, copy,        */
-/* modify, merge, publish, distribute, sublicense, and/or sell copies of     */
-/* the Software, and to permit persons to whom the Software is furnished     */
-/* to do so, subject to the following conditions:                            */
-/*                                                                           */
-/* The above copyright notice and this permission notice shall be included   */
-/* in all copies or substantial portions of the Software.                    */
-/*                                                                           */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   */
-/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    */
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY      */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */
-/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  */
-/* THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                */
-/*                                                                           */
-/* ------------------------------------------------------------------------- */
-/*                                                                           */
-/* File revision information                                                 */
-/*                                                                           */
-/* $Source: /tang_cvs/arm4/sdk4/c/include/arm4.h,v $    */
-/* $Revision: 1.2 $  */
-/* $Date: 2003/12/03 13:55:14 $      */
-/*                                                                           */
-/* --------------------------------------------------------------- */
-/* arm4.h - ARM4 standard header file                              */
-/*                                                                 */
-/* This header file defines all defines, typedefs, structures,     */
-/* and API functions visible for an application which uses an ARM  */
-/* agent. All compiler/platform specifics are handled in a         */
-/* separate header file named <arm4os.h>.                          */
-/*                                                                 */
-/* NOTE: The ARM4 C language binding differs completely from       */
-/* ARM1 and ARM2 bindings.                                         */
-/* --------------------------------------------------------------- */
-
-#ifndef ARM4_H_INCLUDED
-#define ARM4_H_INCLUDED
-
-#ifndef ARM4OS_H_INCLUDED
-#include "arm4os.h"
-#endif /* ARM4OS_H_INCLUDED */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* --------------------------------------------------------------- */
-/* ---------------------- defines section ------------------------ */
-/* --------------------------------------------------------------- */
-
-/* Boolean values */
-#define ARM_FALSE                               0
-#define ARM_TRUE                                1
-
-/* Transaction status */
-#define ARM_STATUS_GOOD                         0
-#define ARM_STATUS_ABORTED                      1
-#define ARM_STATUS_FAILED                       2
-#define ARM_STATUS_UNKNOWN                      3
-
-/* -------------- reserved error codes range --------------------- */
-
-#define ARM_ERROR_CODE_RESERVED_MIN        -20999
-#define ARM_ERROR_CODE_RESERVED_MAX        -20000
-
-/* --------------- known sub-buffer formats ---------------------- */
-
-#define ARM_SUBBUFFER_USER                      3
-#define ARM_SUBBUFFER_ARRIVAL_TIME              4
-#define ARM_SUBBUFFER_METRIC_VALUES             5
-#define ARM_SUBBUFFER_SYSTEM_ADDRESS            6
-#define ARM_SUBBUFFER_DIAG_DETAIL               7
-
-#define ARM_SUBBUFFER_APP_IDENTITY            102
-#define ARM_SUBBUFFER_APP_CONTEXT             103
-#define ARM_SUBBUFFER_TRAN_IDENTITY           104
-#define ARM_SUBBUFFER_TRAN_CONTEXT            105
-#define ARM_SUBBUFFER_METRIC_BINDINGS         106
-#define ARM_SUBBUFFER_CHARSET                 107
-
-/* -------------------- metric defines --------------------------- */
-
-#define ARM_METRIC_FORMAT_RESERVED              0
-#define ARM_METRIC_FORMAT_COUNTER32             1
-#define ARM_METRIC_FORMAT_COUNTER64             2
-#define ARM_METRIC_FORMAT_CNTRDIVR32            3
-#define ARM_METRIC_FORMAT_GAUGE32               4
-#define ARM_METRIC_FORMAT_GAUGE64               5
-#define ARM_METRIC_FORMAT_GAUGEDIVR32           6
-#define ARM_METRIC_FORMAT_NUMERICID32           7
-#define ARM_METRIC_FORMAT_NUMERICID64           8
-/* format 9 (string8) is deprecated */
-#define ARM_METRIC_FORMAT_STRING32             10
-
-#define ARM_METRIC_USE_GENERAL                  0
-#define ARM_METRIC_USE_TRAN_SIZE                1
-#define ARM_METRIC_USE_TRAN_STATUS              2
-
-#define ARM_METRIC_MIN_ARRAY_INDEX              0
-#define ARM_METRIC_MAX_ARRAY_INDEX              6
-#define ARM_METRIC_MAX_COUNT                    7
-
-#define ARM_METRIC_STRING32_MAX_CHARS          31
-#define ARM_METRIC_STRING32_MAX_LENGTH \
-    (ARM_METRIC_STRING32_MAX_CHARS*3+1)
-
-/* ------------------- misc string defines ----------------------- */
-
-#define ARM_NAME_MAX_CHARS                    127
-#define ARM_NAME_MAX_LENGTH (ARM_NAME_MAX_CHARS*3+1)
-
-#define ARM_DIAG_DETAIL_MAX_CHARS            4095
-#define ARM_DIAG_DETAIL_MAX_LENGTH (ARM_DIAG_DETAIL_MAX_CHARS*3+1)
-
-#define ARM_MSG_BUFFER_CHARS                  255
-#define ARM_MSG_BUFFER_LENGTH (ARM_MSG_BUFFER_CHARS*3+1)
-
-/* ------------------- properties defines ------------------------ */
-
-#define ARM_PROPERTY_MIN_ARRAY_INDEX            0
-#define ARM_PROPERTY_MAX_ARRAY_INDEX           19
-#define ARM_PROPERTY_MAX_COUNT                 20
-
-#define ARM_PROPERTY_NAME_MAX_CHARS (ARM_NAME_MAX_CHARS)
-#define ARM_PROPERTY_NAME_MAX_LENGTH \
-    (ARM_PROPERTY_NAME_MAX_CHARS*3+1)
-#define ARM_PROPERTY_VALUE_MAX_CHARS          255
-#define ARM_PROPERTY_VALUE_MAX_LENGTH \
-    (ARM_PROPERTY_VALUE_MAX_CHARS*3+1)
-
-#define ARM_PROPERTY_URI_MAX_CHARS           4095
-#define ARM_PROPERTY_URI_MAX_LENGTH (ARM_PROPERTY_URI_MAX_CHARS*3+1)
-
-/* -------------- system address format values ------------------- */
-
-#define ARM_SYSADDR_FORMAT_RESERVED             0
-#define ARM_SYSADDR_FORMAT_IPV4                 1
-#define ARM_SYSADDR_FORMAT_IPV4PORT             2
-#define ARM_SYSADDR_FORMAT_IPV6                 3
-#define ARM_SYSADDR_FORMAT_IPV6PORT             4
-#define ARM_SYSADDR_FORMAT_SNA                  5
-#define ARM_SYSADDR_FORMAT_X25                  6
-#define ARM_SYSADDR_FORMAT_HOSTNAME             7
-#define ARM_SYSADDR_FORMAT_UUID                 8
-
-/* ------------------ mandatory charsets ------------------------- */
-
-/* IANA charset MIBenum numbers (http://www.iana.org/) */
-#define ARM_CHARSET_ASCII                       3  /* mandatory */
-#define ARM_CHARSET_UTF8                      106  /* mandatory */
-#define ARM_CHARSET_UTF16BE                  1013
-#define ARM_CHARSET_UTF16LE                  1014
-    /* mandatory on Windows */
-#define ARM_CHARSET_UTF16                    1015
-#define ARM_CHARSET_IBM037                   2028
-    /* mandatory on iSeries */
-#define ARM_CHARSET_IBM1047                  2102
-    /* mandatory on zSeries */
-
-/* ------------- flags to be passed on API calls ----------------- */
-
-/* Use ARM_FLAG_NONE instead of zero to be more readable.          */
-#define ARM_FLAG_NONE                (0x00000000)
-
-/* ARM_FLAG_TRACE_REQUEST could be used in the following calls to  */
-/* request a trace:                                                */
-/*   - arm_generate_correlator()                                   */
-/*   - arm_start_transaction()                                     */
-/*   - arm_report_transaction()                                    */
-/* NOTE: The agent need not support instance tracing, so to be     */
-/* sure check the generated correlator using the                   */
-/* arm_get_correlator_flags() function.                            */
-#define ARM_FLAG_TRACE_REQUEST       (0x00000001)
-
-/* ARM_FLAG_BIND_THREAD could be used on arm_start_transaction()   */
-/* call to do an implicit arm_bind_thread().                       */
-#define ARM_FLAG_BIND_THREAD         (0x00000002)
-
-/* ARM_FLAG_CORR_IN_PROCESS indicates that a correlator will only  */
-/* be used within the process it was created. So an ARM            */
-/* implementation may optimize the generation of a correlator      */
-/* for that special usage. This flag can be passed to:             */
-/*   - arm_generate_correlator()                                   */
-/*   - arm_start_transaction()                                     */
-/* NOTE: The agent need not support in-process correlation at all. */
-#define ARM_FLAG_CORR_IN_PROCESS     (0x00000004)
-
-/* --------------- correlator defines ---------------------------- */
-
-#define ARM_CORR_MAX_LENGTH                   512
-    /* total max length */
-
-/* Correlator interface flag numbers. See                          */
-/* arm_get_correlator_flags().                                     */
-#define ARM_CORR_FLAGNUM_APP_TRACE              1
-#define ARM_CORR_FLAGNUM_AGENT_TRACE            2
-
-
-/* Use if no correlator should be provided (e.g., in               */
-/* arm_start_transaction().                                        */
-#define ARM_CORR_NONE ((arm_correlator_t *) NULL)
-
-/* --- current time for arm_report_transaction() stop time ------- */
-
-#define ARM_USE_CURRENT_TIME ((arm_stop_time_t)-1)
-
-/* ------------------ misc defines ------------------------------- */
-
-/* Use ARM_BUF4_NONE instead of a NULL to be more readable.        */
-#define ARM_BUF4_NONE ((arm_buffer4_t*) NULL)
-
-/* Use ARM_ID_NONE instead of a NULL to be more readable.          */
-#define ARM_ID_NONE ((arm_id_t *) NULL)
-
-/* --------------------------------------------------------------- */
-/* --------------- basic typedef section ------------------------- */
-/* --------------------------------------------------------------- */
-
-/* Generic data types */
-/* ARM4_*INT* defines are set in the <arm4os.h> header file.       */
-/* They are platform/compiler-specific.                            */
-typedef ARM4_CHAR arm_char_t;
-
-typedef ARM4_INT8 arm_int8_t;
-typedef ARM4_UINT8 arm_uint8_t;
-    /* used to define an opaque byte array */
-
-typedef ARM4_INT16 arm_int16_t;
-typedef ARM4_UINT16 arm_uint16_t;
-
-typedef ARM4_INT32 arm_int32_t;
-typedef ARM4_UINT32 arm_uint32_t;
-
-typedef ARM4_INT64 arm_int64_t;
-typedef ARM4_UINT64 arm_uint64_t;
-
-/* ARM-specific simple types */
-typedef arm_int32_t arm_boolean_t;
-typedef arm_int32_t arm_error_t;
-
-typedef arm_int64_t arm_arrival_time_t;  /* opaque arrival time */
-typedef arm_int64_t arm_stop_time_t;  /* stop time in milli secs */
-typedef arm_int64_t arm_response_time_t;
-    /* response time in nano secs */
-
-typedef arm_int32_t arm_tran_status_t;  /* ARM_TRAN_STATUS_* values */
-typedef arm_int32_t arm_charset_t;  /* IANA MIBenum values */
-typedef arm_int32_t arm_sysaddr_format_t;  /* ARM_SYSADDR_* values */
-
-/* ARM string buffer types */
-typedef arm_char_t arm_message_buffer_t[ARM_MSG_BUFFER_LENGTH];
-
-/* subbuffer types */
-typedef arm_int32_t arm_subbuffer_format_t;
-
-/* metric types */
-typedef arm_uint8_t arm_metric_format_t;
-typedef arm_uint8_t arm_metric_slot_t;
-typedef arm_int16_t arm_metric_usage_t;
-
-/* handle types */
-typedef arm_int64_t arm_app_start_handle_t;
-typedef arm_int64_t arm_tran_start_handle_t;
-typedef arm_int64_t arm_tran_block_handle_t;
-
-/* correlator types */
-typedef arm_int16_t arm_correlator_length_t;
-
-/* --------------------------------------------------------------- */
-/* ---------------- compound typedefs section -------------------- */
-/* --------------------------------------------------------------- */
-
-/* All IDs are 16 bytes on an 8-byte boundary. */
-typedef struct arm_id
-{
-    union
-    {
-        arm_uint8_t  uint8[16];
-        arm_uint32_t uint32[4];
-        arm_uint64_t uint64[2];
-    } id_u;
-} arm_id_t;
-
-/* Correlator */
-typedef struct arm_correlator
-{
-    arm_uint8_t opaque[ARM_CORR_MAX_LENGTH];
-} arm_correlator_t;
-
-/* User-defined metrics */
-typedef arm_int32_t arm_metric_counter32_t;
-typedef arm_int64_t arm_metric_counter64_t;
-typedef arm_int32_t arm_metric_divisor32_t;
-typedef arm_int32_t arm_metric_gauge32_t;
-typedef arm_int64_t arm_metric_gauge64_t;
-typedef arm_int32_t arm_metric_numericID32_t;
-typedef arm_int64_t arm_metric_numericID64_t;
-typedef const arm_char_t *arm_metric_string32_t;
-typedef struct arm_metric_cntrdivr32
-{
-    arm_metric_counter32_t counter;
-    arm_metric_divisor32_t divisor;
-} arm_metric_cntrdivr32_t;
-typedef struct arm_metric_gaugedivr32
-{
-    arm_metric_gauge32_t gauge;
-    arm_metric_divisor32_t divisor;
-} arm_metric_gaugedivr32_t;
-
-typedef struct arm_metric
-{
-    arm_metric_slot_t slot;
-    arm_metric_format_t format;
-    arm_metric_usage_t usage;
-    arm_boolean_t valid;
-    union
-    {
-        arm_metric_counter32_t counter32;
-        arm_metric_counter64_t counter64;
-        arm_metric_cntrdivr32_t counterdivisor32;
-        arm_metric_gauge32_t gauge32;
-        arm_metric_gauge64_t gauge64;
-        arm_metric_gaugedivr32_t gaugedivisor32;
-        arm_metric_numericID32_t numericid32;
-        arm_metric_numericID64_t numericid64;
-        arm_metric_string32_t string32;
-    } metric_u;
-} arm_metric_t;
-
-typedef struct arm_metric_binding
-{
-    arm_metric_slot_t slot;
-    arm_id_t id;
-} arm_metric_binding_t;
-
-typedef struct arm_property
-{
-    const arm_char_t *name;
-    const arm_char_t *value;
-} arm_property_t;
-
-/* ------------------------------------------------------------- */
-/* -------------- sub-buffer typedefs section ------------------ */
-/* ------------------------------------------------------------- */
-
-typedef struct arm_subbuffer {
-    arm_subbuffer_format_t format;
-    /* Format-specific data fields follow here. */
-} arm_subbuffer_t;
-
-/* This macro could be used avoid a compiler warning if you      */
-/* direct one of the following arm_subbuffer_*_t structure       */
-/* pointers to a function accepting sub-buffer pointers. Any     */
-/* sub-buffer is passed to the ARM API call as a                 */
-/* (arm_subbuffer_t *) pointer. Use this macro if you pass a     */
-/* "real" subbuffer to an API function. Note for the special     */
-/* ARM SDK subbuffers the ARM_SDKSB() macro has to be used.      */
-#define ARM_SB(x)  (&((x).header))
-
-/* The user data buffer */
-typedef struct arm_buffer4
-{
-    arm_int32_t count;
-    arm_subbuffer_t **subbuffer_array;
-} arm_buffer4_t;
-
-typedef struct arm_subbuffer_charset
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_CHARSET */
-
-    arm_charset_t charset;  /* One of the IANA MIBenum values */
-    arm_int32_t flags;
-} arm_subbuffer_charset_t;
-
-typedef struct arm_subbuffer_app_identity
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_APP_IDENTITY */
-
-    arm_int32_t identity_property_count;
-    const arm_property_t *identity_property_array;
-    arm_int32_t context_name_count;
-    const arm_char_t **context_name_array;
-} arm_subbuffer_app_identity_t;
-
-typedef struct arm_subbuffer_app_context
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_APP_CONTEXT */
-
-    arm_int32_t context_value_count;
-    const arm_char_t **context_value_array;
-} arm_subbuffer_app_context_t;
-
-typedef struct arm_subbuffer_tran_identity
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_TRAN_IDENTITY */
-
-    arm_int32_t identity_property_count;
-    const arm_property_t *identity_property_array;
-    arm_int32_t context_name_count;
-    const arm_char_t **context_name_array;
-    const arm_char_t *uri;
-} arm_subbuffer_tran_identity_t;
-
-typedef struct arm_subbuffer_tran_context
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_TRAN_CONTEXT */
-
-    arm_int32_t context_value_count;
-    const arm_char_t **context_value_array;
-    const arm_char_t *uri;
-} arm_subbuffer_tran_context_t;
-
-typedef struct arm_subbuffer_arrival_time
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_ARRIVAL_TIME */
-
-    arm_arrival_time_t opaque_time;
-} arm_subbuffer_arrival_time_t;
-
-typedef struct arm_subbuffer_metric_bindings
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_METRIC_BINDINGS */
-
-    arm_int32_t count;
-    const arm_metric_binding_t *metric_binding_array;
-} arm_subbuffer_metric_bindings_t;
-
-typedef struct arm_subbuffer_metric_values
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_METRIC_VALUES */
-
-    arm_int32_t count;
-    const arm_metric_t *metric_value_array;
-} arm_subbuffer_metric_values_t;
-
-typedef struct arm_subbuffer_user
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_USER */
-
-    const arm_char_t *name;
-    arm_boolean_t id_valid;
-    arm_id_t id;
-} arm_subbuffer_user_t;
-
-typedef struct arm_subbuffer_system_address
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_SYSTEM_ADDRESS */
-
-    arm_int16_t address_format;
-    arm_int16_t address_length;
-    const arm_uint8_t *address;
-    arm_boolean_t id_valid;
-    arm_id_t id;
-} arm_subbuffer_system_address_t;
-
-typedef struct arm_subbuffer_diag_detail
-{
-    arm_subbuffer_t header;  /* ARM_SUBBUFFER_DIAG_DETAIL */
-
-    const arm_char_t *diag_detail;
-} arm_subbuffer_diag_detail_t;
-
-/* --------------------------------------------------------------- */
-/* ------------------ ARM4 API section --------------------------- */
-/* --------------------------------------------------------------- */
-
-/* register metadata API functions */
-ARM4_API_DYNAMIC(arm_error_t)
-arm_register_application(
-    const arm_char_t *app_name,
-    const arm_id_t *input_app_id,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4,
-    arm_id_t *output_app_id);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_destroy_application(
-    const arm_id_t *app_id,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_register_transaction(
-    const arm_id_t *app_id,
-    const arm_char_t *tran_name,
-    const arm_id_t *input_tran_id,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4,
-    arm_id_t *output_tran_id);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_register_metric(
-    const arm_id_t *app_id,
-    const arm_char_t *metric_name,
-    const arm_metric_format_t metric_format,
-    const arm_metric_usage_t metric_usage,
-    const arm_char_t *metric_unit,
-    const arm_id_t *input_metric_id,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4,
-    arm_id_t *output_metric_id);
-
-/* application instance API functions */
-ARM4_API_DYNAMIC(arm_error_t)
-arm_start_application(
-    const arm_id_t *app_id,
-    const arm_char_t *app_group,
-    const arm_char_t *app_instance,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4,
-    arm_app_start_handle_t *app_handle);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_stop_application(
-    const arm_app_start_handle_t app_handle,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-/* transaction instance API functions */
-ARM4_API_DYNAMIC(arm_error_t)
-arm_start_transaction(
-    const arm_app_start_handle_t app_handle,
-    const arm_id_t *tran_id,
-    const arm_correlator_t *parent_correlator,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4,
-    arm_tran_start_handle_t *tran_handle,
-    arm_correlator_t *current_correlator);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_stop_transaction(
-    const arm_tran_start_handle_t tran_handle,
-    const arm_tran_status_t tran_status,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_update_transaction(
-    const arm_tran_start_handle_t tran_handle,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_discard_transaction(
-    const arm_tran_start_handle_t tran_handle,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_block_transaction(
-    const arm_tran_start_handle_t tran_handle,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4,
-    arm_tran_block_handle_t *block_handle);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_unblock_transaction(
-    const arm_tran_start_handle_t tran_handle,
-    const arm_tran_block_handle_t block_handle,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-/* thread support API functions */
-ARM4_API_DYNAMIC(arm_error_t)
-arm_bind_thread(
-    const arm_tran_start_handle_t tran_handle,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_unbind_thread(
-    const arm_tran_start_handle_t tran_handle,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-/* report transaction data API function */
-ARM4_API_DYNAMIC(arm_error_t)
-arm_report_transaction(
-    const arm_app_start_handle_t app_handle,
-    const arm_id_t *tran_id,
-    const arm_tran_status_t tran_status,
-    const arm_response_time_t response_time,
-    const arm_stop_time_t stop_time,
-    const arm_correlator_t *parent_correlator,
-    const arm_correlator_t *current_correlator,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4);
-
-/* correlator API functions */
-ARM4_API_DYNAMIC(arm_error_t)
-arm_generate_correlator(
-    const arm_app_start_handle_t app_handle,
-    const arm_id_t *tran_id,
-    const arm_correlator_t *parent_correlator,
-    const arm_int32_t flags,
-    const arm_buffer4_t *buffer4,
-    arm_correlator_t *current_correlator);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_get_correlator_length(
-    const arm_correlator_t *correlator,
-    arm_correlator_length_t *length);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_get_correlator_flags(
-    const arm_correlator_t *correlator,
-    const arm_int32_t corr_flag_num,
-    arm_boolean_t *flag);
-
-/* miscellaneous API functions */
-ARM4_API_DYNAMIC(arm_error_t)
-arm_get_arrival_time(
-    arm_arrival_time_t *opaque_time);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_get_error_message(
-    const arm_charset_t charset,
-    const arm_error_t code, 
-    arm_message_buffer_t msg);
-
-ARM4_API_DYNAMIC(arm_error_t)
-arm_is_charset_supported(
-    const arm_charset_t charset,
-    arm_boolean_t *supported);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#ifndef ARM4DYN_H_INCLUDED
-#include "arm4dyn.h"
-#endif /* !ARM4DYN_H_INCLUDED */
-
-#endif /* ARM4_H_INCLUDED */
-
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/* Copyright (c) 2003 The Open Group                                         */
+/*                                                                           */
+/* Permission is hereby granted, free of charge, to any person obtaining a   */
+/* copy of this software (the "Software"), to deal in the Software without   */
+/* restriction, including without limitation the rights to use, copy,        */
+/* modify, merge, publish, distribute, sublicense, and/or sell copies of     */
+/* the Software, and to permit persons to whom the Software is furnished     */
+/* to do so, subject to the following conditions:                            */
+/*                                                                           */
+/* The above copyright notice and this permission notice shall be included   */
+/* in all copies or substantial portions of the Software.                    */
+/*                                                                           */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   */
+/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY      */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */
+/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  */
+/* THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/* File revision information                                                 */
+/*                                                                           */
+/* $Source: /tang_cvs/arm4/sdk4/c/include/arm4.h,v $    */
+/* $Revision: 1.2 $  */
+/* $Date: 2003/12/03 13:55:14 $      */
+/*                                                                           */
+/* --------------------------------------------------------------- */
+/* arm4.h - ARM4 standard header file                              */
+/*                                                                 */
+/* This header file defines all defines, typedefs, structures,     */
+/* and API functions visible for an application which uses an ARM  */
+/* agent. All compiler/platform specifics are handled in a         */
+/* separate header file named <arm4os.h>.                          */
+/*                                                                 */
+/* NOTE: The ARM4 C language binding differs completely from       */
+/* ARM1 and ARM2 bindings.                                         */
+/* --------------------------------------------------------------- */
+
+#ifndef ARM4_H_INCLUDED
+#define ARM4_H_INCLUDED
+
+#ifndef ARM4OS_H_INCLUDED
+#include "arm4os.h"
+#endif /* ARM4OS_H_INCLUDED */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* --------------------------------------------------------------- */
+/* ---------------------- defines section ------------------------ */
+/* --------------------------------------------------------------- */
+
+/* Boolean values */
+#define ARM_FALSE                               0
+#define ARM_TRUE                                1
+
+/* Transaction status */
+#define ARM_STATUS_GOOD                         0
+#define ARM_STATUS_ABORTED                      1
+#define ARM_STATUS_FAILED                       2
+#define ARM_STATUS_UNKNOWN                      3
+
+/* -------------- reserved error codes range --------------------- */
+
+#define ARM_ERROR_CODE_RESERVED_MIN        -20999
+#define ARM_ERROR_CODE_RESERVED_MAX        -20000
+
+/* --------------- known sub-buffer formats ---------------------- */
+
+#define ARM_SUBBUFFER_USER                      3
+#define ARM_SUBBUFFER_ARRIVAL_TIME              4
+#define ARM_SUBBUFFER_METRIC_VALUES             5
+#define ARM_SUBBUFFER_SYSTEM_ADDRESS            6
+#define ARM_SUBBUFFER_DIAG_DETAIL               7
+
+#define ARM_SUBBUFFER_APP_IDENTITY            102
+#define ARM_SUBBUFFER_APP_CONTEXT             103
+#define ARM_SUBBUFFER_TRAN_IDENTITY           104
+#define ARM_SUBBUFFER_TRAN_CONTEXT            105
+#define ARM_SUBBUFFER_METRIC_BINDINGS         106
+#define ARM_SUBBUFFER_CHARSET                 107
+
+/* -------------------- metric defines --------------------------- */
+
+#define ARM_METRIC_FORMAT_RESERVED              0
+#define ARM_METRIC_FORMAT_COUNTER32             1
+#define ARM_METRIC_FORMAT_COUNTER64             2
+#define ARM_METRIC_FORMAT_CNTRDIVR32            3
+#define ARM_METRIC_FORMAT_GAUGE32               4
+#define ARM_METRIC_FORMAT_GAUGE64               5
+#define ARM_METRIC_FORMAT_GAUGEDIVR32           6
+#define ARM_METRIC_FORMAT_NUMERICID32           7
+#define ARM_METRIC_FORMAT_NUMERICID64           8
+/* format 9 (string8) is deprecated */
+#define ARM_METRIC_FORMAT_STRING32             10
+
+#define ARM_METRIC_USE_GENERAL                  0
+#define ARM_METRIC_USE_TRAN_SIZE                1
+#define ARM_METRIC_USE_TRAN_STATUS              2
+
+#define ARM_METRIC_MIN_ARRAY_INDEX              0
+#define ARM_METRIC_MAX_ARRAY_INDEX              6
+#define ARM_METRIC_MAX_COUNT                    7
+
+#define ARM_METRIC_STRING32_MAX_CHARS          31
+#define ARM_METRIC_STRING32_MAX_LENGTH \
+    (ARM_METRIC_STRING32_MAX_CHARS*3+1)
+
+/* ------------------- misc string defines ----------------------- */
+
+#define ARM_NAME_MAX_CHARS                    127
+#define ARM_NAME_MAX_LENGTH (ARM_NAME_MAX_CHARS*3+1)
+
+#define ARM_DIAG_DETAIL_MAX_CHARS            4095
+#define ARM_DIAG_DETAIL_MAX_LENGTH (ARM_DIAG_DETAIL_MAX_CHARS*3+1)
+
+#define ARM_MSG_BUFFER_CHARS                  255
+#define ARM_MSG_BUFFER_LENGTH (ARM_MSG_BUFFER_CHARS*3+1)
+
+/* ------------------- properties defines ------------------------ */
+
+#define ARM_PROPERTY_MIN_ARRAY_INDEX            0
+#define ARM_PROPERTY_MAX_ARRAY_INDEX           19
+#define ARM_PROPERTY_MAX_COUNT                 20
+
+#define ARM_PROPERTY_NAME_MAX_CHARS (ARM_NAME_MAX_CHARS)
+#define ARM_PROPERTY_NAME_MAX_LENGTH \
+    (ARM_PROPERTY_NAME_MAX_CHARS*3+1)
+#define ARM_PROPERTY_VALUE_MAX_CHARS          255
+#define ARM_PROPERTY_VALUE_MAX_LENGTH \
+    (ARM_PROPERTY_VALUE_MAX_CHARS*3+1)
+
+#define ARM_PROPERTY_URI_MAX_CHARS           4095
+#define ARM_PROPERTY_URI_MAX_LENGTH (ARM_PROPERTY_URI_MAX_CHARS*3+1)
+
+/* -------------- system address format values ------------------- */
+
+#define ARM_SYSADDR_FORMAT_RESERVED             0
+#define ARM_SYSADDR_FORMAT_IPV4                 1
+#define ARM_SYSADDR_FORMAT_IPV4PORT             2
+#define ARM_SYSADDR_FORMAT_IPV6                 3
+#define ARM_SYSADDR_FORMAT_IPV6PORT             4
+#define ARM_SYSADDR_FORMAT_SNA                  5
+#define ARM_SYSADDR_FORMAT_X25                  6
+#define ARM_SYSADDR_FORMAT_HOSTNAME             7
+#define ARM_SYSADDR_FORMAT_UUID                 8
+
+/* ------------------ mandatory charsets ------------------------- */
+
+/* IANA charset MIBenum numbers (http://www.iana.org/) */
+#define ARM_CHARSET_ASCII                       3  /* mandatory */
+#define ARM_CHARSET_UTF8                      106  /* mandatory */
+#define ARM_CHARSET_UTF16BE                  1013
+#define ARM_CHARSET_UTF16LE                  1014
+    /* mandatory on Windows */
+#define ARM_CHARSET_UTF16                    1015
+#define ARM_CHARSET_IBM037                   2028
+    /* mandatory on iSeries */
+#define ARM_CHARSET_IBM1047                  2102
+    /* mandatory on zSeries */
+
+/* ------------- flags to be passed on API calls ----------------- */
+
+/* Use ARM_FLAG_NONE instead of zero to be more readable.          */
+#define ARM_FLAG_NONE                (0x00000000)
+
+/* ARM_FLAG_TRACE_REQUEST could be used in the following calls to  */
+/* request a trace:                                                */
+/*   - arm_generate_correlator()                                   */
+/*   - arm_start_transaction()                                     */
+/*   - arm_report_transaction()                                    */
+/* NOTE: The agent need not support instance tracing, so to be     */
+/* sure check the generated correlator using the                   */
+/* arm_get_correlator_flags() function.                            */
+#define ARM_FLAG_TRACE_REQUEST       (0x00000001)
+
+/* ARM_FLAG_BIND_THREAD could be used on arm_start_transaction()   */
+/* call to do an implicit arm_bind_thread().                       */
+#define ARM_FLAG_BIND_THREAD         (0x00000002)
+
+/* ARM_FLAG_CORR_IN_PROCESS indicates that a correlator will only  */
+/* be used within the process it was created. So an ARM            */
+/* implementation may optimize the generation of a correlator      */
+/* for that special usage. This flag can be passed to:             */
+/*   - arm_generate_correlator()                                   */
+/*   - arm_start_transaction()                                     */
+/* NOTE: The agent need not support in-process correlation at all. */
+#define ARM_FLAG_CORR_IN_PROCESS     (0x00000004)
+
+/* --------------- correlator defines ---------------------------- */
+
+#define ARM_CORR_MAX_LENGTH                   512
+    /* total max length */
+
+/* Correlator interface flag numbers. See                          */
+/* arm_get_correlator_flags().                                     */
+#define ARM_CORR_FLAGNUM_APP_TRACE              1
+#define ARM_CORR_FLAGNUM_AGENT_TRACE            2
+
+
+/* Use if no correlator should be provided (e.g., in               */
+/* arm_start_transaction().                                        */
+#define ARM_CORR_NONE ((arm_correlator_t *) NULL)
+
+/* --- current time for arm_report_transaction() stop time ------- */
+
+#define ARM_USE_CURRENT_TIME ((arm_stop_time_t)-1)
+
+/* ------------------ misc defines ------------------------------- */
+
+/* Use ARM_BUF4_NONE instead of a NULL to be more readable.        */
+#define ARM_BUF4_NONE ((arm_buffer4_t*) NULL)
+
+/* Use ARM_ID_NONE instead of a NULL to be more readable.          */
+#define ARM_ID_NONE ((arm_id_t *) NULL)
+
+/* --------------------------------------------------------------- */
+/* --------------- basic typedef section ------------------------- */
+/* --------------------------------------------------------------- */
+
+/* Generic data types */
+/* ARM4_*INT* defines are set in the <arm4os.h> header file.       */
+/* They are platform/compiler-specific.                            */
+typedef ARM4_CHAR arm_char_t;
+
+typedef ARM4_INT8 arm_int8_t;
+typedef ARM4_UINT8 arm_uint8_t;
+    /* used to define an opaque byte array */
+
+typedef ARM4_INT16 arm_int16_t;
+typedef ARM4_UINT16 arm_uint16_t;
+
+typedef ARM4_INT32 arm_int32_t;
+typedef ARM4_UINT32 arm_uint32_t;
+
+typedef ARM4_INT64 arm_int64_t;
+typedef ARM4_UINT64 arm_uint64_t;
+
+/* ARM-specific simple types */
+typedef arm_int32_t arm_boolean_t;
+typedef arm_int32_t arm_error_t;
+
+typedef arm_int64_t arm_arrival_time_t;  /* opaque arrival time */
+typedef arm_int64_t arm_stop_time_t;  /* stop time in milli secs */
+typedef arm_int64_t arm_response_time_t;
+    /* response time in nano secs */
+
+typedef arm_int32_t arm_tran_status_t;  /* ARM_TRAN_STATUS_* values */
+typedef arm_int32_t arm_charset_t;  /* IANA MIBenum values */
+typedef arm_int32_t arm_sysaddr_format_t;  /* ARM_SYSADDR_* values */
+
+/* ARM string buffer types */
+typedef arm_char_t arm_message_buffer_t[ARM_MSG_BUFFER_LENGTH];
+
+/* subbuffer types */
+typedef arm_int32_t arm_subbuffer_format_t;
+
+/* metric types */
+typedef arm_uint8_t arm_metric_format_t;
+typedef arm_uint8_t arm_metric_slot_t;
+typedef arm_int16_t arm_metric_usage_t;
+
+/* handle types */
+typedef arm_int64_t arm_app_start_handle_t;
+typedef arm_int64_t arm_tran_start_handle_t;
+typedef arm_int64_t arm_tran_block_handle_t;
+
+/* correlator types */
+typedef arm_int16_t arm_correlator_length_t;
+
+/* --------------------------------------------------------------- */
+/* ---------------- compound typedefs section -------------------- */
+/* --------------------------------------------------------------- */
+
+/* All IDs are 16 bytes on an 8-byte boundary. */
+typedef struct arm_id
+{
+    union
+    {
+        arm_uint8_t  uint8[16];
+        arm_uint32_t uint32[4];
+        arm_uint64_t uint64[2];
+    } id_u;
+} arm_id_t;
+
+/* Correlator */
+typedef struct arm_correlator
+{
+    arm_uint8_t opaque[ARM_CORR_MAX_LENGTH];
+} arm_correlator_t;
+
+/* User-defined metrics */
+typedef arm_int32_t arm_metric_counter32_t;
+typedef arm_int64_t arm_metric_counter64_t;
+typedef arm_int32_t arm_metric_divisor32_t;
+typedef arm_int32_t arm_metric_gauge32_t;
+typedef arm_int64_t arm_metric_gauge64_t;
+typedef arm_int32_t arm_metric_numericID32_t;
+typedef arm_int64_t arm_metric_numericID64_t;
+typedef const arm_char_t *arm_metric_string32_t;
+typedef struct arm_metric_cntrdivr32
+{
+    arm_metric_counter32_t counter;
+    arm_metric_divisor32_t divisor;
+} arm_metric_cntrdivr32_t;
+typedef struct arm_metric_gaugedivr32
+{
+    arm_metric_gauge32_t gauge;
+    arm_metric_divisor32_t divisor;
+} arm_metric_gaugedivr32_t;
+
+typedef struct arm_metric
+{
+    arm_metric_slot_t slot;
+    arm_metric_format_t format;
+    arm_metric_usage_t usage;
+    arm_boolean_t valid;
+    union
+    {
+        arm_metric_counter32_t counter32;
+        arm_metric_counter64_t counter64;
+        arm_metric_cntrdivr32_t counterdivisor32;
+        arm_metric_gauge32_t gauge32;
+        arm_metric_gauge64_t gauge64;
+        arm_metric_gaugedivr32_t gaugedivisor32;
+        arm_metric_numericID32_t numericid32;
+        arm_metric_numericID64_t numericid64;
+        arm_metric_string32_t string32;
+    } metric_u;
+} arm_metric_t;
+
+typedef struct arm_metric_binding
+{
+    arm_metric_slot_t slot;
+    arm_id_t id;
+} arm_metric_binding_t;
+
+typedef struct arm_property
+{
+    const arm_char_t *name;
+    const arm_char_t *value;
+} arm_property_t;
+
+/* ------------------------------------------------------------- */
+/* -------------- sub-buffer typedefs section ------------------ */
+/* ------------------------------------------------------------- */
+
+typedef struct arm_subbuffer {
+    arm_subbuffer_format_t format;
+    /* Format-specific data fields follow here. */
+} arm_subbuffer_t;
+
+/* This macro could be used avoid a compiler warning if you      */
+/* direct one of the following arm_subbuffer_*_t structure       */
+/* pointers to a function accepting sub-buffer pointers. Any     */
+/* sub-buffer is passed to the ARM API call as a                 */
+/* (arm_subbuffer_t *) pointer. Use this macro if you pass a     */
+/* "real" subbuffer to an API function. Note for the special     */
+/* ARM SDK subbuffers the ARM_SDKSB() macro has to be used.      */
+#define ARM_SB(x)  (&((x).header))
+
+/* The user data buffer */
+typedef struct arm_buffer4
+{
+    arm_int32_t count;
+    arm_subbuffer_t **subbuffer_array;
+} arm_buffer4_t;
+
+typedef struct arm_subbuffer_charset
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_CHARSET */
+
+    arm_charset_t charset;  /* One of the IANA MIBenum values */
+    arm_int32_t flags;
+} arm_subbuffer_charset_t;
+
+typedef struct arm_subbuffer_app_identity
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_APP_IDENTITY */
+
+    arm_int32_t identity_property_count;
+    const arm_property_t *identity_property_array;
+    arm_int32_t context_name_count;
+    const arm_char_t **context_name_array;
+} arm_subbuffer_app_identity_t;
+
+typedef struct arm_subbuffer_app_context
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_APP_CONTEXT */
+
+    arm_int32_t context_value_count;
+    const arm_char_t **context_value_array;
+} arm_subbuffer_app_context_t;
+
+typedef struct arm_subbuffer_tran_identity
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_TRAN_IDENTITY */
+
+    arm_int32_t identity_property_count;
+    const arm_property_t *identity_property_array;
+    arm_int32_t context_name_count;
+    const arm_char_t **context_name_array;
+    const arm_char_t *uri;
+} arm_subbuffer_tran_identity_t;
+
+typedef struct arm_subbuffer_tran_context
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_TRAN_CONTEXT */
+
+    arm_int32_t context_value_count;
+    const arm_char_t **context_value_array;
+    const arm_char_t *uri;
+} arm_subbuffer_tran_context_t;
+
+typedef struct arm_subbuffer_arrival_time
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_ARRIVAL_TIME */
+
+    arm_arrival_time_t opaque_time;
+} arm_subbuffer_arrival_time_t;
+
+typedef struct arm_subbuffer_metric_bindings
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_METRIC_BINDINGS */
+
+    arm_int32_t count;
+    const arm_metric_binding_t *metric_binding_array;
+} arm_subbuffer_metric_bindings_t;
+
+typedef struct arm_subbuffer_metric_values
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_METRIC_VALUES */
+
+    arm_int32_t count;
+    const arm_metric_t *metric_value_array;
+} arm_subbuffer_metric_values_t;
+
+typedef struct arm_subbuffer_user
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_USER */
+
+    const arm_char_t *name;
+    arm_boolean_t id_valid;
+    arm_id_t id;
+} arm_subbuffer_user_t;
+
+typedef struct arm_subbuffer_system_address
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_SYSTEM_ADDRESS */
+
+    arm_int16_t address_format;
+    arm_int16_t address_length;
+    const arm_uint8_t *address;
+    arm_boolean_t id_valid;
+    arm_id_t id;
+} arm_subbuffer_system_address_t;
+
+typedef struct arm_subbuffer_diag_detail
+{
+    arm_subbuffer_t header;  /* ARM_SUBBUFFER_DIAG_DETAIL */
+
+    const arm_char_t *diag_detail;
+} arm_subbuffer_diag_detail_t;
+
+/* --------------------------------------------------------------- */
+/* ------------------ ARM4 API section --------------------------- */
+/* --------------------------------------------------------------- */
+
+/* register metadata API functions */
+ARM4_API_DYNAMIC(arm_error_t)
+arm_register_application(
+    const arm_char_t *app_name,
+    const arm_id_t *input_app_id,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4,
+    arm_id_t *output_app_id);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_destroy_application(
+    const arm_id_t *app_id,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_register_transaction(
+    const arm_id_t *app_id,
+    const arm_char_t *tran_name,
+    const arm_id_t *input_tran_id,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4,
+    arm_id_t *output_tran_id);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_register_metric(
+    const arm_id_t *app_id,
+    const arm_char_t *metric_name,
+    const arm_metric_format_t metric_format,
+    const arm_metric_usage_t metric_usage,
+    const arm_char_t *metric_unit,
+    const arm_id_t *input_metric_id,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4,
+    arm_id_t *output_metric_id);
+
+/* application instance API functions */
+ARM4_API_DYNAMIC(arm_error_t)
+arm_start_application(
+    const arm_id_t *app_id,
+    const arm_char_t *app_group,
+    const arm_char_t *app_instance,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4,
+    arm_app_start_handle_t *app_handle);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_stop_application(
+    const arm_app_start_handle_t app_handle,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+/* transaction instance API functions */
+ARM4_API_DYNAMIC(arm_error_t)
+arm_start_transaction(
+    const arm_app_start_handle_t app_handle,
+    const arm_id_t *tran_id,
+    const arm_correlator_t *parent_correlator,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4,
+    arm_tran_start_handle_t *tran_handle,
+    arm_correlator_t *current_correlator);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_stop_transaction(
+    const arm_tran_start_handle_t tran_handle,
+    const arm_tran_status_t tran_status,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_update_transaction(
+    const arm_tran_start_handle_t tran_handle,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_discard_transaction(
+    const arm_tran_start_handle_t tran_handle,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_block_transaction(
+    const arm_tran_start_handle_t tran_handle,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4,
+    arm_tran_block_handle_t *block_handle);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_unblock_transaction(
+    const arm_tran_start_handle_t tran_handle,
+    const arm_tran_block_handle_t block_handle,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+/* thread support API functions */
+ARM4_API_DYNAMIC(arm_error_t)
+arm_bind_thread(
+    const arm_tran_start_handle_t tran_handle,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_unbind_thread(
+    const arm_tran_start_handle_t tran_handle,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+/* report transaction data API function */
+ARM4_API_DYNAMIC(arm_error_t)
+arm_report_transaction(
+    const arm_app_start_handle_t app_handle,
+    const arm_id_t *tran_id,
+    const arm_tran_status_t tran_status,
+    const arm_response_time_t response_time,
+    const arm_stop_time_t stop_time,
+    const arm_correlator_t *parent_correlator,
+    const arm_correlator_t *current_correlator,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4);
+
+/* correlator API functions */
+ARM4_API_DYNAMIC(arm_error_t)
+arm_generate_correlator(
+    const arm_app_start_handle_t app_handle,
+    const arm_id_t *tran_id,
+    const arm_correlator_t *parent_correlator,
+    const arm_int32_t flags,
+    const arm_buffer4_t *buffer4,
+    arm_correlator_t *current_correlator);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_get_correlator_length(
+    const arm_correlator_t *correlator,
+    arm_correlator_length_t *length);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_get_correlator_flags(
+    const arm_correlator_t *correlator,
+    const arm_int32_t corr_flag_num,
+    arm_boolean_t *flag);
+
+/* miscellaneous API functions */
+ARM4_API_DYNAMIC(arm_error_t)
+arm_get_arrival_time(
+    arm_arrival_time_t *opaque_time);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_get_error_message(
+    const arm_charset_t charset,
+    const arm_error_t code, 
+    arm_message_buffer_t msg);
+
+ARM4_API_DYNAMIC(arm_error_t)
+arm_is_charset_supported(
+    const arm_charset_t charset,
+    arm_boolean_t *supported);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#ifndef ARM4DYN_H_INCLUDED
+#include "arm4dyn.h"
+#endif /* !ARM4DYN_H_INCLUDED */
+
+#endif /* ARM4_H_INCLUDED */
+

Modified: httpd/mod_arm4/trunk/arm4dyn.h
Url: http://svn.apache.org/viewcvs/httpd/mod_arm4/trunk/arm4dyn.h?view=diff&rev=109477&p1=httpd/mod_arm4/trunk/arm4dyn.h&r1=109476&p2=httpd/mod_arm4/trunk/arm4dyn.h&r2=109477
==============================================================================
--- httpd/mod_arm4/trunk/arm4dyn.h	(original)
+++ httpd/mod_arm4/trunk/arm4dyn.h	Thu Dec  2 00:34:11 2004
@@ -1,208 +1,208 @@
-/* ------------------------------------------------------------------------- */
-/*                                                                           */
-/* Copyright (c) 2003 The Open Group                                         */
-/*                                                                           */
-/* Permission is hereby granted, free of charge, to any person obtaining a   */
-/* copy of this software (the "Software"), to deal in the Software without   */
-/* restriction, including without limitation the rights to use, copy,        */
-/* modify, merge, publish, distribute, sublicense, and/or sell copies of     */
-/* the Software, and to permit persons to whom the Software is furnished     */
-/* to do so, subject to the following conditions:                            */
-/*                                                                           */
-/* The above copyright notice and this permission notice shall be included   */
-/* in all copies or substantial portions of the Software.                    */
-/*                                                                           */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   */
-/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    */
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY      */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */
-/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  */
-/* THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                */
-/*                                                                           */
-/* ------------------------------------------------------------------------- */
-/*                                                                           */
-/* File revision information                                                 */
-/*                                                                           */
-/* $Source: /tang_cvs/arm4/sdk4/c/include/arm4dyn.h,v $    */
-/* $Revision: 1.2 $  */
-/* $Date: 2003/12/03 13:55:14 $      */
-/*                                                                           */
-/* ------------------------------------------------------------------------- */
-
-#ifndef ARM4DYN_H_INCLUDED
-#define ARM4DYN_H_INCLUDED
-
-#ifndef ARM4_H_INCLUDED
-#error "don't include arm4dyn.h directly, use arm4.h instead!"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* API function pointer types for registering metadata */
-typedef arm_error_t
-(ARM4_API_CALL* arm_register_application_t)(
-        const arm_char_t              *app_name,
-        const arm_id_t                *input_app_id,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4,
-        arm_id_t                      *output_app_id);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_destroy_application_t)(
-        const arm_id_t                *app_id,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_register_transaction_t)(
-        const arm_id_t                *app_id,
-        const arm_char_t              *tran_name,
-        const arm_id_t                *input_tran_id,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4,
-        arm_id_t                      *output_tran_id);
-
-typedef arm_error_t
-    (ARM4_API_CALL* arm_register_metric_t)(
-        const arm_id_t                *app_id,
-        const arm_char_t              *metric_name,
-        const arm_metric_format_t      metric_format,
-        const arm_metric_usage_t       metric_usage,
-        const arm_char_t              *metric_unit,
-        const arm_id_t                *input_metric_id,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4,
-        arm_id_t                      *output_metric_id);
-
-/* API function pointer types for application instances */
-typedef arm_error_t
-(ARM4_API_CALL* arm_start_application_t)(
-        const arm_id_t                *app_id,
-        const arm_char_t              *app_group,
-        const arm_char_t              *app_instance,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4,
-        arm_app_start_handle_t        *app_handle);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_stop_application_t)(
-        const arm_app_start_handle_t   app_handle,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-/* API function pointer types for transaction instances */
-typedef arm_error_t
-(ARM4_API_CALL* arm_start_transaction_t)(
-        const arm_app_start_handle_t   app_handle,
-        const arm_id_t                *tran_id,
-        const arm_correlator_t        *parent_correlator,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4,
-        arm_tran_start_handle_t       *tran_handle,
-        arm_correlator_t              *current_correlator);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_stop_transaction_t)(
-        const arm_tran_start_handle_t  tran_handle,
-        const arm_tran_status_t        tran_status,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_update_transaction_t)(
-        const arm_tran_start_handle_t  tran_handle,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_discard_transaction_t)(
-        const arm_tran_start_handle_t  tran_handle,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_block_transaction_t)(
-        const arm_tran_start_handle_t  tran_handle,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4,
-        arm_tran_block_handle_t       *block_handle);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_unblock_transaction_t)(
-        const arm_tran_start_handle_t  tran_handle,
-        const arm_tran_block_handle_t  block_handle,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-/* API function pointer types for thread support */
-typedef arm_error_t
-(ARM4_API_CALL* arm_bind_thread_t)(
-        const arm_tran_start_handle_t  tran_handle,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_unbind_thread_t)(
-        const arm_tran_start_handle_t  tran_handle,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-/* API function pointer types for reporting transaction data */
-typedef arm_error_t
-(ARM4_API_CALL* arm_report_transaction_t)(
-        const arm_app_start_handle_t   app_handle,
-        const arm_id_t                *tran_id,
-        const arm_tran_status_t        tran_status,
-        const arm_response_time_t      response_time,
-        const arm_stop_time_t          stop_time,
-        const arm_correlator_t        *parent_correlator,
-        const arm_correlator_t        *current_correlator,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4);
-
-/* API function pointer types for correlators */
-typedef arm_error_t
-(ARM4_API_CALL* arm_generate_correlator_t)(
-        const arm_app_start_handle_t   app_handle,
-        const arm_id_t                *tran_id,
-        const arm_correlator_t        *parent_correlator,
-        const arm_int32_t              flags,
-        const arm_buffer4_t           *buffer4,
-        arm_correlator_t              *current_correlator);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_get_correlator_length_t)(
-	const arm_correlator_t        *correlator,
-	arm_correlator_length_t       *length);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_get_correlator_flags_t)(
-	const arm_correlator_t        *correlator,
-	const arm_int32_t              corr_flag_num,
-	arm_boolean_t                 *flag);
-
-/* miscellaneous API function pointer types */
-typedef arm_error_t
-(ARM4_API_CALL* arm_get_arrival_time_t)(
-        arm_arrival_time_t            *opaque_time);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_get_error_message_t)(
-        const arm_charset_t            charset,
-        const arm_error_t              code, 
-        arm_message_buffer_t           msg);
-
-typedef arm_error_t
-(ARM4_API_CALL* arm_is_charset_supported_t)(
-	const arm_charset_t            charset,
-	arm_boolean_t                 *supported);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/* Copyright (c) 2003 The Open Group                                         */
+/*                                                                           */
+/* Permission is hereby granted, free of charge, to any person obtaining a   */
+/* copy of this software (the "Software"), to deal in the Software without   */
+/* restriction, including without limitation the rights to use, copy,        */
+/* modify, merge, publish, distribute, sublicense, and/or sell copies of     */
+/* the Software, and to permit persons to whom the Software is furnished     */
+/* to do so, subject to the following conditions:                            */
+/*                                                                           */
+/* The above copyright notice and this permission notice shall be included   */
+/* in all copies or substantial portions of the Software.                    */
+/*                                                                           */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   */
+/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY      */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */
+/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  */
+/* THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/* File revision information                                                 */
+/*                                                                           */
+/* $Source: /tang_cvs/arm4/sdk4/c/include/arm4dyn.h,v $    */
+/* $Revision: 1.2 $  */
+/* $Date: 2003/12/03 13:55:14 $      */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+
+#ifndef ARM4DYN_H_INCLUDED
+#define ARM4DYN_H_INCLUDED
+
+#ifndef ARM4_H_INCLUDED
+#error "don't include arm4dyn.h directly, use arm4.h instead!"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* API function pointer types for registering metadata */
+typedef arm_error_t
+(ARM4_API_CALL* arm_register_application_t)(
+        const arm_char_t              *app_name,
+        const arm_id_t                *input_app_id,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4,
+        arm_id_t                      *output_app_id);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_destroy_application_t)(
+        const arm_id_t                *app_id,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_register_transaction_t)(
+        const arm_id_t                *app_id,
+        const arm_char_t              *tran_name,
+        const arm_id_t                *input_tran_id,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4,
+        arm_id_t                      *output_tran_id);
+
+typedef arm_error_t
+    (ARM4_API_CALL* arm_register_metric_t)(
+        const arm_id_t                *app_id,
+        const arm_char_t              *metric_name,
+        const arm_metric_format_t      metric_format,
+        const arm_metric_usage_t       metric_usage,
+        const arm_char_t              *metric_unit,
+        const arm_id_t                *input_metric_id,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4,
+        arm_id_t                      *output_metric_id);
+
+/* API function pointer types for application instances */
+typedef arm_error_t
+(ARM4_API_CALL* arm_start_application_t)(
+        const arm_id_t                *app_id,
+        const arm_char_t              *app_group,
+        const arm_char_t              *app_instance,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4,
+        arm_app_start_handle_t        *app_handle);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_stop_application_t)(
+        const arm_app_start_handle_t   app_handle,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+/* API function pointer types for transaction instances */
+typedef arm_error_t
+(ARM4_API_CALL* arm_start_transaction_t)(
+        const arm_app_start_handle_t   app_handle,
+        const arm_id_t                *tran_id,
+        const arm_correlator_t        *parent_correlator,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4,
+        arm_tran_start_handle_t       *tran_handle,
+        arm_correlator_t              *current_correlator);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_stop_transaction_t)(
+        const arm_tran_start_handle_t  tran_handle,
+        const arm_tran_status_t        tran_status,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_update_transaction_t)(
+        const arm_tran_start_handle_t  tran_handle,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_discard_transaction_t)(
+        const arm_tran_start_handle_t  tran_handle,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_block_transaction_t)(
+        const arm_tran_start_handle_t  tran_handle,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4,
+        arm_tran_block_handle_t       *block_handle);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_unblock_transaction_t)(
+        const arm_tran_start_handle_t  tran_handle,
+        const arm_tran_block_handle_t  block_handle,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+/* API function pointer types for thread support */
+typedef arm_error_t
+(ARM4_API_CALL* arm_bind_thread_t)(
+        const arm_tran_start_handle_t  tran_handle,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_unbind_thread_t)(
+        const arm_tran_start_handle_t  tran_handle,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+/* API function pointer types for reporting transaction data */
+typedef arm_error_t
+(ARM4_API_CALL* arm_report_transaction_t)(
+        const arm_app_start_handle_t   app_handle,
+        const arm_id_t                *tran_id,
+        const arm_tran_status_t        tran_status,
+        const arm_response_time_t      response_time,
+        const arm_stop_time_t          stop_time,
+        const arm_correlator_t        *parent_correlator,
+        const arm_correlator_t        *current_correlator,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4);
+
+/* API function pointer types for correlators */
+typedef arm_error_t
+(ARM4_API_CALL* arm_generate_correlator_t)(
+        const arm_app_start_handle_t   app_handle,
+        const arm_id_t                *tran_id,
+        const arm_correlator_t        *parent_correlator,
+        const arm_int32_t              flags,
+        const arm_buffer4_t           *buffer4,
+        arm_correlator_t              *current_correlator);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_get_correlator_length_t)(
+	const arm_correlator_t        *correlator,
+	arm_correlator_length_t       *length);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_get_correlator_flags_t)(
+	const arm_correlator_t        *correlator,
+	const arm_int32_t              corr_flag_num,
+	arm_boolean_t                 *flag);
+
+/* miscellaneous API function pointer types */
+typedef arm_error_t
+(ARM4_API_CALL* arm_get_arrival_time_t)(
+        arm_arrival_time_t            *opaque_time);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_get_error_message_t)(
+        const arm_charset_t            charset,
+        const arm_error_t              code, 
+        arm_message_buffer_t           msg);
+
+typedef arm_error_t
+(ARM4_API_CALL* arm_is_charset_supported_t)(
+	const arm_charset_t            charset,
+	arm_boolean_t                 *supported);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif

Modified: httpd/mod_arm4/trunk/arm4os.h
Url: http://svn.apache.org/viewcvs/httpd/mod_arm4/trunk/arm4os.h?view=diff&rev=109477&p1=httpd/mod_arm4/trunk/arm4os.h&r1=109476&p2=httpd/mod_arm4/trunk/arm4os.h&r2=109477
==============================================================================
--- httpd/mod_arm4/trunk/arm4os.h	(original)
+++ httpd/mod_arm4/trunk/arm4os.h	Thu Dec  2 00:34:11 2004
@@ -1,339 +1,339 @@
-/* ------------------------------------------------------------------------- */
-/*                                                                           */
-/* Copyright (c) 2003 The Open Group                                         */
-/*                                                                           */
-/* Permission is hereby granted, free of charge, to any person obtaining a   */
-/* copy of this software (the "Software"), to deal in the Software without   */
-/* restriction, including without limitation the rights to use, copy,        */
-/* modify, merge, publish, distribute, sublicense, and/or sell copies of     */
-/* the Software, and to permit persons to whom the Software is furnished     */
-/* to do so, subject to the following conditions:                            */
-/*                                                                           */
-/* The above copyright notice and this permission notice shall be included   */
-/* in all copies or substantial portions of the Software.                    */
-/*                                                                           */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   */
-/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    */
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY      */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */
-/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  */
-/* THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                */
-/*                                                                           */
-/* ------------------------------------------------------------------------- */
-/*                                                                           */
-/* File revision information                                                 */
-/*                                                                           */
-/* $Source: /tang_cvs/arm4/sdk4/c/include/arm4os.h,v $    */
-/* $Revision: 1.4 $  */
-/* $Date: 2004/03/04 09:24:49 $      */
-/*                                                                           */
-/* ------------------------------------------------------------------------- */
-/* arm4os.h - ARM4 SDK operating system and compiler specific header file    */
-/*                                                                           */
-/* The arm4os.h header file hides OS and compiler specifics from  the        */
-/* actual ARM4 interface found in the arm4.h header file. It is meant to     */
-/* facilitate the adaption of additional compiler/os combinations.           */
-/*                                                                           */
-/* Currently, the following platform/compiler combinations are supported and */
-/* tested:                                                                   */
-/*                                                                           */
-/* Platform                 Compiler                                         */
-/* ------------------------------------------------------------------------- */
-/* Linux 2.4.x (x86)        gcc (2.95, 3.3) GNU C/C++ Compiler               */
-/* Linux 2.4.x (ppc)        gcc (2.95, 3.2) GNU C/C++ Compiler               */
-/* Linux 2.4.x (x86)        icc (7.0)  Intel C++ Compiler                    */
-/* Solaris 8 (sparc)        cc (5.3)   Sun WorkShop 6 C Compiler             */
-/* Solaris 8 (sparc)        CC (5.3)   Sun WorkShop 6 C++ Compiler           */
-/* Solaris 8 (sparc)        gcc (2.95) GNU C/C++ Compiler                    */
-/* OSF1 V5.0 Tru64 (alpha)  cc (6.1)   Compaq C Compiler                     */
-/* OSF1 V5.0 Tru64 (alpha)  gcc (2.95) GNU C/C++ Compiler                    */
-/* Windows 2000 (x86)       MSVC (6.0) Microsoft VisualC++                   */
-/*                                                                           */
-/* The following mechanisms are implemented in this header file:             */
-/*                                                                           */
-/* 1. Determine the native compiler type for 8, 16, 32 and 64 bit integers.  */
-/*    Macros: ARM4_INT8, ARM4_UINT8, ARM4_INT16, ARM4_UINT16, ARM4_INT32,    */
-/*            ARM4_UINT32, ARM4_INT64, ARM_UINT64 and ARM4_CHAR.             */
-/* 2. Special handling for exporting function symbols to support different   */
-/*    shared library scenarios. Set-up of specific function calling          */
-/*    conventions.                                                           */
-/*    Macros: ARM4_API_CALL, ARM4_API_CALLVA, ARM4_API_DYNAMIC               */
-/* 3. Determine compiler inlining support, if any, and setting of the        */
-/*    appropriate keyword for the compier used.                              */
-/*    Macros: ARM4_INLINE                                                    */
-/* ------------------------------------------------------------------------- */
-
-#ifndef ARM4OS_H_INCLUDED
-#define ARM4OS_H_INCLUDED
-
-/* ------------------------------------------------------------------------- */
-/* Consolidate known OS platform identifiers first.                          */
-/* ------------------------------------------------------------------------- */
-
-#if defined(WIN32) || defined(__WIN32__)
-#if !defined(_WIN32)
-#define _WIN32
-#endif
-#endif
-
-#if defined(WIN64) || defined(__WIN64__)
-#if !defined(_WIN64)
-#define _WIN64
-#endif
-#endif
-
-/* ------------------------------------------------------------------------- */
-/* ------------- Step 1: determine 32 and 64 bit integer types ------------- */
-/* ------------------ (compiler/target platform dependent) ----------------- */
-/* ------------------------------------------------------------------------- */
-
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L
-
-/* C99 standard defines all types required for us. */
-#ifdef __cplusplus
-#include <cstdint>
-#else
-#include <stdint.h>
-#endif
-
-#define ARM4_CHAR    char
-
-#define ARM4_INT8    int8_t
-#define ARM4_INT16   int16_t
-#define ARM4_INT32   int32_t
-#define ARM4_INT64   int64_t
-
-#define ARM4_UINT8   uint8_t
-#define ARM4_UINT16  uint16_t
-#define ARM4_UINT32  uint32_t
-#define ARM4_UINT64  uint64_t
-
-#else
-
-/* Needed to find out appropriate int32 and int64 types, limit.h is an       */
-/* ANSI-C header file. Thus any ANSI-C compliant compiler works.             */
-#ifdef __cplusplus
-#include <climits>
-#else
-#include <limits.h>
-#endif
-
-/* set-up arm_int32_t type */
-#if INT_MAX == 2147483647l
-#define ARM4_INT32  int
-#elif LONG_MAX == 2147483647l
-#define ARM4_INT32  long
-#else
-#error "can't determine 32bit integer type"
-#endif /* INT_MAX == 2147483647l */
-
-#ifndef ARM4_UINT32
-#define ARM4_UINT32 unsigned ARM4_INT32
-#endif /* !ARM4_UINT32 */
-
-/* now find appropriate 64 bit integer type */
-#ifndef ARM4_INT64
-
-#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__WATCOMC__)
-/* MSVC and compatible compiler native 64 bit types */
-#define ARM4_INT64           __int64
-
-#elif (defined(LLONG_MAX) && LLONG_MAX > 2147483647l) || \
-      (defined(LONGLONG_MAX) && LONGLONG_MAX > 2147483647l)
-/* LLONG_MAX and LONGLONG_MAX indicate usage of long long 64 bit types       */
-#define ARM4_INT64            long long
-
-#elif (defined(__GNUC__) && \
-      (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
-/* GNU supports long long. To be safe just use current V 2.95 or V3.x        */
-/* Older versions have to be checked first!                                  */
-#define ARM4_INT64            long long
-
-#elif defined(__INTEL_COMPILER)
-/* INTEL C compiler for Windows/Linux supports long long.                    */
-#define ARM4_INT64            long long
-
-#elif defined(__hpux)
-/*  hpux uses *int64_t */
-#define ARM4_INT64            int64_t  
-#define ARM4_UINT64           uint64_t  
-
-#elif LONG_MAX > 2147483647l
-/* on 64-bit systems the normal long type could actually be a 64-bit type    */
-#define ARM4_INT64            long
-
-#else
-/* Raise a compile-time error if unsure. Note that assuming "long long"      */
-/* for int64 might get past the compilation but may cause run-time problems  */
-/* if it is not exactly 64-bit.                                              */
-#error "can't determine 64bit integer type"
-
-#endif /* _MSC_VER ... */
-#endif /* ARM4_INT64 */
-
-/* if ARM4_UINT64 isn't set, use ARM4_INT64 combined with unsigned keyword.  */
-#ifndef ARM4_UINT64
-#define ARM4_UINT64  unsigned ARM4_INT64
-#endif /* !ARM4_UINT64 */
-
-
-/* define standard character and integer defintions if not set previously.   */
-#ifndef ARM4_CHAR
-#define ARM4_CHAR char
-#endif
-
-#ifndef ARM4_INT8
-#define ARM4_INT8 signed char
-#endif
-
-#ifndef ARM4_UINT8
-#define ARM4_UINT8 unsigned char
-#endif
-
-#ifndef ARM4_INT16
-#define ARM4_INT16 signed short
-#endif
-
-#ifndef ARM4_UINT16
-#define ARM4_UINT16 unsigned short
-#endif
-
-#endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L */
-
-#if defined(_WIN32) || defined(_WIN64)
-#define ARM4_LLCONST(x)  ((arm_int64_t) (x))
-#define ARM4_ULLCONST(x) ((arm_uint64_t) (x))
-#else
-#define ARM4_LLCONST(x)  x##ll
-#define ARM4_ULLCONST(x) x##ull
-#endif
-
-/* ------------------------------------------------------------------------- */
-/* ---------------------- Step 2: API function export ---------------------- */
-/* ------------------ (compiler/target platform dependent) ----------------- */
-/* ------------------------------------------------------------------------- */
-
-/* Each OS platform needs to define the API calling convention for itself,   */
-/* and make sure the proper compiler keywords are used.                      */
-/*      ARM4_API_CALL is for API calls with fixed # of parameters, while     */
-/*      ARM4_API_VACALL is for API calls with variable # of parameters.      */
-
-#if defined(_WIN32) || defined(_WIN64)
-/* For 32-bit and 64-bit Windows, "stdcall" (pascal) calling convention is   */
-/* explicitly chosen for ARM4_API_CALL to save a few instructions per call.  */
-#if defined(__GNUC__)
-#define ARM4_API_CALL    __attribute__((stdcall))
-#define ARM4_API_VACALL  __attribute__((cdecl))
-#else
-/* If a compiler does not support __stdcall or __cdecl, it will generate     */
-/* compile time errors when encountering these modifiers. Most compilers,    */
-/* e.g. _MSC_VER, __WATCOMC__, __BORLANDC__ and __MWERKS__ do support both.  */
-/* __INTEL_COMPILER knows both, too.                                         */
-#define ARM4_API_CALL    __stdcall
-#define ARM4_API_VACALL  __cdecl
-#endif
-#endif /* _WIN32 || _WIN64 */
-
-#if defined(linux)
-
-#if defined(__GNUC__)
-
-#if defined(__i386__)
-#define ARM4_API_CALL    __attribute__((stdcall))
-#define ARM4_API_VACALL  __attribute__((cdecl))
-#endif
-
-#elif !defined(__INTEL_COMPILER)
-/* On linux the intel compiler doesn't support __stdcall !?!*/
-#define ARM4_API_CALL    __stdcall
-#define ARM4_API_VACALL  __cdecl
-
-#endif
-#endif /* linux */
-
-/* For other OS platforms, the compiler's default calling convention is used */
-/* and, hopefully, this won't cause link-time or run-time problems.          */
-#if !defined(ARM4_API_CALL)
-#define ARM4_API_CALL
-#define ARM4_API_VACALL
-#endif
-
-/* Set up the ARM4_API_DYNAMIC definition here so the ARM library can be     */
-/* built correctly as a shared library or DLL. Note the return type of the   */
-/* API call must be specified as an argument to this macro because MSVC      */
-/* needs the __declspec() before and __stdcall keyword after the return type.*/
-/*                                                                           */
-/* Note that dllexport and dllimport are needed only for _WIN32 or _WIN64.   */
-/* It is recommended that ARM agent providers for Windows explicitly use an  */
-/* libarm4.def to spell out the exact name of the exports, such that         */
-/* applications can do a GetProcAddress() without problems. Note that in the */
-/* case of a compiler not supporting __declspec(), compile time errors are   */
-/* to be expected.                                                           */
-
-#if !(defined(_WIN32) || defined(_WIN64)) || defined(ARM4_NODLL)
-#define ARM4_API_DYNAMIC(type) extern type ARM4_API_CALL
-
-#elif defined(__GNUC__)
-#if defined(ARM4_BUILD_DLL)
-#define ARM4_API_DYNAMIC(type) __attribute__((dllexport)) type ARM4_API_CALL
-#else
-#define ARM4_API_DYNAMIC(type) __attribute__((dllimport)) type ARM4_API_CALL
-#endif
-#else
-#if defined(ARM4_BUILD_DLL)
-#define ARM4_API_DYNAMIC(type) __declspec(dllexport) type ARM4_API_CALL
-#else
-#define ARM4_API_DYNAMIC(type) __declspec(dllimport) type ARM4_API_CALL
-#endif /* __GNUC__ */
-
-#endif /* !defined(_WIN32) || ... */
-
-#define ARM4_API_STATIC(type)     type ARM4_API_CALL
-#define ARM4_API_VASTATIC(type)   type ARM4_API_VACALL
-
-/* ------------------------------------------------------------------------- */
-/* ------------------------ Step 3: inlining support ----------------------- */
-/* ---------------------------- (compiler dependent) ----------------------- */
-/* ------------------------------------------------------------------------- */
-
-/* determine correct inline keyword */
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L) || \
-    defined(__cplusplus)
-/* C99 C compliant and C++ compilers use the inline keyword */
-#define ARM4_INLINE inline
-
-#elif defined(__GNUC__)
-/* GNU C supports inlining                                  */
-#if __GNUC__ > 2
-#define ARM4_INLINE static __attribute__((always_inline)) __inline__
-#else
-#define ARM4_INLINE static __inline__
-#endif
-
-#elif defined(_MSC_VER)
-/* MSVC supports inlining                                   */
-#define ARM4_INLINE __inline
-
-#elif defined(__INTEL_COMPILER)
-/* INTEL compiler can take both inline or __inline          */
-#define ARM4_INLINE __inline
-
-#elif defined(__DECC)
-/* Compaq C V6.1 cc compiler can take __inline              */
-#define ARM4_INLINE __inline
-
-/* any other compiler specific inline support should be     */
-/* placed here.                                             */
-
-#else
-/* not sure if the current compiler supports inlining, so   */
-/* use the default keyword. Compile time errors will result */
-/* if the compiler does not support the default keyword.    */
-#define ARM4_INLINE inline
-
-#endif /* (defined(__STD_VERSION__) && ... */
-
-/* ------------------------------------------------------------------------- */
-
-#endif /* !ARM4OS_H_INCLUDED */
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/* Copyright (c) 2003 The Open Group                                         */
+/*                                                                           */
+/* Permission is hereby granted, free of charge, to any person obtaining a   */
+/* copy of this software (the "Software"), to deal in the Software without   */
+/* restriction, including without limitation the rights to use, copy,        */
+/* modify, merge, publish, distribute, sublicense, and/or sell copies of     */
+/* the Software, and to permit persons to whom the Software is furnished     */
+/* to do so, subject to the following conditions:                            */
+/*                                                                           */
+/* The above copyright notice and this permission notice shall be included   */
+/* in all copies or substantial portions of the Software.                    */
+/*                                                                           */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   */
+/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.    */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY      */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */
+/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR  */
+/* THE USE OR OTHER DEALINGS IN THE SOFTWARE.                                */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+/*                                                                           */
+/* File revision information                                                 */
+/*                                                                           */
+/* $Source: /tang_cvs/arm4/sdk4/c/include/arm4os.h,v $    */
+/* $Revision: 1.4 $  */
+/* $Date: 2004/03/04 09:24:49 $      */
+/*                                                                           */
+/* ------------------------------------------------------------------------- */
+/* arm4os.h - ARM4 SDK operating system and compiler specific header file    */
+/*                                                                           */
+/* The arm4os.h header file hides OS and compiler specifics from  the        */
+/* actual ARM4 interface found in the arm4.h header file. It is meant to     */
+/* facilitate the adaption of additional compiler/os combinations.           */
+/*                                                                           */
+/* Currently, the following platform/compiler combinations are supported and */
+/* tested:                                                                   */
+/*                                                                           */
+/* Platform                 Compiler                                         */
+/* ------------------------------------------------------------------------- */
+/* Linux 2.4.x (x86)        gcc (2.95, 3.3) GNU C/C++ Compiler               */
+/* Linux 2.4.x (ppc)        gcc (2.95, 3.2) GNU C/C++ Compiler               */
+/* Linux 2.4.x (x86)        icc (7.0)  Intel C++ Compiler                    */
+/* Solaris 8 (sparc)        cc (5.3)   Sun WorkShop 6 C Compiler             */
+/* Solaris 8 (sparc)        CC (5.3)   Sun WorkShop 6 C++ Compiler           */
+/* Solaris 8 (sparc)        gcc (2.95) GNU C/C++ Compiler                    */
+/* OSF1 V5.0 Tru64 (alpha)  cc (6.1)   Compaq C Compiler                     */
+/* OSF1 V5.0 Tru64 (alpha)  gcc (2.95) GNU C/C++ Compiler                    */
+/* Windows 2000 (x86)       MSVC (6.0) Microsoft VisualC++                   */
+/*                                                                           */
+/* The following mechanisms are implemented in this header file:             */
+/*                                                                           */
+/* 1. Determine the native compiler type for 8, 16, 32 and 64 bit integers.  */
+/*    Macros: ARM4_INT8, ARM4_UINT8, ARM4_INT16, ARM4_UINT16, ARM4_INT32,    */
+/*            ARM4_UINT32, ARM4_INT64, ARM_UINT64 and ARM4_CHAR.             */
+/* 2. Special handling for exporting function symbols to support different   */
+/*    shared library scenarios. Set-up of specific function calling          */
+/*    conventions.                                                           */
+/*    Macros: ARM4_API_CALL, ARM4_API_CALLVA, ARM4_API_DYNAMIC               */
+/* 3. Determine compiler inlining support, if any, and setting of the        */
+/*    appropriate keyword for the compier used.                              */
+/*    Macros: ARM4_INLINE                                                    */
+/* ------------------------------------------------------------------------- */
+
+#ifndef ARM4OS_H_INCLUDED
+#define ARM4OS_H_INCLUDED
+
+/* ------------------------------------------------------------------------- */
+/* Consolidate known OS platform identifiers first.                          */
+/* ------------------------------------------------------------------------- */
+
+#if defined(WIN32) || defined(__WIN32__)
+#if !defined(_WIN32)
+#define _WIN32
+#endif
+#endif
+
+#if defined(WIN64) || defined(__WIN64__)
+#if !defined(_WIN64)
+#define _WIN64
+#endif
+#endif
+
+/* ------------------------------------------------------------------------- */
+/* ------------- Step 1: determine 32 and 64 bit integer types ------------- */
+/* ------------------ (compiler/target platform dependent) ----------------- */
+/* ------------------------------------------------------------------------- */
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L
+
+/* C99 standard defines all types required for us. */
+#ifdef __cplusplus
+#include <cstdint>
+#else
+#include <stdint.h>
+#endif
+
+#define ARM4_CHAR    char
+
+#define ARM4_INT8    int8_t
+#define ARM4_INT16   int16_t
+#define ARM4_INT32   int32_t
+#define ARM4_INT64   int64_t
+
+#define ARM4_UINT8   uint8_t
+#define ARM4_UINT16  uint16_t
+#define ARM4_UINT32  uint32_t
+#define ARM4_UINT64  uint64_t
+
+#else
+
+/* Needed to find out appropriate int32 and int64 types, limit.h is an       */
+/* ANSI-C header file. Thus any ANSI-C compliant compiler works.             */
+#ifdef __cplusplus
+#include <climits>
+#else
+#include <limits.h>
+#endif
+
+/* set-up arm_int32_t type */
+#if INT_MAX == 2147483647l
+#define ARM4_INT32  int
+#elif LONG_MAX == 2147483647l
+#define ARM4_INT32  long
+#else
+#error "can't determine 32bit integer type"
+#endif /* INT_MAX == 2147483647l */
+
+#ifndef ARM4_UINT32
+#define ARM4_UINT32 unsigned ARM4_INT32
+#endif /* !ARM4_UINT32 */
+
+/* now find appropriate 64 bit integer type */
+#ifndef ARM4_INT64
+
+#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__WATCOMC__)
+/* MSVC and compatible compiler native 64 bit types */
+#define ARM4_INT64           __int64
+
+#elif (defined(LLONG_MAX) && LLONG_MAX > 2147483647l) || \
+      (defined(LONGLONG_MAX) && LONGLONG_MAX > 2147483647l)
+/* LLONG_MAX and LONGLONG_MAX indicate usage of long long 64 bit types       */
+#define ARM4_INT64            long long
+
+#elif (defined(__GNUC__) && \
+      (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
+/* GNU supports long long. To be safe just use current V 2.95 or V3.x        */
+/* Older versions have to be checked first!                                  */
+#define ARM4_INT64            long long
+
+#elif defined(__INTEL_COMPILER)
+/* INTEL C compiler for Windows/Linux supports long long.                    */
+#define ARM4_INT64            long long
+
+#elif defined(__hpux)
+/*  hpux uses *int64_t */
+#define ARM4_INT64            int64_t  
+#define ARM4_UINT64           uint64_t  
+
+#elif LONG_MAX > 2147483647l
+/* on 64-bit systems the normal long type could actually be a 64-bit type    */
+#define ARM4_INT64            long
+
+#else
+/* Raise a compile-time error if unsure. Note that assuming "long long"      */
+/* for int64 might get past the compilation but may cause run-time problems  */
+/* if it is not exactly 64-bit.                                              */
+#error "can't determine 64bit integer type"
+
+#endif /* _MSC_VER ... */
+#endif /* ARM4_INT64 */
+
+/* if ARM4_UINT64 isn't set, use ARM4_INT64 combined with unsigned keyword.  */
+#ifndef ARM4_UINT64
+#define ARM4_UINT64  unsigned ARM4_INT64
+#endif /* !ARM4_UINT64 */
+
+
+/* define standard character and integer defintions if not set previously.   */
+#ifndef ARM4_CHAR
+#define ARM4_CHAR char
+#endif
+
+#ifndef ARM4_INT8
+#define ARM4_INT8 signed char
+#endif
+
+#ifndef ARM4_UINT8
+#define ARM4_UINT8 unsigned char
+#endif
+
+#ifndef ARM4_INT16
+#define ARM4_INT16 signed short
+#endif
+
+#ifndef ARM4_UINT16
+#define ARM4_UINT16 unsigned short
+#endif
+
+#endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L */
+
+#if defined(_WIN32) || defined(_WIN64)
+#define ARM4_LLCONST(x)  ((arm_int64_t) (x))
+#define ARM4_ULLCONST(x) ((arm_uint64_t) (x))
+#else
+#define ARM4_LLCONST(x)  x##ll
+#define ARM4_ULLCONST(x) x##ull
+#endif
+
+/* ------------------------------------------------------------------------- */
+/* ---------------------- Step 2: API function export ---------------------- */
+/* ------------------ (compiler/target platform dependent) ----------------- */
+/* ------------------------------------------------------------------------- */
+
+/* Each OS platform needs to define the API calling convention for itself,   */
+/* and make sure the proper compiler keywords are used.                      */
+/*      ARM4_API_CALL is for API calls with fixed # of parameters, while     */
+/*      ARM4_API_VACALL is for API calls with variable # of parameters.      */
+
+#if defined(_WIN32) || defined(_WIN64)
+/* For 32-bit and 64-bit Windows, "stdcall" (pascal) calling convention is   */
+/* explicitly chosen for ARM4_API_CALL to save a few instructions per call.  */
+#if defined(__GNUC__)
+#define ARM4_API_CALL    __attribute__((stdcall))
+#define ARM4_API_VACALL  __attribute__((cdecl))
+#else
+/* If a compiler does not support __stdcall or __cdecl, it will generate     */
+/* compile time errors when encountering these modifiers. Most compilers,    */
+/* e.g. _MSC_VER, __WATCOMC__, __BORLANDC__ and __MWERKS__ do support both.  */
+/* __INTEL_COMPILER knows both, too.                                         */
+#define ARM4_API_CALL    __stdcall
+#define ARM4_API_VACALL  __cdecl
+#endif
+#endif /* _WIN32 || _WIN64 */
+
+#if defined(linux)
+
+#if defined(__GNUC__)
+
+#if defined(__i386__)
+#define ARM4_API_CALL    __attribute__((stdcall))
+#define ARM4_API_VACALL  __attribute__((cdecl))
+#endif
+
+#elif !defined(__INTEL_COMPILER)
+/* On linux the intel compiler doesn't support __stdcall !?!*/
+#define ARM4_API_CALL    __stdcall
+#define ARM4_API_VACALL  __cdecl
+
+#endif
+#endif /* linux */
+
+/* For other OS platforms, the compiler's default calling convention is used */
+/* and, hopefully, this won't cause link-time or run-time problems.          */
+#if !defined(ARM4_API_CALL)
+#define ARM4_API_CALL
+#define ARM4_API_VACALL
+#endif
+
+/* Set up the ARM4_API_DYNAMIC definition here so the ARM library can be     */
+/* built correctly as a shared library or DLL. Note the return type of the   */
+/* API call must be specified as an argument to this macro because MSVC      */
+/* needs the __declspec() before and __stdcall keyword after the return type.*/
+/*                                                                           */
+/* Note that dllexport and dllimport are needed only for _WIN32 or _WIN64.   */
+/* It is recommended that ARM agent providers for Windows explicitly use an  */
+/* libarm4.def to spell out the exact name of the exports, such that         */
+/* applications can do a GetProcAddress() without problems. Note that in the */
+/* case of a compiler not supporting __declspec(), compile time errors are   */
+/* to be expected.                                                           */
+
+#if !(defined(_WIN32) || defined(_WIN64)) || defined(ARM4_NODLL)
+#define ARM4_API_DYNAMIC(type) extern type ARM4_API_CALL
+
+#elif defined(__GNUC__)
+#if defined(ARM4_BUILD_DLL)
+#define ARM4_API_DYNAMIC(type) __attribute__((dllexport)) type ARM4_API_CALL
+#else
+#define ARM4_API_DYNAMIC(type) __attribute__((dllimport)) type ARM4_API_CALL
+#endif
+#else
+#if defined(ARM4_BUILD_DLL)
+#define ARM4_API_DYNAMIC(type) __declspec(dllexport) type ARM4_API_CALL
+#else
+#define ARM4_API_DYNAMIC(type) __declspec(dllimport) type ARM4_API_CALL
+#endif /* __GNUC__ */
+
+#endif /* !defined(_WIN32) || ... */
+
+#define ARM4_API_STATIC(type)     type ARM4_API_CALL
+#define ARM4_API_VASTATIC(type)   type ARM4_API_VACALL
+
+/* ------------------------------------------------------------------------- */
+/* ------------------------ Step 3: inlining support ----------------------- */
+/* ---------------------------- (compiler dependent) ----------------------- */
+/* ------------------------------------------------------------------------- */
+
+/* determine correct inline keyword */
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L) || \
+    defined(__cplusplus)
+/* C99 C compliant and C++ compilers use the inline keyword */
+#define ARM4_INLINE inline
+
+#elif defined(__GNUC__)
+/* GNU C supports inlining                                  */
+#if __GNUC__ > 2
+#define ARM4_INLINE static __attribute__((always_inline)) __inline__
+#else
+#define ARM4_INLINE static __inline__
+#endif
+
+#elif defined(_MSC_VER)
+/* MSVC supports inlining                                   */
+#define ARM4_INLINE __inline
+
+#elif defined(__INTEL_COMPILER)
+/* INTEL compiler can take both inline or __inline          */
+#define ARM4_INLINE __inline
+
+#elif defined(__DECC)
+/* Compaq C V6.1 cc compiler can take __inline              */
+#define ARM4_INLINE __inline
+
+/* any other compiler specific inline support should be     */
+/* placed here.                                             */
+
+#else
+/* not sure if the current compiler supports inlining, so   */
+/* use the default keyword. Compile time errors will result */
+/* if the compiler does not support the default keyword.    */
+#define ARM4_INLINE inline
+
+#endif /* (defined(__STD_VERSION__) && ... */
+
+/* ------------------------------------------------------------------------- */
+
+#endif /* !ARM4OS_H_INCLUDED */

Modified: httpd/mod_arm4/trunk/mod_arm4.c
Url: http://svn.apache.org/viewcvs/httpd/mod_arm4/trunk/mod_arm4.c?view=diff&rev=109477&p1=httpd/mod_arm4/trunk/mod_arm4.c&r1=109476&p2=httpd/mod_arm4/trunk/mod_arm4.c&r2=109477
==============================================================================
--- httpd/mod_arm4/trunk/mod_arm4.c	(original)
+++ httpd/mod_arm4/trunk/mod_arm4.c	Thu Dec  2 00:34:11 2004
@@ -1,881 +1,881 @@
-/* Copyright 2000-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* INSTRUMENT_HANDLER_HACK
- * Use arm_fixups and arm_logger as a poor man's way to call 
- * arm_block_transaction/arm_unblock_transaction across a call to a handler. 
- * The correct way to instrument block/unblock transactions is to modify 
- * each handler that sends requests outside the httpd process to call the
- * optional hooks, arm_ap_block_transaction() and arm_ap_unblock_transaction().
- * We can selectively turn on the request for block/unblock instrumentation by
- * setting the ArmInstrumentHandler directive inside  <Directory> or <Location> containers.
- */
-
-#include "httpd.h"
-#include "http_config.h"
-#include "http_core.h"
-#include "http_log.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "util_script.h"
-#include "apr.h"
-#include "apr_strings.h"
-#include "apr_base64.h"
-#include "http_request.h"
-
-#include <stdio.h>
-
-#ifdef WIN32
-#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.dll"
-#elif defined(_AIX)
-#ifdef __64BIT__
-#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.a(shr_64.o)"
-#else
-#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.a(shr.o)"
-#endif
-/* End AIX */
-#else
-#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.so"
-#endif
-
-#include "arm4.h"
-
-#if !defined(APR_UINT64_T_HEX_FMT)
-#if defined(LINUX)
-#define APR_UINT64_T_HEX_FMT "llx"
-#elif defined(WIN32)
-#define APR_UINT64_T_HEX_FMT "I64x"
-#endif
-#endif
-
-/*
- * Define the dynamically loadable API to the ARM client library 
- */
-APR_DECLARE_OPTIONAL_FN(void, arm_ap_block_transaction, (const void *));
-APR_DECLARE_OPTIONAL_FN(void, arm_ap_unblock_transaction, (const void *));
-
-arm_register_application_t  ap_arm_register_application;
-arm_register_transaction_t  ap_arm_register_transaction;
-arm_register_metric_t       ap_arm_register_metric;
-arm_start_application_t     ap_arm_start_application;
-arm_stop_application_t      ap_arm_stop_application;
-arm_destroy_application_t   ap_arm_destroy_application;
-arm_start_transaction_t     ap_arm_start_transaction;
-arm_stop_transaction_t      ap_arm_stop_transaction;
-arm_update_transaction_t    ap_arm_update_transaction;
-arm_discard_transaction_t   ap_arm_discard_transaction;
-arm_block_transaction_t     ap_arm_block_transaction;
-arm_unblock_transaction_t   ap_arm_unblock_transaction;
-arm_report_transaction_t    ap_arm_report_transaction;
-arm_bind_thread_t           ap_arm_bind_thread;
-arm_unbind_thread_t         ap_arm_unbind_thread;
-arm_generate_correlator_t   ap_arm_generate_correlator;
-arm_get_correlator_length_t ap_arm_get_correlator_length;
-arm_get_correlator_flags_t  ap_arm_get_correlator_flags;
-arm_get_arrival_time_t      ap_arm_get_arrival_time;
-arm_get_error_message_t     ap_arm_get_error_message;
-arm_is_charset_supported_t  ap_arm_is_charset_supported;
-
-/* Module declaration */
-#define ARM_MODULE arm4_module
-module AP_MODULE_DECLARE_DATA ARM_MODULE;
-
-/* Per server config */
-#define DEFAULT_TRAN_NAME "HTTP Request"
-#define DEFAULT_APP_NAME  "Apache HTTP Server"
-typedef struct server_config {
-    arm_id_t app_id;
-    arm_id_t tran_id;
-    arm_app_start_handle_t app_handle;
-    const char* libname;
-
-    char *app_name;
-    char *tran_name;
-} server_config_t;
-
-/* Per dir config */
-typedef struct dir_config {
-    int instrument_handler;
-} dir_config_t;
-
-/* Per request config */
-typedef struct request_config {
-    arm_tran_start_handle_t   tran_handle;
-    arm_tran_block_handle_t   block_handle;
-    arm_subbuffer_arrival_time_t sb_arrival_time;
-} request_config_t;
-
-static int module_is_disabled = 0;
-
-/* 
- * Convert binary data into a hex string.
- * in  - Input data in binary format.  It's length must be len+1.
- * out - Output data in Hex String.  It must be pre-allocated.
- *       It's length must be at least len*2+1.
- * len - The amount of Byte that are going to be converted.
- */
-static void stringify(unsigned char *in, unsigned char *out, int len)
-{
-    int i;
-    char to_hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
-                      '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', } ;
-
-    for(i=0; i<len;i++) {
-        out[2*i] = to_hex[(in[i]>>4) & 0x0f];
-        out[1+2*i] = to_hex[in[i] & 0x0f];
-    }
-
-    out[2*len] = '\0';
-}
-
-/*
- * Convert hex String into binary data.
- * in  - Input data in Hex String.  It's length must be len*2+1.
- * out - Output data in binary.  It must be pre-allocated.  It's length must be
- *       at least len+1.
- * len - len*2+1 will be the number of byte converted.
- */
-static void destringify(const unsigned char *in, unsigned char *out, int orig_len)
-{
-    int len=0;
-    int i;
-    int maxlen = orig_len * 2 + 1;
-
-    while((in[len] != '\0') && isxdigit(in[len]) && (len < maxlen)) {
-        len++;
-    }
-
-    /*
-     * if (in[len] != '\0') at this point we're ignoring trailing non xdigit chars
-     * also, len should be even, but we're not checking ...
-     */
-    for(i=0;i<(len/2);i++) {
-        if(isdigit(in[2*i])) {
-            if(isdigit(in[1+2*i])) {
-                out[i] = ((in[2*i]-'0')<<4)|(0x0f & (in[1+2*i]-'0'));
-            }
-            else  {
-                out[i] = ((in[2*i]-'0')<<4)|(0x0f & (10+toupper(in[1+2*i])-'A'));
-            }
-        }
-        else {
-            if(isdigit(in[1+2*i])) {
-                out[i] = ((10+toupper(in[2*i])-'A')<<4)|(0x0f & (in[1+2*i]-'0'));
-            }
-            else {
-                out[i] = ((10+toupper(in[2*i])-'A')<<4) |
-                  (0x0f & (10+toupper(in[1+2*i])-'A'));
-            }
-        }
-    }
-}
-
-/*
- *   This is to change the correlator into a string so it can be passed
- *   in the request header to a downstream application.(Inefficient version)
- *
- *   Note: arm_correlator_get_length(corr_out) should be at least
- *         2*arm_correlator_get_length(corr_in)+1
- */
-static void stringify_Correlator(arm_correlator_t* corr_in, unsigned char* corr_out)
-{
-    unsigned char *in;
-    arm_correlator_length_t len = 0;
-    ap_arm_get_correlator_length(corr_in, &len);
-    in = (unsigned char *)corr_in;
-
-    stringify(in, corr_out, len);
-}
-
-/*
- * pconf pool cleanup
- */
-static apr_status_t mod_arm4_cleanup(void *dv)
-{
-    server_config_t *sconf;
-    server_rec *s = dv;
-    char *sname = s->server_hostname;
-    arm_error_t arm_rc;
-
-    sconf = ap_get_module_config(s->module_config, &arm4_module);
-    /* End the Application for this process */
-    arm_rc = ap_arm_stop_application(sconf->app_handle, 0, NULL);
-    if (arm_rc < 0) {
-        ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, 
-                     "mod_arm: arm_end_application failed with rc = %d", arm_rc);
-    }
-
-    return APR_SUCCESS;
-}
-
-#define LOAD_SYMBOL(symbol) \
-{ \
-   rv = apr_dso_sym((void**)&ap_##symbol,libhandle,#symbol); \
-   if (rv != APR_SUCCESS)  { \
-      ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "Failed to load symbol %s in library %s", #symbol, libname);  \
-      return rv; \
-    } \
-}
-static apr_status_t load_library(apr_pool_t *p, server_rec *s, const char *libname)
-{
-    apr_status_t rv;
-    apr_dso_handle_t *libhandle;
-
-    rv = apr_dso_load(&libhandle, libname, p);
-    if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "Failed to load library %s", libname);
-        return rv;
-    }
-
-    LOAD_SYMBOL(arm_register_application);
-    LOAD_SYMBOL(arm_register_transaction);
-    LOAD_SYMBOL(arm_register_metric);
-
-    LOAD_SYMBOL(arm_start_application);
-    LOAD_SYMBOL(arm_stop_application);
-    LOAD_SYMBOL(arm_destroy_application)
-
-    LOAD_SYMBOL(arm_start_transaction);
-    LOAD_SYMBOL(arm_stop_transaction);
-    LOAD_SYMBOL(arm_update_transaction);
-    LOAD_SYMBOL(arm_discard_transaction);
-    LOAD_SYMBOL(arm_block_transaction);
-    LOAD_SYMBOL(arm_unblock_transaction);
-    LOAD_SYMBOL(arm_report_transaction);
-
-    LOAD_SYMBOL(arm_bind_thread);
-    LOAD_SYMBOL(arm_unbind_thread);
-
-    LOAD_SYMBOL(arm_generate_correlator);
-    LOAD_SYMBOL(arm_get_correlator_length);
-    LOAD_SYMBOL(arm_get_correlator_flags);
-
-    LOAD_SYMBOL(arm_get_arrival_time);
-    LOAD_SYMBOL(arm_get_error_message);
-    LOAD_SYMBOL(arm_is_charset_supported);
-
-    /* Register a cleanup against the open handle */
-
-    return APR_SUCCESS;
-}
-
-/*
- * Build the app_instance parameter passed on the arm_start_application()
- * call. app_instance should be of the form:
- * hostname/PID=pid
- */
-static char* build_app_instance(apr_pool_t *p, server_rec *s, int max_len)
-{
-    char *app_instance;
-    char *pid_str;
-    pid_t pid = getpid();
-    
-    pid_str = apr_itoa(p, pid);
-    app_instance = apr_pstrndup(p,
-                                apr_pstrcat(p, s->server_hostname,"/PID=",pid_str,NULL),
-                                max_len);
-    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, 
-                 "mod_arm: pid: %d app_instance: %s", pid, app_instance);
-    return app_instance;
-}
-
-/* This function is called during server initialisation by each process
- * which can serve a request. 
- */
-static int register_application(apr_pool_t *p, server_rec *s)
-{
-    apr_status_t                    rv;
-    arm_error_t                     arm_rc;
-    server_config_t                 *sconf;
-
-    arm_buffer4_t                   cnbuf; /* context name buf */
-    arm_subbuffer_t                 *subbuf;
-    arm_subbuffer_tran_identity_t   *sb_tran_identity;
-
-    char *app_group;
-    char *app_instance;
-
-    const arm_char_t *attributes[] = {
-        "ServerVersion",
-        "HostInfo",
-        "RemoteAddress",
-        "RemoteUser",
-        "Scheme",
-        "Port",
-        "QueryString",
-        "Protocol",
-        "ServerName"
-    };
-
-    /*
-     * Set up the per process config record to hold the application and transaction
-     * type handles.
-     */
-    sconf = ap_get_module_config(s->module_config, &arm4_module);
-
-    /* Load the ARM4 client library */
-    ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "mod_arm: Loading the ARM4 client library %s", sconf->libname);
-    rv = load_library(p, s, sconf->libname);
-    if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
-                     "mod_arm: Failed to load the ARM4 client library %s. mod_arm4_ap20 is disabled.", 
-                     sconf->libname);
-        module_is_disabled = 1;
-        return OK;
-    }
-
-    ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "mod_arm: Initializing ARM client.");
-
-    /* 
-     * Register application class with arm agent 
-     */
-    arm_rc = ap_arm_register_application(sconf->app_name, ARM_ID_NONE, 
-                                         ARM_FLAG_NONE, ARM_BUF4_NONE,
-                                         &(sconf->app_id));
-    if (arm_rc < 0) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
-                     "mod_arm: arm_register_application() failed with rc = %d. mod_arm4_ap20 is disabled.", 
-                     arm_rc);
-        module_is_disabled = 1;
-        return OK;
-    }
-
-    /* Register the cleanup which calls arm_stop_application() when pconf 
-     * is destroyed 
-     */
-    apr_pool_cleanup_register(p, s, mod_arm4_cleanup, apr_pool_cleanup_null);
-
-    /* Register transaction class with arm agent. Begin by setting up the 
-     * transaction type buffer
-     */
-    sb_tran_identity = apr_pcalloc(p, sizeof(*sb_tran_identity));
-
-    sb_tran_identity->header.format = ARM_SUBBUFFER_TRAN_IDENTITY;
-    sb_tran_identity->identity_property_count = 0;
-    sb_tran_identity->identity_property_array = NULL;
-    sb_tran_identity->context_name_count = 9;
-    sb_tran_identity->context_name_array = &attributes[0];
-    sb_tran_identity->uri = NULL;
-
-    subbuf = (arm_subbuffer_t *) sb_tran_identity;
-    cnbuf.count = 1;
-    cnbuf.subbuffer_array = &subbuf;
-
-    arm_rc = ap_arm_register_transaction(&(sconf->app_id),
-                                         sconf->tran_name,
-                                         ARM_ID_NONE,
-                                         ARM_FLAG_NONE, 
-                                         &cnbuf,
-                                         &(sconf->tran_id));
-    if (arm_rc < 0) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
-                     "mod_arm: arm_register_transaction() failed with rc = %d. mod_arm4_ap20 is disabled", 
-                     arm_rc);
-        module_is_disabled = 1;
-        return OK;
-    }
- 
-    /* Start the application instance
-     */
-    app_group = apr_pstrndup(p,ap_get_server_version(),ARM_PROPERTY_VALUE_MAX_CHARS);
-    app_instance = build_app_instance(p, s, ARM_PROPERTY_VALUE_MAX_CHARS);
-    arm_rc = ap_arm_start_application(&(sconf->app_id),
-                                      app_group,
-                                      app_instance,
-                                      ARM_FLAG_NONE, 
-                                      ARM_BUF4_NONE,
-                                      &(sconf->app_handle));
-    if (arm_rc < 0) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
-                     "mod_arm: arm_start_application() failed with rc = %d. mod_arm4_ap20 is disabled", arm_rc);
-        module_is_disabled = 1;
-        return OK;
-    }
- 
-    ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "mod_arm: ARM client initialized for server %s", 
-                 s->server_hostname);
-
-    return OK;
-}
-static void arm_child_init(apr_pool_t *p, server_rec *s)
-{
-    register_application(p, s);
-}
-
-/*
- * This function gets called to create a per-server configuration
- * record.  It will always be called for the "default" server.
- *
- * The return value is a pointer to the created module-specific
- * structure.
- */
-static void *arm_create_server_config(apr_pool_t *p, server_rec *s)
-{
-    server_config_t *sconf;
-
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, 
-                 "mod_arm: Entering arm_create_server_config()");
-
-    sconf = (server_config_t *) apr_pcalloc(p, sizeof(*sconf));
-    sconf->libname = DEFAULT_ARM4_LIBRARY_NAME;
-    sconf->tran_name = DEFAULT_TRAN_NAME;
-    sconf->app_name = DEFAULT_APP_NAME;
-    return sconf;
-}
-
-/* Create the per-dir config
- */
-static void *arm_create_dir_config(apr_pool_t *p, char *s)
-{
-    dir_config_t *dconf =  apr_pcalloc(p, sizeof (dir_config_t));
-    dconf->instrument_handler = 0;
-    return dconf;
-}
-static void *arm_merge_dir_config(apr_pool_t *p, void *basev, void *addv)
-{
-    dir_config_t *base = (dir_config_t*) basev;
-    dir_config_t *add = (dir_config_t*) addv;
-    dir_config_t *new = apr_pcalloc(p, sizeof(dir_config_t));
-
-    new->instrument_handler = add->instrument_handler;
-    return new;
-}
-
-/*
- * This function is a request pool cleanup to notify the ARM agent
- * the transaction has ended.
- */
-static apr_status_t stop_transaction(void *arg)
-{
-    request_rec *r = (request_rec *) arg;
-    arm_error_t arm_rc;
-    arm_tran_status_t tran_status;
-    request_config_t *rconf;
-
-#if 0
-    /* This check was needed when this code was called during the
-     * logging phase. Leave in for documentation.
-     */
-    if (module_is_disabled) {
-        return DECLINED;
-    }
-#endif
-
-    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);
-
-    if (r->status >= 500) {
-        tran_status = ARM_STATUS_ABORTED;   /* Server errors */
-    }
-    else if (r->status >= 400) {
-        tran_status = ARM_STATUS_FAILED;    /* Client Errors */
-    }
-    else {
-        tran_status = ARM_STATUS_GOOD;      /* No Error */
-    }
-
-    arm_rc = ap_arm_stop_transaction(rconf->tran_handle,
-                                     tran_status,
-                                     0,
-                                     NULL);
-
-    if (arm_rc < 0) {
-        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, 
-                      "mod_arm4: arm_stop_transaction() failed with rc: %x "
-                      "Start handle: %"APR_UINT64_T_HEX_FMT"", arm_rc, rconf->tran_handle);
-    }
-    else {
-        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
-                      "mod_arm4: arm_stop_transaction() handle: %"APR_UINT64_T_HEX_FMT", rc: %x", 
-                      rconf->tran_handle, arm_rc);
-    }
-    return APR_SUCCESS;
-}
-
-/* Record the HTTP request arrival time for use in the arm_start_transaction()
- * call made after all access/auth checks have been made
- */
-static int arm_post_read_request(request_rec *r)
-{
-    request_config_t *rconf;
-
-    if (module_is_disabled) {
-        return DECLINED;
-    }
-
-    /* Set up the per-request config structure */
-    rconf = apr_pcalloc(r->pool, sizeof(*rconf));
-    rconf->sb_arrival_time.header.format = ARM_SUBBUFFER_ARRIVAL_TIME;
-    ap_arm_get_arrival_time(&(rconf->sb_arrival_time.opaque_time));
-
-    ap_set_module_config(r->request_config, &arm4_module, rconf); 
-
-    return DECLINED;
-}
-
-/* ArmLoadLibrary <library name>
- */
-static const char *arm_load_library(cmd_parms *parms, 
-                                    void *dummy, 
-                                    const char *arg)
-{
-    server_config_t *sconf;
-    char *libname;
-    const char *c;
-
-    sconf = ap_get_module_config(parms->server->module_config, &arm4_module);
-    if (!arg) {
-        return "ArmLoadLibrary requires an ARM library name as an argument";
-    }
-    libname = apr_pstrdup(parms->pool, arg);
-
-    c = strrchr(arg, '.');
-#ifdef _AIX
-    /* AIX presents it's shared objects in an archive file. Tweak the libname
-     * argument appropriately 
-     */
-    if (c && !strcasecmp(c, ".a")) {
-#ifdef __64BIT__
-        libname = apr_pstrcat(parms->pool, arg, "(shr_64.o)", NULL);
-#else
-        libname = apr_pstrcat(parms->pool, arg, "(shr.o)", NULL);
-#endif
-    }
-#endif
-
-    sconf->libname = libname;
-    return NULL;
-}
-
-/* ArmTransactionName <name>
- */
-static const char *arm_set_transaction_name(cmd_parms *parms, void *d, const char *arg)
-{
-    server_config_t *sconf = ap_get_module_config(parms->server->module_config, &arm4_module);
-    sconf->tran_name = apr_pstrdup(parms->pool, arg);
-    return NULL;
-}
-
-/* ArmApplicationName <name>
- */
-static const char *arm_set_application_name(cmd_parms *parms, void *d, const char *arg)
-{
-    server_config_t *sconf = ap_get_module_config(parms->server->module_config, &arm4_module);
-    sconf->app_name = apr_pstrdup(parms->pool, arg);
-    return NULL;
-}
-
-/* ArmInstrumentHandler on|off
- */
-static const char *arm_instrument_handler(cmd_parms *parms, void *dconfv, const char *arg)
-{
-    dir_config_t *dconf = (dir_config_t *) dconfv;
-
-    if (!strcasecmp(arg, "on")) {
-        dconf->instrument_handler = 1;
-    }
-    else {
-        dconf->instrument_handler = 0;
-    }
-    return NULL;
-}
-
-static const command_rec arm_commands[] = {
-    AP_INIT_TAKE1("ArmLoadLibrary", arm_load_library, NULL, RSRC_CONF | EXEC_ON_READ,
-      "the name of the ARM4 agent shared library."),
-    AP_INIT_TAKE1("ArmTransactionName", arm_set_transaction_name, NULL, RSRC_CONF | EXEC_ON_READ,
-      "the transaction name registered with the ARM agent. Default: HTTP Request"),
-    AP_INIT_TAKE1("ArmApplicationName", arm_set_application_name, NULL, RSRC_CONF | EXEC_ON_READ,
-      "the application name registered with the the ARM agent. Default: Apache HTTP Server"),
-    AP_INIT_TAKE1("ArmInstrumentHandler", arm_instrument_handler, NULL, RSRC_CONF | ACCESS_CONF,
-      "on|off. ArmInstrumentHandler on causes arm_block|unblock_transaction to be called across content handlers. Default: off"),
-    { NULL }
-};
-void arm_ap_unblock_transaction(const void *vr)
-{
-    arm_error_t arm_rc;
-    request_config_t *rconf;
-    request_rec *r = (request_rec *) vr;
-
-    if (module_is_disabled) {
-        return;
-    }
-
-    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);    
-    if (!rconf) {
-        /* We can hit this case while processing a subrequest. Checking for rconf
-         * NULL is faster check than checking for subrequest
-         */
-        return;
-    }
-    arm_rc = ap_arm_unblock_transaction(rconf->tran_handle, rconf->block_handle, 0, NULL);
-
-    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
-                  "mod_arm4: arm_unblocked_transaction() handle:  %"APR_UINT64_T_HEX_FMT", "     
-                  "block_handle: %"APR_UINT64_T_HEX_FMT", rc: %x",     
-                  rconf->tran_handle, rconf->block_handle, arm_rc);
-
-    return;
-}
-
-/*
- * Begin definition of optional functions. These functions are used to enable a module to
- * interface to the ARM client w/o needing to be responsible for making sure the ARM client
- * library is loaded, initialized, etc.
- */
-void arm_ap_block_transaction(const void *vr)
-{
-    arm_error_t arm_rc;
-    request_rec *r = (request_rec*) vr;
-    request_config_t *rconf;
-    /*    arm_tran_block_handle_t *block_handle = apr_pcalloc(r->pool, sizeof(arm_tran_block_handle_t)); */
-
-    if (module_is_disabled) {
-        return;
-    }
-    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);
-    if (!rconf) {
-        /* We can hit this case while processing a subrequest. Checking for rconf
-         * NULL is faster check than checking for subrequest
-         */
-        return;
-    }
-
-    arm_rc = ap_arm_block_transaction(rconf->tran_handle, 0, NULL, &rconf->block_handle);
-    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
-                  "mod_arm4: arm_block_transaction() handle:  %"APR_UINT64_T_HEX_FMT", "     
-                  "block_handle: %"APR_UINT64_T_HEX_FMT", rc: %x",     
-                  rconf->tran_handle, rconf->block_handle, arm_rc);
-    return;
-}
-
-/* arm_fixups:
- * Call arm_start_transaction() in this hook rather than in post_read_request
- * because RemoteUser is not known until after access/auth checks have been 
- * run.
- */
-static int arm_fixups(request_rec *r)
-{
-    dir_config_t     *dconf;
-    server_config_t  *sconf;
-    request_config_t *rconf;
-    arm_error_t arm_rc;
-    apr_uri_t uri_parts;
-
-    unsigned char *stringified_correlator;
-    const char *stringified_parent_correlator;
-    arm_correlator_t *correlator;
-    arm_correlator_t *parent_correlator;
-
-    const arm_char_t *attribvalues[9];
-    arm_buffer4_t cvbuf;  
-    arm_subbuffer_t *subbuf[2];
-    arm_subbuffer_tran_context_t *sb_tran_values;
-
-    if (module_is_disabled) {
-        return DECLINED;
-    }
-
-    /* Start the request only the first time we see it. If we see it again
-     * after alias or redirect we don't want to start another one. If you'd
-     * rather do classification on the aliased or redirected URL you'll have
-     * to change this.
-     */
-    if (!ap_is_initial_req(r)) {
-        return DECLINED;
-    }
-    sconf = ap_get_module_config(r->server->module_config, &arm4_module);
-
-    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);    
-    if (!rconf) {
-        /* We can hit this case while processing a subrequest. Checking for rconf
-         * NULL is faster check than checking for subrequest
-         */
-        return DECLINED;
-    }
-
-    /* Initialize the arm_subbuffer_tran_context_t
-     */
-    apr_uri_parse(r->pool, ap_construct_url(r->pool,r->uri,r), &uri_parts);
-    attribvalues[0] = apr_pstrdup(r->pool, ap_get_server_version());
-    attribvalues[1] = uri_parts.hostinfo;
-    attribvalues[2] = r->connection->remote_ip;
-    attribvalues[3] = r->user;
-    attribvalues[4] = uri_parts.scheme;
-    attribvalues[5] = apr_psprintf(r->pool, "%u", ap_get_server_port(r));
-    attribvalues[6] = apr_pstrdup(r->pool, r->args); /* Query string */
-    attribvalues[7] = "HTTP 1.1"; /* Protocol */
-    attribvalues[8] = ap_get_server_name(r);
-
-    sb_tran_values = apr_pcalloc(r->pool, sizeof(*sb_tran_values));
-    sb_tran_values->header.format = ARM_SUBBUFFER_TRAN_CONTEXT;
-    sb_tran_values->context_value_count = 9;
-    sb_tran_values->context_value_array = &attribvalues[0];
-    sb_tran_values->uri = r->uri;
-    subbuf[0] = (arm_subbuffer_t *) sb_tran_values;
-
-    /* arm_subbuffer_arrival_time_t was initialized in the post_read_request hook
-     */
-    subbuf[1] = (arm_subbuffer_t *) &rconf->sb_arrival_time;
-
-    cvbuf.count = 2;
-    cvbuf.subbuffer_array = &subbuf[0];
-
-    correlator = (arm_correlator_t *) apr_pcalloc(r->pool, ARM_CORR_MAX_LENGTH);
-
-    /* Check for an ARM_CORRELATOR header field on the inbound request, set the
-     * parent_correlator.
-     */
-    parent_correlator = NULL;
-    stringified_parent_correlator = apr_table_get(r->headers_in, "ARM_CORRELATOR");
-    if (stringified_parent_correlator) {
-        int len;
-
-        /* Do some simple validity checks on the correlator string. Ignore invalid
-         * correlators.
-         */
-        len = strlen(stringified_parent_correlator);
-        if (len > 2*ARM_CORR_MAX_LENGTH) {
-            /* Length error: exceeded max len */
-            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
-                          "mod_arm: Inbound ARM_CORRELATOR failed length check. Length is %d. Correlator: %s ...",
-                          len, apr_pstrndup(r->pool, stringified_parent_correlator, 20));
-        }
-        else if (len % 2) {
-            /* Length error: odd length */
-            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
-                          "mod_arm: Inbound ARM_CORRELATOR failed length check. Correlator contains odd number of characters. Correlator: %s ...",
-                          apr_pstrndup(r->pool, stringified_parent_correlator, 20));
-        }
-        else {
-            len = (len/2);
-            parent_correlator = (arm_correlator_t *) apr_pcalloc(r->pool, ARM_CORR_MAX_LENGTH);
-            destringify((const unsigned char*)stringified_parent_correlator, (unsigned char*) parent_correlator, len);
-            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
-                          "mod_arm: Received ARM_CORRELATOR header field. Correlator: %s ...",
-                          apr_pstrndup(r->pool, stringified_parent_correlator, 20));
-        }
-    }
-
-    /* ARM_FLAG_BIND_THREAD is only valid if the same thread calls 
-     * arm_start_transaction() and arm_stop_transaction(). This assumption
-     * breaks when httpd supports non-blocking event driven or async 
-     * i/o.
-     */
-    arm_rc = ap_arm_start_transaction(sconf->app_handle,
-                                      &(sconf->tran_id),
-                                      parent_correlator,
-                                      ARM_FLAG_BIND_THREAD,
-                                      &cvbuf,
-                                      &rconf->tran_handle,
-                                      correlator);
-    if (arm_rc < 0) {
-        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, 
-                      "mod_arm: arm_start_transaction() failed with rc = %x", arm_rc);
-    }
-    else {
-        /* Register the stop_transaction only if the call to 
-         * start_transaction is successful.
-         */
-        apr_pool_cleanup_register(r->pool, r, stop_transaction, 
-                                  apr_pool_cleanup_null);
-        stringified_correlator = (unsigned char *) apr_pcalloc(r->pool, (2*ARM_CORR_MAX_LENGTH+1));
-        stringify_Correlator(correlator, stringified_correlator);
-    }
-
-    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
-                  "mod_arm4: arm_start_transaction() handle: %"APR_UINT64_T_HEX_FMT", rc: %x\n"
-                  "\tcorrelator: %s\n"
-                  "\tconstructed url: %s\n"
-                  "\tattr::ServerVersion: %s\n"
-                  "\tattr::Hostinfo: %s\n"
-                  "\tattr::RemoteAddress: %s\n"
-                  "\tattr::RemoteUser: %s\n"
-                  "\tattr::Scheme: %s\n"
-                  "\tattr::Port: %s\n"
-                  "\tattr::QueryString: %s\n"
-                  "\tattr::Protocol: %s\n"
-                  "\tattr::ServerName: %s\n",
-                  rconf->tran_handle, arm_rc, 
-                  stringified_correlator, 
-                  ap_construct_url(r->pool, r->uri, r),
-                  attribvalues[0], 
-                  attribvalues[1], 
-                  attribvalues[2], 
-                  attribvalues[3], 
-                  attribvalues[4],
-                  attribvalues[5],
-                  attribvalues[6],
-                  attribvalues[7],
-                  attribvalues[8]);
-
-    /* TODO: Develop config driven or huristic for when to add the ARM_CORRELATOR.
-     * For now, always add the correlator.
-     */
-    apr_table_set(r->headers_in, "ARM_CORRELATOR", (char*) stringified_correlator);
-    apr_table_set(r->err_headers_out, "ARM_CORRELATOR", (char*) stringified_correlator); /* Is this necessary? */
-
-    /* Poor man's way to bracket the call to the handler with
-     * arm_block_transaction()/arm_unblock_transaction() calls. The 
-     * arm_unblock_transaction() is called in the logging phase.  If you
-     * can live with the potential inacuracies with this method, you can
-     * eliminate the need to instrument each and every handler with block/unblock
-     * calls.
-     */
-    dconf = (dir_config_t *) ap_get_module_config(r->per_dir_config, &arm4_module);
-    if (dconf->instrument_handler) {
-        arm_ap_block_transaction(r);
-    }
-    return DECLINED;
-}
-
-/* arm_logger(): poor man's arm_unblock_tranaction()
- * TODO: Consider implementing this call in a simple output filter that
- *       sets high in the stack.
- */
-static int arm_logger(request_rec *r)
-{
-    dir_config_t *dconf;
-
-    if (module_is_disabled) {
-        return DECLINED;
-    }
-    dconf = (dir_config_t *) ap_get_module_config(r->per_dir_config, &arm4_module);
-    if (dconf->instrument_handler) {
-        arm_ap_unblock_transaction(r);
-    }
-    return DECLINED;
-}
-
-
-static void arm_register_hooks(apr_pool_t *p)
-{
-    ap_hook_fixups(arm_fixups, NULL, NULL, APR_HOOK_REALLY_FIRST);
-    ap_hook_log_transaction(arm_logger, NULL, NULL, APR_HOOK_LAST);
-    ap_hook_post_read_request(arm_post_read_request, NULL, NULL, APR_HOOK_MIDDLE);
-    ap_hook_child_init(arm_child_init, NULL, NULL, APR_HOOK_MIDDLE);
-    APR_REGISTER_OPTIONAL_FN(arm_ap_block_transaction);
-    APR_REGISTER_OPTIONAL_FN(arm_ap_unblock_transaction);
-}
-
-module AP_MODULE_DECLARE_DATA ARM_MODULE =
-{
-    STANDARD20_MODULE_STUFF,
-    arm_create_dir_config,      /* per-directory config creator */
-    arm_merge_dir_config,       /* dir config merger */
-    arm_create_server_config,   /* server config creator */
-    NULL,                       /* server config merger */
-    arm_commands,               /* command table */
-    arm_register_hooks,         /* register hooks*/
-};
+/* Copyright 2000-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* INSTRUMENT_HANDLER_HACK
+ * Use arm_fixups and arm_logger as a poor man's way to call 
+ * arm_block_transaction/arm_unblock_transaction across a call to a handler. 
+ * The correct way to instrument block/unblock transactions is to modify 
+ * each handler that sends requests outside the httpd process to call the
+ * optional hooks, arm_ap_block_transaction() and arm_ap_unblock_transaction().
+ * We can selectively turn on the request for block/unblock instrumentation by
+ * setting the ArmInstrumentHandler directive inside  <Directory> or <Location> containers.
+ */
+
+#include "httpd.h"
+#include "http_config.h"
+#include "http_core.h"
+#include "http_log.h"
+#include "http_main.h"
+#include "http_protocol.h"
+#include "util_script.h"
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_base64.h"
+#include "http_request.h"
+
+#include <stdio.h>
+
+#ifdef WIN32
+#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.dll"
+#elif defined(_AIX)
+#ifdef __64BIT__
+#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.a(shr_64.o)"
+#else
+#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.a(shr.o)"
+#endif
+/* End AIX */
+#else
+#define DEFAULT_ARM4_LIBRARY_NAME "libarm4.so"
+#endif
+
+#include "arm4.h"
+
+#if !defined(APR_UINT64_T_HEX_FMT)
+#if defined(LINUX)
+#define APR_UINT64_T_HEX_FMT "llx"
+#elif defined(WIN32)
+#define APR_UINT64_T_HEX_FMT "I64x"
+#endif
+#endif
+
+/*
+ * Define the dynamically loadable API to the ARM client library 
+ */
+APR_DECLARE_OPTIONAL_FN(void, arm_ap_block_transaction, (const void *));
+APR_DECLARE_OPTIONAL_FN(void, arm_ap_unblock_transaction, (const void *));
+
+arm_register_application_t  ap_arm_register_application;
+arm_register_transaction_t  ap_arm_register_transaction;
+arm_register_metric_t       ap_arm_register_metric;
+arm_start_application_t     ap_arm_start_application;
+arm_stop_application_t      ap_arm_stop_application;
+arm_destroy_application_t   ap_arm_destroy_application;
+arm_start_transaction_t     ap_arm_start_transaction;
+arm_stop_transaction_t      ap_arm_stop_transaction;
+arm_update_transaction_t    ap_arm_update_transaction;
+arm_discard_transaction_t   ap_arm_discard_transaction;
+arm_block_transaction_t     ap_arm_block_transaction;
+arm_unblock_transaction_t   ap_arm_unblock_transaction;
+arm_report_transaction_t    ap_arm_report_transaction;
+arm_bind_thread_t           ap_arm_bind_thread;
+arm_unbind_thread_t         ap_arm_unbind_thread;
+arm_generate_correlator_t   ap_arm_generate_correlator;
+arm_get_correlator_length_t ap_arm_get_correlator_length;
+arm_get_correlator_flags_t  ap_arm_get_correlator_flags;
+arm_get_arrival_time_t      ap_arm_get_arrival_time;
+arm_get_error_message_t     ap_arm_get_error_message;
+arm_is_charset_supported_t  ap_arm_is_charset_supported;
+
+/* Module declaration */
+#define ARM_MODULE arm4_module
+module AP_MODULE_DECLARE_DATA ARM_MODULE;
+
+/* Per server config */
+#define DEFAULT_TRAN_NAME "HTTP Request"
+#define DEFAULT_APP_NAME  "Apache HTTP Server"
+typedef struct server_config {
+    arm_id_t app_id;
+    arm_id_t tran_id;
+    arm_app_start_handle_t app_handle;
+    const char* libname;
+
+    char *app_name;
+    char *tran_name;
+} server_config_t;
+
+/* Per dir config */
+typedef struct dir_config {
+    int instrument_handler;
+} dir_config_t;
+
+/* Per request config */
+typedef struct request_config {
+    arm_tran_start_handle_t   tran_handle;
+    arm_tran_block_handle_t   block_handle;
+    arm_subbuffer_arrival_time_t sb_arrival_time;
+} request_config_t;
+
+static int module_is_disabled = 0;
+
+/* 
+ * Convert binary data into a hex string.
+ * in  - Input data in binary format.  It's length must be len+1.
+ * out - Output data in Hex String.  It must be pre-allocated.
+ *       It's length must be at least len*2+1.
+ * len - The amount of Byte that are going to be converted.
+ */
+static void stringify(unsigned char *in, unsigned char *out, int len)
+{
+    int i;
+    char to_hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
+                      '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', } ;
+
+    for(i=0; i<len;i++) {
+        out[2*i] = to_hex[(in[i]>>4) & 0x0f];
+        out[1+2*i] = to_hex[in[i] & 0x0f];
+    }
+
+    out[2*len] = '\0';
+}
+
+/*
+ * Convert hex String into binary data.
+ * in  - Input data in Hex String.  It's length must be len*2+1.
+ * out - Output data in binary.  It must be pre-allocated.  It's length must be
+ *       at least len+1.
+ * len - len*2+1 will be the number of byte converted.
+ */
+static void destringify(const unsigned char *in, unsigned char *out, int orig_len)
+{
+    int len=0;
+    int i;
+    int maxlen = orig_len * 2 + 1;
+
+    while((in[len] != '\0') && isxdigit(in[len]) && (len < maxlen)) {
+        len++;
+    }
+
+    /*
+     * if (in[len] != '\0') at this point we're ignoring trailing non xdigit chars
+     * also, len should be even, but we're not checking ...
+     */
+    for(i=0;i<(len/2);i++) {
+        if(isdigit(in[2*i])) {
+            if(isdigit(in[1+2*i])) {
+                out[i] = ((in[2*i]-'0')<<4)|(0x0f & (in[1+2*i]-'0'));
+            }
+            else  {
+                out[i] = ((in[2*i]-'0')<<4)|(0x0f & (10+toupper(in[1+2*i])-'A'));
+            }
+        }
+        else {
+            if(isdigit(in[1+2*i])) {
+                out[i] = ((10+toupper(in[2*i])-'A')<<4)|(0x0f & (in[1+2*i]-'0'));
+            }
+            else {
+                out[i] = ((10+toupper(in[2*i])-'A')<<4) |
+                  (0x0f & (10+toupper(in[1+2*i])-'A'));
+            }
+        }
+    }
+}
+
+/*
+ *   This is to change the correlator into a string so it can be passed
+ *   in the request header to a downstream application.(Inefficient version)
+ *
+ *   Note: arm_correlator_get_length(corr_out) should be at least
+ *         2*arm_correlator_get_length(corr_in)+1
+ */
+static void stringify_Correlator(arm_correlator_t* corr_in, unsigned char* corr_out)
+{
+    unsigned char *in;
+    arm_correlator_length_t len = 0;
+    ap_arm_get_correlator_length(corr_in, &len);
+    in = (unsigned char *)corr_in;
+
+    stringify(in, corr_out, len);
+}
+
+/*
+ * pconf pool cleanup
+ */
+static apr_status_t mod_arm4_cleanup(void *dv)
+{
+    server_config_t *sconf;
+    server_rec *s = dv;
+    char *sname = s->server_hostname;
+    arm_error_t arm_rc;
+
+    sconf = ap_get_module_config(s->module_config, &arm4_module);
+    /* End the Application for this process */
+    arm_rc = ap_arm_stop_application(sconf->app_handle, 0, NULL);
+    if (arm_rc < 0) {
+        ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, 
+                     "mod_arm: arm_end_application failed with rc = %d", arm_rc);
+    }
+
+    return APR_SUCCESS;
+}
+
+#define LOAD_SYMBOL(symbol) \
+{ \
+   rv = apr_dso_sym((void**)&ap_##symbol,libhandle,#symbol); \
+   if (rv != APR_SUCCESS)  { \
+      ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "Failed to load symbol %s in library %s", #symbol, libname);  \
+      return rv; \
+    } \
+}
+static apr_status_t load_library(apr_pool_t *p, server_rec *s, const char *libname)
+{
+    apr_status_t rv;
+    apr_dso_handle_t *libhandle;
+
+    rv = apr_dso_load(&libhandle, libname, p);
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, "Failed to load library %s", libname);
+        return rv;
+    }
+
+    LOAD_SYMBOL(arm_register_application);
+    LOAD_SYMBOL(arm_register_transaction);
+    LOAD_SYMBOL(arm_register_metric);
+
+    LOAD_SYMBOL(arm_start_application);
+    LOAD_SYMBOL(arm_stop_application);
+    LOAD_SYMBOL(arm_destroy_application)
+
+    LOAD_SYMBOL(arm_start_transaction);
+    LOAD_SYMBOL(arm_stop_transaction);
+    LOAD_SYMBOL(arm_update_transaction);
+    LOAD_SYMBOL(arm_discard_transaction);
+    LOAD_SYMBOL(arm_block_transaction);
+    LOAD_SYMBOL(arm_unblock_transaction);
+    LOAD_SYMBOL(arm_report_transaction);
+
+    LOAD_SYMBOL(arm_bind_thread);
+    LOAD_SYMBOL(arm_unbind_thread);
+
+    LOAD_SYMBOL(arm_generate_correlator);
+    LOAD_SYMBOL(arm_get_correlator_length);
+    LOAD_SYMBOL(arm_get_correlator_flags);
+
+    LOAD_SYMBOL(arm_get_arrival_time);
+    LOAD_SYMBOL(arm_get_error_message);
+    LOAD_SYMBOL(arm_is_charset_supported);
+
+    /* Register a cleanup against the open handle */
+
+    return APR_SUCCESS;
+}
+
+/*
+ * Build the app_instance parameter passed on the arm_start_application()
+ * call. app_instance should be of the form:
+ * hostname/PID=pid
+ */
+static char* build_app_instance(apr_pool_t *p, server_rec *s, int max_len)
+{
+    char *app_instance;
+    char *pid_str;
+    pid_t pid = getpid();
+    
+    pid_str = apr_itoa(p, pid);
+    app_instance = apr_pstrndup(p,
+                                apr_pstrcat(p, s->server_hostname,"/PID=",pid_str,NULL),
+                                max_len);
+    ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, 
+                 "mod_arm: pid: %d app_instance: %s", pid, app_instance);
+    return app_instance;
+}
+
+/* This function is called during server initialisation by each process
+ * which can serve a request. 
+ */
+static int register_application(apr_pool_t *p, server_rec *s)
+{
+    apr_status_t                    rv;
+    arm_error_t                     arm_rc;
+    server_config_t                 *sconf;
+
+    arm_buffer4_t                   cnbuf; /* context name buf */
+    arm_subbuffer_t                 *subbuf;
+    arm_subbuffer_tran_identity_t   *sb_tran_identity;
+
+    char *app_group;
+    char *app_instance;
+
+    const arm_char_t *attributes[] = {
+        "ServerVersion",
+        "HostInfo",
+        "RemoteAddress",
+        "RemoteUser",
+        "Scheme",
+        "Port",
+        "QueryString",
+        "Protocol",
+        "ServerName"
+    };
+
+    /*
+     * Set up the per process config record to hold the application and transaction
+     * type handles.
+     */
+    sconf = ap_get_module_config(s->module_config, &arm4_module);
+
+    /* Load the ARM4 client library */
+    ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "mod_arm: Loading the ARM4 client library %s", sconf->libname);
+    rv = load_library(p, s, sconf->libname);
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
+                     "mod_arm: Failed to load the ARM4 client library %s. mod_arm4_ap20 is disabled.", 
+                     sconf->libname);
+        module_is_disabled = 1;
+        return OK;
+    }
+
+    ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "mod_arm: Initializing ARM client.");
+
+    /* 
+     * Register application class with arm agent 
+     */
+    arm_rc = ap_arm_register_application(sconf->app_name, ARM_ID_NONE, 
+                                         ARM_FLAG_NONE, ARM_BUF4_NONE,
+                                         &(sconf->app_id));
+    if (arm_rc < 0) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
+                     "mod_arm: arm_register_application() failed with rc = %d. mod_arm4_ap20 is disabled.", 
+                     arm_rc);
+        module_is_disabled = 1;
+        return OK;
+    }
+
+    /* Register the cleanup which calls arm_stop_application() when pconf 
+     * is destroyed 
+     */
+    apr_pool_cleanup_register(p, s, mod_arm4_cleanup, apr_pool_cleanup_null);
+
+    /* Register transaction class with arm agent. Begin by setting up the 
+     * transaction type buffer
+     */
+    sb_tran_identity = apr_pcalloc(p, sizeof(*sb_tran_identity));
+
+    sb_tran_identity->header.format = ARM_SUBBUFFER_TRAN_IDENTITY;
+    sb_tran_identity->identity_property_count = 0;
+    sb_tran_identity->identity_property_array = NULL;
+    sb_tran_identity->context_name_count = 9;
+    sb_tran_identity->context_name_array = &attributes[0];
+    sb_tran_identity->uri = NULL;
+
+    subbuf = (arm_subbuffer_t *) sb_tran_identity;
+    cnbuf.count = 1;
+    cnbuf.subbuffer_array = &subbuf;
+
+    arm_rc = ap_arm_register_transaction(&(sconf->app_id),
+                                         sconf->tran_name,
+                                         ARM_ID_NONE,
+                                         ARM_FLAG_NONE, 
+                                         &cnbuf,
+                                         &(sconf->tran_id));
+    if (arm_rc < 0) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
+                     "mod_arm: arm_register_transaction() failed with rc = %d. mod_arm4_ap20 is disabled", 
+                     arm_rc);
+        module_is_disabled = 1;
+        return OK;
+    }
+ 
+    /* Start the application instance
+     */
+    app_group = apr_pstrndup(p,ap_get_server_version(),ARM_PROPERTY_VALUE_MAX_CHARS);
+    app_instance = build_app_instance(p, s, ARM_PROPERTY_VALUE_MAX_CHARS);
+    arm_rc = ap_arm_start_application(&(sconf->app_id),
+                                      app_group,
+                                      app_instance,
+                                      ARM_FLAG_NONE, 
+                                      ARM_BUF4_NONE,
+                                      &(sconf->app_handle));
+    if (arm_rc < 0) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, 
+                     "mod_arm: arm_start_application() failed with rc = %d. mod_arm4_ap20 is disabled", arm_rc);
+        module_is_disabled = 1;
+        return OK;
+    }
+ 
+    ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "mod_arm: ARM client initialized for server %s", 
+                 s->server_hostname);
+
+    return OK;
+}
+static void arm_child_init(apr_pool_t *p, server_rec *s)
+{
+    register_application(p, s);
+}
+
+/*
+ * This function gets called to create a per-server configuration
+ * record.  It will always be called for the "default" server.
+ *
+ * The return value is a pointer to the created module-specific
+ * structure.
+ */
+static void *arm_create_server_config(apr_pool_t *p, server_rec *s)
+{
+    server_config_t *sconf;
+
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, 
+                 "mod_arm: Entering arm_create_server_config()");
+
+    sconf = (server_config_t *) apr_pcalloc(p, sizeof(*sconf));
+    sconf->libname = DEFAULT_ARM4_LIBRARY_NAME;
+    sconf->tran_name = DEFAULT_TRAN_NAME;
+    sconf->app_name = DEFAULT_APP_NAME;
+    return sconf;
+}
+
+/* Create the per-dir config
+ */
+static void *arm_create_dir_config(apr_pool_t *p, char *s)
+{
+    dir_config_t *dconf =  apr_pcalloc(p, sizeof (dir_config_t));
+    dconf->instrument_handler = 0;
+    return dconf;
+}
+static void *arm_merge_dir_config(apr_pool_t *p, void *basev, void *addv)
+{
+    dir_config_t *base = (dir_config_t*) basev;
+    dir_config_t *add = (dir_config_t*) addv;
+    dir_config_t *new = apr_pcalloc(p, sizeof(dir_config_t));
+
+    new->instrument_handler = add->instrument_handler;
+    return new;
+}
+
+/*
+ * This function is a request pool cleanup to notify the ARM agent
+ * the transaction has ended.
+ */
+static apr_status_t stop_transaction(void *arg)
+{
+    request_rec *r = (request_rec *) arg;
+    arm_error_t arm_rc;
+    arm_tran_status_t tran_status;
+    request_config_t *rconf;
+
+#if 0
+    /* This check was needed when this code was called during the
+     * logging phase. Leave in for documentation.
+     */
+    if (module_is_disabled) {
+        return DECLINED;
+    }
+#endif
+
+    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);
+
+    if (r->status >= 500) {
+        tran_status = ARM_STATUS_ABORTED;   /* Server errors */
+    }
+    else if (r->status >= 400) {
+        tran_status = ARM_STATUS_FAILED;    /* Client Errors */
+    }
+    else {
+        tran_status = ARM_STATUS_GOOD;      /* No Error */
+    }
+
+    arm_rc = ap_arm_stop_transaction(rconf->tran_handle,
+                                     tran_status,
+                                     0,
+                                     NULL);
+
+    if (arm_rc < 0) {
+        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, 
+                      "mod_arm4: arm_stop_transaction() failed with rc: %x "
+                      "Start handle: %"APR_UINT64_T_HEX_FMT"", arm_rc, rconf->tran_handle);
+    }
+    else {
+        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
+                      "mod_arm4: arm_stop_transaction() handle: %"APR_UINT64_T_HEX_FMT", rc: %x", 
+                      rconf->tran_handle, arm_rc);
+    }
+    return APR_SUCCESS;
+}
+
+/* Record the HTTP request arrival time for use in the arm_start_transaction()
+ * call made after all access/auth checks have been made
+ */
+static int arm_post_read_request(request_rec *r)
+{
+    request_config_t *rconf;
+
+    if (module_is_disabled) {
+        return DECLINED;
+    }
+
+    /* Set up the per-request config structure */
+    rconf = apr_pcalloc(r->pool, sizeof(*rconf));
+    rconf->sb_arrival_time.header.format = ARM_SUBBUFFER_ARRIVAL_TIME;
+    ap_arm_get_arrival_time(&(rconf->sb_arrival_time.opaque_time));
+
+    ap_set_module_config(r->request_config, &arm4_module, rconf); 
+
+    return DECLINED;
+}
+
+/* ArmLoadLibrary <library name>
+ */
+static const char *arm_load_library(cmd_parms *parms, 
+                                    void *dummy, 
+                                    const char *arg)
+{
+    server_config_t *sconf;
+    char *libname;
+    const char *c;
+
+    sconf = ap_get_module_config(parms->server->module_config, &arm4_module);
+    if (!arg) {
+        return "ArmLoadLibrary requires an ARM library name as an argument";
+    }
+    libname = apr_pstrdup(parms->pool, arg);
+
+    c = strrchr(arg, '.');
+#ifdef _AIX
+    /* AIX presents it's shared objects in an archive file. Tweak the libname
+     * argument appropriately 
+     */
+    if (c && !strcasecmp(c, ".a")) {
+#ifdef __64BIT__
+        libname = apr_pstrcat(parms->pool, arg, "(shr_64.o)", NULL);
+#else
+        libname = apr_pstrcat(parms->pool, arg, "(shr.o)", NULL);
+#endif
+    }
+#endif
+
+    sconf->libname = libname;
+    return NULL;
+}
+
+/* ArmTransactionName <name>
+ */
+static const char *arm_set_transaction_name(cmd_parms *parms, void *d, const char *arg)
+{
+    server_config_t *sconf = ap_get_module_config(parms->server->module_config, &arm4_module);
+    sconf->tran_name = apr_pstrdup(parms->pool, arg);
+    return NULL;
+}
+
+/* ArmApplicationName <name>
+ */
+static const char *arm_set_application_name(cmd_parms *parms, void *d, const char *arg)
+{
+    server_config_t *sconf = ap_get_module_config(parms->server->module_config, &arm4_module);
+    sconf->app_name = apr_pstrdup(parms->pool, arg);
+    return NULL;
+}
+
+/* ArmInstrumentHandler on|off
+ */
+static const char *arm_instrument_handler(cmd_parms *parms, void *dconfv, const char *arg)
+{
+    dir_config_t *dconf = (dir_config_t *) dconfv;
+
+    if (!strcasecmp(arg, "on")) {
+        dconf->instrument_handler = 1;
+    }
+    else {
+        dconf->instrument_handler = 0;
+    }
+    return NULL;
+}
+
+static const command_rec arm_commands[] = {
+    AP_INIT_TAKE1("ArmLoadLibrary", arm_load_library, NULL, RSRC_CONF | EXEC_ON_READ,
+      "the name of the ARM4 agent shared library."),
+    AP_INIT_TAKE1("ArmTransactionName", arm_set_transaction_name, NULL, RSRC_CONF | EXEC_ON_READ,
+      "the transaction name registered with the ARM agent. Default: HTTP Request"),
+    AP_INIT_TAKE1("ArmApplicationName", arm_set_application_name, NULL, RSRC_CONF | EXEC_ON_READ,
+      "the application name registered with the the ARM agent. Default: Apache HTTP Server"),
+    AP_INIT_TAKE1("ArmInstrumentHandler", arm_instrument_handler, NULL, RSRC_CONF | ACCESS_CONF,
+      "on|off. ArmInstrumentHandler on causes arm_block|unblock_transaction to be called across content handlers. Default: off"),
+    { NULL }
+};
+void arm_ap_unblock_transaction(const void *vr)
+{
+    arm_error_t arm_rc;
+    request_config_t *rconf;
+    request_rec *r = (request_rec *) vr;
+
+    if (module_is_disabled) {
+        return;
+    }
+
+    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);    
+    if (!rconf) {
+        /* We can hit this case while processing a subrequest. Checking for rconf
+         * NULL is faster check than checking for subrequest
+         */
+        return;
+    }
+    arm_rc = ap_arm_unblock_transaction(rconf->tran_handle, rconf->block_handle, 0, NULL);
+
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                  "mod_arm4: arm_unblocked_transaction() handle:  %"APR_UINT64_T_HEX_FMT", "     
+                  "block_handle: %"APR_UINT64_T_HEX_FMT", rc: %x",     
+                  rconf->tran_handle, rconf->block_handle, arm_rc);
+
+    return;
+}
+
+/*
+ * Begin definition of optional functions. These functions are used to enable a module to
+ * interface to the ARM client w/o needing to be responsible for making sure the ARM client
+ * library is loaded, initialized, etc.
+ */
+void arm_ap_block_transaction(const void *vr)
+{
+    arm_error_t arm_rc;
+    request_rec *r = (request_rec*) vr;
+    request_config_t *rconf;
+    /*    arm_tran_block_handle_t *block_handle = apr_pcalloc(r->pool, sizeof(arm_tran_block_handle_t)); */
+
+    if (module_is_disabled) {
+        return;
+    }
+    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);
+    if (!rconf) {
+        /* We can hit this case while processing a subrequest. Checking for rconf
+         * NULL is faster check than checking for subrequest
+         */
+        return;
+    }
+
+    arm_rc = ap_arm_block_transaction(rconf->tran_handle, 0, NULL, &rconf->block_handle);
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                  "mod_arm4: arm_block_transaction() handle:  %"APR_UINT64_T_HEX_FMT", "     
+                  "block_handle: %"APR_UINT64_T_HEX_FMT", rc: %x",     
+                  rconf->tran_handle, rconf->block_handle, arm_rc);
+    return;
+}
+
+/* arm_fixups:
+ * Call arm_start_transaction() in this hook rather than in post_read_request
+ * because RemoteUser is not known until after access/auth checks have been 
+ * run.
+ */
+static int arm_fixups(request_rec *r)
+{
+    dir_config_t     *dconf;
+    server_config_t  *sconf;
+    request_config_t *rconf;
+    arm_error_t arm_rc;
+    apr_uri_t uri_parts;
+
+    unsigned char *stringified_correlator;
+    const char *stringified_parent_correlator;
+    arm_correlator_t *correlator;
+    arm_correlator_t *parent_correlator;
+
+    const arm_char_t *attribvalues[9];
+    arm_buffer4_t cvbuf;  
+    arm_subbuffer_t *subbuf[2];
+    arm_subbuffer_tran_context_t *sb_tran_values;
+
+    if (module_is_disabled) {
+        return DECLINED;
+    }
+
+    /* Start the request only the first time we see it. If we see it again
+     * after alias or redirect we don't want to start another one. If you'd
+     * rather do classification on the aliased or redirected URL you'll have
+     * to change this.
+     */
+    if (!ap_is_initial_req(r)) {
+        return DECLINED;
+    }
+    sconf = ap_get_module_config(r->server->module_config, &arm4_module);
+
+    rconf = (request_config_t *) ap_get_module_config(r->request_config, &arm4_module);    
+    if (!rconf) {
+        /* We can hit this case while processing a subrequest. Checking for rconf
+         * NULL is faster check than checking for subrequest
+         */
+        return DECLINED;
+    }
+
+    /* Initialize the arm_subbuffer_tran_context_t
+     */
+    apr_uri_parse(r->pool, ap_construct_url(r->pool,r->uri,r), &uri_parts);
+    attribvalues[0] = apr_pstrdup(r->pool, ap_get_server_version());
+    attribvalues[1] = uri_parts.hostinfo;
+    attribvalues[2] = r->connection->remote_ip;
+    attribvalues[3] = r->user;
+    attribvalues[4] = uri_parts.scheme;
+    attribvalues[5] = apr_psprintf(r->pool, "%u", ap_get_server_port(r));
+    attribvalues[6] = apr_pstrdup(r->pool, r->args); /* Query string */
+    attribvalues[7] = "HTTP 1.1"; /* Protocol */
+    attribvalues[8] = ap_get_server_name(r);
+
+    sb_tran_values = apr_pcalloc(r->pool, sizeof(*sb_tran_values));
+    sb_tran_values->header.format = ARM_SUBBUFFER_TRAN_CONTEXT;
+    sb_tran_values->context_value_count = 9;
+    sb_tran_values->context_value_array = &attribvalues[0];
+    sb_tran_values->uri = r->uri;
+    subbuf[0] = (arm_subbuffer_t *) sb_tran_values;
+
+    /* arm_subbuffer_arrival_time_t was initialized in the post_read_request hook
+     */
+    subbuf[1] = (arm_subbuffer_t *) &rconf->sb_arrival_time;
+
+    cvbuf.count = 2;
+    cvbuf.subbuffer_array = &subbuf[0];
+
+    correlator = (arm_correlator_t *) apr_pcalloc(r->pool, ARM_CORR_MAX_LENGTH);
+
+    /* Check for an ARM_CORRELATOR header field on the inbound request, set the
+     * parent_correlator.
+     */
+    parent_correlator = NULL;
+    stringified_parent_correlator = apr_table_get(r->headers_in, "ARM_CORRELATOR");
+    if (stringified_parent_correlator) {
+        int len;
+
+        /* Do some simple validity checks on the correlator string. Ignore invalid
+         * correlators.
+         */
+        len = strlen(stringified_parent_correlator);
+        if (len > 2*ARM_CORR_MAX_LENGTH) {
+            /* Length error: exceeded max len */
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+                          "mod_arm: Inbound ARM_CORRELATOR failed length check. Length is %d. Correlator: %s ...",
+                          len, apr_pstrndup(r->pool, stringified_parent_correlator, 20));
+        }
+        else if (len % 2) {
+            /* Length error: odd length */
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+                          "mod_arm: Inbound ARM_CORRELATOR failed length check. Correlator contains odd number of characters. Correlator: %s ...",
+                          apr_pstrndup(r->pool, stringified_parent_correlator, 20));
+        }
+        else {
+            len = (len/2);
+            parent_correlator = (arm_correlator_t *) apr_pcalloc(r->pool, ARM_CORR_MAX_LENGTH);
+            destringify((const unsigned char*)stringified_parent_correlator, (unsigned char*) parent_correlator, len);
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                          "mod_arm: Received ARM_CORRELATOR header field. Correlator: %s ...",
+                          apr_pstrndup(r->pool, stringified_parent_correlator, 20));
+        }
+    }
+
+    /* ARM_FLAG_BIND_THREAD is only valid if the same thread calls 
+     * arm_start_transaction() and arm_stop_transaction(). This assumption
+     * breaks when httpd supports non-blocking event driven or async 
+     * i/o.
+     */
+    arm_rc = ap_arm_start_transaction(sconf->app_handle,
+                                      &(sconf->tran_id),
+                                      parent_correlator,
+                                      ARM_FLAG_BIND_THREAD,
+                                      &cvbuf,
+                                      &rconf->tran_handle,
+                                      correlator);
+    if (arm_rc < 0) {
+        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, 
+                      "mod_arm: arm_start_transaction() failed with rc = %x", arm_rc);
+    }
+    else {
+        /* Register the stop_transaction only if the call to 
+         * start_transaction is successful.
+         */
+        apr_pool_cleanup_register(r->pool, r, stop_transaction, 
+                                  apr_pool_cleanup_null);
+        stringified_correlator = (unsigned char *) apr_pcalloc(r->pool, (2*ARM_CORR_MAX_LENGTH+1));
+        stringify_Correlator(correlator, stringified_correlator);
+    }
+
+    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+                  "mod_arm4: arm_start_transaction() handle: %"APR_UINT64_T_HEX_FMT", rc: %x\n"
+                  "\tcorrelator: %s\n"
+                  "\tconstructed url: %s\n"
+                  "\tattr::ServerVersion: %s\n"
+                  "\tattr::Hostinfo: %s\n"
+                  "\tattr::RemoteAddress: %s\n"
+                  "\tattr::RemoteUser: %s\n"
+                  "\tattr::Scheme: %s\n"
+                  "\tattr::Port: %s\n"
+                  "\tattr::QueryString: %s\n"
+                  "\tattr::Protocol: %s\n"
+                  "\tattr::ServerName: %s\n",
+                  rconf->tran_handle, arm_rc, 
+                  stringified_correlator, 
+                  ap_construct_url(r->pool, r->uri, r),
+                  attribvalues[0], 
+                  attribvalues[1], 
+                  attribvalues[2], 
+                  attribvalues[3], 
+                  attribvalues[4],
+                  attribvalues[5],
+                  attribvalues[6],
+                  attribvalues[7],
+                  attribvalues[8]);
+
+    /* TODO: Develop config driven or huristic for when to add the ARM_CORRELATOR.
+     * For now, always add the correlator.
+     */
+    apr_table_set(r->headers_in, "ARM_CORRELATOR", (char*) stringified_correlator);
+    apr_table_set(r->err_headers_out, "ARM_CORRELATOR", (char*) stringified_correlator); /* Is this necessary? */
+
+    /* Poor man's way to bracket the call to the handler with
+     * arm_block_transaction()/arm_unblock_transaction() calls. The 
+     * arm_unblock_transaction() is called in the logging phase.  If you
+     * can live with the potential inacuracies with this method, you can
+     * eliminate the need to instrument each and every handler with block/unblock
+     * calls.
+     */
+    dconf = (dir_config_t *) ap_get_module_config(r->per_dir_config, &arm4_module);
+    if (dconf->instrument_handler) {
+        arm_ap_block_transaction(r);
+    }
+    return DECLINED;
+}
+
+/* arm_logger(): poor man's arm_unblock_tranaction()
+ * TODO: Consider implementing this call in a simple output filter that
+ *       sets high in the stack.
+ */
+static int arm_logger(request_rec *r)
+{
+    dir_config_t *dconf;
+
+    if (module_is_disabled) {
+        return DECLINED;
+    }
+    dconf = (dir_config_t *) ap_get_module_config(r->per_dir_config, &arm4_module);
+    if (dconf->instrument_handler) {
+        arm_ap_unblock_transaction(r);
+    }
+    return DECLINED;
+}
+
+
+static void arm_register_hooks(apr_pool_t *p)
+{
+    ap_hook_fixups(arm_fixups, NULL, NULL, APR_HOOK_REALLY_FIRST);
+    ap_hook_log_transaction(arm_logger, NULL, NULL, APR_HOOK_LAST);
+    ap_hook_post_read_request(arm_post_read_request, NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_child_init(arm_child_init, NULL, NULL, APR_HOOK_MIDDLE);
+    APR_REGISTER_OPTIONAL_FN(arm_ap_block_transaction);
+    APR_REGISTER_OPTIONAL_FN(arm_ap_unblock_transaction);
+}
+
+module AP_MODULE_DECLARE_DATA ARM_MODULE =
+{
+    STANDARD20_MODULE_STUFF,
+    arm_create_dir_config,      /* per-directory config creator */
+    arm_merge_dir_config,       /* dir config merger */
+    arm_create_server_config,   /* server config creator */
+    NULL,                       /* server config merger */
+    arm_commands,               /* command table */
+    arm_register_hooks,         /* register hooks*/
+};

Modified: httpd/mod_arm4/trunk/mod_arm4.dsp
Url: http://svn.apache.org/viewcvs/httpd/mod_arm4/trunk/mod_arm4.dsp?view=diff&rev=109477&p1=httpd/mod_arm4/trunk/mod_arm4.dsp&r1=109476&p2=httpd/mod_arm4/trunk/mod_arm4.dsp&r2=109477
==============================================================================
--- httpd/mod_arm4/trunk/mod_arm4.dsp	(original)
+++ httpd/mod_arm4/trunk/mod_arm4.dsp	Thu Dec  2 00:34:11 2004
@@ -1,121 +1,121 @@
-# Microsoft Developer Studio Project File - Name="mod_arm4" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mod_arm4 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "mod_arm4.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "mod_arm4.mak" CFG="mod_arm4 - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "mod_arm4 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mod_arm4 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "mod_arm4 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "c:\apache2\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 c:\apache2\lib\libapr.lib c:\apache2\lib\libhttpd.lib c:\apache2\lib\libaprutil.lib /nologo /dll /map /machine:I386 /out:"Release/mod_arm4.so"
-
-!ELSEIF  "$(CFG)" == "mod_arm4 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm- /GX /Zi /Od /I "c:\apache2\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 c:\apache2\lib\libapr.lib c:\apache2\lib\libhttpd.lib c:\apache2\lib\libaprutil.lib /nologo /dll /map /debug /machine:I386 /out:"Debug/mod_arm4.so" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "mod_arm4 - Win32 Release"
-# Name "mod_arm4 - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mod_arm4.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\arm4.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\arm4dyn.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\arm4os.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="mod_arm4" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=mod_arm4 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "mod_arm4.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "mod_arm4.mak" CFG="mod_arm4 - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "mod_arm4 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "mod_arm4 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "mod_arm4 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "c:\apache2\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 c:\apache2\lib\libapr.lib c:\apache2\lib\libhttpd.lib c:\apache2\lib\libaprutil.lib /nologo /dll /map /machine:I386 /out:"Release/mod_arm4.so"
+
+!ELSEIF  "$(CFG)" == "mod_arm4 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm- /GX /Zi /Od /I "c:\apache2\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MOD_ARM4_EXPORTS" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 c:\apache2\lib\libapr.lib c:\apache2\lib\libhttpd.lib c:\apache2\lib\libaprutil.lib /nologo /dll /map /debug /machine:I386 /out:"Debug/mod_arm4.so" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "mod_arm4 - Win32 Release"
+# Name "mod_arm4 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\mod_arm4.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\arm4.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\arm4dyn.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\arm4os.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Mime
View raw message