# tcpmon_session.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  * Licensed to the Apache Software Foundation (ASF) under one or more
    00004  * contributor license agreements.  See the NOTICE file distributed with
    00005  * this work for additional information regarding copyright ownership.
    00006  * The ASF licenses this file to You under the Apache License, Version 2.0
    00007  * (the "License"); you may not use this file except in compliance with
    00008  * the License.  You may obtain a copy of the License at
    00009  *
    00010  *      http://www.apache.org/licenses/LICENSE-2.0
    00011  *
    00012  * Unless required by applicable law or agreed to in writing, software
    00013  * distributed under the License is distributed on an "AS IS" BASIS,
    00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00015  * See the License for the specific language governing permissions and
    00016  * limitations under the License.
    00017  */
    00018
    00019 #ifndef TCPMON_SESSION_H
    00020 #define TCPMON_SESSION_H
    00021
    00022 #include <axutil_env.h>
    00023 #include <tcpmon_entry.h>
    00024 #include <axutil_string.h>
    00025
    00031 #ifdef __cplusplus
    00032 extern "C"
    00033 {
    00034 #endif
    00035
    00042     typedef struct tcpmon_session_ops tcpmon_session_ops_t;
    00043     typedef struct tcpmon_session tcpmon_session_t;
    00044
    00048     typedef int(
    00049         *TCPMON_SESSION_NEW_ENTRY_FUNCT)(
    00050             const axutil_env_t * env,
    00051             tcpmon_entry_t * entry,
    00052             int status);            /* 0-started, 1-finished */
    00053
    00054     typedef int(
    00055         *TCPMON_SESSION_TRANS_ERROR_FUNCT)(
    00056             const axutil_env_t * env,
    00057             axis2_char_t * error_message);
    00058
    00059     struct tcpmon_session_ops
    00060     {
    00061
    00068         axis2_status_t(
    00069             AXIS2_CALL
    00070             * free)(
    00071                 tcpmon_session_t * session,
    00072                 const axutil_env_t * env);
    00073
    00074         axis2_status_t(
    00075             AXIS2_CALL
    00076             * set_test_bit)(
    00077                 tcpmon_session_t * session,
    00078                 const axutil_env_t * env,
    00079                 int test_bit);
    00080
    00081         axis2_status_t(
    00082             AXIS2_CALL
    00083             * get_test_bit)(
    00084                 tcpmon_session_t * session,
    00085                 const axutil_env_t * env);
    00086         axis2_status_t(
    00087             AXIS2_CALL
    00088             * set_format_bit)(
    00089                 tcpmon_session_t * session,
    00090                 const axutil_env_t * env,
    00091                 int format_bit);
    00092
    00093         int(
    00094             AXIS2_CALL
    00095             * get_format_bit)(
    00096                 tcpmon_session_t * session,
    00097                 const axutil_env_t * env);
    00098
    00106         axis2_status_t(
    00107             AXIS2_CALL
    00108             * set_listen_port)(
    00109                 tcpmon_session_t * session,
    00110                 const axutil_env_t * env,
    00111                 int listen_port);
    00112
    00118         int(
    00119             AXIS2_CALL
    00120             * get_listen_port)(
    00121                 tcpmon_session_t * session,
    00122                 const axutil_env_t * env);
    00123
    00131         axis2_status_t(
    00132             AXIS2_CALL
    00133             * set_target_port)(
    00134                 tcpmon_session_t * session,
    00135                 const axutil_env_t * env,
    00136                 int target_port);
    00137
    00143         int(
    00144             AXIS2_CALL
    00145             * get_target_port)(
    00146                 tcpmon_session_t * session,
    00147                 const axutil_env_t * env);
    00148
    00156         axis2_status_t(
    00157             AXIS2_CALL
    00158             * set_target_host)(
    00159                 tcpmon_session_t * session,
    00160                 const axutil_env_t * env,
    00161                 axis2_char_t * target_host);
    00162
    00168         axis2_char_t *(
    00169             AXIS2_CALL
    00170             * get_target_host)(
    00171                 tcpmon_session_t * session,
    00172                 const axutil_env_t * env);
    00173
    00179         axis2_status_t(
    00180             AXIS2_CALL
    00181             * start)(
    00182                 tcpmon_session_t * session,
    00183                 const axutil_env_t * env);
    00184
    00190         axis2_status_t(
    00191             AXIS2_CALL
    00192             * stop)(
    00193                 tcpmon_session_t * session,
    00194                 const axutil_env_t * env);
    00195
    00202         axis2_status_t(
    00203             AXIS2_CALL
    00204             * on_new_entry)(
    00205                 tcpmon_session_t * session,
    00206                 const axutil_env_t * env,
    00207                 TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct);
    00208
    00215         axis2_status_t(
    00216             AXIS2_CALL
    00217             * on_trans_fault)(
    00218                 tcpmon_session_t * session,
    00219                 const axutil_env_t * env,
    00220                 TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct);
    00221
    00222     };
    00223
    00224     struct tcpmon_session
    00225     {
    00226         tcpmon_session_ops_t *ops;
    00227     };
    00228
    00234     tcpmon_session_t *AXIS2_CALL
    00235     tcpmon_session_create(
    00236         const axutil_env_t * env);
    00237
    00238     /*************************** Function macros **********************************/
    00239
    00240 #define TCPMON_SESSION_FREE(session, env) \
    00241         ((session)->ops->free (session, env))
    00242
    00243 #define TCPMON_SESSION_SET_TEST_BIT(session, env, test_bit) \
    00244         ((session)->ops->set_test_bit(session, env, test_bit))
    00245
    00246 #define TCPMON_SESSION_GET_TEST_BIT(session, env) \
    00247         ((session)->ops->get_test_bit(session, env))
    00248
    00249 #define TCPMON_SESSION_SET_FORMAT_BIT(session, env, format_bit) \
    00250         ((session)->ops->set_format_bit(session, env, format_bit))
    00251
    00252 #define TCPMON_SESSION_GET_FORMAT_BIT(session, env) \
    00253         ((session)->ops->get_format_bit(session, env))
    00254
    00255 #define TCPMON_SESSION_SET_LISTEN_PORT(session, env, listen_port) \
    00256         ((session)->ops->set_listen_port(session, env, listen_port))
    00257
    00258 #define TCPMON_SESSION_GET_LISTEN_PORT(session, env) \
    00259         ((session)->ops->get_listen_port(session, env))
    00260
    00261 #define TCPMON_SESSION_SET_TARGET_PORT(session, env, target_port) \
    00262         ((session)->ops->set_target_port(session, env, target_port))
    00263
    00264 #define TCPMON_SESSION_GET_TARGET_PORT(session, env) \
    00265         ((session)->ops->get_target_port(session, env))
    00266
    00267 #define TCPMON_SESSION_SET_TARGET_HOST(session, env, target_host) \
    00268         ((session)->ops->set_target_host(session, env, target_host))
    00269
    00270 #define TCPMON_SESSION_GET_TARGET_HOST(session, env) \
    00271         ((session)->ops->get_target_host(session, env))
    00272
    00273 #define TCPMON_SESSION_START(session, env) \
    00274         ((session)->ops->start(session, env))
    00275
    00276 #define TCPMON_SESSION_STOP(session, env) \
    00277         ((session)->ops->stop(session, env))
    00278
    00279 #define TCPMON_SESSION_ON_TRANS_FAULT(session, env, funct) \
    00280         ((session)->ops->on_trans_fault(session, env, funct))
    00281
    00282 #define TCPMON_SESSION_ON_NEW_ENTRY(session, env, funct) \
    00283         ((session)->ops->on_new_entry(session, env, funct))
    00284
    00287 #ifdef __cplusplus
    00288 }
    00289 #endif
    00290
    00291 #endif                          /* TCPMON_SESSION_H */