//
-// @file l7vscommand.h
-// @brief l7vsadm and l7vsd connection data prototype
+//! @file l7vscommand.h
+//! @brief l7vsadm and l7vsd connection data prototype
//
// copyright (c) sdy corporation. 2008
// mail: n dot nakai at sdy dot co dot jp
namespace l7vs{
//
-// l7vsadm -> l7vsd request data class
-//
-//
+//! @class l7vsadm_request
+//! @brief l7vsadm -> l7vsd request data class
class l7vsadm_request{
public:
- // command lists
+ //! @enum COMMAND_CODE_TAG request command code enum
enum COMMAND_CODE_TAG{
CMD_NONE = 0,
CMD_LIST, //!< List command(-l,--list)
CMD_PARAMETER, //!< Parameter command(-P, --parameter)
CMD_HELP, //!< Help command(-h, --help)
};
+
+ //! @enum REPLICATION_COMMAND_TAG replication request command enum
enum REPLICATION_COMMAND_TAG{
REP_NONE = 0,
- REP_START, // !< REPLICATION START COMMAND
- REP_STOP, // !< REPLICATION STOP COMMAND
- REP_FORCE, // !< REPLICATION FORCE COMMAND
- REP_DUMP // !< REPLICATION DUMP COMMAND
+ REP_START, //!< REPLICATION START COMMAND
+ REP_STOP, //!< REPLICATION STOP COMMAND
+ REP_FORCE, //!< REPLICATION FORCE COMMAND
+ REP_DUMP //!< REPLICATION DUMP COMMAND
};
- COMMAND_CODE_TAG command;
- virtualservice_element vs_element;
- REPLICATION_COMMAND_TAG replication_command;
- LOG_CATEGORY_TAG log_category;
- LOG_LEVEL_TAG log_level;
- PARAMETER_COMPONENT_TAG reload_param;
- LOG_CATEGORY_TAG snmp_log_category;
- LOG_LEVEL_TAG snmp_log_level;
+ COMMAND_CODE_TAG command; //!< request command
+ virtualservice_element vs_element; //!< use VS mode and RealServer mode
+ REPLICATION_COMMAND_TAG replication_command; //!< use replication command mode
+ LOG_CATEGORY_TAG log_category; //!< use log change mode. target log category
+ LOG_LEVEL_TAG log_level; //!< use log level change mode target category log level
+ PARAMETER_COMPONENT_TAG reload_param; //!< set reload param mode
+ LOG_CATEGORY_TAG snmp_log_category; //!< use snmp mode. target change log category
+ LOG_LEVEL_TAG snmp_log_level; //!< use snmp mode. target log category change to log level
+ //! constractor
l7vsadm_request() : command( CMD_NONE ),
replication_command( REP_NONE ),
log_category( LOG_CAT_NONE ),
snmp_log_category( LOG_CAT_NONE ),
snmp_log_level( LOG_LV_NONE ){}
private:
- friend class boost::serialization::access;
+ friend class boost::serialization::access; //!< serializable access class is friend.
+ //! serializable function
+ //! @param[in] archiver class from boost serializable
+ //! @param[in] version use boost serializable
template <class Archive > void serialize( Archive& ar, const unsigned int version ){
ar & command;
ar & vs_element;
};
//
-// l7vsd -> l7vsadm data class
-//
-
+//! @class l7vsd_response
+//! @brief l7vsd -> l7vsadm data class
class l7vsd_response{
public:
- enum COMMAND_RESPONSE_CODE{
- RESPONSE_NONE = 0,
- RESPONSE_OK,
- RESPONSE_LIST_ERROR,
- RESPONSE_LIST_VERBOSE_ERROR,
- RESPONSE_LIST_KEY_ERROR,
- RESPONSE_ADD_VS_ERROR,
- RESPONSE_DEL_VS_ERROR,
- RESPONSE_EDIT_VS_ERROR,
- RESPONSE_FLUSH_VS_ERROR,
- RESPONSE_ADD_RS_ERROR,
- RESPONSE_DEL_RS_ERROR,
- RESPONSE_EDIT_RS_ERROR,
- RESPONSE_REPLICATION_ERROR,
- RESPONSE_LOG_ERROR,
- RESPONSE_SNMP_ERROR,
- RESPONSE_PARAMETER_ERROR,
- RESPONSE_HELP_ERROR
- };
+ enum COMMAND_RESPONSE_CODE{ //!< response command code enum
+ RESPONSE_NONE = 0, //!< none
+ RESPONSE_OK, //!< request execute ok
+ RESPONSE_LIST_ERROR, //!< list request error
+ RESPONSE_LIST_VERBOSE_ERROR,//!< list verbose request error
+ RESPONSE_LIST_KEY_ERROR, //!< list key request error
+ RESPONSE_ADD_VS_ERROR, //!< virtual service add error
+ RESPONSE_DEL_VS_ERROR, //!< virtual service delete error
+ RESPONSE_EDIT_VS_ERROR, //!< virtual service edit error
+ RESPONSE_FLUSH_VS_ERROR, //!< virtual service clear error
+ RESPONSE_ADD_RS_ERROR, //!< realserver add error
+ RESPONSE_DEL_RS_ERROR, //!< realserver delete error
+ RESPONSE_EDIT_RS_ERROR, //!< realserver edit error
+ RESPONSE_REPLICATION_ERROR, //!< replication error
+ RESPONSE_LOG_ERROR, //!< logger error
+ RESPONSE_SNMP_ERROR, //!< snmpagent error
+ RESPONSE_PARAMETER_ERROR, //!< parameter error
+
l7vsadm_request::COMMAND_CODE_TAG
- code;
+ code; //!< request command.
- bool status;
+ COMMAND_RESPONSE_CODE status; //!< return status.
- std::string message;
+ std::string message;//!< error message
std::list< virtualservice_element >
- virtualservice_status_list;
+ virtualservice_status_list;//!< virtual service lists
- REPLICATION_MODE_TAG replication_mode_status;
+ REPLICATION_MODE_TAG replication_mode_status;//!< replication status.
std::list< std::pair<LOG_CATEGORY_TAG, LOG_LEVEL_TAG> >
- log_status_list;
+ log_status_list; //!< log cateogries statuses.
- bool snmp_connection_status;
+ bool snmp_connection_status; //!< snmp connection status
std::list< std::pair<LOG_CATEGORY_TAG, LOG_LEVEL_TAG> >
- snmp_log_status_list;
+ snmp_log_status_list; //!< snmp log statuses
- unsigned long long total_bps;
- unsigned long long total_client_recv_byte;
- unsigned long long total_client_send_byte;
- unsigned long long total_realserver_recv_byte;
- unsigned long long total_realserver_send_byte;
+ unsigned long long total_bps; //!< l7vsd's total bit par sec
+ unsigned long long total_client_recv_byte; //!< l7vsd's total client recive bytes
+ unsigned long long total_client_send_byte; //!< l7vsd's total client send bytes
+ unsigned long long total_realserver_recv_byte; //!< l7vsd's total realserver recive bytes
+ unsigned long long total_realserver_send_byte; //!< l7vsd's total realserver send bytes
std::vector<virtualservice_element>
- virtualservice_vec;
+ virtualservice_vec; //!< virtualservice lists
private:
- friend class boost::serialization::access;
+ friend class boost::serialization::access; //! friend boost serializable class
+ //! serializable
+ //! @brief using boost serialiable. class serializable function.
+ //! @param[in] archive
+ //! @param[in] version
template <class Archive > void serialize( Archive& ar, const unsigned int version ){
ar & code;
ar & status;
//
-// @file protocol_module_base.h
-// @brief shared object protocol module absctract class
+//! @file protocol_module_base.h
+//! @brief shared object protocol module absctract class
//
// copyright (c) sdy corporation. 2008
// mail: h dot okada at sdy dot co dot jp
#define MODULE_CONTROL_BASE
#include <string>
+#include <boost/noncopyable.hpp>
namespace l7vs{
+//
+//! @class module_control_base_alloc
+//! @brief this class throw then don't allocate memory.
class module_control_bad_alloc : public std::bad_alloc {
public:
// module_control_bad_alloc( ) : std::bad_alloc( ){
// }
};
+//
+//! @class module_control_error
+//! @brief this class throw then logical error
class module_control_error : public std::logic_error {
};
-class module_control_base{
+//
+//! @class module_control_base
+//! @brief base abstract class. all module control is extend this class.
+class module_control_base : private boost::noncopyable{
protected:
- std::string modulefile_path;
- module_control_base(){}
- virtual ~module_control_base(){};
+ std::string modulefile_path; //!< shared object path
+ virtual ~module_control_base(){}; //!< destractor
public:
+ //! @brief initialize prototype function is fist called
virtual void initialize( const std::string& infile_path ) = 0;
+ //! @brief finalize prototype function is last called
virtual void finalize() = 0;
};
//
-// @file protocol_module_control.h
-// @brief control load/unload shared object protocol module
+//! @file protocol_module_control.h
+//! @brief control load/unload shared object protocol module
//
// copyright (c) sdy corporation. 2008
// mail: h dot okada at sdy dot co dot jp
namespace l7vs{
-// protocol module control class is load protocol module from shared object file.
-// many virtual service class used protocol module instance.
-// but, shared object load is once. and unload when vitual service refarence count is zero.
+//
+//! @class protocol_module_control
+//! @brief protocol module control class is load protocol module from shared object file.
+//! @brief many virtual service class used protocol module instance.
+//! @brief but, shared object load is once. and unload when vitual service refarence count is zero.
class protocol_module_control : public module_control_base, private boost::noncopyable{
public:
//! getloglevel function object typedef
//! module destroy function object typedef
typedef boost::function< void ( protocol_module_base* ) >
destroy_func_type;
-
- //! protocol module information structure.
+
+ //! @struct protocol_module_information
+ //! @brief protocol module information structure.
struct protocol_module_info{
- unsigned int ref_count; // refarence count
- create_func_type create_func; // create function object
- destroy_func_type destroy_func; // destroy function object
- protocol_module_info() : ref_count(0) {} // constractor
+ unsigned int ref_count; //!< refarence count
+ create_func_type create_func; //!< create function object
+ destroy_func_type destroy_func; //!< destroy function object
+ protocol_module_info() : ref_count(0) {} //!< constractor
};
//! name module map type typedef
//! instance getter function.
static protocol_module_control& getInstance();
//! initialize
+ //! @param[in] shared object file path
void initialize( const std::string& infile_path );
//! finalize
void finalize();
//! load module function
+ //! @param[in] protocol module name
+ //! @return protocol module pointer
protocol_module_base* load_module( const std::string& modulename );
//! unload module function.
- void unload_module( const std::string& modulename,
- protocol_module_base* module_ptr );
+ //! @param[in] module ptr
+ void unload_module( protocol_module_base* module_ptr );
};
} //namespace l7vs
//
-// @file schedule_module_base.h
-// @brief shared object schedule module abstract class
+//! @file schedule_module_base.h
+//! @brief shared object schedule module abstract class
//
// copyright (c) sdy corporation. 2008
// mail: h dot okada at sdy dot co dot jp
namespace l7vs{
-class schedule_module_base
-{
+//
+//! @class schedule_module_base
+//! @brief schedule module abstract base class.
+//! @brief all schedule module is extened this class.
+class schedule_module_base : public module_base{
public:
- //logger function type
+ //! logger function type
typedef boost::function< void ( const LOG_LEVEL_TAG, const unsigned int, const std::string) >
logger_func_type;
- //replication_pay_memory function type
+ //! replication_pay_memory function type
typedef boost::function< void ( const std::string&, unsigned int* ) >
replicationpaymemory_func_type;
- //
+ //! realserver list iterator type
typedef boost::function< std::list<realserver>::iterator (void)>
- rslist_iterator_type;
-protected:
-
+ rslist_iterator_func_type;
public:
+ //! constractor
schedule_module_base() {};
+ //! destractor
virtual ~schedule_module_base(){};
-
+ //! initialize function
virtual void initialize();
-
+ //! handle schedule called then schedule function for TCP/IP endpoint
+ //! @param[in] thread id
+ //! @param[in] list iterator first function object
+ //! @param[in] list iterator last function object
+ //! @param[in] list iterator next function object
+ //! @param[out] scheduled TCP/IP endpoint
virtual void handle_schedule(
- boost::thread::id thread_id,
- rslist_iterator_type inlist_begin,
- rslist_iterator_type inlist_end,
- rslist_iterator_type inlist_next,
- boost::asio::ip::tcp::endpoint& outendpoint ) = 0;
+ boost::thread::id,
+ rslist_iterator_func_type,
+ rslist_iterator_func_type,
+ rslist_iterator_func_type,
+ boost::asio::ip::tcp::endpoint&) = 0;
+ //! handle schedule calles then schedule function for UDP endpoint
+ //! @param[in] thread id
+ //! @param[in] list iterator first function object
+ //! @param[in] list iterator last function object
+ //! @param[in] list iterator next function object
+ //! @param[out] scheduled UDP endpoint
virtual void handle_schedule(
- boost::thread::id thread_id,
- rslist_iterator_type inlist_begin,
- rslist_iterator_type inlist_end,
- rslist_iterator_type inlist_next,
- boost::asio::ip::udp::endpoint& outendpoint ) = 0;
+ boost::thread::id,
+ rslist_iterator_func_type,
+ rslist_iterator_func_type,
+ rslist_iterator_func_type,
+ boost::asio::ip::udp::endpoint&) = 0;
};
//
-// @file session thread controler.
-// @brief session used 2 threads. thread pooling unit is 2 thread control.
+//! @file session thread controler.
+//! @brief session used 2 threads. thread pooling unit is 2 thread control.
//
// copyright (c) sdy corporation. 2009
// mail: n dot nakai at sdy dot co dot jp
namespace l7vs{
-//
-// session thread pooling utility class.
-//
+//!
+//! @brief session thread pooling utility class.
+//! @class session_thread_control is session thread pool utirity.
class session_thread_control : private boost::noncopyable{
public:
typedef boost::shared_ptr< boost::thread > thread_ptr; //! shared_ptr thread typedef
typedef boost::shared_ptr< session > session_ptr; //! shared_ptr session typedef
typedef boost::thread::id thread_id_type; //! thread id typedef
protected:
- enum state_tag{ //! upthread and down thread state enum
+ enum state_tag{ //! @enum state_tag upthread and down thread state enum
WAIT = 0, //! thread pooling mode
RUNNING, //! thread running mode
EXIT //! thread exit mode
void downstream_run(); //! downstream thread bind function
public:
//! constractor.
+ //! @param session_ptr session class shared ptr
session_thread_control( session_ptr ptr ) :
session( ptr ),
upthread_state( WAIT ),
//! destractor
~session_thread_control(){}
//! session shared ptr getter
+ //! @return session shared ptr
session_ptr get_session(){ return session; }
//! upstream thread start function
void startupstream();
//! all thread destory function.
void join();
//! upstream-thread id getter
+ //! @return thread_id_type upstream thread id
thread_id_type get_upthread_id(){ return upthread.get_id(); }
//! downstream-thread id getter
+ //! @return thread_id_type downstream thread id
thread_id_type get_downthread_id(){ return downthread.get_id(); }
};
//
-// upstream thread bind function.
+//! @brief upstream thread bind function.
//
void session_thread_control::upstream_run(){
state_tag state;
}
}
//
-// downstream thread bind function,
+//! @brief downstream thread bind function,
//
void session_thread_control::downstream_run(){
state_tag state;
}
}
//
-// start upstream function.
+//! @brief start upstream function.
//
void session_thread_control::startupstream(){
boost::mutex::scoped_lock( upthread_condition_mutex ); //upstream state lock
upthread_condition.notify_all(); // conditionwait upstreamthread is run.
}
//
-// stop upstream function
+//! @brief stop upstream function
//
void session_thread_control::stopupstream(){
boost::mutex::scoped_lock lock( upthread_condition_mutex ); // upstream state lock
if( upthrad_state != EXIT ) upthread_state = WAIT; // upthread state is update [WAIT] -> pooling mode
}
//
-// start downstream function
+//! @brief start downstream function
//
void session_thread_control::startdownstream(){
boost::mutex::scoped_lock( downthread_condition_mutex ); // downstream state lock
downthread_condition.notify_all(); // condition wait thread is run.
}
//
-// stop downstream function.
+//! @brief stop downstream function.
//
void session_thread_control::stopdownstream(){
boost::mutex::scoped_lock lock( downthread_condition_mutex ); // downstream state lock
if( downthread_state != EXIT ) downthread_state = WAIT; // downstream state is update [WAIT] -> pooling mode
}
//
-// upstream and downstream threads finished function
+//! @brief upstream and downstream threads finished function
//
void session_thread_control::join(){
boost::mutex::scoped_lock uplock( upthread_condition_mutex ); //upstream state lock