2 * @file schedule_module_base.h
3 * @brief shared object schedule module abstract class
5 * L7VSD: Linux Virtual Server for Layer7 Load Balancing
6 * Copyright (C) 2009 NTT COMWARE Corporation.
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.
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.
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
23 **********************************************************************/
24 #ifndef SCHEDULE_MODULE_BASE_H
25 #define SCHEDULE_MODULE_BASE_H
27 #include <boost/asio.hpp>
28 #include <boost/function.hpp>
29 #include "logger_enum.h"
30 #include "module_base.h"
31 #include "realserver.h"
37 //! @class schedule_module_base
38 //! @brief schedule module abstract base class.
39 //! @brief all schedule module is extened this class.
40 class schedule_module_base : public module_base
43 //! realserver list iterator type
44 typedef std::list<l7vs::realserver>
46 typedef boost::function< rslist_type::iterator(void)>
47 rslist_iterator_begin_func_type;
48 typedef boost::function< rslist_type::iterator(void)>
49 rslist_iterator_end_func_type;
50 typedef boost::function< rslist_type::iterator(rslist_type::iterator)>
51 rslist_iterator_next_func_type;
54 schedule_module_base(std::string in_modulename) : module_base(in_modulename) {};
56 virtual ~schedule_module_base() {};
57 //! initialize function
58 virtual void initialize() = 0;
59 //! handle schedule called then schedule function for TCP/IP endpoint
60 //! @param[in] thread id
61 //! @param[in] list iterator first function object
62 //! @param[in] list iterator last function object
63 //! @param[in] list iterator next function object
64 //! @param[out] scheduled TCP/IP endpoint
65 virtual void handle_schedule(
67 rslist_iterator_begin_func_type,
68 rslist_iterator_end_func_type,
69 rslist_iterator_next_func_type,
70 boost::asio::ip::tcp::endpoint &) = 0;
72 //! handle schedule calles then schedule function for UDP endpoint
73 //! @param[in] thread id
74 //! @param[in] list iterator first function object
75 //! @param[in] list iterator last function object
76 //! @param[in] list iterator next function object
77 //! @param[out] scheduled UDP endpoint
78 virtual void handle_schedule(
80 rslist_iterator_begin_func_type,
81 rslist_iterator_end_func_type,
82 rslist_iterator_next_func_type,
83 boost::asio::ip::udp::endpoint &) = 0;
89 #endif //SCHEDULE_MODULE_BASE_H