3 * @brief mibdata module.
5 * L7VSD: Linux Virtual Server for Layer7 Load Balancing
6 * Copyright (C) 2010 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 **********************************************************************/
27 #include "error_code.h"
29 #include "snmp_info.h"
31 #include <net-snmp/net-snmp-config.h>
32 #include <net-snmp/net-snmp-includes.h>
33 #include <net-snmp/agent/net-snmp-agent-includes.h>
35 #define L7VS_IPADDR_LEN (128)
41 //! @brief this class is mib data cache class.
42 class mibdata : private boost::noncopyable
45 netsnmp_table_data_set* vs_table;
46 netsnmp_table_data_set* rs_table;
49 int replication_state;
53 mibdata(const mibdata &);
54 mibdata& operator=(const mibdata &);
57 * update virtual service table information.
59 * @param l7vsd * l7vsd pointer
60 * @param error_code & error code
63 void update_vs_table(l7vsd *, error_code &);
66 * update real server table information.
68 * @param const std::vector<rsdata> & temporary real server list
69 * @param error_code & error code
72 void update_rs_table(const std::vector<rsdata> &, error_code &);
75 * update replication state.
77 * @param l7vsd * l7vsd pointer
78 * @param error_code & error code
81 void update_replication_state(l7vsd *, error_code &);
85 * get mibdata instance.
87 * @retrun mibdata instance
89 static mibdata& get_instance();
92 * collect mibdata in l7vsd.
94 * @param l7vsd * l7vsd pointer
95 * @param error_code & error code
98 void collect_mibdata(l7vsd *, error_code &);
101 * set virtual service data set.
103 * @param netsnmp_table_data_set * virtual service data set
106 void set_vs_table(netsnmp_table_data_set *);
109 * set real server data set.
111 * @param netsnmp_table_data_set * real server data set
114 void set_rs_table(netsnmp_table_data_set *);
117 * get virtual service table size
119 * @retrun int virtual service table size
121 inline int get_vs_table_size() {
122 return vs_table_size;
126 * get replication state.
128 * @retrun int replication state
130 inline int get_replication_state() {
131 return replication_state;
136 #endif //__MIBDATA_H__