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 na...@apache.org on 2006/09/01 14:55:46 UTC
svn commit: r439300 [1/2] - in /webservices/axis2/trunk/c/tools/tcpmon: ./
include/ src/ test/ test/unit/
Author: nandika
Date: Fri Sep 1 05:55:44 2006
New Revision: 439300
URL: http://svn.apache.org/viewvc?rev=439300&view=rev
Log:
code from JIRA 216, thanks to samitha.
Added:
webservices/axis2/trunk/c/tools/tcpmon/
webservices/axis2/trunk/c/tools/tcpmon/AUTHORS
webservices/axis2/trunk/c/tools/tcpmon/COPYING (with props)
webservices/axis2/trunk/c/tools/tcpmon/ChangeLog
webservices/axis2/trunk/c/tools/tcpmon/INSTALL (with props)
webservices/axis2/trunk/c/tools/tcpmon/LICENSE
webservices/axis2/trunk/c/tools/tcpmon/Makefile.am
webservices/axis2/trunk/c/tools/tcpmon/NEWS
webservices/axis2/trunk/c/tools/tcpmon/README
webservices/axis2/trunk/c/tools/tcpmon/autogen.sh (with props)
webservices/axis2/trunk/c/tools/tcpmon/build.sh
webservices/axis2/trunk/c/tools/tcpmon/configure.ac
webservices/axis2/trunk/c/tools/tcpmon/include/
webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h
webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h
webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h
webservices/axis2/trunk/c/tools/tcpmon/src/
webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am
webservices/axis2/trunk/c/tools/tcpmon/src/entry.c
webservices/axis2/trunk/c/tools/tcpmon/src/session.c
webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_entry_local.h
webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon_session_local.h
webservices/axis2/trunk/c/tools/tcpmon/src/util.c
webservices/axis2/trunk/c/tools/tcpmon/test/
webservices/axis2/trunk/c/tools/tcpmon/test/Makefile.am
webservices/axis2/trunk/c/tools/tcpmon/test/unit/
webservices/axis2/trunk/c/tools/tcpmon/test/unit/Makefile.am
webservices/axis2/trunk/c/tools/tcpmon/test/unit/main.c
webservices/axis2/trunk/c/tools/tcpmon/test/unit/result
webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.c
webservices/axis2/trunk/c/tools/tcpmon/test/unit/tcpmon_test.h
Added: webservices/axis2/trunk/c/tools/tcpmon/AUTHORS
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/AUTHORS?rev=439300&view=auto
==============================================================================
(empty)
Added: webservices/axis2/trunk/c/tools/tcpmon/COPYING
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/COPYING?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/COPYING (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/COPYING Fri Sep 1 05:55:44 2006
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Propchange: webservices/axis2/trunk/c/tools/tcpmon/COPYING
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/axis2/trunk/c/tools/tcpmon/ChangeLog
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/ChangeLog?rev=439300&view=auto
==============================================================================
(empty)
Added: webservices/axis2/trunk/c/tools/tcpmon/INSTALL
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/INSTALL?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/INSTALL (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/INSTALL Fri Sep 1 05:55:44 2006
@@ -0,0 +1 @@
+link /usr/share/automake-1.9/INSTALL
\ No newline at end of file
Propchange: webservices/axis2/trunk/c/tools/tcpmon/INSTALL
------------------------------------------------------------------------------
svn:special = *
Added: webservices/axis2/trunk/c/tools/tcpmon/LICENSE
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/LICENSE?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/LICENSE (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/LICENSE Fri Sep 1 05:55:44 2006
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: webservices/axis2/trunk/c/tools/tcpmon/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/Makefile.am?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/Makefile.am (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/Makefile.am Fri Sep 1 05:55:44 2006
@@ -0,0 +1,3 @@
+SUBDIRS = src $(TESTDIR)
+include_HEADERS=$(top_builddir)/include/*.h
+data_DATA= INSTALL README AUTHORS NEWS LICENSE COPYING
Added: webservices/axis2/trunk/c/tools/tcpmon/NEWS
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/NEWS?rev=439300&view=auto
==============================================================================
(empty)
Added: webservices/axis2/trunk/c/tools/tcpmon/README
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/README?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/README (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/README Fri Sep 1 05:55:44 2006
@@ -0,0 +1,18 @@
+ Axis2C TCP Monitor
+
+What is it?
+-----------
+
+Axis2 TCP monitor project is aimed at capture the SOAP messages sent and received.It works only in command line interface.
+
+How to run the TCP monitor?
+Run the file called tcpmon with the Listen Port,Target port and Host name.
+For instruction run tcpmon -h
+
+
+Installation
+------------
+
+Please see the file called INSTALL.
+
+
Added: webservices/axis2/trunk/c/tools/tcpmon/autogen.sh
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/autogen.sh?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/autogen.sh (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/autogen.sh Fri Sep 1 05:55:44 2006
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+echo -n 'Running libtoolize...'
+if libtoolize --force > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running aclocal...'
+if aclocal > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running autoheader...'
+if autoheader > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running autoconf...'
+if autoconf > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running automake...'
+if automake --add-missing > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo 'done'
Propchange: webservices/axis2/trunk/c/tools/tcpmon/autogen.sh
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/axis2/trunk/c/tools/tcpmon/build.sh
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/build.sh?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/build.sh (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/build.sh Fri Sep 1 05:55:44 2006
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+./autogen.sh
+
+if test -z ${AXIS2C_HOME}
+then
+ AXIS2C_HOME=`pwd`/../deploy
+fi
+
+export AXIS2C_HOME
+
+./configure --prefix=${AXIS2C_HOME} --enable-tests=yes --with-axis2_util=${AXIS2C_HOME}/include
+make
+make install
Added: webservices/axis2/trunk/c/tools/tcpmon/configure.ac
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/configure.ac?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/configure.ac (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/configure.ac Fri Sep 1 05:55:44 2006
@@ -0,0 +1,98 @@
+dnl run autogen.sh to generate the configure script.
+
+AC_PREREQ(2.59)
+
+AC_INIT(tcpmon-src, 0.93_pre)
+AC_CANONICAL_SYSTEM
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AC_PREFIX_DEFAULT(/usr/local/tcpmon)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CPP
+AM_PROG_LIBTOOL
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+
+CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -g"
+if test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -ansi -Wall -Wno-implicit-function-declaration"
+fi
+LDFLAGS="-lpthread"
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdio.h stdlib.h string.h])
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+dnl Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([memmove])
+
+AC_CHECK_LIB(z, inflate)
+AC_CHECK_LIB(cutest, CuTestInit)
+
+
+AC_MSG_CHECKING(To Use Axis2/C Util. This is a compulsory module to build TCPMON/C)
+AC_ARG_WITH(axis2_util,
+[ --with-axis2_util[=PATH] use axis2_util.],
+[ case "$withval" in
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ dnl Find axis2_util include dir in the path
+ if test -d $withval; then
+ axis2_utilinc="-I$withval"
+ dnl else find the axis2_util include dir in $(AXIS2C_HOME)/include
+ elif test -d '$(AXIS2C_HOME)/include'; then
+ axis2_utilinc="-I$(AXIS2C_HOME)/include"
+ else
+ AC_MSG_ERROR(could not find axis2_util. stop)
+ fi
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+AC_MSG_CHECKING(whether to build tests)
+AC_ARG_ENABLE(tests,
+[ --enable-tests build tests. default=no],
+[ case "${enableval}" in
+ no)
+ AC_MSG_RESULT(no)
+ TESTDIR=""
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ TESTDIR="test"
+
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+ TESTDIR=""
+)
+
+
+UTILINC=$axis2_utilinc
+
+AC_SUBST(UTILINC)
+AC_SUBST(TESTDIR)
+
+CFLAGS="$CFLAGS"
+
+AC_CONFIG_FILES([Makefile \
+ src/Makefile \
+ test/Makefile \
+ test/unit/Makefile \
+ ])
+
+AC_OUTPUT
Added: 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=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_entry.h Fri Sep 1 05:55:44 2006
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TCPMON_ENTRY_H
+#define TCPMON_ENTRY_H
+
+#include <axis2_env.h>
+#include <axis2_string.h>
+
+/**
+ * @file tcpmon_entry.h
+ * @brief represent entry of tcpmon
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup represent entry of tcpmon
+ * @ingroup tcpmon
+ * @{
+ */
+
+typedef struct tcpmon_entry_ops tcpmon_entry_ops_t;
+typedef struct tcpmon_entry tcpmon_entry_t;
+
+AXIS2_DECLARE_DATA struct tcpmon_entry_ops
+{
+ /**
+ * free the tcpmon_entry.
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE.
+ */
+ axis2_status_t (AXIS2_CALL *
+ free)(tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve the arrived_time
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ arrived_time) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve the sent_time
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ sent_time) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve the arrived_time - sent_time ( in seconds)
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ time_diff) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve the sent data
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ sent_data) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve the arrived data
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ arrived_data) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve the sent headers
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ sent_headers) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve the arrived headers
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ arrived_headers) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+ /**
+ * retrieve whether the transportation success
+ * @param entry represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_bool_t (AXIS2_CALL *
+ is_success) (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+};
+
+AXIS2_DECLARE_DATA struct tcpmon_entry
+{
+ tcpmon_entry_ops_t *ops;
+};
+
+/**
+ * Creates tcpmon_entry struct
+ * @param env double pointer to environment struct. MUST NOT be NULL
+ * @return pointer to newly created tcpmon_entry struct
+ */
+AXIS2_EXTERN tcpmon_entry_t * AXIS2_CALL
+tcpmon_entry_create(const axis2_env_t *env );
+
+/*************************** Function macros **********************************/
+
+#define TCPMON_ENTRY_FREE(entry, env) \
+ ((entry)->ops->free (entry, env))
+
+#define TCPMON_ENTRY_ARRIVED_TIME(entry, env) \
+ ((entry)->ops->arrived_time(entry, env))
+
+#define TCPMON_ENTRY_SENT_TIME(entry, env) \
+ ((entry)->ops->sent_time(entry, env))
+
+#define TCPMON_ENTRY_TIME_DIFF(entry, env) \
+ ((entry)->ops->time_diff(entry, env))
+
+#define TCPMON_ENTRY_SENT_DATA(entry, env) \
+ ((entry)->ops->sent_data(entry, env))
+
+#define TCPMON_ENTRY_ARRIVED_DATA(entry, env) \
+ ((entry)->ops->arrived_data(entry, env))
+
+#define TCPMON_ENTRY_SENT_HEADERS(entry, env) \
+ ((entry)->ops->sent_headers(entry, env))
+
+#define TCPMON_ENTRY_ARRIVED_HEADERS(entry, env) \
+ ((entry)->ops->arrived_headers(entry, env))
+
+#define TCPMON_ENTRY_IS_SUCCESS(entry, env) \
+ ((entry)->ops->is_success(entry, env))
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TCPMON_ENTRY_H */
Added: webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h Fri Sep 1 05:55:44 2006
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TCPMON_SESSION_H
+#define TCPMON_SESSION_H
+
+#include <axis2_env.h>
+#include <tcpmon_entry.h>
+#include <axis2_string.h>
+
+/**
+ * @file tcpmon_session.h
+ * @brief represent session of tcpmon
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup represent session of tcpmon
+ * @ingroup tcpmon
+ * @{
+ */
+
+typedef struct tcpmon_session_ops tcpmon_session_ops_t;
+typedef struct tcpmon_session tcpmon_session_t;
+
+/**
+ * callback functions for the tcpmon session
+ */
+typedef int (*TCPMON_SESSION_NEW_ENTRY_FUNCT)
+ ( const axis2_env_t *env,
+ tcpmon_entry_t* entry,
+ int status); /* 0-started, 1-finished */
+
+typedef int (*TCPMON_SESSION_TRANS_ERROR_FUNCT)
+ ( const axis2_env_t *env,
+ axis2_char_t* error_message);
+
+
+AXIS2_DECLARE_DATA struct tcpmon_session_ops
+{
+ /**
+ * free the tcpmon_session.
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE.
+ */
+ axis2_status_t (AXIS2_CALL *
+ free)(tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+ /**
+ * configure the listening port.
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @param listen_port listening port ( port of a localhost).
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE.
+ */
+ axis2_status_t (AXIS2_CALL *
+ set_listen_port) (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int listen_port);
+
+ /**
+ * retrieve the listening port
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ int (AXIS2_CALL *
+ get_listen_port) (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+ /**
+ * configure the target port
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @param target_port tartet port
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE.
+ */
+ axis2_status_t (AXIS2_CALL *
+ set_target_port) (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int target_port);
+
+ /**
+ * retrieve the target port
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ int (AXIS2_CALL *
+ get_target_port) (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+ /**
+ * configure the target host
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @param target_host url of the target host
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE.
+ */
+ axis2_status_t (AXIS2_CALL *
+ set_target_host) (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ axis2_char_t* target_host);
+
+ /**
+ * retrieve the base uri of the target host
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_char_t* (AXIS2_CALL *
+ get_target_host) (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+ /**
+ * start the session
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_status_t (AXIS2_CALL *
+ start) (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+ /**
+ * stop the session.
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ */
+ axis2_status_t (AXIS2_CALL *
+ stop) (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+ /**
+ * set on new entry.
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @param on_new_entry_funct function to triger on new entry
+ */
+ axis2_status_t (AXIS2_CALL *
+ on_new_entry) (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct);
+
+ /**
+ * set on new entry.
+ * @param session represet the type object.
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @param on_new_entry function to triger on new entry
+ */
+ axis2_status_t (AXIS2_CALL *
+ on_trans_fault) (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct);
+
+
+};
+
+AXIS2_DECLARE_DATA struct tcpmon_session
+{
+ tcpmon_session_ops_t *ops;
+};
+
+/**
+ * Creates tcpmon_session struct
+ * @param env double pointer to environment struct. MUST NOT be NULL
+ * @return pointer to newly created tcpmon_session struct
+ */
+AXIS2_EXTERN tcpmon_session_t * AXIS2_CALL
+tcpmon_session_create(const axis2_env_t *env );
+
+/*************************** Function macros **********************************/
+
+#define TCPMON_SESSION_FREE(session, env) \
+ ((session)->ops->free (session, env))
+
+#define TCPMON_SESSION_SET_LISTEN_PORT(session, env, listen_port) \
+ ((session)->ops->set_listen_port(session, env, listen_port))
+
+#define TCPMON_SESSION_GET_LISTEN_PORT(session, env) \
+ ((session)->ops->get_listen_port(session, env))
+
+#define TCPMON_SESSION_SET_TARGET_PORT(session, env, target_port) \
+ ((session)->ops->set_target_port(session, env, target_port))
+
+#define TCPMON_SESSION_GET_TARGET_PORT(session, env) \
+ ((session)->ops->get_target_port(session, env))
+
+#define TCPMON_SESSION_SET_TARGET_HOST(session, env, target_host) \
+ ((session)->ops->set_target_host(session, env, target_host))
+
+#define TCPMON_SESSION_GET_TARGET_HOST(session, env) \
+ ((session)->ops->get_target_host(session, env))
+
+#define TCPMON_SESSION_START(session, env) \
+ ((session)->ops->start(session, env))
+
+#define TCPMON_SESSION_STOP(session, env) \
+ ((session)->ops->stop(session, env))
+
+#define TCPMON_SESSION_ON_TRANS_FAULT(session, env, funct) \
+ ((session)->ops->on_trans_fault(session, env, funct))
+
+#define TCPMON_SESSION_ON_NEW_ENTRY(session, env, funct) \
+ ((session)->ops->on_new_entry(session, env, funct))
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TCPMON_SESSION_H */
Added: webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h Fri Sep 1 05:55:44 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TCPMON_UTIL_H
+#define TCPMON_UTIL_H
+
+#include <axis2_env.h>
+#include <axis2_string.h>
+
+/**
+ * @file tcpmon_util.h
+ * @brief hold util functions of tcpmon
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup hold util functions of tcpmon
+ * @ingroup tcpmon
+ * @{
+ */
+
+/**
+ * format the data as xml
+ * @param env pointer to environment struct. MUST NOT be NULL.
+ * @param data to be formatted
+ */
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+tcpmon_util_format_as_xml (const axis2_env_t *env, axis2_char_t *data);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TCPMON_UTIL_H */
Added: webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am?rev=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am Fri Sep 1 05:55:44 2006
@@ -0,0 +1,31 @@
+prglibdir=$(prefix)/lib
+prgbindir=$(prefix)/bin
+
+prglib_LTLIBRARIES = \
+ libaxis2_tcpmon.la
+
+libaxis2_tcpmon_la_SOURCES = \
+ entry.c \
+ session.c \
+ util.c \
+ $(NULL)
+
+libaxis2_tcpmon_la_LIBADD = \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ $(NULL)
+
+prgbin_PROGRAMS = tcpmon
+
+tcpmon_SOURCES = tcpmon.c
+tcpmon_LDADD = \
+ $(top_builddir)/src/libaxis2_tcpmon.la \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ $(NULL)
+
+
+INCLUDES = -I$(top_builddir)/include \
+ @UTILINC@ \
+ $(NULL)
+
Added: 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=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/entry.c (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/entry.c Fri Sep 1 05:55:44 2006
@@ -0,0 +1,606 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <axis2_utils.h>
+#include <axis2_error.h>
+#include <axis2_string.h>
+#include <axis2_network_handler.h>
+#include <axis2_stream.h>
+#include <time.h>
+
+#include <tcpmon_entry_local.h>
+#include <tcpmon_session_local.h>
+
+#define AXIS2_TCPMON
+/**
+ * @brief
+ */
+typedef struct tcpmon_entry_impl
+{
+ tcpmon_entry_t entry;
+
+ axis2_char_t* arrived_time;
+ axis2_char_t* sent_time;
+ axis2_char_t* sent_data;
+ axis2_char_t* arrived_data;
+ axis2_char_t* sent_headers;
+ axis2_char_t* arrived_headers;
+ axis2_bool_t is_success;
+ axis2_char_t* time_diff;
+} tcpmon_entry_impl_t;
+
+#define AXIS2_INTF_TO_IMPL(entry) \
+ ((tcpmon_entry_impl_t *) entry)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL
+tcpmon_entry_free (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_arrived_time (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_sent_time (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_time_diff (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_sent_data (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_sent_headers(tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_arrived_data (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_arrived_headers(tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+
+axis2_bool_t AXIS2_CALL
+tcpmon_entry_is_success (tcpmon_entry_t *entry,
+ const axis2_env_t *env);
+
+axis2_char_t*
+get_current_stream_to_buffer( axis2_stream_t* stream,
+ const axis2_env_t* env,
+ int* stream_size);
+
+axis2_char_t*
+read_current_stream ( axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int *stream_size,
+ axis2_char_t** header,
+ axis2_char_t** data);
+
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN tcpmon_entry_t * AXIS2_CALL
+tcpmon_entry_create (const axis2_env_t *env)
+{
+ tcpmon_entry_impl_t *entry_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ entry_impl = (tcpmon_entry_impl_t *) AXIS2_MALLOC(env->
+ allocator, sizeof(tcpmon_entry_impl_t));
+
+ if(NULL == entry_impl)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ entry_impl -> arrived_time = AXIS2_MALLOC ( env->allocator, 32);
+ entry_impl -> sent_time = AXIS2_MALLOC ( env->allocator, 32);
+ entry_impl -> time_diff = AXIS2_MALLOC ( env->allocator, 32);
+ entry_impl -> arrived_data = NULL;
+ entry_impl -> sent_data = NULL;
+ entry_impl -> arrived_headers = NULL;
+ entry_impl -> sent_headers = NULL;
+ entry_impl -> is_success = AXIS2_FALSE;
+
+ entry_impl->entry.ops =
+ AXIS2_MALLOC (env->allocator, sizeof(tcpmon_entry_ops_t));
+ if(NULL == entry_impl->entry.ops)
+ {
+ tcpmon_entry_free(&(entry_impl->entry), env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ entry_impl->entry.ops->free = tcpmon_entry_free;
+ entry_impl->entry.ops->arrived_time = tcpmon_entry_arrived_time;
+ entry_impl->entry.ops->sent_time = tcpmon_entry_sent_time;
+ entry_impl->entry.ops->time_diff = tcpmon_entry_time_diff;
+ entry_impl->entry.ops->sent_data = tcpmon_entry_sent_data;
+ entry_impl->entry.ops->sent_headers = tcpmon_entry_sent_headers;
+ entry_impl->entry.ops->arrived_data = tcpmon_entry_arrived_data;
+ entry_impl->entry.ops->arrived_headers = tcpmon_entry_arrived_headers;
+ entry_impl->entry.ops->is_success = tcpmon_entry_is_success;
+
+ return &(entry_impl->entry);
+}
+
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL
+tcpmon_entry_free (tcpmon_entry_t *entry,
+ const axis2_env_t *env)
+{
+ tcpmon_entry_impl_t *entry_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ entry_impl = AXIS2_INTF_TO_IMPL(entry);
+
+ if(entry->ops)
+ {
+ AXIS2_FREE(env->allocator, entry->ops);
+ entry->ops = NULL;
+ }
+
+ if(entry_impl -> arrived_time )
+ {
+ AXIS2_FREE (env-> allocator, entry_impl -> arrived_time);
+ entry_impl -> arrived_time = NULL;
+ }
+ if(entry_impl -> sent_time )
+ {
+ AXIS2_FREE (env-> allocator, entry_impl -> sent_time);
+ entry_impl -> sent_time = NULL;
+ }
+ if(entry_impl -> time_diff )
+ {
+ AXIS2_FREE (env-> allocator, entry_impl -> time_diff);
+ entry_impl -> time_diff = NULL;
+ }
+ if(entry_impl -> arrived_data )
+ {
+ AXIS2_FREE (env-> allocator, entry_impl -> arrived_data);
+ entry_impl -> arrived_data = NULL;
+ }
+ if(entry_impl -> sent_data )
+ {
+ AXIS2_FREE (env-> allocator, entry_impl -> sent_data);
+ entry_impl -> sent_data = NULL;
+ }
+ if(entry_impl -> arrived_headers )
+ {
+ AXIS2_FREE (env-> allocator, entry_impl -> arrived_headers);
+ entry_impl -> arrived_headers = NULL;
+ }
+ if(entry_impl -> sent_headers )
+ {
+ AXIS2_FREE (env-> allocator, entry_impl -> sent_headers);
+ entry_impl -> sent_headers = NULL;
+ }
+
+ if(entry_impl)
+ {
+ AXIS2_FREE(env->allocator, entry_impl);
+ entry_impl = NULL;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_arrived_time (tcpmon_entry_t *entry,
+ const axis2_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-> arrived_time;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_sent_time (tcpmon_entry_t *entry,
+ const axis2_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_time;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_time_diff (tcpmon_entry_t *entry,
+ const axis2_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-> time_diff;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_sent_data (tcpmon_entry_t *entry,
+ const axis2_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;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_sent_headers(tcpmon_entry_t *entry,
+ const axis2_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_headers;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_arrived_data (tcpmon_entry_t *entry,
+ const axis2_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-> arrived_data;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_entry_arrived_headers(tcpmon_entry_t *entry,
+ const axis2_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-> arrived_headers;
+}
+
+axis2_bool_t AXIS2_CALL
+tcpmon_entry_is_success (tcpmon_entry_t *entry,
+ const axis2_env_t *env)
+{
+ tcpmon_entry_impl_t *entry_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ entry_impl = AXIS2_INTF_TO_IMPL(entry);
+
+ return entry_impl-> is_success;
+}
+
+/** implimentations for protected methods */
+
+/** executes as new entry arises */
+void* tcpmon_entry_new_entry_funct(axis2_thread_t *thd, void* data)
+{
+ tcpmon_entry_request_data_t* req_data = data;
+ const axis2_env_t* env = NULL;
+ int client_socket = -1;
+ int host_socket = -1;
+ tcpmon_session_t* session;
+ TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct;
+ TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry;
+
+ axis2_stream_t* client_stream = NULL;
+ axis2_stream_t* host_stream = NULL;
+ int buffer_size = 0;
+ axis2_char_t* headers = NULL;
+ axis2_char_t* content = NULL;
+ axis2_char_t* buffer = NULL;
+ time_t now;
+ struct tm* localTime = NULL;
+ int arrived_secs = 0;
+ int sent_secs = 0;
+ int time_diff_i = 0;
+ int target_port = 0;
+ axis2_char_t* target_host = NULL;
+
+
+ env = req_data -> env;
+ client_socket = req_data-> socket;
+ session = req_data-> session;
+ on_trans_fault_funct =
+ tcpmon_session_get_on_trans_fault( session, env);
+ on_new_entry =
+ tcpmon_session_get_on_new_entry( session, env);
+
+ tcpmon_entry_t* entry = NULL;
+ tcpmon_entry_impl_t* entry_impl = NULL;
+
+ entry = tcpmon_entry_create ( env );
+ entry_impl = AXIS2_INTF_TO_IMPL ( entry);
+
+ target_port = TCPMON_SESSION_GET_TARGET_PORT ( session, env );
+ target_host = TCPMON_SESSION_GET_TARGET_HOST ( session, env );
+
+ if ( target_port == -1 || target_host == NULL )
+ {
+ axis2_network_handler_close_socket (env, client_socket);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Missing target port and host"
+ "input missing");
+ if ( on_trans_fault_funct )
+ {
+ (on_trans_fault_funct)(env,
+ "Missing target port and host");
+ }
+ return NULL;
+ }
+ client_stream = axis2_stream_create_socket( env, client_socket);
+ if(NULL == client_stream)
+ {
+ axis2_network_handler_close_socket (env, client_socket);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error in creating client stream"
+ "handling response");
+ /** call the callback */
+ if ( on_trans_fault_funct )
+ {
+ (on_trans_fault_funct)(env,
+ "error in creating the client stream");
+ }
+ return NULL;
+ }
+
+
+ buffer = read_current_stream ( client_stream, env, &buffer_size,
+ &headers, &content );
+
+ host_socket = axis2_network_handler_open_socket(env, target_host, target_port);
+ if ( -1 == host_socket )
+ {
+ AXIS2_STREAM_WRITE ( client_stream, env, NULL, 0);
+ AXIS2_STREAM_FREE ( client_stream, env );
+ axis2_network_handler_close_socket (env, client_socket);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error in creating host_socket"
+ "creating socket");
+ /** call the callback */
+ if ( on_trans_fault_funct )
+ {
+ (on_trans_fault_funct)(env,
+ "error in creating the host socket");
+ }
+ return NULL;
+ }
+
+ host_stream = axis2_stream_create_socket( env, host_socket);
+ if(NULL == host_stream)
+ {
+ AXIS2_STREAM_WRITE ( client_stream, env, NULL, 0);
+ AXIS2_STREAM_FREE ( client_stream, env );
+ axis2_network_handler_close_socket (env, client_socket);
+ axis2_network_handler_close_socket (env, host_socket);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error in creating host stream"
+ "handling response");
+ /** call the callback */
+ if ( on_trans_fault_funct )
+ {
+ (on_trans_fault_funct)(env,
+ "error in creating the host stream");
+ }
+ return NULL;
+ }
+
+ now = time (NULL );
+ localTime = localtime ( &now);
+
+ sprintf (entry_impl-> sent_time, "%d:%d:%d" , localTime-> tm_hour, localTime-> tm_min,
+ localTime-> tm_sec );
+ sent_secs = localTime-> tm_hour * 60 * 60 +
+ localTime-> tm_min * 60 +
+ localTime-> tm_sec;
+
+ /*free ( localTime); */
+
+ entry_impl-> sent_headers = headers;
+ entry_impl-> sent_data = content;
+
+ if ( on_new_entry)
+ {
+ (on_new_entry)(env, entry, 0);
+ }
+
+
+
+ AXIS2_STREAM_WRITE ( host_stream, env, buffer , buffer_size);
+ AXIS2_FREE ( env-> allocator, buffer);
+
+ buffer = read_current_stream ( host_stream, env, &buffer_size,
+ &headers, &content );
+
+
+ now = time (NULL );
+ localTime = localtime ( &now);
+
+ sprintf (entry_impl-> arrived_time, "%d:%d:%d" , localTime-> tm_hour, localTime-> tm_min,
+ localTime-> tm_sec );
+ arrived_secs = localTime-> tm_hour * 60 * 60 +
+ localTime-> tm_min * 60 +
+ localTime-> tm_sec;
+ /*free ( localTime); */
+
+
+ time_diff_i = arrived_secs - sent_secs;
+ if ( time_diff_i < 0 )
+ {
+ time_diff_i += 24 * 60 * 60 ;
+ }
+ sprintf (entry_impl-> time_diff, "%d sec(s)", time_diff_i );
+
+ entry_impl-> arrived_headers = headers;
+ entry_impl-> arrived_data = content;
+ if ( buffer == NULL || buffer_size == 0 )
+ {
+ entry_impl->is_success = 0;
+ }
+ else
+ {
+ entry_impl->is_success = 1;
+ }
+
+ if ( on_new_entry)
+ {
+ (on_new_entry)(env, entry, 1);
+ }
+
+
+ AXIS2_STREAM_WRITE ( client_stream, env, buffer, buffer_size);
+ AXIS2_FREE ( env-> allocator, buffer);
+
+ AXIS2_STREAM_FREE ( client_stream, env );
+ AXIS2_STREAM_FREE ( host_stream, env );
+ axis2_network_handler_close_socket (env, client_socket);
+ axis2_network_handler_close_socket (env, host_socket);
+
+ return NULL;
+}
+
+
+axis2_char_t*
+read_current_stream ( axis2_stream_t *stream,
+ const axis2_env_t *env,
+ int *stream_size,
+ axis2_char_t **header,
+ axis2_char_t **data )
+{
+ int read_size = 0;
+ axis2_char_t *buffer = NULL;
+ axis2_char_t *header_ptr = NULL;
+ axis2_char_t *body_ptr = NULL;
+ int header_found = 0;
+ int header_just_finished = 0;
+ int read = 0;
+ int header_width = 0;
+ int current_line_offset = 0;
+ axis2_char_t *current_line = NULL;
+ int line_just_ended = 1;
+ axis2_char_t *length_char= 0;
+ int length = -1;
+
+
+ buffer = AXIS2_MALLOC ( env-> allocator, sizeof(axis2_char_t) );
+ do
+ {
+ buffer = AXIS2_REALLOC ( env-> allocator, buffer,
+ sizeof (axis2_char_t)* (read_size + 1) );
+ read = AXIS2_STREAM_READ ( stream, env , buffer + read_size, 1 );
+
+ if ( header_just_finished )
+ {
+ header_just_finished = 0;
+ header_width = read_size;
+ }
+ /** identify the content lenth*/
+ if ( !header_found && *(buffer + read_size ) =='\r')
+ {
+ *(buffer + read_size ) = '\0';
+ current_line = buffer + current_line_offset;
+ if ( NULL != strstr ( current_line, "Content-Length" ) )
+ {
+ if ( NULL != (length_char = strstr ( current_line, ":" ) ) )
+ {
+ length_char++;
+ length = atoi ( length_char);
+ }
+ }
+ *(buffer + read_size ) = '\r';
+ }
+ if ( !header_found && line_just_ended )
+ {
+ line_just_ended = 0;
+ current_line_offset = read_size;
+ }
+ if ( !header_found && *(buffer + read_size ) == '\n' )
+ {
+ line_just_ended = 1; /* set for the next loop to read*/
+ }
+ if ( header_found )
+ {
+ length--;
+ }
+
+ /** identify the end of the header */
+ if ( !header_found &&
+ read_size >= 3 &&
+ *(buffer + read_size) == '\n' &&
+ *(buffer + read_size) == '\n' &&
+ *(buffer + read_size -1 ) == '\r' &&
+ *(buffer + read_size -2 ) == '\n' &&
+ *(buffer + read_size -3 ) == '\r')
+ {
+ header_found = 1;
+ *(buffer + read_size-3) = '\0';
+ header_ptr = (axis2_char_t*)AXIS2_STRDUP (buffer, env );
+ header_just_finished = 1;
+ *(buffer + read_size-3) = '\r';
+ }
+ read_size ++;
+ if ( length < -1 )
+ {
+ header_width = 0;
+ break;
+ }
+ }
+ while ( length != 0 );
+
+ if( header_width != 0)
+ {
+ body_ptr = buffer + header_width;
+ *data = (axis2_char_t*) AXIS2_STRDUP ( body_ptr, env);
+ }
+ else
+ {
+ *(buffer + read_size) = '\0';
+ header_ptr = (axis2_char_t*)AXIS2_STRDUP (buffer, env );
+ /** soap body part is unavailable */
+ *data = NULL;
+ }
+
+ *header = header_ptr;
+ *stream_size = read_size;
+ return buffer;
+}
Added: 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=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/session.c (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/session.c Fri Sep 1 05:55:44 2006
@@ -0,0 +1,490 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <axis2_string.h>
+#include <axis2_utils.h>
+#include <axis2_error.h>
+#include <tcpmon_util.h>
+#include <axis2_thread.h>
+#include <axis2_network_handler.h>
+#include <axis2_array_list.h>
+
+#include <tcpmon_session_local.h>
+#include <tcpmon_entry_local.h>
+
+/**
+ * @brief
+ */
+typedef struct tcpmon_session_impl
+{
+ tcpmon_session_t session;
+ int listen_port;
+ int target_port;
+ axis2_char_t *target_host;
+ TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct;
+ TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct;
+ axis2_array_list_t* entries;
+
+ axis2_bool_t is_running;
+} tcpmon_session_impl_t;
+
+typedef struct tcpmon_session_server_thread_data
+{
+ tcpmon_session_impl_t* session_impl;
+ const axis2_env_t* env;
+} tcpmon_session_server_thread_data_t;
+
+#define AXIS2_INTF_TO_IMPL(session) \
+ ((tcpmon_session_impl_t *) session)
+
+/************************* Function prototypes ********************************/
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_free (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_set_listen_port (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int listen_port);
+
+int AXIS2_CALL
+tcpmon_session_get_listen_port (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_set_target_port (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int target_port);
+
+int AXIS2_CALL
+tcpmon_session_get_target_port (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_set_target_host (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ axis2_char_t* target_host);
+
+axis2_char_t* AXIS2_CALL
+tcpmon_session_get_target_host (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_start (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_stop (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_on_new_entry (tcpmon_session_t *session,
+ const axis2_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 axis2_env_t *env,
+ TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct);
+
+/** internal implementations */
+
+void * AXIS2_THREAD_FUNC
+server_funct(axis2_thread_t *thd, void *data);
+
+/************************** End of function prototypes ************************/
+
+AXIS2_EXTERN tcpmon_session_t * AXIS2_CALL
+tcpmon_session_create (const axis2_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));
+
+ if(NULL == 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 -> target_host = NULL;
+
+ session_impl -> on_new_entry_funct = NULL;
+ session_impl -> on_trans_fault_funct = NULL;
+ session_impl -> entries = axis2_array_list_create( env, 10);
+
+ session_impl->session.ops =
+ AXIS2_MALLOC (env->allocator, sizeof(tcpmon_session_ops_t));
+ if(NULL == 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->session.ops->free = tcpmon_session_free;
+ session_impl->session.ops->set_listen_port = tcpmon_session_set_listen_port;
+ session_impl->session.ops->get_listen_port = tcpmon_session_get_listen_port;
+ session_impl->session.ops->set_target_port = tcpmon_session_set_target_port;
+ session_impl->session.ops->get_target_port = tcpmon_session_get_target_port;
+ session_impl->session.ops->set_target_host = tcpmon_session_set_target_host;
+ session_impl->session.ops->get_target_host = tcpmon_session_get_target_host;
+ session_impl->session.ops->start = tcpmon_session_start;
+ session_impl->session.ops->stop = tcpmon_session_stop;
+ session_impl->session.ops->on_new_entry = tcpmon_session_on_new_entry;
+ session_impl->session.ops->on_trans_fault = tcpmon_session_on_trans_fault;
+
+ return &(session_impl->session);
+}
+
+
+/***************************Function implementation****************************/
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_free (tcpmon_session_t *session,
+ const axis2_env_t *env)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+ int entries_size = 0;
+ tcpmon_entry_t* entry = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ for ( entries_size = AXIS2_ARRAY_LIST_SIZE(session_impl-> entries, env ) -1;
+ entries_size >= 0; entries_size --)
+ {
+ TCPMON_ENTRY_FREE ( entry, env);
+ }
+ AXIS2_ARRAY_LIST_FREE ( session_impl-> entries, env);
+
+ if(session->ops)
+ {
+ AXIS2_FREE(env->allocator, session->ops);
+ session->ops = NULL;
+ }
+
+ if(session_impl->target_host)
+ {
+ AXIS2_FREE (env-> allocator, session_impl->target_host);
+ session_impl-> target_host = NULL;
+ }
+
+ if(session_impl)
+ {
+ AXIS2_FREE(env->allocator, session_impl);
+ session_impl = NULL;
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_set_listen_port (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int listen_port)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ session_impl-> listen_port = listen_port;
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+tcpmon_session_get_listen_port (tcpmon_session_t *session,
+ const axis2_env_t *env)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, -1);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ return session_impl-> listen_port;
+}
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_set_target_port (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int target_port)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ session_impl-> target_port = target_port;
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+tcpmon_session_get_target_port (tcpmon_session_t *session,
+ const axis2_env_t *env)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, -1);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ return session_impl-> target_port;
+}
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_set_target_host (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ axis2_char_t* target_host)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ session_impl-> target_host = (axis2_char_t*)AXIS2_STRDUP (target_host, env);
+ return AXIS2_SUCCESS;
+}
+
+axis2_char_t* AXIS2_CALL
+tcpmon_session_get_target_host (tcpmon_session_t *session,
+ const axis2_env_t *env)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ return session_impl-> target_host;
+}
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_start (tcpmon_session_t *session,
+ const axis2_env_t *env)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+ axis2_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;
+
+ session_impl-> is_running = AXIS2_TRUE;
+ server_thread = AXIS2_THREAD_POOL_GET_THREAD(env->thread_pool,
+ server_funct, (void*)thread_data);
+ if(NULL == server_thread)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Thread creation failed"
+ "server thread");
+ if ( session_impl->on_trans_fault_funct )
+ {
+ (session_impl->on_trans_fault_funct)(env,
+ "error in creating the server thread");
+ }
+ }
+
+ AXIS2_THREAD_POOL_THREAD_DETACH(env->thread_pool, server_thread);
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_stop (tcpmon_session_t *session,
+ const axis2_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;
+
+ return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+tcpmon_session_on_new_entry (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ 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 axis2_env_t *env,
+ TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ session_impl-> on_trans_fault_funct = on_trans_fault_funct;
+ return AXIS2_SUCCESS;
+}
+
+
+/** internal implementations */
+void * AXIS2_THREAD_FUNC
+server_funct(axis2_thread_t *thd, void *data)
+{
+ tcpmon_session_server_thread_data_t* thread_data = data;
+ tcpmon_session_impl_t *session_impl = NULL;
+ const axis2_env_t* env = NULL;
+ int listen_socket = -1;
+ int socket = -1;
+ axis2_thread_t* request_thread = NULL;
+ tcpmon_entry_request_data_t* request_thread_data = NULL;
+
+ session_impl = thread_data -> session_impl;
+ env = thread_data -> env;
+
+ listen_socket = axis2_network_handler_create_server_socket
+ (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");
+ 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");
+ }
+ return NULL;
+ }
+ while ( session_impl-> is_running )
+ {
+ socket = axis2_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");
+ if ( session_impl->on_trans_fault_funct )
+ {
+ (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 = AXIS2_THREAD_POOL_GET_THREAD(env->thread_pool,
+ tcpmon_entry_new_entry_funct,
+ (void*)request_thread_data);
+ if(NULL == request_thread)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Thread creation failed"
+ "request thread");
+ if ( session_impl->on_trans_fault_funct )
+ {
+ (session_impl->on_trans_fault_funct)(env,
+ "fail in creating the thread");
+ }
+ break;
+ }
+
+ AXIS2_THREAD_POOL_THREAD_DETACH(env->thread_pool, request_thread);
+ }
+ axis2_network_handler_close_socket (env, listen_socket);
+
+ return NULL;
+}
+
+
+/* implementations for protected functions */
+
+axis2_status_t
+tcpmon_session_add_new_entry( tcpmon_session_t* session,
+ const axis2_env_t* env,
+ tcpmon_entry_t* entry)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ AXIS2_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 axis2_env_t *env )
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ return session_impl-> on_trans_fault_funct;
+}
+
+TCPMON_SESSION_NEW_ENTRY_FUNCT
+tcpmon_session_get_on_new_entry (tcpmon_session_t *session,
+ const axis2_env_t *env )
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ return session_impl-> on_new_entry_funct;
+}
+
Added: 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=439300&view=auto
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (added)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Fri Sep 1 05:55:44 2006
@@ -0,0 +1,154 @@
+#include <axis2_utils.h>
+#include <axis2_error_default.h>
+#include <axis2_log_default.h>
+#include <axis2_thread_pool.h>
+#include <tcpmon_session.h>
+#include <tcpmon_entry.h>
+#include <tcpmon_util.h>
+#include <platforms/axis2_platform_auto_sense.h>
+#include <axis2_string.h>
+
+#define SIZE 1024
+
+int on_new_entry( const axis2_env_t *env,
+ tcpmon_entry_t* entry,
+ int status);
+int on_error_func ( const axis2_env_t *env,
+ char* error_message );
+
+
+
+int main(int argc, char** argv )
+{
+ axis2_env_t* env = NULL;
+ axis2_allocator_t* allocator = NULL;
+ axis2_error_t *error = NULL;
+ axis2_log_t *log = NULL;
+ axis2_thread_pool_t *thread_pool = NULL;
+ tcpmon_session_t* session = NULL;
+ int c;
+ int listen_port,target_port;
+ char *target_host;
+
+ allocator = axis2_allocator_init(NULL);
+
+ error = axis2_error_create(allocator);
+ log = axis2_log_create(allocator, NULL, "axis2_tcpmon.log");
+ thread_pool = axis2_thread_pool_init(allocator);
+
+ env = axis2_env_create_with_error_log_thread_pool(allocator, error, log,
+ thread_pool);
+
+ if ( (argc == 2 && AXIS2_STRCMP(argv[1], "-h") ) ||
+ !(argc == 3 || argc == 4) )
+ {
+ printf("Usage : %s LISTEN_PORT TARGET_PORT [TARGET_HOST]\n", argv[0]);
+ printf("use -h for help\n");
+ return 0;
+ }
+ if ( argc > 1 )
+ {
+ listen_port = atoi(argv[1]);
+ if ( listen_port == 0 )
+ {
+ printf( "INVALID value for listen port\n");
+ printf("use -h for help\n");
+ return 0;
+ }
+ }
+ if ( argc > 2 )
+ {
+ target_port = atoi(argv[2]);
+ if ( target_port == 0 )
+ {
+ printf( "INVALID value for target port\n");
+ printf("use -h for help\n");
+ return 0;
+ }
+ }
+ /* if the target_host is not given fill with the default */
+ if ( argc > 3)
+ {
+ target_host = (char*)AXIS2_STRDUP( argv[3], env);
+ }
+ else
+ {
+ target_host = (char*)AXIS2_STRDUP( "localhost", env);
+ }
+ 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);
+
+ 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);
+ axis2_allocator_free(allocator);
+ axis2_env_free ( env );
+ return 0;
+}
+
+int on_new_entry( const axis2_env_t *env,
+ tcpmon_entry_t* entry,
+ int status)
+{
+ char* plain_buffer = NULL;
+ char* formated_buffer = NULL;
+ 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);
+ }
+ 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);
+ }
+ 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 axis2_env_t *env,
+ char* error_message )
+{
+ fprintf (stderr, "ERROR: %s\n", error_message );
+ return 0;
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org