OSDN Git Service

Update INSTALL.ja.utf-8 for new release.
[ultramonkey-l7/ultramonkey-l7-v2.git] / include / l7vs_config.h
1  /*!
2  * @file        l7vs_config.h
3  * @brief       configulation module header file.
4  * @auther      nakai norihisa
5  *
6  * L7VSD: Linux Virtual Server for Layer7 Load Balancing
7  * Copyright (C) 2005  NTT COMWARE Corporation.
8  *
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.
13  *
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.
18  *
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
22  * 02110-1301 USA
23  *
24  **********************************************************************/
25 #ifndef L7VS_CONFIG_H
26 #define L7VS_CONFIG_H
27
28 #include "logger_wrapper.h"
29 #include "parameter_wrapper.h"
30 #include "l7vs_replication.h"
31 #include "l7vs_snmpbridge.h"
32
33 #include "l7vs_dest.h"
34
35
36 /*!
37  *      config socket file path
38  */
39 #ifndef L7VS_CONFIG_SOCK_PATH
40         #define L7VS_CONFIG_SOCK_PATH   "/var/run/l7vs"
41 #endif
42 #define L7VS_CONFIG_SOCKNAME            L7VS_CONFIG_SOCK_PATH "/l7vs"
43
44
45
46 /*!
47  *      configulation module error type
48  *
49  */
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 */
64 };
65
66 /*!
67  * configulation command type
68  *
69  */
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                           */
91 };
92
93
94 /*!
95  *      config request for virtual service
96  */
97 struct  l7vs_config_req_list_vs{
98         enum l7vs_config_command        cmd;            /*! request command             */
99 };
100
101 /*!
102  *      config request for real server 
103  */
104 struct  l7vs_config_req_list_rs{
105         enum l7vs_config_command        cmd;            /*! request command             */
106         // service_arg follows
107 };
108
109 /*!
110  *      config request for operation virtual service
111  */
112 struct  l7vs_config_req_operate_vs{
113         enum l7vs_config_command        cmd;            /*! request command             */
114         // service_arg follows
115 };
116
117 /*!
118  *      config request for operation 
119  */
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
124 };
125
126 /*!
127  *      config request for virtual service flash
128  */
129 struct  l7vs_config_req_flush_vs{
130         enum l7vs_config_command        cmd;            /*!     request command         */
131 };      
132
133 /*!
134  *      config message for replication kind
135  */
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 */
141 };
142
143 /*!
144  *      config message for replication
145  */
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     */
151 };
152
153
154 /*!
155  *      config message for log
156  */
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               */
162 };
163
164 /*!
165  *      config message for SNMP
166  */
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               */
173 };
174
175 /*!
176  *      config message for parameter
177  */
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                    */
182 };
183
184 /*!
185  *      config request union.
186  *      this union is extend class like.
187  *      but, memory management is not.
188  */
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;
200         char    _buf[2048];     
201 };
202
203
204 /*!
205  *      config response list virtual service
206  */
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
212 };
213
214 /*!
215  *      config response list real server
216  */
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
222 };
223
224 /*!
225  *      config response operation virual service
226  */
227 struct  l7vs_config_rsp_operate_vs {
228         enum l7vs_config_command        cmd;            /*! response commnad            */
229         int                             code;           /*! response code               */
230 };
231
232 /*!
233  *      config response operation real server
234  */
235 struct  l7vs_config_rsp_operate_rs {
236         enum l7vs_config_command        cmd;            /*! response command            */
237         int                             code;           /*! response code               */
238 };
239
240 /*!
241  *      config response flush virtual service
242  */
243 struct  l7vs_config_rsp_flush_vs{
244         enum l7vs_config_command        cmd;            /*! response command            */
245         int                             code;           /*! response code               */
246 };
247
248  /*!
249   *     config unknown command response
250   */
251 struct  l7vs_config_rsp_unknown_cmd{
252         enum l7vs_config_command        cmd;            /*! response command            */
253         int                             code;           /*! response code               */
254 };
255
256 //
257 // functions
258 //
259
260 /*! l7vs_config_init
261  *      configration module initialize function.
262  *      @return         success return is 0, else error code
263  */
264 extern  int     l7vs_config_init();
265
266 /*!
267  *      l7vs_config_fini()
268  *      configuration module finalize function.
269  */
270 extern  void    l7vs_config_fini();
271
272 #endif  //L7VS_CONFIG_H