axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r580289 [19/20] - in /webservices/axis2/trunk/c: guththila/include/ guththila/samples/ guththila/src/ guththila/tests/ neethi/include/ neethi/src/ neethi/src/secpolicy/builder/ neethi/src/secpolicy/model/ neethi/test/ samples/client/echo/ s...
Date Fri, 28 Sep 2007 10:29:43 GMT
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/session.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/session.c?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/session.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/session.c Fri Sep 28 03:29:16 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -35,12 +36,12 @@
     tcpmon_session_t session;
     int listen_port;
     int target_port;
-	int test_bit;
+    int test_bit;
     int format_bit;
     axis2_char_t *target_host;
     TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct;
     TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct;
-    axutil_array_list_t* entries;
+    axutil_array_list_t *entries;
 
     axis2_bool_t is_running;
 }
@@ -48,8 +49,8 @@
 
 typedef struct tcpmon_session_server_thread_data
 {
-    tcpmon_session_impl_t* session_impl;
-    const axutil_env_t* env;
+    tcpmon_session_impl_t *session_impl;
+    const axutil_env_t *env;
 }
 tcpmon_session_server_thread_data_t;
 
@@ -58,116 +59,121 @@
 
 /************************* Function prototypes ********************************/
 
-axis2_status_t AXIS2_CALL
-tcpmon_session_free(tcpmon_session_t *session,
-        const axutil_env_t *env);
-
-axis2_status_t AXIS2_CALL
-tcpmon_session_set_listen_port(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        int listen_port);
-
-int AXIS2_CALL
-tcpmon_session_get_listen_port(tcpmon_session_t *session,
-        const axutil_env_t *env);
-
-axis2_status_t AXIS2_CALL
-tcpmon_session_set_target_port(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        int target_port);
-
-int AXIS2_CALL
-tcpmon_session_get_target_port(tcpmon_session_t *session,
-        const axutil_env_t *env);
-
-axis2_status_t AXIS2_CALL
-tcpmon_session_set_target_host(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        axis2_char_t* target_host);
-
-axis2_char_t* AXIS2_CALL
-tcpmon_session_get_target_host(tcpmon_session_t *session,
-        const axutil_env_t *env);
-
-axis2_status_t AXIS2_CALL
-tcpmon_session_start(tcpmon_session_t *session,
-        const axutil_env_t *env);
-
-axis2_status_t AXIS2_CALL
-tcpmon_session_stop(tcpmon_session_t *session,
-        const axutil_env_t *env);
-
-axis2_status_t AXIS2_CALL
-tcpmon_session_on_new_entry(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct);
-
-axis2_status_t AXIS2_CALL
-tcpmon_session_on_trans_fault(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct);
-
-int AXIS2_CALL
-tcpmon_session_get_test_bit (tcpmon_session_t *session,
-									  const axutil_env_t *env);
-
-int AXIS2_CALL
-tcpmon_session_set_test_bit (tcpmon_session_t *session,
-									  const axutil_env_t *env,
-									  int test_bit);
-
-int AXIS2_CALL
-tcpmon_session_get_format_bit (tcpmon_session_t *session,
-                                      const axutil_env_t *env);
-                                      
-int AXIS2_CALL 
-tcpmon_session_set_format_bit(tcpmon_session_t *session,
-                                      const axutil_env_t *env,
-                                      int format_bit);
+axis2_status_t AXIS2_CALL tcpmon_session_free(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+axis2_status_t AXIS2_CALL tcpmon_session_set_listen_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int listen_port);
+
+int AXIS2_CALL tcpmon_session_get_listen_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+axis2_status_t AXIS2_CALL tcpmon_session_set_target_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int target_port);
+
+int AXIS2_CALL tcpmon_session_get_target_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+axis2_status_t AXIS2_CALL tcpmon_session_set_target_host(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    axis2_char_t * target_host);
+
+axis2_char_t *AXIS2_CALL tcpmon_session_get_target_host(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+axis2_status_t AXIS2_CALL tcpmon_session_start(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+axis2_status_t AXIS2_CALL tcpmon_session_stop(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+axis2_status_t AXIS2_CALL tcpmon_session_on_new_entry(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct);
+
+axis2_status_t AXIS2_CALL tcpmon_session_on_trans_fault(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct);
+
+int AXIS2_CALL tcpmon_session_get_test_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+int AXIS2_CALL tcpmon_session_set_test_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int test_bit);
+
+int AXIS2_CALL tcpmon_session_get_format_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
+
+int AXIS2_CALL tcpmon_session_set_format_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int format_bit);
 
 /** internal implementations */
 
-void * AXIS2_THREAD_FUNC
-server_funct(axutil_thread_t *thd, void *data);
+void *AXIS2_THREAD_FUNC server_funct(
+    axutil_thread_t * thd,
+    void *data);
 
 /************************** End of function prototypes ************************/
 
-tcpmon_session_t * AXIS2_CALL
-tcpmon_session_create(const axutil_env_t *env)
+tcpmon_session_t *AXIS2_CALL
+tcpmon_session_create(
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
     session_impl = (tcpmon_session_impl_t *) AXIS2_MALLOC(env->
-            allocator, sizeof(tcpmon_session_impl_t));
+                                                          allocator,
+                                                          sizeof
+                                                          (tcpmon_session_impl_t));
 
-    if (! session_impl)
+    if (!session_impl)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
-    session_impl -> listen_port = -1;
-    session_impl -> target_port = -1;
-	 session_impl->test_bit = -1;
-     session_impl->format_bit = 0;
-    session_impl -> target_host = NULL;
-
-    session_impl -> on_new_entry_funct = NULL;
-    session_impl -> on_trans_fault_funct = NULL;
-    session_impl -> entries = axutil_array_list_create(env, AXIS2_ARRAY_LIST_DEFAULT_CAPACITY);
+    session_impl->listen_port = -1;
+    session_impl->target_port = -1;
+    session_impl->test_bit = -1;
+    session_impl->format_bit = 0;
+    session_impl->target_host = NULL;
+
+    session_impl->on_new_entry_funct = NULL;
+    session_impl->on_trans_fault_funct = NULL;
+    session_impl->entries =
+        axutil_array_list_create(env, AXIS2_ARRAY_LIST_DEFAULT_CAPACITY);
 
     session_impl->session.ops =
         AXIS2_MALLOC(env->allocator, sizeof(tcpmon_session_ops_t));
-    if (! session_impl->session.ops)
+    if (!session_impl->session.ops)
     {
         tcpmon_session_free(&(session_impl->session), env);
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-    
-    session_impl-> is_running = AXIS2_FALSE;
+
+    session_impl->is_running = AXIS2_FALSE;
     session_impl->session.ops->free = tcpmon_session_free;
     session_impl->session.ops->set_test_bit = tcpmon_session_set_test_bit;
     session_impl->session.ops->get_test_bit = tcpmon_session_get_test_bit;
@@ -187,27 +193,27 @@
     return &(session_impl->session);
 }
 
-
 /***************************Function implementation****************************/
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_free(tcpmon_session_t *session,
-        const axutil_env_t *env)
+tcpmon_session_free(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
     int entries_size = 0;
-    tcpmon_entry_t* entry = NULL;
+    tcpmon_entry_t *entry = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    for (entries_size = axutil_array_list_size(session_impl-> entries, env) - 1;
-            entries_size >= 0; entries_size --)
+    for (entries_size = axutil_array_list_size(session_impl->entries, env) - 1;
+         entries_size >= 0; entries_size--)
     {
         TCPMON_ENTRY_FREE(entry, env);
     }
-    axutil_array_list_free(session_impl-> entries, env);
+    axutil_array_list_free(session_impl->entries, env);
 
     if (session->ops)
     {
@@ -217,8 +223,8 @@
 
     if (session_impl->target_host)
     {
-        AXIS2_FREE(env-> allocator, session_impl->target_host);
-        session_impl-> target_host = NULL;
+        AXIS2_FREE(env->allocator, session_impl->target_host);
+        session_impl->target_host = NULL;
     }
 
     if (session_impl)
@@ -230,43 +236,44 @@
     return AXIS2_SUCCESS;
 }
 
-
 axis2_status_t AXIS2_CALL
-tcpmon_session_set_test_bit (tcpmon_session_t *session,
-									  const axutil_env_t *env,
-									  int test_bit)
+tcpmon_session_set_test_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int test_bit)
 {
-	 tcpmon_session_impl_t *session_impl = NULL;
+    tcpmon_session_impl_t *session_impl = NULL;
 
-	 AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-	 session_impl = AXIS2_INTF_TO_IMPL (session);
-	 session_impl -> test_bit = test_bit;
-	 return AXIS2_SUCCESS;
+    session_impl = AXIS2_INTF_TO_IMPL(session);
+    session_impl->test_bit = test_bit;
+    return AXIS2_SUCCESS;
 }
 
-
 int AXIS2_CALL
-tcpmon_session_get_test_bit (tcpmon_session_t *session,
-									  const axutil_env_t *env)
+tcpmon_session_get_test_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
-	 tcpmon_session_impl_t *session_impl = NULL;
+    tcpmon_session_impl_t *session_impl = NULL;
 
-	 AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-	 session_impl = AXIS2_INTF_TO_IMPL (session);
+    session_impl = AXIS2_INTF_TO_IMPL(session);
 
-	 return session_impl->test_bit;
+    return session_impl->test_bit;
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_set_format_bit (tcpmon_session_t *session,
-                                     const axutil_env_t *env,
-                                     int format_bit)
+tcpmon_session_set_format_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int format_bit)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
-    AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
@@ -276,12 +283,13 @@
 }
 
 int AXIS2_CALL
-tcpmon_session_get_format_bit (tcpmon_session_t *session,
-                                     const axutil_env_t *env)
+tcpmon_session_get_format_bit(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
-    AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
@@ -289,9 +297,10 @@
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_set_listen_port(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        int listen_port)
+tcpmon_session_set_listen_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int listen_port)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -299,13 +308,14 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    session_impl-> listen_port = listen_port;
+    session_impl->listen_port = listen_port;
     return AXIS2_SUCCESS;
 }
 
 int AXIS2_CALL
-tcpmon_session_get_listen_port(tcpmon_session_t *session,
-        const axutil_env_t *env)
+tcpmon_session_get_listen_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -313,13 +323,14 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    return session_impl-> listen_port;
+    return session_impl->listen_port;
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_set_target_port(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        int target_port)
+tcpmon_session_set_target_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    int target_port)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -327,13 +338,14 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    session_impl-> target_port = target_port;
+    session_impl->target_port = target_port;
     return AXIS2_SUCCESS;
 }
 
 int AXIS2_CALL
-tcpmon_session_get_target_port(tcpmon_session_t *session,
-        const axutil_env_t *env)
+tcpmon_session_get_target_port(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -341,13 +353,14 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    return session_impl-> target_port;
+    return session_impl->target_port;
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_set_target_host(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        axis2_char_t* target_host)
+tcpmon_session_set_target_host(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    axis2_char_t * target_host)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -355,13 +368,15 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    session_impl-> target_host = (axis2_char_t*)axutil_strdup(env, target_host);
+    session_impl->target_host =
+        (axis2_char_t *) axutil_strdup(env, target_host);
     return AXIS2_SUCCESS;
 }
 
-axis2_char_t* AXIS2_CALL
-tcpmon_session_get_target_host(tcpmon_session_t *session,
-        const axutil_env_t *env)
+axis2_char_t *AXIS2_CALL
+tcpmon_session_get_target_host(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -369,37 +384,41 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    return session_impl-> target_host;
+    return session_impl->target_host;
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_start(tcpmon_session_t *session,
-        const axutil_env_t *env)
+tcpmon_session_start(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
-    axutil_thread_t* server_thread = NULL;
-    tcpmon_session_server_thread_data_t* thread_data = NULL;
+    axutil_thread_t *server_thread = NULL;
+    tcpmon_session_server_thread_data_t *thread_data = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    thread_data = (tcpmon_session_server_thread_data_t*) AXIS2_MALLOC(
-                env-> allocator, sizeof(tcpmon_session_server_thread_data_t));
-    thread_data-> session_impl = session_impl;
-    thread_data-> env = env;
+    thread_data =
+        (tcpmon_session_server_thread_data_t *) AXIS2_MALLOC(env->allocator,
+                                                             sizeof
+                                                             (tcpmon_session_server_thread_data_t));
+    thread_data->session_impl = session_impl;
+    thread_data->env = env;
 
-    session_impl-> is_running = AXIS2_TRUE;
+    session_impl->is_running = AXIS2_TRUE;
     server_thread = axutil_thread_pool_get_thread(env->thread_pool,
-            server_funct, (void*)thread_data);
-    if (! server_thread)
+                                                  server_funct,
+                                                  (void *) thread_data);
+    if (!server_thread)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Thread creation failed"
-                "server thread");
+                        "server thread");
         if (session_impl->on_trans_fault_funct)
         {
-            (session_impl->on_trans_fault_funct)(env,
-                    "error in creating the server thread");
+            (session_impl->on_trans_fault_funct) (env,
+                                                  "error in creating the server thread");
         }
     }
 
@@ -408,23 +427,25 @@
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_stop(tcpmon_session_t *session,
-        const axutil_env_t *env)
+tcpmon_session_stop(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
-    session_impl-> is_running = AXIS2_FALSE;
+    session_impl->is_running = AXIS2_FALSE;
 
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_on_new_entry(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct)
+tcpmon_session_on_new_entry(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -432,15 +453,16 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    session_impl-> on_new_entry_funct = on_new_entry_funct;
+    session_impl->on_new_entry_funct = on_new_entry_funct;
 
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
-tcpmon_session_on_trans_fault(tcpmon_session_t *session,
-        const axutil_env_t *env,
-        TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct)
+tcpmon_session_on_trans_fault(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -448,75 +470,77 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    session_impl-> on_trans_fault_funct = on_trans_fault_funct;
+    session_impl->on_trans_fault_funct = on_trans_fault_funct;
     return AXIS2_SUCCESS;
 }
 
-
 /** internal implementations */
-void * AXIS2_THREAD_FUNC
-server_funct(axutil_thread_t *thd, void *data)
+void *AXIS2_THREAD_FUNC
+server_funct(
+    axutil_thread_t * thd,
+    void *data)
 {
-    tcpmon_session_server_thread_data_t* thread_data = data;
+    tcpmon_session_server_thread_data_t *thread_data = data;
     tcpmon_session_impl_t *session_impl = NULL;
-    const axutil_env_t* env = NULL;
+    const axutil_env_t *env = NULL;
     int listen_socket = -1;
     int socket = -1;
-    axutil_thread_t* request_thread = NULL;
-    tcpmon_entry_request_data_t* request_thread_data = NULL;
+    axutil_thread_t *request_thread = NULL;
+    tcpmon_entry_request_data_t *request_thread_data = NULL;
 
-    session_impl = thread_data -> session_impl;
-    env = thread_data -> env;
+    session_impl = thread_data->session_impl;
+    env = thread_data->env;
 
     listen_socket = axutil_network_handler_create_server_socket
-            (env, session_impl->listen_port);
+        (env, session_impl->listen_port);
     if (-1 == listen_socket)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "error in creating the server socket, "
-                "port may be already occupied",
-                "create socket");
+                        "error in creating the server socket, "
+                        "port may be already occupied", "create socket");
         if (session_impl->on_trans_fault_funct)
         {
-            (session_impl->on_trans_fault_funct)(env,
-                    "error in creating the server socket, "
-                    "port may be already occupied");
+            (session_impl->on_trans_fault_funct) (env,
+                                                  "error in creating the server socket, "
+                                                  "port may be already occupied");
         }
         return NULL;
     }
-    while (session_impl-> is_running)
+    while (session_impl->is_running)
     {
-        socket = axutil_network_handler_svr_socket_accept(env,
-                listen_socket);
+        socket = axutil_network_handler_svr_socket_accept(env, listen_socket);
         if (socket == -1)
         {
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "error in creating the socket"
-                    "create socket");
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "error in creating the socket" "create socket");
             if (session_impl->on_trans_fault_funct)
             {
-                (session_impl->on_trans_fault_funct)(env,
-                        "error in creating the socket");
+                (session_impl->on_trans_fault_funct) (env,
+                                                      "error in creating the socket");
             }
             break;
         }
 
-        request_thread_data = (tcpmon_entry_request_data_t*) AXIS2_MALLOC(
-                    env-> allocator, sizeof(tcpmon_entry_request_data_t));
-        request_thread_data-> env = env;
-        request_thread_data-> socket = socket;
-        request_thread_data-> session = (tcpmon_session_t*)session_impl;
+        request_thread_data =
+            (tcpmon_entry_request_data_t *) AXIS2_MALLOC(env->allocator,
+                                                         sizeof
+                                                         (tcpmon_entry_request_data_t));
+        request_thread_data->env = env;
+        request_thread_data->socket = socket;
+        request_thread_data->session = (tcpmon_session_t *) session_impl;
 
         request_thread = axutil_thread_pool_get_thread(env->thread_pool,
-                tcpmon_entry_new_entry_funct,
-                (void*)request_thread_data);
-        if (! request_thread)
+                                                       tcpmon_entry_new_entry_funct,
+                                                       (void *)
+                                                       request_thread_data);
+        if (!request_thread)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Thread creation failed"
-                    "request thread");
+                            "request thread");
             if (session_impl->on_trans_fault_funct)
             {
-                (session_impl->on_trans_fault_funct)(env,
-                        "fail in creating the thread");
+                (session_impl->on_trans_fault_funct) (env,
+                                                      "fail in creating the thread");
             }
             break;
         }
@@ -528,13 +552,13 @@
     return NULL;
 }
 
-
 /* implementations for protected functions */
 
 axis2_status_t
-tcpmon_session_add_new_entry(tcpmon_session_t* session,
-        const axutil_env_t* env,
-        tcpmon_entry_t* entry)
+tcpmon_session_add_new_entry(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    tcpmon_entry_t * entry)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
@@ -542,35 +566,35 @@
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    axutil_array_list_add(session_impl-> entries,
-            env,
-            entry);
+    axutil_array_list_add(session_impl->entries, env, entry);
     return AXIS2_SUCCESS;
 
 }
 
 TCPMON_SESSION_TRANS_ERROR_FUNCT
-tcpmon_session_get_on_trans_fault(tcpmon_session_t *session,
-        const axutil_env_t *env)
+tcpmon_session_get_on_trans_fault(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
-	AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_ENV_CHECK(env, NULL);
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    return session_impl-> on_trans_fault_funct;
+    return session_impl->on_trans_fault_funct;
 }
 
 TCPMON_SESSION_NEW_ENTRY_FUNCT
-tcpmon_session_get_on_new_entry(tcpmon_session_t *session,
-        const axutil_env_t *env)
+tcpmon_session_get_on_new_entry(
+    tcpmon_session_t * session,
+    const axutil_env_t * env)
 {
     tcpmon_session_impl_t *session_impl = NULL;
 
-	AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_ENV_CHECK(env, NULL);
 
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
-    return session_impl-> on_new_entry_funct;
+    return session_impl->on_new_entry_funct;
 }

Modified: webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Fri Sep 28 03:29:16 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -27,355 +28,378 @@
 #define SIZE 1024
 axis2_char_t *tcpmon_traffic_log = "tcpmon_traffic.log";
 
-int on_new_entry(const axutil_env_t *env,
-					  tcpmon_entry_t* entry,
-					  int status);
-int on_new_entry_to_file(const axutil_env_t *env,
-					  tcpmon_entry_t* entry,
-					  int status);
-int on_error_func(const axutil_env_t *env,
-						char* error_message);
-
-char *str_replace(char *str, const char *search, const char *replace);
+int on_new_entry(
+    const axutil_env_t * env,
+    tcpmon_entry_t * entry,
+    int status);
+int on_new_entry_to_file(
+    const axutil_env_t * env,
+    tcpmon_entry_t * entry,
+    int status);
+int on_error_func(
+    const axutil_env_t * env,
+    char *error_message);
+
+char *str_replace(
+    char *str,
+    const char *search,
+    const char *replace);
+
+int
+main(
+    int argc,
+    char **argv)
+{
+    axutil_env_t *env = NULL;
+    axutil_allocator_t *allocator = NULL;
+    axutil_error_t *error = NULL;
+    axutil_log_t *log = NULL;
+    axutil_thread_pool_t *thread_pool = NULL;
+    tcpmon_session_t *session = NULL;
+    int c;
+    int listen_port = 9090,
+        target_port = 8080;
+    char *target_host = NULL;
+    int test_bit = 0;
+    int format_bit = 0;
+    int ii = 1;
+
+    allocator = axutil_allocator_init(NULL);
+
+    error = axutil_error_create(allocator);
+    log = axutil_log_create(allocator, NULL, "axis2_tcpmon.log");
+    thread_pool = axutil_thread_pool_init(allocator);
+
+    env = axutil_env_create_with_error_log_thread_pool(allocator, error, log,
+                                                       thread_pool);
+    target_host = axutil_strdup(env, "localhost");
+
+    if (!axutil_strcmp(argv[1], "-h"))
+    {
+        printf
+            ("Usage : %s [-lp LISTEN_PORT] [-tp TARGET_PORT] [-th TARGET_HOST] [-f LOG_FILE]\n",
+             argv[0]);
+        fprintf(stdout, " Options :\n");
+        fprintf(stdout,
+                "\t-lp LISTEN_PORT \t port number to listen on, default is 9090\n");
+        fprintf(stdout,
+                "\t-tp TARGET_PORT \t port number to connect and re-direct messages, default is 8080\n");
+        fprintf(stdout,
+                "\t-th TARGET_HOST \t target host to connect, default is localhost\n");
+        fprintf(stdout,
+                "\t-f  LOG_FILE    \t file to write the messages to, default is %s\n",
+                tcpmon_traffic_log);
+        fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
+        return 0;
+    }
+
+    while (ii < argc)
+    {
+        if (!strcmp("-lp", argv[ii]))
+        {
+            ii++;
+            listen_port = atoi(argv[ii++]);
+            if (listen_port == 0)
+            {
+                printf("INVALID value for listen port\n");
+                printf("Use -h for help\n");
+                return 0;
+            }
 
+        }
+        else if (!strcmp("-tp", argv[ii]))
+        {
+            ii++;
+            target_port = atoi(argv[ii++]);
+            if (target_port == 0)
+            {
+                printf("INVALID value for target port\n");
+                printf("Use -h for help\n");
+                return 0;
+            }
+        }
+        else if (!strcmp("-th", argv[ii]))
+        {
+            ii++;
+            target_host = (char *) axutil_strdup(env, argv[ii++]);
+        }
+        else if (!strcmp("--test", argv[ii]))
+        {
+            ii++;
+            test_bit = 1;
+        }
+        else if (!strcmp("--format", argv[ii]))
+        {
+            ii++;
+            format_bit = 1;
+        }
+        else if (!strcmp("-f", argv[ii]))
+        {
+            ii++;
+            tcpmon_traffic_log = argv[ii++];
+        }
+        else
+        {
+            printf("INVALID value for tcpmon \n");
+            printf("Use -h for help\n");
+            return 0;
+        }
+    }
 
-int main(int argc, char** argv)
-{
-		axutil_env_t* env = NULL;
-		axutil_allocator_t* allocator = NULL;
-		axutil_error_t *error = NULL;
-		axutil_log_t *log = NULL;
-		axutil_thread_pool_t *thread_pool = NULL;
-		tcpmon_session_t* session = NULL;
-		int c;
-		int listen_port = 9090, target_port = 8080;
-		char *target_host = NULL;
-		int test_bit = 0;
-        int format_bit = 0;
-		int ii = 1;
-
-		allocator = axutil_allocator_init(NULL);
-
-		error = axutil_error_create(allocator);
-		log = axutil_log_create(allocator, NULL, "axis2_tcpmon.log");
-		thread_pool = axutil_thread_pool_init(allocator);
-
-		env = axutil_env_create_with_error_log_thread_pool(allocator, error, log,
-																		  thread_pool);
-        target_host = axutil_strdup(env, "localhost");
-        
-		if (!axutil_strcmp(argv[1], "-h"))
-		{
-				printf("Usage : %s [-lp LISTEN_PORT] [-tp TARGET_PORT] [-th TARGET_HOST] [-f LOG_FILE]\n", argv[0]);
-                fprintf(stdout, " Options :\n");
-                fprintf(stdout, "\t-lp LISTEN_PORT \t port number to listen on, default is 9090\n");
-                fprintf(stdout, "\t-tp TARGET_PORT \t port number to connect and re-direct messages, default is 8080\n");
-                fprintf(stdout, "\t-th TARGET_HOST \t target host to connect, default is localhost\n");
-                fprintf(stdout, "\t-f  LOG_FILE    \t file to write the messages to, default is %s\n", tcpmon_traffic_log);
-                fprintf(stdout, " Help :\n\t-h \t display this help screen.\n\n");
-				return 0;
-		}
-
-		while (ii < argc)
-		{
-				if (!strcmp ("-lp", argv[ii]))
-				{
-						ii++;
-						listen_port = atoi(argv[ii++]);
-						if (listen_port == 0)
-						{
-								printf("INVALID value for listen port\n");
-								printf("Use -h for help\n");
-								return 0;
-						}
-
-				}
-				else if (!strcmp ("-tp", argv[ii]))
-				{
-						ii++;
-						target_port = atoi(argv[ii++]);
-						if (target_port == 0)
-						{
-								printf("INVALID value for target port\n");
-								printf("Use -h for help\n");
-								return 0;
-						}
-				}
-				else if (!strcmp ("-th", argv[ii]))
-				{
-						ii++;
-						target_host = (char*)axutil_strdup(env, argv[ii++]);
-				}
-				else if (!strcmp ("--test", argv [ii]))
-				{
-						ii++;
-						test_bit = 1;
-				}
-                else if (!strcmp ("--format",argv [ii]))
-                {
-                    ii++;
-                    format_bit = 1;
-                }
-                else if (!strcmp ("-f", argv[ii]))
-				{
-						ii++;
-						tcpmon_traffic_log = argv[ii++];
-				}
-				else
-				{
-						printf("INVALID value for tcpmon \n");
-						printf("Use -h for help\n");
-						return 0;
-				}
-		}
-
-		if (!(listen_port && target_port && target_host))
-        {
-				printf ("ERROR: essential argument missing \n");
-				printf ("Please recheck values of listen_port (-lp), target_port(-tp) and target_host (-th)\n");
-				return 0;
-        }
-
-        printf ("Listen port : %d Target port : %d Target host: %s\n", 
-            listen_port, target_port, target_host);
-		session = tcpmon_session_create(env);
-
-		TCPMON_SESSION_SET_LISTEN_PORT(session, env, listen_port);
-		TCPMON_SESSION_SET_TARGET_PORT(session, env, target_port);
-		TCPMON_SESSION_SET_TARGET_HOST(session, env, target_host);
-		TCPMON_SESSION_ON_TRANS_FAULT(session, env, on_error_func);
-
-		TCPMON_SESSION_ON_NEW_ENTRY(session, env, on_new_entry_to_file);
-
-		TCPMON_SESSION_SET_TEST_BIT (session, env, test_bit);
-		TCPMON_SESSION_SET_FORMAT_BIT(session, env, format_bit);
-		TCPMON_SESSION_START(session, env);
-
-		do
-		{
-				c = getchar();
-		}
-		while (c != 'q');
-
-		TCPMON_SESSION_STOP(session, env);
-		TCPMON_SESSION_FREE(session, env);
-		AXIS2_FREE(env-> allocator, target_host);
-		axutil_allocator_free(allocator);
-		axutil_env_free(env);
-		return 0;
+    if (!(listen_port && target_port && target_host))
+    {
+        printf("ERROR: essential argument missing \n");
+        printf
+            ("Please recheck values of listen_port (-lp), target_port(-tp) and target_host (-th)\n");
+        return 0;
+    }
+
+    printf("Listen port : %d Target port : %d Target host: %s\n",
+           listen_port, target_port, target_host);
+    session = tcpmon_session_create(env);
+
+    TCPMON_SESSION_SET_LISTEN_PORT(session, env, listen_port);
+    TCPMON_SESSION_SET_TARGET_PORT(session, env, target_port);
+    TCPMON_SESSION_SET_TARGET_HOST(session, env, target_host);
+    TCPMON_SESSION_ON_TRANS_FAULT(session, env, on_error_func);
+
+    TCPMON_SESSION_ON_NEW_ENTRY(session, env, on_new_entry_to_file);
+
+    TCPMON_SESSION_SET_TEST_BIT(session, env, test_bit);
+    TCPMON_SESSION_SET_FORMAT_BIT(session, env, format_bit);
+    TCPMON_SESSION_START(session, env);
+
+    do
+    {
+        c = getchar();
+    }
+    while (c != 'q');
+
+    TCPMON_SESSION_STOP(session, env);
+    TCPMON_SESSION_FREE(session, env);
+    AXIS2_FREE(env->allocator, target_host);
+    axutil_allocator_free(allocator);
+    axutil_env_free(env);
+    return 0;
 }
 
-
-int on_new_entry_to_file(const axutil_env_t *env,
-					  tcpmon_entry_t* entry,
-					  int status)
+int
+on_new_entry_to_file(
+    const axutil_env_t * env,
+    tcpmon_entry_t * entry,
+    int status)
 {
-		char* plain_buffer = NULL;
-		char* formated_buffer = NULL;
-        int format = 0;
-		FILE *file;
-		char *convert = NULL;
-
-		file = fopen(tcpmon_traffic_log, "a+");
-
-		if(NULL == file) {
-			printf("\ncould not create or open log-file\n");
-			return -1;
-		}
-
-		fprintf(file, "\n= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\n");
-
-        format = TCPMON_ENTRY_GET_FORMAT_BIT(entry, env);
-
-		if (status == 0)
-		{
-				plain_buffer = TCPMON_ENTRY_SENT_DATA(entry, env);
-				if (plain_buffer) /* this can be possible as no xml present */
-				{
-						formated_buffer = tcpmon_util_format_as_xml
-								(env, plain_buffer, format);
-				}
-				else
-				{
-						formated_buffer = "";
-				}
-				/* 2 screen */
-				printf("%s\n", "SENDING DATA..");
-				printf("/* sending time = %s*/\n", TCPMON_ENTRY_SENT_TIME(entry, env));
-				printf("---------------------\n");
-
-				printf("%s\n\n%s\n\n", TCPMON_ENTRY_SENT_HEADERS(entry, env), formated_buffer);
-
-				/* 2 file */
-				fprintf(file, "%s\n", "SENDING DATA..");
-				fprintf(file, "/* sending time = %s*/\n", TCPMON_ENTRY_SENT_TIME(entry, env));
-				fprintf(file, "---------------------\n");
-
-				convert = TCPMON_ENTRY_SENT_HEADERS(entry, env);
-				convert = str_replace(convert, "; ", ";\n\t");
-				fprintf(file, "%s", convert);
-
-				convert = formated_buffer;
-				convert = str_replace(convert, "; ", ";\n\t");
-				convert = str_replace(convert, "><", ">\n<");
-				fprintf(file, "%s", convert);
-
-				
-		}
-		if (status == 1)
-		{
-				plain_buffer = TCPMON_ENTRY_ARRIVED_DATA(entry, env);
-				if (plain_buffer) /* this can be possible as no xml present */
-				{
-						formated_buffer = tcpmon_util_format_as_xml
-								(env, plain_buffer, format);
-				}
-				else
-				{
-						formated_buffer = "";
-				}
-				/* 2 screen */
-				printf("%s\n", "RETRIEVING DATA..");
-				printf("/* retrieving time = %s*/\n", TCPMON_ENTRY_ARRIVED_TIME(entry, env));
-				printf("/* time throughput = %s*/\n", TCPMON_ENTRY_TIME_DIFF(entry, env));
-				printf("---------------------\n");
-
-				printf("%s\n\n%s\n\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env), formated_buffer);
-
-				/* 2 file */
-				fprintf(file, "%s\n", "RETRIEVING DATA..");
-				fprintf(file, "/* retrieving time = %s*/\n", TCPMON_ENTRY_ARRIVED_TIME(entry, env));
-				fprintf(file, "/* time throughput = %s*/\n", TCPMON_ENTRY_TIME_DIFF(entry, env));
-				fprintf(file, "---------------------\n");
-
-				convert = TCPMON_ENTRY_ARRIVED_HEADERS(entry, env);
-				convert = str_replace(convert, "; ", ";\n\t");
-				fprintf(file, "%s", convert);
-
-				convert = formated_buffer;
-				convert = str_replace(convert, "; ", ";\n\t");
-				convert = str_replace(convert, "><", ">\n<");
-				fprintf(file, "%s", convert);
-		}
+    char *plain_buffer = NULL;
+    char *formated_buffer = NULL;
+    int format = 0;
+    FILE *file;
+    char *convert = NULL;
+
+    file = fopen(tcpmon_traffic_log, "a+");
+
+    if (NULL == file)
+    {
+        printf("\ncould not create or open log-file\n");
+        return -1;
+    }
+
+    fprintf(file,
+            "\n= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =\n");
+
+    format = TCPMON_ENTRY_GET_FORMAT_BIT(entry, env);
+
+    if (status == 0)
+    {
+        plain_buffer = TCPMON_ENTRY_SENT_DATA(entry, env);
+        if (plain_buffer)       /* this can be possible as no xml present */
+        {
+            formated_buffer = tcpmon_util_format_as_xml
+                (env, plain_buffer, format);
+        }
+        else
+        {
+            formated_buffer = "";
+        }
+        /* 2 screen */
+        printf("%s\n", "SENDING DATA..");
+        printf("/* sending time = %s*/\n", TCPMON_ENTRY_SENT_TIME(entry, env));
+        printf("---------------------\n");
+
+        printf("%s\n\n%s\n\n", TCPMON_ENTRY_SENT_HEADERS(entry, env),
+               formated_buffer);
+
+        /* 2 file */
+        fprintf(file, "%s\n", "SENDING DATA..");
+        fprintf(file, "/* sending time = %s*/\n",
+                TCPMON_ENTRY_SENT_TIME(entry, env));
+        fprintf(file, "---------------------\n");
+
+        convert = TCPMON_ENTRY_SENT_HEADERS(entry, env);
+        convert = str_replace(convert, "; ", ";\n\t");
+        fprintf(file, "%s", convert);
+
+        convert = formated_buffer;
+        convert = str_replace(convert, "; ", ";\n\t");
+        convert = str_replace(convert, "><", ">\n<");
+        fprintf(file, "%s", convert);
+
+    }
+    if (status == 1)
+    {
+        plain_buffer = TCPMON_ENTRY_ARRIVED_DATA(entry, env);
+        if (plain_buffer)       /* this can be possible as no xml present */
+        {
+            formated_buffer = tcpmon_util_format_as_xml
+                (env, plain_buffer, format);
+        }
+        else
+        {
+            formated_buffer = "";
+        }
+        /* 2 screen */
+        printf("%s\n", "RETRIEVING DATA..");
+        printf("/* retrieving time = %s*/\n",
+               TCPMON_ENTRY_ARRIVED_TIME(entry, env));
+        printf("/* time throughput = %s*/\n",
+               TCPMON_ENTRY_TIME_DIFF(entry, env));
+        printf("---------------------\n");
+
+        printf("%s\n\n%s\n\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env),
+               formated_buffer);
+
+        /* 2 file */
+        fprintf(file, "%s\n", "RETRIEVING DATA..");
+        fprintf(file, "/* retrieving time = %s*/\n",
+                TCPMON_ENTRY_ARRIVED_TIME(entry, env));
+        fprintf(file, "/* time throughput = %s*/\n",
+                TCPMON_ENTRY_TIME_DIFF(entry, env));
+        fprintf(file, "---------------------\n");
+
+        convert = TCPMON_ENTRY_ARRIVED_HEADERS(entry, env);
+        convert = str_replace(convert, "; ", ";\n\t");
+        fprintf(file, "%s", convert);
+
+        convert = formated_buffer;
+        convert = str_replace(convert, "; ", ";\n\t");
+        convert = str_replace(convert, "><", ">\n<");
+        fprintf(file, "%s", convert);
+    }
 
-		fclose(file);
+    fclose(file);
 
-		return 0;
+    return 0;
 }
 
-
-int on_new_entry(const axutil_env_t *env,
-					  tcpmon_entry_t* entry,
-					  int status)
+int
+on_new_entry(
+    const axutil_env_t * env,
+    tcpmon_entry_t * entry,
+    int status)
 {
-		char* plain_buffer = NULL;
-		char* formated_buffer = NULL;
-        int format = 0;
-
-        format = TCPMON_ENTRY_GET_FORMAT_BIT(entry, env);
-
-		if (status == 0)
-		{
-				plain_buffer = TCPMON_ENTRY_SENT_DATA(entry, env);
-				if (plain_buffer) /* this can be possible as no xml present */
-				{
-						formated_buffer = tcpmon_util_format_as_xml
-								(env, plain_buffer, format);
-				}
-				else
-				{
-						formated_buffer = "";
-				}
-				printf("%s\n", "SENDING DATA..");
-				printf("/* sending time = %s*/\n", TCPMON_ENTRY_SENT_TIME(entry, env));
-				printf("---------------------\n");
-
-				printf("%s\n\n%s\n\n", TCPMON_ENTRY_SENT_HEADERS(entry, env), formated_buffer);
-		}
-		if (status == 1)
-		{
-				plain_buffer = TCPMON_ENTRY_ARRIVED_DATA(entry, env);
-				if (plain_buffer) /* this can be possible as no xml present */
-				{
-						formated_buffer = tcpmon_util_format_as_xml
-								(env, plain_buffer, format);
-				}
-				else
-				{
-						formated_buffer = "";
-				}
-				printf("%s\n", "RETRIEVING DATA..");
-				printf("/* retrieving time = %s*/\n", TCPMON_ENTRY_ARRIVED_TIME(entry, env));
-				printf("/* time throughput = %s*/\n", TCPMON_ENTRY_TIME_DIFF(entry, env));
-				printf("---------------------\n");
-
-				printf("%s\n\n%s\n\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env),
-						 formated_buffer);
-		}
-		return 0;
+    char *plain_buffer = NULL;
+    char *formated_buffer = NULL;
+    int format = 0;
+
+    format = TCPMON_ENTRY_GET_FORMAT_BIT(entry, env);
+
+    if (status == 0)
+    {
+        plain_buffer = TCPMON_ENTRY_SENT_DATA(entry, env);
+        if (plain_buffer)       /* this can be possible as no xml present */
+        {
+            formated_buffer = tcpmon_util_format_as_xml
+                (env, plain_buffer, format);
+        }
+        else
+        {
+            formated_buffer = "";
+        }
+        printf("%s\n", "SENDING DATA..");
+        printf("/* sending time = %s*/\n", TCPMON_ENTRY_SENT_TIME(entry, env));
+        printf("---------------------\n");
+
+        printf("%s\n\n%s\n\n", TCPMON_ENTRY_SENT_HEADERS(entry, env),
+               formated_buffer);
+    }
+    if (status == 1)
+    {
+        plain_buffer = TCPMON_ENTRY_ARRIVED_DATA(entry, env);
+        if (plain_buffer)       /* this can be possible as no xml present */
+        {
+            formated_buffer = tcpmon_util_format_as_xml
+                (env, plain_buffer, format);
+        }
+        else
+        {
+            formated_buffer = "";
+        }
+        printf("%s\n", "RETRIEVING DATA..");
+        printf("/* retrieving time = %s*/\n",
+               TCPMON_ENTRY_ARRIVED_TIME(entry, env));
+        printf("/* time throughput = %s*/\n",
+               TCPMON_ENTRY_TIME_DIFF(entry, env));
+        printf("---------------------\n");
+
+        printf("%s\n\n%s\n\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env),
+               formated_buffer);
+    }
+    return 0;
 }
 
-
-
-int on_error_func(const axutil_env_t *env,
-						char* error_message)
+int
+on_error_func(
+    const axutil_env_t * env,
+    char *error_message)
 {
-		fprintf(stderr, "ERROR: %s\n", error_message);
-		return 0;
+    fprintf(stderr, "ERROR: %s\n", error_message);
+    return 0;
 }
 
+char *
+str_replace(
+    char *str,
+    const char *search,
+    const char *replace)
+{
+    int size = strlen(str) * 2;
+    int addmem = size;
+    int diff = strlen(replace) - strlen(search);
+
+    char *str_return = (char *) malloc(size * sizeof(char));
+    char *str_tmp = (char *) malloc(size * sizeof(char));
+    char *str_relic;
+
+    if (str_return == NULL || str_tmp == NULL)
+    {
+        free(str_return);
+        free(str_tmp);
+        return "function str_replace : gimme more memory";
+    }
+
+    strcpy(str_return, str);
+
+    while ((str_relic = strstr(str_return, search)) != NULL)
+    {
+        if (strlen(str_return) + diff >= addmem)
+        {
+            str_return = (char *) realloc(str_return, addmem += size);
+            str_tmp = (char *) realloc(str_tmp, addmem);
 
+            if (str_return == NULL || str_tmp == NULL)
+            {
+                free(str_return);
+                free(str_tmp);
+                return "function str_replace : gimme more memory";
+            }
+        }
 
+        strcpy(str_tmp, replace);
+        strcat(str_tmp, (str_relic + strlen(search)));
+        *str_relic = '\0';
 
-char *str_replace(char *str, const char *search, const char *replace) {
-	int size = strlen(str) * 2;
-	int addmem = size;
-	int diff = strlen(replace)-strlen(search);
-
-	char *str_return = (char *) malloc(size *sizeof(char));
-	char *str_tmp = (char *) malloc(size * sizeof(char));
-	char *str_relic;	
-
-	if(str_return == NULL || str_tmp == NULL) {
-		free(str_return);
-		free(str_tmp);
-		return "function str_replace : gimme more memory";
-	}
-
-	strcpy(str_return, str);
-
-	while( (str_relic = strstr(str_return, search)) != NULL) {
-		if( strlen(str_return) + diff >= addmem) {
-			str_return = (char *) realloc(str_return, addmem+=size);
-			str_tmp = (char *) realloc(str_tmp, addmem);
-
-			if(str_return == NULL || str_tmp == NULL) {
-				free(str_return);
-				free(str_tmp);
-				return "function str_replace : gimme more memory";
-			}
-		}
-
-		strcpy(str_tmp, replace);
-		strcat(str_tmp, (str_relic+strlen(search)) );
-		*str_relic = '\0';
-
-		strcat(str_return, str_tmp);
-	}
+        strcat(str_return, str_tmp);
+    }
 
-	free(str_tmp);
-	return(str_return);
+    free(str_tmp);
+    return (str_return);
 }
-
-
-
-
-
-
-
-
-
-
-
-
-

Modified: webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_entry_local.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_entry_local.h?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_entry_local.h (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_entry_local.h Fri Sep 28 03:29:16 2007
@@ -4,10 +4,13 @@
 
 typedef struct tcpmon_entry_request_data
 {
-    const axutil_env_t* env;
+    const axutil_env_t *env;
     int socket;
-    tcpmon_session_t* session;
-} tcpmon_entry_request_data_t;
-
-void* AXIS2_CALL tcpmon_entry_new_entry_funct(axutil_thread_t *thd, void* data);
+    tcpmon_session_t *session;
+}
+tcpmon_entry_request_data_t;
 
+void *AXIS2_CALL
+tcpmon_entry_new_entry_funct(
+    axutil_thread_t * thd,
+    void *data);

Modified: webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_session_local.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_session_local.h?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_session_local.h (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_session_local.h Fri Sep 28 03:29:16 2007
@@ -1,14 +1,15 @@
 #include <tcpmon_session.h>
 #include <tcpmon_entry.h>
 
-axis2_status_t
-tcpmon_session_add_new_entry( tcpmon_session_t* session,
-                              const axutil_env_t* env, tcpmon_entry_t* entry);
+axis2_status_t tcpmon_session_add_new_entry(
+    tcpmon_session_t * session,
+    const axutil_env_t * env,
+    tcpmon_entry_t * entry);
 
-TCPMON_SESSION_TRANS_ERROR_FUNCT
-tcpmon_session_get_on_trans_fault (tcpmon_session_t *session,
-                        const axutil_env_t *env );
+TCPMON_SESSION_TRANS_ERROR_FUNCT tcpmon_session_get_on_trans_fault(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);
 
-TCPMON_SESSION_NEW_ENTRY_FUNCT
-tcpmon_session_get_on_new_entry (tcpmon_session_t *session,
-                        const axutil_env_t *env );
+TCPMON_SESSION_NEW_ENTRY_FUNCT tcpmon_session_get_on_new_entry(
+    tcpmon_session_t * session,
+    const axutil_env_t * env);

Modified: webservices/axis2/trunk/c/tools/tcpmon/src/util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/util.c?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/util.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/util.c Fri Sep 28 03:29:16 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -25,13 +26,17 @@
 
 typedef struct tcpmon_util_allocator
 {
-  int allocated;
-  int index;
-  axis2_char_t* buffer;
+    int allocated;
+    int index;
+    axis2_char_t *buffer;
 }
 tcpmon_util_allocator_t;
 
-axis2_char_t* tcpmon_strcat(char *dest, char *source, int *cur_buf_s, const axutil_env_t *env);
+axis2_char_t *tcpmon_strcat(
+    char *dest,
+    char *source,
+    int *cur_buf_s,
+    const axutil_env_t * env);
 
 /*static void add_string(const axutil_env_t* env,
 		       tcpmon_util_allocator_t* allocator,
@@ -43,10 +48,13 @@
 			     axis2_char_t c,
 			     int turns);
 */
-axis2_char_t*
-tcpmon_util_format_as_xml(const axutil_env_t *env, axis2_char_t *data, int format)
+axis2_char_t *
+tcpmon_util_format_as_xml(
+    const axutil_env_t * env,
+    axis2_char_t * data,
+    int format)
 {
-    if(format)
+    if (format)
     {
         int c;
         int tab_pos = 0;
@@ -55,278 +63,325 @@
         int start_ele = 0;
         int prev_case = 0;
         int buffer_size = 0;
-	
+
         axis2_char_t *out;
-	
+
         axiom_xml_reader_t *xml_reader = NULL;
 
-        buffer_size = 2*strlen(data);
-        out = AXIS2_MALLOC(env->allocator, buffer_size*sizeof(axis2_char_t));
-    
+        buffer_size = 2 * strlen(data);
+        out = AXIS2_MALLOC(env->allocator, buffer_size * sizeof(axis2_char_t));
+
         if (data)
-        {  
+        {
             int size = 0;
-            size = strlen (data);
+            size = strlen(data);
             xml_reader =
-    	    axiom_xml_reader_create_for_memory (env, data, size, "utf-8", AXIS2_XML_PARSER_TYPE_BUFFER);
+                axiom_xml_reader_create_for_memory(env, data, size, "utf-8",
+                                                   AXIS2_XML_PARSER_TYPE_BUFFER);
             if (!xml_reader)
-    	        return AXIS2_FAILURE;
+                return AXIS2_FAILURE;
         }
 
-        axiom_xml_reader_init ();
+        axiom_xml_reader_init();
 
-        while ((c = axiom_xml_reader_next (xml_reader, env)) != -1)
+        while ((c = axiom_xml_reader_next(xml_reader, env)) != -1)
         {
             switch (c)
-	        {
-	            case AXIOM_XML_READER_START_DOCUMENT:
-    	        {
-	                int ix;
-	            
-    	            tcpmon_strcat(out, "<?xml ", &buffer_size, env);
-                
-                
-	                ix = axiom_xml_reader_get_attribute_count (xml_reader, env);
-	                for (; ix > 0; ix--)
-	                {
-		                axis2_char_t *attr_prefix;
-		                axis2_char_t *attr_name;
-    		            axis2_char_t *attr_value;
-
-	    	            attr_prefix = (axis2_char_t *)axiom_xml_reader_get_attribute_prefix_by_number (xml_reader, env, ix);
-		                if (attr_prefix)
-		                {
-		                    tcpmon_strcat(out, attr_prefix, &buffer_size, env);
-		                    tcpmon_strcat(out, ":", &buffer_size, env);
-		                }
-				        
-    		            attr_name = (axis2_char_t *)axiom_xml_reader_get_attribute_name_by_number (xml_reader, env, ix);
-	    	            if (attr_name)
-		                {
-		                    tcpmon_strcat(out, attr_name, &buffer_size, env);
-		                    tcpmon_strcat(out, "=\"", &buffer_size, env);
-		                }
-		    			            
-		                attr_value = (axis2_char_t *)axiom_xml_reader_get_attribute_value_by_number (xml_reader, env, ix);
-		                if (attr_value)
-    		            {
-	    	                tcpmon_strcat(out, attr_value, &buffer_size, env);
-		                    tcpmon_strcat(out, "\"", &buffer_size, env);
-		                }
-	                }
-
-    	            printf ("?>");
-	            }
-	            break;
-	            case AXIOM_XML_READER_START_ELEMENT:
-	            {
-	                int i, ix, has_prefix = 0;
-	            
+            {
+            case AXIOM_XML_READER_START_DOCUMENT:
+                {
+                    int ix;
+
+                    tcpmon_strcat(out, "<?xml ", &buffer_size, env);
+
+                    ix = axiom_xml_reader_get_attribute_count(xml_reader, env);
+                    for (; ix > 0; ix--)
+                    {
+                        axis2_char_t *attr_prefix;
+                        axis2_char_t *attr_name;
+                        axis2_char_t *attr_value;
+
+                        attr_prefix =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_prefix_by_number
+                            (xml_reader, env, ix);
+                        if (attr_prefix)
+                        {
+                            tcpmon_strcat(out, attr_prefix, &buffer_size, env);
+                            tcpmon_strcat(out, ":", &buffer_size, env);
+                        }
+
+                        attr_name =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_name_by_number
+                            (xml_reader, env, ix);
+                        if (attr_name)
+                        {
+                            tcpmon_strcat(out, attr_name, &buffer_size, env);
+                            tcpmon_strcat(out, "=\"", &buffer_size, env);
+                        }
+
+                        attr_value =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_value_by_number
+                            (xml_reader, env, ix);
+                        if (attr_value)
+                        {
+                            tcpmon_strcat(out, attr_value, &buffer_size, env);
+                            tcpmon_strcat(out, "\"", &buffer_size, env);
+                        }
+                    }
+
+                    printf("?>");
+                }
+                break;
+            case AXIOM_XML_READER_START_ELEMENT:
+                {
+                    int i,
+                     ix,
+                     has_prefix = 0;
+
                     axis2_char_t *ele_name;
-	                axis2_char_t *ele_prefix;
+                    axis2_char_t *ele_prefix;
+
+                    prev_case = START_ELEMENT;
+
+                    has_value = 0;
+                    has_space = 0;
+
+                    if (start_ele != 0)
+                        tcpmon_strcat(out, "\n", &buffer_size, env);
+
+                    for (i = 0; i < tab_pos; i++)
+                        tcpmon_strcat(out, "\t", &buffer_size, env);
+
+                    tcpmon_strcat(out, "<", &buffer_size, env);
+
+                    ele_prefix =
+                        (axis2_char_t *) axiom_xml_reader_get_prefix(xml_reader,
+                                                                     env);
+                    if (ele_prefix)
+                    {
+                        tcpmon_strcat(out, ele_prefix, &buffer_size, env);
+                        tcpmon_strcat(out, ":", &buffer_size, env);
+                    }
+
+                    ele_name =
+                        (axis2_char_t *) axiom_xml_reader_get_name(xml_reader,
+                                                                   env);
+                    if (ele_name)
+                    {
+                        tcpmon_strcat(out, ele_name, &buffer_size, env);
+                    }
+
+                    ix = axiom_xml_reader_get_attribute_count(xml_reader, env);
+                    for (; ix > 0; ix--)
+                    {
+                        axis2_char_t *attr_prefix;
+                        axis2_char_t *attr_name;
+                        axis2_char_t *attr_value;
+
+                        attr_prefix =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_prefix_by_number
+                            (xml_reader, env, ix);
+                        if (attr_prefix)
+                        {
+                            has_prefix = 1;
+                            tcpmon_strcat(out, " ", &buffer_size, env);
+                            tcpmon_strcat(out, attr_prefix, &buffer_size, env);
+                            tcpmon_strcat(out, ":", &buffer_size, env);
+                        }
+
+                        attr_name =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_name_by_number
+                            (xml_reader, env, ix);
+                        if (attr_name)
+                        {
+                            if (has_prefix)
+                            {
+                                tcpmon_strcat(out, attr_name, &buffer_size,
+                                              env);
+                                tcpmon_strcat(out, "=\"", &buffer_size, env);
+                            }
+                            else
+                            {
+                                tcpmon_strcat(out, " ", &buffer_size, env);
+                                tcpmon_strcat(out, attr_name, &buffer_size,
+                                              env);
+                                tcpmon_strcat(out, "=\"", &buffer_size, env);
+                            }
 
-	                prev_case = START_ELEMENT;
-	            
-    	            has_value = 0;
-	                has_space = 0;
-								
-	                if (start_ele != 0)
-	                tcpmon_strcat(out, "\n", &buffer_size, env);
-                    
-    	            for (i = 0; i < tab_pos; i++)
-	                    tcpmon_strcat(out, "\t", &buffer_size, env);
-	            
-	                tcpmon_strcat(out, "<", &buffer_size, env);
-	            
-	                ele_prefix =(axis2_char_t *)axiom_xml_reader_get_prefix (xml_reader, env);
-	                if (ele_prefix)
-    	            {
-	    	            tcpmon_strcat(out, ele_prefix, &buffer_size, env);
-		                tcpmon_strcat(out, ":", &buffer_size, env);                    
-    	            }
-	        
-	                ele_name = (axis2_char_t *) axiom_xml_reader_get_name (xml_reader, env);
-	                if (ele_name)
-	                {
-		                tcpmon_strcat(out, ele_name, &buffer_size, env);					                    
-    	            }
-                            
-	                ix = axiom_xml_reader_get_attribute_count (xml_reader, env);
-	                for (; ix > 0; ix--)
-	                {
-		                axis2_char_t *attr_prefix;
-    		            axis2_char_t *attr_name;
-    		            axis2_char_t *attr_value;
-	                		
-               		    attr_prefix = (axis2_char_t *)axiom_xml_reader_get_attribute_prefix_by_number (xml_reader, env, ix);
-    		            if (attr_prefix)
-	    	            {
-		                    has_prefix = 1;
-		                    tcpmon_strcat(out, " ", &buffer_size, env);
-		                    tcpmon_strcat(out, attr_prefix, &buffer_size, env);
-		                    tcpmon_strcat(out, ":", &buffer_size, env);
-		                }
-		  
-    		            attr_name = (axis2_char_t *)axiom_xml_reader_get_attribute_name_by_number (xml_reader, env, ix);
-    		            if (attr_name)
-    		            {
-    		                if(has_prefix)
-    		                {
-    			                tcpmon_strcat(out, attr_name, &buffer_size, env);
-    			                tcpmon_strcat(out, "=\"", &buffer_size, env);
-	    	                }
-		                    else
-    		                {
-	    		                tcpmon_strcat(out, " ", &buffer_size, env);
-		    	                tcpmon_strcat(out, attr_name, &buffer_size, env);
-			                    tcpmon_strcat(out, "=\"", &buffer_size, env);
-		                    }
-		                
                             has_prefix = 0;
-		                }
+                        }
+
+                        attr_value =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_value_by_number
+                            (xml_reader, env, ix);
+                        if (attr_value)
+                        {
+                            tcpmon_strcat(out, attr_value, &buffer_size, env);
+                            tcpmon_strcat(out, "\"", &buffer_size, env);
+                        }
+                    }
+
+                    tcpmon_strcat(out, ">", &buffer_size, env);
 
-    		            attr_value = (axis2_char_t *)axiom_xml_reader_get_attribute_value_by_number (xml_reader, env, ix);
-	    	            if (attr_value)
-		                {
-		                    tcpmon_strcat(out, attr_value, &buffer_size, env);
-		                    tcpmon_strcat(out, "\"", &buffer_size, env);
-		                }
-    	            }
-	            
-	                tcpmon_strcat(out, ">", &buffer_size, env);
-	            
                     tab_pos++;
-	                start_ele = 1;
-    	        }
-	            break;
-	            case AXIOM_XML_READER_CHARACTER:
-	            {
-    	            axis2_char_t *ele_value;
-                
-	                prev_case = CHAR_VALUE;
-
-	                ele_value = axiom_xml_reader_get_value (xml_reader, env);
-	                if (ele_value)
-    	                tcpmon_strcat(out, ele_value, &buffer_size, env);
-	            
-	                has_value = 1;
-                
-	            }
-	            break;
-	            case AXIOM_XML_READER_EMPTY_ELEMENT:
-	            {
-	                int i, ix, has_prefix = 0;
-	            
+                    start_ele = 1;
+                }
+                break;
+            case AXIOM_XML_READER_CHARACTER:
+                {
+                    axis2_char_t *ele_value;
+
+                    prev_case = CHAR_VALUE;
+
+                    ele_value = axiom_xml_reader_get_value(xml_reader, env);
+                    if (ele_value)
+                        tcpmon_strcat(out, ele_value, &buffer_size, env);
+
+                    has_value = 1;
+
+                }
+                break;
+            case AXIOM_XML_READER_EMPTY_ELEMENT:
+                {
+                    int i,
+                     ix,
+                     has_prefix = 0;
+
                     axis2_char_t *ele_name;
-	                axis2_char_t *ele_prefix;
+                    axis2_char_t *ele_prefix;
+
+                    prev_case = EMPTY_ELEMENT;
+
+                    has_value = 0;
+                    has_space = 0;
 
-	                prev_case = EMPTY_ELEMENT;
+                    if (start_ele != 0)
+                        tcpmon_strcat(out, "\n", &buffer_size, env);
+
+                    for (i = 0; i < tab_pos; i++)
+                        tcpmon_strcat(out, "\t", &buffer_size, env);
+
+                    tcpmon_strcat(out, "<", &buffer_size, env);
+
+                    ele_prefix =
+                        (axis2_char_t *) axiom_xml_reader_get_prefix(xml_reader,
+                                                                     env);
+                    if (ele_prefix)
+                    {
+                        tcpmon_strcat(out, ele_prefix, &buffer_size, env);
+                        tcpmon_strcat(out, ":", &buffer_size, env);
+                    }
+
+                    ele_name =
+                        (axis2_char_t *) axiom_xml_reader_get_name(xml_reader,
+                                                                   env);
+                    if (ele_name)
+                        tcpmon_strcat(out, ele_name, &buffer_size, env);
+
+                    ix = axiom_xml_reader_get_attribute_count(xml_reader, env);
+                    for (; ix > 0; ix--)
+                    {
+                        axis2_char_t *attr_prefix;
+                        axis2_char_t *attr_name;
+                        axis2_char_t *attr_value;
+
+                        attr_prefix =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_prefix_by_number
+                            (xml_reader, env, ix);
+                        if (attr_prefix)
+                        {
+                            has_prefix = 1;
+                            tcpmon_strcat(out, " ", &buffer_size, env);
+                            tcpmon_strcat(out, attr_prefix, &buffer_size, env);
+                            tcpmon_strcat(out, ":", &buffer_size, env);
+                        }
+
+                        attr_name =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_name_by_number
+                            (xml_reader, env, ix);
+                        if (attr_name)
+                        {
+                            if (has_prefix)
+                            {
+                                tcpmon_strcat(out, attr_name, &buffer_size,
+                                              env);
+                                tcpmon_strcat(out, "=\"", &buffer_size, env);
+                            }
+                            else
+                            {
+                                tcpmon_strcat(out, " ", &buffer_size, env);
+                                tcpmon_strcat(out, attr_name, &buffer_size,
+                                              env);
+                                tcpmon_strcat(out, "=\"", &buffer_size, env);
+                            }
+                            has_prefix = 0;
+                        }
+
+                        attr_value =
+                            (axis2_char_t *)
+                            axiom_xml_reader_get_attribute_value_by_number
+                            (xml_reader, env, ix);
+                        if (attr_value)
+                        {
+                            tcpmon_strcat(out, attr_value, &buffer_size, env);
+                            tcpmon_strcat(out, "\"", &buffer_size, env);
+                        }
+                    }
 
-	                has_value = 0;
-	                has_space = 0;
-                
-	                if (start_ele != 0)
-	                    tcpmon_strcat(out, "\n", &buffer_size, env);
-	            
-    	            for (i = 0; i < tab_pos; i++)
-	                    tcpmon_strcat(out, "\t", &buffer_size, env);
-
-	                tcpmon_strcat(out, "<", &buffer_size, env);
-	            
-	                ele_prefix = (axis2_char_t *) axiom_xml_reader_get_prefix (xml_reader, env);
-    	            if (ele_prefix)
-	                {
-		                tcpmon_strcat(out, ele_prefix, &buffer_size, env);
-		                tcpmon_strcat(out, ":", &buffer_size, env);                    
-	                }
-	     
-    	            ele_name = (axis2_char_t *) axiom_xml_reader_get_name (xml_reader, env);
-	                if (ele_name)
-	                    tcpmon_strcat(out, ele_name, &buffer_size, env);
-	      
-	                ix = axiom_xml_reader_get_attribute_count (xml_reader, env);
-    	            for (; ix > 0; ix--)
-	                {
-    		            axis2_char_t *attr_prefix;
-	    	            axis2_char_t *attr_name;
-		                axis2_char_t *attr_value;
-
-		                attr_prefix = (axis2_char_t *)axiom_xml_reader_get_attribute_prefix_by_number (xml_reader, env, ix);
-		                if (attr_prefix)
-		                {
-    		                has_prefix = 1;
-	    	                tcpmon_strcat(out, " ", &buffer_size, env);
-		                    tcpmon_strcat(out, attr_prefix, &buffer_size, env);
-		                    tcpmon_strcat(out, ":", &buffer_size, env);
-		                }
-
-		                attr_name = (axis2_char_t *)axiom_xml_reader_get_attribute_name_by_number (xml_reader, env, ix);
-    		            if (attr_name)
-	    	            {
-		                    if(has_prefix)
-		                    {
-			                    tcpmon_strcat(out, attr_name, &buffer_size, env);
-			                    tcpmon_strcat(out, "=\"", &buffer_size, env);
-		                    }
-    		                else
-	    	                {
-		    	                tcpmon_strcat(out, " ", &buffer_size, env);
-			                    tcpmon_strcat(out, attr_name, &buffer_size, env);
-			                    tcpmon_strcat(out, "=\"", &buffer_size, env);
-		                    }
-		                    has_prefix = 0;
-    		            }
-		            
-	    	            attr_value = (axis2_char_t *)axiom_xml_reader_get_attribute_value_by_number (xml_reader, env, ix);
-		                if (attr_value)
-		                {
-		                    tcpmon_strcat(out, attr_value, &buffer_size, env);
-		                    tcpmon_strcat(out, "\"", &buffer_size, env);
-    		            }
-	                }
-    
                     tcpmon_strcat(out, "/>", &buffer_size, env);
-    	            start_ele = 1;
+                    start_ele = 1;
                 }
-	            break;
-    	        case AXIOM_XML_READER_END_ELEMENT:
-	            {
-	                int i;
-	    
+                break;
+            case AXIOM_XML_READER_END_ELEMENT:
+                {
+                    int i;
+
                     axis2_char_t *ele_prefix;
-    	            axis2_char_t *ele_name;
-				
-	                tab_pos--;
-				
-	                if (has_value == 0 && prev_case != START_ELEMENT)
-	                {
-		                tcpmon_strcat(out, "\n", &buffer_size, env);
-    		            for (i = 0; i < tab_pos; i++)
-	        	            tcpmon_strcat(out, "\t", &buffer_size, env);
-	                }
-
-	                has_value = 0;
-	            				
-    	            tcpmon_strcat(out, "</", &buffer_size, env);
-
-	                ele_prefix = (axis2_char_t *) axiom_xml_reader_get_prefix (xml_reader, env);
-	                if (ele_prefix)
-	                {
-		                tcpmon_strcat(out, ele_prefix, &buffer_size, env);
-		                tcpmon_strcat(out, ":", &buffer_size, env);                    
-	                }
-	      
-    	            ele_name = (axis2_char_t *) axiom_xml_reader_get_name (xml_reader, env);
-	                if (ele_name)
-	                {
-		                tcpmon_strcat(out, ele_name, &buffer_size, env);
-		                tcpmon_strcat(out, ">", &buffer_size, env);
-    	            }
-	                prev_case = END_ELEMENT;
-	            
-	            }
-	            break;
-    	    }   
+                    axis2_char_t *ele_name;
+
+                    tab_pos--;
+
+                    if (has_value == 0 && prev_case != START_ELEMENT)
+                    {
+                        tcpmon_strcat(out, "\n", &buffer_size, env);
+                        for (i = 0; i < tab_pos; i++)
+                            tcpmon_strcat(out, "\t", &buffer_size, env);
+                    }
+
+                    has_value = 0;
+
+                    tcpmon_strcat(out, "</", &buffer_size, env);
+
+                    ele_prefix =
+                        (axis2_char_t *) axiom_xml_reader_get_prefix(xml_reader,
+                                                                     env);
+                    if (ele_prefix)
+                    {
+                        tcpmon_strcat(out, ele_prefix, &buffer_size, env);
+                        tcpmon_strcat(out, ":", &buffer_size, env);
+                    }
+
+                    ele_name =
+                        (axis2_char_t *) axiom_xml_reader_get_name(xml_reader,
+                                                                   env);
+                    if (ele_name)
+                    {
+                        tcpmon_strcat(out, ele_name, &buffer_size, env);
+                        tcpmon_strcat(out, ">", &buffer_size, env);
+                    }
+                    prev_case = END_ELEMENT;
+
+                }
+                break;
+            }
         }
         return out;
     }
@@ -367,6 +422,7 @@
   allocator-> index += count - 1;
 }
 */
+
 /*void add_axis2_char_t(const axutil_env_t* env,
 		      tcpmon_util_allocator_t* allocator,
 		      axis2_char_t c,
@@ -397,27 +453,33 @@
 
 } */
 
-axis2_char_t* tcpmon_strcat(axis2_char_t *dest, axis2_char_t *source, int *buff_size, const axutil_env_t* env)
+axis2_char_t *
+tcpmon_strcat(
+    axis2_char_t * dest,
+    axis2_char_t * source,
+    int *buff_size,
+    const axutil_env_t * env)
 {
     int cur_len = 0;
     int source_len = 0;
-  
+
     axis2_char_t *tmp;
     cur_len = strlen(dest);
     source_len = strlen(source);
 
-    if ((*buff_size-cur_len) < source_len)
+    if ((*buff_size - cur_len) < source_len)
     {
-        *buff_size = *buff_size + (*buff_size*2);
-        tmp = (axis2_char_t*)AXIS2_REALLOC(env->allocator, dest, *buff_size*sizeof(axis2_char_t));
+        *buff_size = *buff_size + (*buff_size * 2);
+        tmp =
+            (axis2_char_t *) AXIS2_REALLOC(env->allocator, dest,
+                                           *buff_size * sizeof(axis2_char_t));
         dest = tmp;
-        strcat((char*)dest, (char*)source);
+        strcat((char *) dest, (char *) source);
     }
     else
     {
-        strcat((char*)dest, (char*)source);
+        strcat((char *) dest, (char *) source);
     }
 
     return dest;
 }
-

Modified: webservices/axis2/trunk/c/tools/tcpmon/test/unit/main.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/test/unit/main.c?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/test/unit/main.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/test/unit/main.c Fri Sep 28 03:29:16 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -19,12 +20,14 @@
 #include <stdio.h>
 #include "tcpmon_test.h"
 
-void RunAllTests(void)
+void
+RunAllTests(
+    void)
 {
     CuString *output = CuStringNew();
-    CuSuite* suite = CuSuiteNew();
+    CuSuite *suite = CuSuiteNew();
 
-    CuSuiteAddSuite(suite, (CuSuite*)tcpmon_GetSuite());
+    CuSuiteAddSuite(suite, (CuSuite *) tcpmon_GetSuite());
 
     CuSuiteRun(suite);
     CuSuiteSummary(suite, output);
@@ -32,7 +35,9 @@
     printf("%s\n", output->buffer);
 }
 
-int main(void)
+int
+main(
+    void)
 {
     RunAllTests();
     return 0;

Modified: webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.c?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.c Fri Sep 28 03:29:16 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -23,56 +24,50 @@
 
 #include <tcpmon_util.h>
 
-void test_format_xml(CuTest *tc)
+void
+test_format_xml(
+    CuTest * tc)
 {
     axutil_env_t *env;
     axutil_allocator_t *allocator;
-    axis2_char_t* input;
-    axis2_char_t* actual;
-    axis2_char_t* expected;
+    axis2_char_t *input;
+    axis2_char_t *actual;
+    axis2_char_t *expected;
 
     allocator = axutil_allocator_init(NULL);
     env = axutil_env_create(allocator);
 
-    input = (char*)axutil_strdup(env, "<input>check for one step</input>");
-    actual =
-        (char*)tcpmon_util_format_as_xml(env, input);
-    expected = "<input>\n"
-            "\tcheck for one step\n"
-            "</input>\n";
+    input = (char *) axutil_strdup(env, "<input>check for one step</input>");
+    actual = (char *) tcpmon_util_format_as_xml(env, input);
+    expected = "<input>\n" "\tcheck for one step\n" "</input>\n";
     CuAssertStrEquals(tc, expected, actual);
     free(actual);
     free(input);
 
-
-    input = (char*)axutil_strdup(env, "<input><tag2><another_tag with='attriutes'>check for one step</another_tag></tag2></input>");
-    actual =
-        (char*)tcpmon_util_format_as_xml(env, input);
+    input =
+        (char *) axutil_strdup(env,
+                               "<input><tag2><another_tag with='attriutes'>check for one step</another_tag></tag2></input>");
+    actual = (char *) tcpmon_util_format_as_xml(env, input);
     expected =
         "<input>\n"
         "\t<tag2>\n"
         "\t\t<another_tag with='attriutes'>\n"
         "\t\t\tcheck for one step\n"
-        "\t\t</another_tag>\n"
-        "\t</tag2>\n"
-        "</input>\n";
+        "\t\t</another_tag>\n" "\t</tag2>\n" "</input>\n";
 
     CuAssertStrEquals(tc, expected, actual);
     free(actual);
     free(input);
 
-    input = (char*)axutil_strdup(env,
-		"<?processing inc?><input><tag2><another_tag with='attriutes'>check for one step</another_tag></tag2></input>");
-    actual =
-        (char*)tcpmon_util_format_as_xml(env, input);
+    input = (char *) axutil_strdup(env,
+                                   "<?processing inc?><input><tag2><another_tag with='attriutes'>check for one step</another_tag></tag2></input>");
+    actual = (char *) tcpmon_util_format_as_xml(env, input);
     expected = "<?processing inc?>\n"
-            "<input>\n"
-            "\t<tag2>\n"
-            "\t\t<another_tag with='attriutes'>\n"
-            "\t\t\tcheck for one step\n"
-            "\t\t</another_tag>\n"
-            "\t</tag2>\n"
-            "</input>\n";
+        "<input>\n"
+        "\t<tag2>\n"
+        "\t\t<another_tag with='attriutes'>\n"
+        "\t\t\tcheck for one step\n"
+        "\t\t</another_tag>\n" "\t</tag2>\n" "</input>\n";
 
     CuAssertStrEquals(tc, expected, actual);
     free(actual);
@@ -80,10 +75,11 @@
 
 }
 
-CuSuite* tcpmon_GetSuite()
+CuSuite *
+tcpmon_GetSuite(
+    )
 {
-    CuSuite* suite = CuSuiteNew();
+    CuSuite *suite = CuSuiteNew();
     SUITE_ADD_TEST(suite, test_format_xml);
     return suite;
 }
-

Modified: webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.h?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.h (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.h Fri Sep 28 03:29:16 2007
@@ -3,7 +3,7 @@
 
 #include <CuTest.h>
 
-CuSuite* tcpmon_GetSuite();
-
-#endif /* TCPMON_TEST_H */
+CuSuite *tcpmon_GetSuite(
+);
 
+#endif                          /* TCPMON_TEST_H */

Modified: webservices/axis2/trunk/c/xdocs/docs/hello/client/hello.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xdocs/docs/hello/client/hello.c?rev=580289&r1=580288&r2=580289&view=diff
==============================================================================
--- webservices/axis2/trunk/c/xdocs/docs/hello/client/hello.c (original)
+++ webservices/axis2/trunk/c/xdocs/docs/hello/client/hello.c Fri Sep 28 03:29:16 2007
@@ -1,3 +1,4 @@
+
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -20,21 +21,24 @@
 #include <axiom_soap.h>
 #include <axis2_client.h>
 
-axiom_node_t *
-build_om_request(const axutil_env_t *env);
+axiom_node_t *build_om_request(
+    const axutil_env_t * env);
 
-const axis2_char_t *
-process_om_response(const axutil_env_t *env,
-        axiom_node_t *node);
-
-int main(int argc, char** argv)
+const axis2_char_t *process_om_response(
+    const axutil_env_t * env,
+    axiom_node_t * node);
+
+int
+main(
+    int argc,
+    char **argv)
 {
     const axutil_env_t *env = NULL;
     const axis2_char_t *address = NULL;
-    axis2_endpoint_ref_t* endpoint_ref = NULL;
+    axis2_endpoint_ref_t *endpoint_ref = NULL;
     axis2_options_t *options = NULL;
     const axis2_char_t *client_home = NULL;
-    axis2_svc_client_t* svc_client = NULL;
+    axis2_svc_client_t *svc_client = NULL;
     axiom_node_t *payload = NULL;
     axiom_node_t *ret_node = NULL;
 
@@ -63,9 +67,10 @@
     if (!svc_client)
     {
         printf("Error creating service client\n");
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
-                " %d :: %s", env->error->error_number,
-                AXIS2_ERROR_GET_MESSAGE(env->error));
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "Stub invoke FAILED: Error code:" " %d :: %s",
+                        env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
         return -1;
     }
 
@@ -86,9 +91,10 @@
     }
     else
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
-                " %d :: %s", env->error->error_number,
-                AXIS2_ERROR_GET_MESSAGE(env->error));
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "Stub invoke FAILED: Error code:" " %d :: %s",
+                        env->error->error_number,
+                        AXIS2_ERROR_GET_MESSAGE(env->error));
         printf("hello client invoke FAILED!\n");
     }
 
@@ -114,20 +120,23 @@
 }
 
 axiom_node_t *
-build_om_request(const axutil_env_t *env)
+build_om_request(
+    const axutil_env_t * env)
 {
-    axiom_node_t* greet_om_node = NULL;
-    axiom_element_t * greet_om_ele = NULL;
+    axiom_node_t *greet_om_node = NULL;
+    axiom_element_t *greet_om_ele = NULL;
 
-    greet_om_ele = axiom_element_create(env, NULL, "greet", NULL, &greet_om_node);
+    greet_om_ele =
+        axiom_element_create(env, NULL, "greet", NULL, &greet_om_node);
     axiom_element_set_text(greet_om_ele, env, "Hello Server!", greet_om_node);
 
     return greet_om_node;
 }
 
 const axis2_char_t *
-process_om_response(const axutil_env_t *env,
-        axiom_node_t *node)
+process_om_response(
+    const axutil_env_t * env,
+    axiom_node_t * node)
 {
     axiom_node_t *service_greeting_node = NULL;
     axiom_node_t *return_node = NULL;
@@ -136,10 +145,12 @@
     {
         service_greeting_node = axiom_node_get_first_child(node, env);
         if (service_greeting_node &&
-                axiom_node_get_node_type(service_greeting_node, env) == AXIOM_TEXT)
+            axiom_node_get_node_type(service_greeting_node, env) == AXIOM_TEXT)
         {
-            axiom_text_t *greeting = (axiom_text_t *)axiom_node_get_data_element(service_greeting_node, env);
-            if (greeting && axiom_text_get_value(greeting , env))
+            axiom_text_t *greeting =
+                (axiom_text_t *)
+                axiom_node_get_data_element(service_greeting_node, env);
+            if (greeting && axiom_text_get_value(greeting, env))
             {
                 return axiom_text_get_value(greeting, env);
             }
@@ -147,4 +158,3 @@
     }
     return NULL;
 }
-



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message