3 * @brief configulation module header file.
4 * @auther nakai norihisa
6 * L7VSD: Linux Virtual Server for Layer7 Load Balancing
7 * Copyright (C) 2005 NTT COMWARE Corporation.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 **********************************************************************/
28 #include "logger_wrapper.h"
29 #include "parameter_wrapper.h"
30 #include "l7vs_replication.h"
31 #include "l7vs_snmpbridge.h"
33 #include "l7vs_dest.h"
37 * config socket file path
39 #ifndef L7VS_CONFIG_SOCK_PATH
40 #define L7VS_CONFIG_SOCK_PATH "/var/run/l7vs"
42 #define L7VS_CONFIG_SOCKNAME L7VS_CONFIG_SOCK_PATH "/l7vs"
47 * configulation module error type
50 enum l7vs_config_err_type{
51 L7VS_CONFIG_NOERR = 0, /*! command error none. default value */
52 L7VS_CONFIG_ERR_INVALID_COMMAND = 1, /*! command is invalid */
53 L7VS_CONFIG_ERR_NOMEM = 2, /*! don't allocate memory */
54 L7VS_CONFIG_ERR_VS_EXISTS = 3, /*! virtual service exists */
55 L7VS_CONFIG_ERR_RS_EXISTS = 4, /*! real server exists */
56 L7VS_CONFIG_ERR_NOVS = 5, /*! no virtual service */
57 L7VS_CONFIG_ERR_NORS = 6, /*! no real server */
58 L7VS_CONFIG_ERR_NOSCHED = 7, /*! no schedule module */
59 L7VS_CONFIG_ERR_NOSOCK = 8, /*! no socket */
60 L7VS_CONFIG_ERR_QOSSET = 9, /*! set QoS threshold failure */
61 L7VS_CONFIG_ERR_SORRYSET = 10, /*! modify Sorry-Server Values failure */
62 L7VS_CONFIG_ERR_SENDMSG = 11, /*! send message failure */
63 L7VS_CONFIG_ERR_MAXVS_EXISTS = 12 /*! max service instance is exists */
67 * configulation command type
70 enum l7vs_config_command{
71 L7VS_CONFIG_LIST_VS, /*! virtual service list up */
72 L7VS_CONFIG_LIST_RS, /*! real server list up */
73 L7VS_CONFIG_ADD_VS, /*! virtual service add */
74 L7VS_CONFIG_ADD_RS, /*! real server add */
75 L7VS_CONFIG_DEL_VS, /*! virtual service delete */
76 L7VS_CONFIG_DEL_RS, /*! real server delete */
77 L7VS_CONFIG_EDIT_VS, /*! virtual service edit */
78 L7VS_CONFIG_EDIT_RS, /*! real server edit */
79 L7VS_CONFIG_FLUSH_VS, /*! virtual service flush */
80 L7VS_CONFIG_GET_REPLICATION_INFO, /*! get replication information */
81 L7VS_CONFIG_REPLICATION, /*! modify replication information */
82 L7VS_CONFIG_GET_LOG_INFO, /*! get log information */
83 L7VS_CONFIG_SET_LOG_LEVEL, /*! modify log information */
84 L7VS_CONFIG_SET_LOG_LEVEL_ALL, /*! modify log information */
85 L7VS_CONFIG_GET_SNMP_LOG_INFO, /*! get SNMP information */
86 L7VS_CONFIG_GET_SNMP_CONNECT_STATUS, /*! get SNMP information */
87 L7VS_CONFIG_SET_SNMP_LOG_LEVEL, /*! modify SNMP information */
88 L7VS_CONFIG_SET_SNMP_LOG_LEVEL_ALL, /*! get SNMP information(connect status)*/
89 L7VS_CONFIG_PARAMETER, /*! modify parameter */
90 L7VS_CONFIG_NONE /*! no config */
95 * config request for virtual service
97 struct l7vs_config_req_list_vs{
98 enum l7vs_config_command cmd; /*! request command */
102 * config request for real server
104 struct l7vs_config_req_list_rs{
105 enum l7vs_config_command cmd; /*! request command */
106 // service_arg follows
110 * config request for operation virtual service
112 struct l7vs_config_req_operate_vs{
113 enum l7vs_config_command cmd; /*! request command */
114 // service_arg follows
118 * config request for operation
120 struct l7vs_config_req_operate_rs{
121 enum l7vs_config_command cmd; /*! request comand */
122 struct l7vs_dest_arg darg; /*! real server data */
123 //service_arg follows
127 * config request for virtual service flash
129 struct l7vs_config_req_flush_vs{
130 enum l7vs_config_command cmd; /*! request command */
134 * config message for replication kind
136 enum REPLICATION_KIND_TAG{
137 L7VS_CONFIG_REPLICATION_DUMP=0, /*! replication dump */
138 L7VS_CONFIG_REPLICATION_START, /*! raplication start */
139 L7VS_CONFIG_REPLICATION_STOP, /*! replication stop */
140 L7VS_CONFIG_REPLICATION_COMPULSORILY /*! compulsion replication */
144 * config message for replication
146 struct l7vs_config_msg_replication{
147 enum l7vs_config_command cmd; /*! request command */
148 int code; /*! error code number */
149 enum REPLICATION_KIND_TAG kind; /*! replication action */
150 enum REPLICATION_MODE_TAG replication_mode; /*! replication mode */
155 * config message for log
157 struct l7vs_config_msg_log{
158 enum l7vs_config_command cmd; /* request command */
159 int code; /* error code number */
160 LOG_CATEGORY_TAG kind; /* kind of log action */
161 LOG_LEVEL_TAG vsd_log_level; /* log category of network */
165 * config message for SNMP
167 struct l7vs_config_msg_snmp{
168 enum l7vs_config_command cmd; /* request command */
169 int code; /* error code number */
170 enum LOG_CATEGORY_TAG kind; /* kind of action */
171 enum LOG_LEVEL_TAG snmp_log_level; /* SNMP Loglevel */
172 int connection_status; /* connection information */
176 * config message for parameter
178 struct l7vs_config_msg_parameter{
179 enum l7vs_config_command cmd; /* request command */
180 int code; /* error code number */
181 enum PARAMETER_COMPONENT_TAG category; /* parameter category */
185 * config request union.
186 * this union is extend class like.
187 * but, memory management is not.
189 union l7vs_config_req{
190 enum l7vs_config_command cmd;
191 struct l7vs_config_req_list_vs list_vs;
192 struct l7vs_config_req_list_rs list_rs;
193 struct l7vs_config_req_operate_vs operate_vs;
194 struct l7vs_config_req_operate_rs operate_rs;
195 struct l7vs_config_req_flush_vs flush_vs;
196 struct l7vs_config_msg_replication msg_replication;
197 struct l7vs_config_msg_log msg_log;
198 struct l7vs_config_msg_snmp msg_snmp;
199 struct l7vs_config_msg_parameter msg_parameter;
205 * config response list virtual service
207 struct l7vs_config_rsp_list_vs{
208 enum l7vs_config_command cmd; /*! response command */
209 int code; /*! virtual service code */
210 int num; /*! number */
211 // number of "num" l7vs_service_arg follow
215 * config response list real server
217 struct l7vs_config_rsp_list_rs{
218 enum l7vs_config_command cmd; /*! response command */
219 int code; /*! real server code */
220 int num; /*! number */
221 //number of "num" l7vs_dest_args_follow
225 * config response operation virual service
227 struct l7vs_config_rsp_operate_vs {
228 enum l7vs_config_command cmd; /*! response commnad */
229 int code; /*! response code */
233 * config response operation real server
235 struct l7vs_config_rsp_operate_rs {
236 enum l7vs_config_command cmd; /*! response command */
237 int code; /*! response code */
241 * config response flush virtual service
243 struct l7vs_config_rsp_flush_vs{
244 enum l7vs_config_command cmd; /*! response command */
245 int code; /*! response code */
249 * config unknown command response
251 struct l7vs_config_rsp_unknown_cmd{
252 enum l7vs_config_command cmd; /*! response command */
253 int code; /*! response code */
261 * configration module initialize function.
262 * @return success return is 0, else error code
264 extern int l7vs_config_init();
268 * configuration module finalize function.
270 extern void l7vs_config_fini();
272 #endif //L7VS_CONFIG_H