OSDN Git Service

Re-add epoll repository
[ultramonkey-l7/ultramonkey-l7-v3.git] / l7vsd / include / tcp_session.h
1 /*!
2  *    @file    tcp_session.h
3  *    @brief    tcp session class
4  *
5  * L7VSD: Linux Virtual Server for Layer7 Load Balancing
6  * Copyright (C) 2009  NTT COMWARE Corporation.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  **********************************************************************/
24
25 #ifndef TCP_SESSION_H
26 #define TCP_SESSION_H
27
28 #include <bitset>
29 #include <boost/asio.hpp>
30 //#include <boost/asio/ssl.hpp>
31 #include <boost/thread/thread.hpp>
32 #include <boost/thread/mutex.hpp>
33 #include <sys/epoll.h>
34
35 #include "wrlock.h"
36 #include "protocol_module_base.h"
37 #include "session_result_message.h"
38 #include "tcp_socket.h"
39 #include "tcp_ssl_socket.h"
40 #include "tcp_realserver_connect_socket_list.h"
41 #include "tcp_data.h"
42 #include "lockfree_queue.h"
43
44 #define TCP_SESSION_THREAD_STATE_BIT 8
45
46 #define    PARAM_UP_BUFFER_SIZE    "upstream_buffer_size"
47 #define    PARAM_DOWN_BUFFER_SIZE    "downstream_buffer_size"
48
49 namespace l7vs{
50
51     //! @class    virtualservice_tcp
52     //! @brief    this class is parent virtualservice class.
53     class virtualservice_tcp;
54
55     //! @class    tcp_thread_message
56     //! @brief    tcp_thread_message class name define.
57     class tcp_thread_message;
58
59     //! @class    loger_implement_access
60     //! @brief    logger_implement_access class name define.
61     class logger_implement_access;
62
63     //! @class    tcp_session
64     //! @brief    this class is tcp session class.
65     class tcp_session : private boost::noncopyable{
66         public:
67             //! process type
68             enum TCP_PROCESS_TYPE_TAG{
69                 LOCAL_PROC = 0,
70                 MESSAGE_PROC
71             };
72             //! tcp virtualservice message type
73             enum TCP_VIRTUAL_SERVICE_MESSAGE_TAG{
74                 SORRY_STATE_ENABLE = 0,
75                 SORRY_STATE_DISABLE,
76                 SESSION_END,
77                 SESSION_PAUSE_ON,
78                 SESSION_PAUSE_OFF,
79                 ACCESS_LOG_ON,
80                 ACCESS_LOG_OFF
81             };
82
83             //! construcor
84             //! @param[in/out]    vs is parent virtualservice object
85             //! @param[in/out]    io is session use io service object
86             //! @param[in]        set_option is
87             //!                     session use set socket option info
88             //! @param[in]        listen_endpoint is
89             //!                     virtualservice listen endpoint
90             //! @param[in]        ssl_mode is session use SSL flag
91             //! @param[in]        set_ssl_context is
92             //!                     session use SSL context object
93             //! @param[in]        set_ssl_cache_flag is
94             //!                     session use SSL session cache
95             //! @param[in]        set_ssl_handshake_time_out is
96             //!                     session use SSL handshake timeout
97             //! @param[in]        set_access_logger is
98             //!                     session use access logger
99             tcp_session(virtualservice_tcp& vs,
100                  boost::asio::io_service& session_io,
101                  const tcp_socket_option_info set_option,
102                  const boost::asio::ip::tcp::endpoint listen_endpoint,
103                  const bool ssl_mode,
104                  boost::asio::ssl::context& set_ssl_context,
105                  const bool set_ssl_cache_flag,
106                  const int set_ssl_handshake_time_out,
107                  logger_implement_access* set_access_logger);
108
109             //! destructor
110             virtual ~tcp_session();
111             //! initialize
112             session_result_message initialize();
113             //! get reference client side socket
114             //! @return            reference client side socket
115             boost::asio::ip::tcp::socket& get_client_socket(); 
116             //! get reference client side ssl socket
117             //! @return            reference client side ssl socket
118             ssl_socket& get_client_ssl_socket();
119             //! is thread wait
120             //! @return         true is wait
121             //! @return         false is not wait
122             bool is_thread_wait();
123             //! message from parent virtualservice
124             //! @param[in]        message is tcp virtualservice message type
125             void set_virtual_service_message(
126                  const TCP_VIRTUAL_SERVICE_MESSAGE_TAG  message);
127             //! up stream thread main function
128             void up_thread_run();
129             //! down stream thread main function
130             void down_thread_run();
131             
132         protected:
133             typedef boost::asio::ip::tcp::endpoint endpoint;
134             typedef boost::shared_ptr< tcp_socket > tcp_socket_ptr;
135             typedef std::pair< endpoint, tcp_socket_ptr> socket_element;
136             typedef boost::function< void(TCP_PROCESS_TYPE_TAG) > tcp_session_func;
137             //! up thread call function type
138             enum UP_THREAD_FUNC_TYPE_TAG{
139                 UP_FUNC_CLIENT_ACCEPT = 0,                  //! up_thread_client_accept function
140                 UP_FUNC_CLIENT_ACCEPT_EVENT,                //! up_thread_client_accept_event function
141                 UP_FUNC_CLIENT_DISCONNECT,                  //! up_thread_client_disconnect function
142                 UP_FUNC_CLIENT_DISCONNECT_EVENT,            //! up_thread_client_disconnect_event function
143                 UP_FUNC_CLIENT_RECEIVE,                     //! up_thread_client_receive function
144                 UP_FUNC_CLIENT_RESPOND_SEND,                //! up_thread_client_respond function
145                 UP_FUNC_CLIENT_RESPOND_SEND_EVENT,          //! up_thread_client_respond_event function
146                 UP_FUNC_REALSERVER_GET_DEST_EVENT,          //! up_thread_realserver_get_distination_event function
147                 UP_FUNC_REALSERVER_CONNECT,                 //! up_thread_realserver_connect function
148                 UP_FUNC_REALSERVER_CONNECT_EVENT,           //! up_thread_realserver_connect_event function
149                 UP_FUNC_REALSERVER_CONNECT_FAIL_EVENT,      //! up_thread_realserver_connection_fail_event function
150                 UP_FUNC_REALSERVER_SEND,                    //! up_thread_realserver_send function
151                 UP_FUNC_REALSERVER_DISCONNECT,              //! up_thread_realserver_disconnect function
152                 UP_FUNC_REALSERVER_DISCONNECT_EVENT,        //! up_thread_realserver_disconnect_event function
153                 UP_FUNC_REALSERVER_ALL_DISCONNECT,          //! up_thread_all_realserver_disconnect function
154                 UP_FUNC_SORRYSERVER_GET_DEST,               //! up_thread_sorryserver_get_destination_event function
155                 UP_FUNC_SORRYSERVER_CONNECT,                //! up_thread_sorryserver_connect function
156                 UP_FUNC_SORRYSERVER_CONNECT_EVENT,          //! up_thread_sorryserver_connect_event function
157                 UP_FUNC_SORRYSERVER_CONNECT_FAIL_EVENT,     //! up_thread_sorryserver_connection_fail_event function
158                 UP_FUNC_SORRYSERVER_SEND,                   //! up_thread_sorryserver_send function
159                 UP_FUNC_SORRYSERVER_DISCONNECT,             //! up_thread_sorryserver_disconnect function
160                 UP_FUNC_SORRYSERVER_MOD_DISCONNECT,         //! up_thread_sorryserver_mod_disconnect function
161                 UP_FUNC_SORRYSERVER_DISCONNECT_EVENT,       //! up_thread_sorryserver_disconnect_event function
162                 UP_FUNC_SORRY_ENABLE_EVENT,                 //! up_thread_sorry_enable_event function
163                 UP_FUNC_SORRY_DISABLE_EVENT,                //! up_thread_sorry_disable_event function
164                 UP_FUNC_EXIT                                //! up_thread_exit function
165             };
166             //! down thread call function type
167             enum DOWN_THREAD_FUNC_TYPE_TAG{
168                 DOWN_FUNC_CLIENT_DISCONNECT = 0,            //! down_thread_client_disconnect function
169                 DOWN_FUNC_CLIENT_DISCONNECT_EVENT,          //! down_thread_client_disconnect_event function
170                 DOWN_FUNC_CLIENT_CONNECTION_CHK,            //! down_thread_client_connection_chk_event function
171                 DOWN_FUNC_CLIENT_SEND,                      //! down_thread_client_send function
172                 DOWN_FUNC_CLIENT_RESPOND_SEND_EVENT,        //! down_thread_client_respond_event function
173                 DOWN_FUNC_REALSERVER_RECEIVE,               //! down_thread_realserver_receive function
174                 DOWN_FUNC_REALSERVER_DISCONNECT,            //! down_thread_realserver_disconnect function
175                 DOWN_FUNC_REALSERVER_DISCONNECT_EVENT,      //! down_thread_realserver_disconnect_event function
176                 DOWN_FUNC_REALSERVER_ALL_DISCONNECT,        //! down_thread_all_realserver_disconnect function
177                 DOWN_FUNC_SORRYSERVER_RECEIVE,              //! down_thread_sorryserver_receive function
178                 DOWN_FUNC_SORRYSERVER_DISCONNECT,           //! down_thread_sorryserver_disconnect function
179                 DOWN_FUNC_SORRYSERVER_MOD_DISCONNECT,       //! down_thread_sorryserver_mod_disconnect function
180                 DOWN_FUNC_SORRYSERVER_DISCONNECT_EVENT,     //! down_thread_sorryserver_disconnect_event function
181                 DOWN_FUNC_SORRY_ENABLE_EVENT,               //! down_thread_sorry_enable_event function
182                 DOWN_FUNC_SORRY_DISABLE_EVENT,              //! down_thread_sorry_disable_event function
183                 DOWN_FUNC_EXIT                              //! down_thread_exit function
184             };
185             typedef std::pair< UP_THREAD_FUNC_TYPE_TAG, tcp_session_func > 
186                 up_thread_function_pair;
187             typedef std::pair< DOWN_THREAD_FUNC_TYPE_TAG, tcp_session_func > 
188                 down_thread_function_pair;
189             //! tcp_session use io service
190             boost::asio::io_service& io;
191             //! parent virtualservice
192             virtualservice_tcp& parent_service;
193             //! thread main loop exit flag
194             bool exit_flag;
195             //! thread main loop exit flag update mutex
196             wr_mutex exit_flag_update_mutex;
197             //! up and down thread status bit frag
198             std::bitset<TCP_SESSION_THREAD_STATE_BIT> thread_state;
199             //! thread_state update mutex
200             wr_mutex thread_state_update_mutex;
201             //! up thread id
202             boost::thread::id up_thread_id;
203             //! down thread id
204             boost::thread::id down_thread_id;
205             //! pointer of protocol module
206             protocol_module_base* protocol_module;
207             //! up and down thread wait flag
208             bool session_pause_flag;
209             //! wait flag mutex
210             wr_mutex session_pause_flag_mutex;
211             //! client socket
212             tcp_socket client_socket;
213             //! sorryserver socket
214             socket_element sorryserver_socket;
215             //! up thread use realserver socket map
216             std::map<endpoint,tcp_socket_ptr> 
217                 up_thread_send_realserver_socket_map;
218             //! connect realserver list
219             tcp_realserver_connect_socket_list down_thread_connect_socket_list;
220             //! down thread use realserver socket list
221             std::list<socket_element> 
222                 down_thread_receive_realserver_socket_list;
223             //! down thread next receive realserver
224             std::list<socket_element>::iterator 
225                 down_thread_current_receive_realserver_socket;
226             //! module function mutex (handle_response_send_inform) 
227             wr_mutex module_function_response_send_inform_mutex;
228             //! module function mutex (handle_client_disconnect) 
229             wr_mutex module_function_client_disconnect_mutex;
230             //! module function mutex (handle_realserver_disconnect) 
231             wr_mutex module_function_realserver_disconnect_mutex;
232             //! module function mutex (handle_sorryserver_disconnect) 
233             wr_mutex module_function_sorryserver_disconnect_mutex;
234             //! module function mutex (handle_sorry_enable) 
235             wr_mutex module_function_sorry_enable_mutex;
236             //! module function mutex (handle_sorry_disable) 
237             wr_mutex module_function_sorry_disable_mutex;
238             //! up thread call function object array
239             up_thread_function_pair up_thread_function_array[UP_FUNC_EXIT+1];
240             //! up thread recept module event convert to up thread function type map
241             std::map< protocol_module_base::EVENT_TAG , 
242                 UP_THREAD_FUNC_TYPE_TAG > up_thread_module_event_map;
243             //! up thread raise message map for down thread
244             std::map< DOWN_THREAD_FUNC_TYPE_TAG, 
245                 tcp_session_func > up_thread_message_down_thread_function_map;
246             //! up thread next call function object
247             up_thread_function_pair up_thread_next_call_function;
248             //! up thread use client side buffer
249             tcp_data up_thread_data_client_side;
250             //! up thread use destination side buffer
251             tcp_data up_thread_data_dest_side;
252             //! message data queue for up thread
253             lockfree_queue< tcp_thread_message > up_thread_message_que;
254             //! up thread use message data
255             tcp_data up_thread_message_data;
256             //! down thread call function object array
257             down_thread_function_pair
258                 down_thread_function_array[DOWN_FUNC_EXIT+1];
259             //! down thread recept module event convert to down thread function type map
260             std::map< protocol_module_base::EVENT_TAG ,
261                 DOWN_THREAD_FUNC_TYPE_TAG > down_thread_module_event_map;
262             //! down thread raise message map for up thread
263             std::map< UP_THREAD_FUNC_TYPE_TAG, tcp_session_func > 
264                 down_thread_message_up_thread_function_map;
265             //! down thread next call function object
266             down_thread_function_pair down_thread_next_call_function;
267             //! down thread use client side buffer
268             tcp_data down_thread_data_client_side;
269             //! down thread use destination side buffer
270             tcp_data down_thread_data_dest_side;
271             //! message data queue for down thread
272             lockfree_queue< tcp_thread_message > down_thread_message_que;
273             //! up thread use message data
274             tcp_data down_thread_message_data;
275             //! upstream socket buffer size
276             int upstream_buffer_size;
277             //! downstream socket buffer size
278             int downstream_buffer_size;
279             //! virtual service message convert to up thread function object map
280             std::map< TCP_VIRTUAL_SERVICE_MESSAGE_TAG, tcp_session_func> 
281                 virtual_service_message_up_thread_function_map;
282             //! virtual service message convert to down thread function object map
283             std::map< TCP_VIRTUAL_SERVICE_MESSAGE_TAG, tcp_session_func>  
284                 virtual_service_message_down_thread_function_map;
285             //! client conection src endpoint
286             boost::asio::ip::tcp::endpoint client_endpoint;
287             //! virtualservice accept endpoint
288             boost::asio::ip::tcp::endpoint virtualservice_endpoint;
289             //! access log out put flag
290             bool access_log_flag;
291             //! access log out put flag mutex
292             wr_mutex access_log_flag_mutex;
293             //! access logger
294             logger_implement_access* access_logger;
295             //! ssl mode flag
296             bool ssl_flag;
297             //! client ssl socket
298             tcp_ssl_socket client_ssl_socket;
299             //! ssl context
300             boost::asio::ssl::context& ssl_context;
301             //! ssl session cache flag
302             bool ssl_cache_flag;
303             //! ssl handshake timer
304             typedef boost::shared_ptr<boost::asio::deadline_timer>  
305                  deadline_timer_ptr_type;
306             deadline_timer_ptr_type ssl_handshake_timer;
307             //! ssl handshake timer flag
308             bool ssl_handshake_timer_flag;
309             //! ssl handshake timeout
310             int ssl_handshake_time_out;
311             //! ssl handshake timeout flag
312             bool ssl_handshake_time_out_flag;
313             //! ssl handshake timeout flag mutex
314             wr_mutex ssl_handshake_time_out_flag_mutex;
315             //! socket option 
316             tcp_socket_option_info socket_opt_info;
317
318             // epoll using member
319             #define EVENT_NUM       2
320             #define EPOLL_TIMEOUT   50      //[microsecond]
321             struct epoll_event  up_client_events[EVENT_NUM];
322             struct epoll_event  up_realserver_events[EVENT_NUM];
323             struct epoll_event  down_client_events[EVENT_NUM];
324             struct epoll_event  down_realserver_events[EVENT_NUM];
325             int    up_client_epollfd;
326             int    up_realserver_epollfd;
327             int    down_client_epollfd;
328             int    down_realserver_epollfd;
329
330             //! handshake timer handler
331             //! @param[in]        error is error code object
332             virtual void handle_ssl_handshake_timer(
333                  const boost::system::error_code& error);
334             //! reset ssl object for reuse
335             //! @param[in/out]    clear_ssl is clear target SSL structure pointer
336             virtual bool ssl_clear_keep_cache(SSL *clear_ssl);          
337             //! up and down thread state update
338             //! @param[in]        thread_flag is regist or unregist bitset
339             //! @param[in]        regist is regist or unregist flag
340             virtual void thread_state_update(
341                 const std::bitset<TCP_SESSION_THREAD_STATE_BIT> thread_flag,
342                 const bool regist);
343             //! endpoint data to string infomation
344             //! @param[in]        endpoint is target endpoint object
345             virtual std::string endpoint_to_string( 
346                 const boost::asio::ip::tcp::endpoint& target_endpoint); 
347  
348             //! up thread accept client side
349             //! @param[in]        process_type is prosecess type
350             virtual void up_thread_client_accept(
351                 const TCP_PROCESS_TYPE_TAG process_type);
352             //! up thread raise module event of handle_accept
353             //! @param[in]        process_type is prosecess type
354             virtual void up_thread_client_accept_event(
355                 const TCP_PROCESS_TYPE_TAG process_type);
356             //! up thread receive client side and raise module event of handle_client_recv
357             //! @param[in]        process_type is prosecess type
358             virtual void up_thread_client_receive(
359                 const TCP_PROCESS_TYPE_TAG process_type);
360             //! up thread raise client respond send event message for up and down thread
361             //! @param[in]        process_type is prosecess type
362             virtual void up_thread_client_respond(
363                 const TCP_PROCESS_TYPE_TAG process_type);
364             //! up thread raise module event of handle_response_send_inform
365             //! @param[in]        process_type is prosecess type
366             virtual void up_thread_client_respond_event(
367                 const TCP_PROCESS_TYPE_TAG process_type);
368             //! up thread close client socket and raise client disconnect event message for up and down thread
369             //! @param[in]        process_type is prosecess type
370             virtual void up_thread_client_disconnect(
371                 const TCP_PROCESS_TYPE_TAG process_type);
372             //! up thread raise module event of handle_client_disconnect
373             //! @param[in]        process_type is prosecess type
374             virtual void up_thread_client_disconnect_event(
375                 const TCP_PROCESS_TYPE_TAG process_type);
376             //! up thread send realserver and raise module event of handle_client_recv
377             //! @param[in]        process_type is prosecess type
378             virtual void up_thread_realserver_send(
379                 const TCP_PROCESS_TYPE_TAG process_type);
380             //! up thread raise module event of handle_realserver_select
381             //! @param[in]        process_type is prosecess type
382             virtual void up_thread_realserver_get_destination_event(
383                 const TCP_PROCESS_TYPE_TAG process_type);
384             //! up thread connect realserver
385             //! @param[in]        process_type is prosecess type
386             virtual void up_thread_realserver_connect(
387                 const TCP_PROCESS_TYPE_TAG process_type);
388             //! up thread raise module event of handle_realserver_connect
389             //! @param[in]        process_type is prosecess type
390             virtual void up_thread_realserver_connect_event(
391                 const TCP_PROCESS_TYPE_TAG process_type);
392             //! up thread raise module event of handle_realserver_connection_fail
393             //! @param[in]        process_type is prosecess type
394             virtual void up_thread_realserver_connection_fail_event(
395                 const TCP_PROCESS_TYPE_TAG process_type);
396             //! up thread close realserver socket and raise realserver disconnect event message for up and down thread
397             //! @param[in]        process_type is prosecess type
398             virtual void up_thread_realserver_disconnect(
399                 const TCP_PROCESS_TYPE_TAG process_type);
400             //! up thread raise module event of handle_realserver_disconnect
401             //! @param[in]        process_type is prosecess type
402             virtual void up_thread_realserver_disconnect_event(
403                 const TCP_PROCESS_TYPE_TAG process_type);
404             //! up thread close all realserver socket and raise module event of handle_realserver_disconnect
405             //! @param[in]        process_type is prosecess type
406             virtual void up_thread_all_realserver_disconnect(
407                 const TCP_PROCESS_TYPE_TAG process_type);
408             //! up thread send sorryserver and raise module event of handle_sorryserver_send
409             //! @param[in]        process_type is prosecess type
410             virtual void up_thread_sorryserver_send(
411                 const TCP_PROCESS_TYPE_TAG process_type);
412             //! up thread raise module event of handle_sorryserver_select
413             //! @param[in]        process_type is prosecess type
414             virtual void up_thread_sorryserver_get_destination_event(
415                 const TCP_PROCESS_TYPE_TAG process_type);
416             //! up thread connect sorryserver
417             //! @param[in]        process_type is prosecess type
418             virtual void up_thread_sorryserver_connect(
419                 const TCP_PROCESS_TYPE_TAG process_type);
420             //! up thread raise module event of handle_sorryserver_connect
421             //! @param[in]        process_type is prosecess type
422             virtual void up_thread_sorryserver_connect_event(
423                 const TCP_PROCESS_TYPE_TAG process_type);
424             //! up thread raise module event of handle_sorryserver_connection_fail
425             //! @param[in]        process_type is prosecess type
426             virtual void up_thread_sorryserver_connection_fail_event(
427                 const TCP_PROCESS_TYPE_TAG process_type);
428             //! up thread close sorryserver socket and raise sorryserver disconnect event message for up and down thread
429             //! @param[in]        process_type is prosecess type
430             virtual void up_thread_sorryserver_disconnect(
431                 const TCP_PROCESS_TYPE_TAG process_type);
432             //! up thread close sorryserver socket and raise module sorryserver disconnect event
433             //! @param[in]        process_type is prosecess type
434             virtual void up_thread_sorryserver_mod_disconnect(
435                 const TCP_PROCESS_TYPE_TAG process_type);
436             //! up thread raise module event of handle_sorryserver_disconnect
437             //! @param[in]        process_type is prosecess type
438             virtual void up_thread_sorryserver_disconnect_event(
439                 const TCP_PROCESS_TYPE_TAG process_type);
440             //! up thread raise module event of handle_sorry_enable
441             //! @param[in]        process_type is prosecess type
442             virtual void up_thread_sorry_enable_event(
443                 const TCP_PROCESS_TYPE_TAG process_type);
444             //! up thread raise module event of handle_sorry_disable
445             //! @param[in]        process_type is prosecess type
446             virtual void up_thread_sorry_disable_event(
447                 const TCP_PROCESS_TYPE_TAG process_type);
448             //! up thread exit main loop
449             //! @param[in]        process_type is prosecess type
450             virtual void up_thread_exit(
451                 const TCP_PROCESS_TYPE_TAG process_type);
452             //! up thread close all socket
453             virtual void up_thread_all_socket_close(void);
454
455             //! down thread receive from realserver and raise module event of handle_realserver_recv
456             //! @param[in]        process_type is prosecess type
457             virtual void down_thread_realserver_receive(
458                 const TCP_PROCESS_TYPE_TAG process_type);
459             //! down thread close realserver socket and raise realserver disconnect event message for up and down thread
460             //! @param[in]        process_type is prosecess type
461             virtual void down_thread_realserver_disconnect(
462                 const TCP_PROCESS_TYPE_TAG process_type);
463             //! down thread raise module event of handle_realserver_disconnect
464             //! @param[in]        process_type is prosecess type
465             virtual void down_thread_realserver_disconnect_event(
466                 const TCP_PROCESS_TYPE_TAG process_type);
467             //! down thread close all realserver socket and raise module event of handle_realserver_disconnect
468             //! @param[in]        process_type is prosecess type
469             virtual void down_thread_all_realserver_disconnect(
470                 const TCP_PROCESS_TYPE_TAG process_type);
471             //! down thread raise module event of handle_client_connection_check
472             //! @param[in]        process_type is prosecess type
473             virtual void down_thread_client_connection_chk_event(
474                 const TCP_PROCESS_TYPE_TAG process_type);
475             //! down thread raise module event of handle_response_send_inform
476             //! @param[in]        process_type is prosecess type
477             virtual void down_thread_client_respond_event(
478                 const TCP_PROCESS_TYPE_TAG process_type);
479             //! down thread send for client and raise module event of handle_client_send
480             //! @param[in]        process_type is prosecess type
481             virtual void down_thread_client_send(
482                 const TCP_PROCESS_TYPE_TAG process_type);
483             //! down thread close client socket and raise client disconnect event message for up and down thread 
484             //! @param[in]        process_type is prosecess type
485             virtual void down_thread_client_disconnect(
486                 const TCP_PROCESS_TYPE_TAG process_type);
487             //! down thread raise module event of handle_client_disconnect
488             //! @param[in]        process_type is prosecess type
489             virtual void down_thread_client_disconnect_event(
490                 const TCP_PROCESS_TYPE_TAG process_type);
491             //! down thread receive from sorryserver and raise module event of handle_sorryserver_recv
492             //! @param[in]        process_type is prosecess type
493             virtual void down_thread_sorryserver_receive(
494                 const TCP_PROCESS_TYPE_TAG process_type);
495             //! down thread close sorryserver socket and raise sorryserver disconnect event message for up and down thread
496             //! @param[in]        process_type is prosecess type
497             virtual void down_thread_sorryserver_disconnect(
498                 const TCP_PROCESS_TYPE_TAG process_type);
499             //! down thread close sorryserver socket and raise module sorryserver disconnect event
500             //! @param[in]        process_type is prosecess type
501             virtual void down_thread_sorryserver_mod_disconnect(
502                 const TCP_PROCESS_TYPE_TAG process_type);
503             //! down thread raise module event of handle_sorryserver_disconnect
504             //! @param[in]        process_type is prosecess type
505             virtual void down_thread_sorryserver_disconnect_event(
506                 const TCP_PROCESS_TYPE_TAG process_type);
507             //! down thread raise module event of handle_sorry_enable
508             //! @param[in]        process_type is prosecess type
509             virtual void down_thread_sorry_enable_event(
510                 const TCP_PROCESS_TYPE_TAG process_type);
511             //! down thread raise module event of handle_sorry_disable
512             //! @param[in]        process_type is prosecess type
513             virtual void down_thread_sorry_disable_event(
514                 const TCP_PROCESS_TYPE_TAG process_type);
515             //! down thread exit main loop
516             //! @param[in]        process_type is prosecess type
517             virtual void down_thread_exit(
518                 const TCP_PROCESS_TYPE_TAG process_type);
519             //! down thread close all socket
520             virtual void down_thread_all_socket_close(void);
521
522     };// class tcp_session
523 }// namespace l7vs
524
525 #endif//TCP_SESSION_H
526  
527