You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by se...@apache.org on 2008/03/08 21:23:11 UTC
svn commit: r635071 - in /webservices/axis2/trunk/c/tools/tcpmon:
include/tcpmon_entry.h src/entry.c src/tcpmon.c
Author: senaka
Date: Sat Mar 8 12:23:08 2008
New Revision: 635071
URL: http://svn.apache.org/viewvc?rev=635071&view=rev
Log:
Fixing mtom bug in TCPMon
Modified:
webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h
webservices/axis2/trunk/c/tools/tcpmon/src/entry.c
webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
Modified: webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h?rev=635071&r1=635070&r2=635071&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h Sat Mar 8 12:23:08 2008
@@ -152,7 +152,13 @@
int(
AXIS2_CALL
- * get_data_length)(
+ * get_sent_data_length)(
+ tcpmon_entry_t * entry,
+ const axutil_env_t * env);
+
+ int(
+ AXIS2_CALL
+ * get_arrived_data_length)(
tcpmon_entry_t * entry,
const axutil_env_t * env);
@@ -213,8 +219,11 @@
#define TCPMON_ENTRY_GET_FORMAT_BIT(entry, env) \
((entry)->ops->get_format_bit(entry, env))
-#define TCPMON_ENTRY_GET_DATA_LENGTH(entry, env) \
- ((entry)->ops->get_data_length(entry, env))
+#define TCPMON_ENTRY_GET_SENT_DATA_LENGTH(entry, env) \
+ ((entry)->ops->get_sent_data_length(entry, env))
+
+#define TCPMON_ENTRY_GET_ARRIVED_DATA_LENGTH(entry, env) \
+ ((entry)->ops->get_arrived_data_length(entry, env))
/** @} */
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/entry.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/entry.c?rev=635071&r1=635070&r2=635071&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/entry.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/entry.c Sat Mar 8 12:23:08 2008
@@ -46,7 +46,8 @@
axis2_char_t *time_diff;
axis2_char_t *test_file_name;
int format_bit;
- int data_length;
+ int sent_data_length;
+ int arrived_data_length;
}
tcpmon_entry_impl_t;
@@ -111,7 +112,11 @@
tcpmon_entry_t * entry,
const axutil_env_t * env);
-int AXIS2_CALL tcpmon_entry_get_data_length(
+int AXIS2_CALL tcpmon_entry_get_sent_data_length(
+ tcpmon_entry_t * entry,
+ const axutil_env_t * env);
+
+int AXIS2_CALL tcpmon_entry_get_arrived_data_length(
tcpmon_entry_t * entry,
const axutil_env_t * env);
@@ -150,7 +155,8 @@
entry_impl->sent_headers = NULL;
entry_impl->is_success = AXIS2_FALSE;
entry_impl->format_bit = 0;
- entry_impl->data_length = 0;
+ entry_impl->sent_data_length = 0;
+ entry_impl->arrived_data_length = 0;
entry_impl->entry.ops =
AXIS2_MALLOC(env->allocator, sizeof(tcpmon_entry_ops_t));
@@ -172,7 +178,8 @@
entry_impl->entry.ops->is_success = tcpmon_entry_is_success;
entry_impl->entry.ops->set_format_bit = tcpmon_entry_set_format_bit;
entry_impl->entry.ops->get_format_bit = tcpmon_entry_get_format_bit;
- entry_impl->entry.ops->get_data_length = tcpmon_entry_get_data_length;
+ entry_impl->entry.ops->get_sent_data_length = tcpmon_entry_get_sent_data_length;
+ entry_impl->entry.ops->get_arrived_data_length = tcpmon_entry_get_arrived_data_length;
return &(entry_impl->entry);
}
@@ -368,7 +375,21 @@
}
int AXIS2_CALL
-tcpmon_entry_get_data_length(
+tcpmon_entry_get_sent_data_length(
+ tcpmon_entry_t * entry,
+ const axutil_env_t * env)
+{
+ tcpmon_entry_impl_t *entry_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ entry_impl = AXIS2_INTF_TO_IMPL(entry);
+
+ return entry_impl->sent_data_length;
+}
+
+int AXIS2_CALL
+tcpmon_entry_get_arrived_data_length(
tcpmon_entry_t * entry,
const axutil_env_t * env)
{
@@ -378,7 +399,7 @@
entry_impl = AXIS2_INTF_TO_IMPL(entry);
- return entry_impl->data_length;
+ return entry_impl->arrived_data_length;
}
axis2_status_t AXIS2_CALL
@@ -512,7 +533,7 @@
entry_impl->sent_headers = headers;
entry_impl->sent_data = content;
- entry_impl->data_length = buffer_size;
+ entry_impl->sent_data_length = buffer_size;
if (on_new_entry)
{
@@ -602,7 +623,7 @@
entry_impl->arrived_headers = headers;
entry_impl->arrived_data = content;
- entry_impl->data_length = buffer_size;
+ entry_impl->arrived_data_length = buffer_size;
if (buffer == NULL || buffer_size == 0)
{
entry_impl->is_success = 0;
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=635071&r1=635070&r2=635071&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Sat Mar 8 12:23:08 2008
@@ -211,6 +211,7 @@
}
}
while (c != 'q');
+ printf("\n\n");
TCPMON_SESSION_STOP(session, env);
TCPMON_SESSION_FREE(session, env);
@@ -253,7 +254,7 @@
plain_buffer = TCPMON_ENTRY_SENT_DATA(entry, env);
if (plain_buffer) /* this can be possible as no xml present */
{
- if (TCPMON_ENTRY_GET_DATA_LENGTH(entry, env) ==
+ if (TCPMON_ENTRY_GET_SENT_DATA_LENGTH(entry, env) ==
strlen(TCPMON_ENTRY_SENT_HEADERS(entry, env)) +
strlen(plain_buffer) + 4)
{
@@ -267,11 +268,11 @@
formated_buffer = "";
}
/* 2 screen */
- printf("%s\n", "SENDING DATA..");
+ printf("\n\n%s\n", "SENDING DATA..");
printf("/* sending time = %s*/\n", TCPMON_ENTRY_SENT_TIME(entry, env));
printf("---------------------\n");
- if (format || TCPMON_ENTRY_GET_DATA_LENGTH(entry, env) ==
+ if (format || TCPMON_ENTRY_GET_SENT_DATA_LENGTH(entry, env) ==
strlen(TCPMON_ENTRY_SENT_HEADERS(entry, env)) +
strlen(formated_buffer) + 4)
{
@@ -285,7 +286,7 @@
axis2_char_t *temp = NULL;
axis2_char_t *formated_buffer_temp = formated_buffer;
printf("%s\n", TCPMON_ENTRY_SENT_HEADERS(entry, env));
- count = TCPMON_ENTRY_GET_DATA_LENGTH(entry, env) - 4 -
+ count = TCPMON_ENTRY_GET_SENT_DATA_LENGTH(entry, env) - 4 -
strlen(TCPMON_ENTRY_SENT_HEADERS(entry, env));
temp = AXIS2_MALLOC(env->allocator,
sizeof(axis2_char_t) * count + 1);
@@ -308,8 +309,9 @@
formated_buffer = formated_buffer_temp;*/
int count = 0;
int printed = 0;
+ axis2_char_t *formated_buffer_temp = formated_buffer;
printf("%s\n", TCPMON_ENTRY_SENT_HEADERS(entry, env));
- count = TCPMON_ENTRY_GET_DATA_LENGTH(entry, env) - 4 -
+ count = TCPMON_ENTRY_GET_SENT_DATA_LENGTH(entry, env) - 4 -
strlen(TCPMON_ENTRY_SENT_HEADERS(entry, env));
while (count > printed)
{
@@ -326,6 +328,7 @@
formated_buffer += plen;
}
}
+ formated_buffer = formated_buffer_temp;
}
/* 2 file */
@@ -343,7 +346,7 @@
}
if (strcmp(formated_buffer, "") != 0)
{
- if (format || TCPMON_ENTRY_GET_DATA_LENGTH(entry, env) ==
+ if (format || TCPMON_ENTRY_GET_SENT_DATA_LENGTH(entry, env) ==
strlen(TCPMON_ENTRY_SENT_HEADERS(entry, env)) +
strlen(formated_buffer) + 4)
{
@@ -359,7 +362,7 @@
{
int count = 0;
int printed = 0;
- count = TCPMON_ENTRY_GET_DATA_LENGTH(entry, env) - 4 -
+ count = TCPMON_ENTRY_GET_SENT_DATA_LENGTH(entry, env) - 4 -
strlen(TCPMON_ENTRY_SENT_HEADERS(entry, env));
while (count > printed)
{
@@ -384,6 +387,12 @@
plain_buffer = TCPMON_ENTRY_ARRIVED_DATA(entry, env);
if (plain_buffer) /* this can be possible as no xml present */
{
+ if (TCPMON_ENTRY_GET_ARRIVED_DATA_LENGTH(entry, env) ==
+ strlen(TCPMON_ENTRY_ARRIVED_HEADERS(entry, env)) +
+ strlen(plain_buffer) + 4)
+ {
+ format = 0; /* mtom scenario */
+ }
formated_buffer = tcpmon_util_format_as_xml
(env, plain_buffer, format);
}
@@ -399,8 +408,64 @@
TCPMON_ENTRY_TIME_DIFF(entry, env));
printf("---------------------\n");
- printf("%s\n\n%s\n\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env),
- formated_buffer);
+ if (format || TCPMON_ENTRY_GET_ARRIVED_DATA_LENGTH(entry, env) ==
+ strlen(TCPMON_ENTRY_ARRIVED_HEADERS(entry, env)) +
+ strlen(formated_buffer) + 4)
+ {
+ printf("%s\n\n%s\n\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env),
+ formated_buffer);
+ }
+ else
+ {
+ /*int count = 0;
+ int printed = 0;
+ axis2_char_t *temp = NULL;
+ axis2_char_t *formated_buffer_temp = formated_buffer;
+ printf("%s\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env));
+ count = TCPMON_ENTRY_GET_ARRIVED_DATA_LENGTH(entry, env) - 4 -
+ strlen(TCPMON_ENTRY_ARRIVED_HEADERS(entry, env));
+ temp = AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_char_t) * count + 1);
+ while (count > printed)
+ {
+ if (*formated_buffer)
+ {
+ temp[printed] = *formated_buffer;
+ }
+ else
+ {
+ temp[printed] = ' ';
+ }
+ printed++;
+ formated_buffer++;
+ }
+ temp[count] = '\0';
+ printf("%s\n\n", temp);
+ AXIS2_FREE(env->allocator, temp);
+ formated_buffer = formated_buffer_temp;*/
+ int count = 0;
+ int printed = 0;
+ axis2_char_t *formated_buffer_temp = formated_buffer;
+ printf("%s\n", TCPMON_ENTRY_ARRIVED_HEADERS(entry, env));
+ count = TCPMON_ENTRY_GET_ARRIVED_DATA_LENGTH(entry, env) - 4 -
+ strlen(TCPMON_ENTRY_ARRIVED_HEADERS(entry, env));
+ while (count > printed)
+ {
+ int plen = 0;
+ plen = ((int)strlen(formated_buffer) + 1);
+ if (plen != 1)
+ {
+ printf("%s", formated_buffer);
+ }
+ printed += plen;
+ if (count > printed)
+ {
+ printf("%c", '\0');
+ formated_buffer += plen;
+ }
+ }
+ formated_buffer = formated_buffer_temp;
+ }
/* 2 file */
fprintf(file, "%s\n", "RETRIEVING DATA..");
@@ -419,19 +484,43 @@
}
if (strcmp(formated_buffer, "") != 0)
{
- convert = axutil_strdup(env, formated_buffer);
- convert = str_replace(convert, "; ", ";\n\t");
- convert = str_replace(convert, "><", ">\n<");
- fprintf(file, "%s", convert);
- if (convert)
+ if (format || TCPMON_ENTRY_GET_ARRIVED_DATA_LENGTH(entry, env) ==
+ strlen(TCPMON_ENTRY_ARRIVED_HEADERS(entry, env)) +
+ strlen(formated_buffer) + 4)
{
- free(convert);
+ convert = axutil_strdup(env, formated_buffer);
+ convert = str_replace(convert, "><", ">\n<");
+ fprintf(file, "%s", convert);
+ if (convert)
+ {
+ free(convert);
+ }
+ }
+ else
+ {
+ int count = 0;
+ int printed = 0;
+ count = TCPMON_ENTRY_GET_ARRIVED_DATA_LENGTH(entry, env) - 4 -
+ strlen(TCPMON_ENTRY_ARRIVED_HEADERS(entry, env));
+ while (count > printed)
+ {
+ int plen = 0;
+ plen = ((int)strlen(formated_buffer) + 1);
+ if (plen != 1)
+ {
+ fprintf(file, "%s", formated_buffer);
+ }
+ printed += plen;
+ if (count > printed)
+ {
+ fprintf(file, "%c", '\0');
+ formated_buffer += plen;
+ }
+ }
}
}
}
-
fclose(file);
-
return 0;
}
@@ -575,6 +664,7 @@
{
AXIS2_LOG_INFO(system_env->log, "Received signal SIGINT. Utility "
"shutting down");
+ printf("\n\n");
TCPMON_SESSION_STOP(session, system_env);
TCPMON_SESSION_FREE(session, system_env);
AXIS2_FREE(system_env->allocator, target_host);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org