OSDN Git Service

formatted all files with 'astyle -A8 -HUpc -k3 -z2 -r ./*.cpp ./*.c ./*.h'
[ultramonkey-l7/ultramonkey-l7-v3.git] / l7vsd / module / protocol / sslid_session_data_processor.h
1 /*
2  * @file  sslid_session_data_processor.h
3  * @brief sslid session data processor header file.
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 SSLID_SESSION_DATA_PROCESSOR_H
26 #define SSLID_SESSION_DATA_PROCESSOR_H
27
28 #include "sslid_replication_data_processor.h"
29 #include "logger_enum.h"
30 #include <boost/asio.hpp>
31 #include <string>
32
33 namespace l7vs
34 {
35
36 class sslid_session_data_processor
37 {
38 public:
39         //! loglevel get function object type
40         typedef    boost::function< LOG_LEVEL_TAG(void) >
41         getloglevel_func_type;
42         //! log output function object type
43         typedef    boost::function< void (const unsigned int, const std::string &, const char *, int) >
44         logger_func_type;
45
46 public:
47         sslid_session_data_processor(
48                 int maxlist,
49                 int timeout,
50                 sslid_replication_data_processor *replication_data_processor,
51                 getloglevel_func_type    ingetloglevel,
52                 logger_func_type inputLogFatal,
53                 logger_func_type inputLogError,
54                 logger_func_type inputLogWarn,
55                 logger_func_type inputLogInfo,
56                 logger_func_type inputLogDebug);
57
58         virtual ~sslid_session_data_processor();
59
60         int get_endpoint_from_session_data(
61                 const std::string &session_id,
62                 boost::asio::ip::tcp::endpoint &endpoint);
63
64         int write_session_data(
65                 const std::string &session_id,
66                 const boost::asio::ip::tcp::endpoint &endpoint,
67                 time_t now_time);
68
69         int read_session_data_from_replication_area(sslid_replication_data *replication_area);
70
71 protected:
72         int clear_expired_session_data();
73
74 protected:
75         int maxlist;
76         int timeout;
77         std::map<std::string, boost::asio::ip::tcp::endpoint> session_endpoint_map;
78         std::map<std::string, time_t> session_lasttime_map;
79         std::multimap<time_t, std::string> lasttime_session_map;
80         boost::mutex session_map_mutex;
81         sslid_replication_data_processor *replication_data_processor;
82         getloglevel_func_type     getloglevel;        //!< get loglevel function object
83         logger_func_type putLogFatal;                //!< fatal log output function object
84         logger_func_type putLogError;                //!< error log output function object
85         logger_func_type putLogWarn;                //!< warn log output function object
86         logger_func_type putLogInfo;                //!< info log output function object
87         logger_func_type putLogDebug;            //!< debug log output function object
88 private:
89 };
90
91 }
92 #endif // SSLID_SESSION_DATA_PROCESSOR_H