- all module migrated to the changes in the module_export
- some syncronizations fixes in the MI functions in imc module
- new module ported to the new MI - flatstore and pdt
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@1165 689a6050-402a-0410-94f2-e92a70836424
... | ... |
@@ -241,6 +241,7 @@ struct module_exports exports= { |
241 | 241 |
cmds, /* exported functions */ |
242 | 242 |
params, /* exported params */ |
243 | 243 |
0, /* exported statistics */ |
244 |
+ 0, /* exported MI functions */ |
|
244 | 245 |
mod_init, /* initialization module */ |
245 | 246 |
0, /* response function */ |
246 | 247 |
destroy, /* destroy function */ |
... | ... |
@@ -99,6 +99,7 @@ struct module_exports exports = { |
99 | 99 |
cmds, /* Exported functions */ |
100 | 100 |
params, /* Exported parameters */ |
101 | 101 |
0, /* exported statistics */ |
102 |
+ 0, /* exported MI functions */ |
|
102 | 103 |
mod_init, /* module initialization function */ |
103 | 104 |
0, /* response function */ |
104 | 105 |
destroy, /* destroy function */ |
... | ... |
@@ -146,6 +146,7 @@ struct module_exports exports = { |
146 | 146 |
cmds, /* Exported functions */ |
147 | 147 |
params, /* Exported parameters */ |
148 | 148 |
0, /* exported statistics */ |
149 |
+ 0, /* exported MI functions */ |
|
149 | 150 |
mod_init, /* module initialization function */ |
150 | 151 |
0, /* response function */ |
151 | 152 |
destroy, /* destroy function */ |
... | ... |
@@ -100,14 +100,15 @@ static param_export_t params[] = { |
100 | 100 |
* Module interface |
101 | 101 |
*/ |
102 | 102 |
struct module_exports exports = { |
103 |
- "auth_diameter", |
|
104 |
- cmds, /* Exported functions */ |
|
105 |
- params, /* Exported parameters */ |
|
106 |
- 0, /* exported statistics */ |
|
107 |
- mod_init, /* module initialization function */ |
|
108 |
- 0, /* response function */ |
|
109 |
- 0, /* destroy function */ |
|
110 |
- mod_child_init /* child initialization function */ |
|
103 |
+ "auth_diameter", |
|
104 |
+ cmds, /* Exported functions */ |
|
105 |
+ params, /* Exported parameters */ |
|
106 |
+ 0, /* exported statistics */ |
|
107 |
+ 0, /* exported MI functions */ |
|
108 |
+ mod_init, /* module initialization function */ |
|
109 |
+ 0, /* response function */ |
|
110 |
+ 0, /* destroy function */ |
|
111 |
+ mod_child_init /* child initialization function */ |
|
111 | 112 |
}; |
112 | 113 |
|
113 | 114 |
|
... | ... |
@@ -94,6 +94,7 @@ struct module_exports exports = { |
94 | 94 |
cmds, /* Exported functions */ |
95 | 95 |
params, /* Exported parameters */ |
96 | 96 |
0, /* exported statistics */ |
97 |
+ 0, /* exported MI functions */ |
|
97 | 98 |
mod_init, /* module initialization function */ |
98 | 99 |
0, /* response function */ |
99 | 100 |
0, /* destroy function */ |
... | ... |
@@ -98,6 +98,7 @@ struct module_exports exports = { |
98 | 98 |
cmds, /* Exported commands */ |
99 | 99 |
params, /* Exported parameters */ |
100 | 100 |
0, /* exported statistics */ |
101 |
+ 0, /* exported MI functions */ |
|
101 | 102 |
mod_init, /* module initialization function */ |
102 | 103 |
0, /* response function*/ |
103 | 104 |
0, /* destroy function */ |
... | ... |
@@ -152,10 +152,11 @@ static param_export_t params[] = { |
152 | 152 |
|
153 | 153 |
struct module_exports exports = { |
154 | 154 |
"avpops", |
155 |
- cmds, /* Exported functions */ |
|
156 |
- params, /* Exported parameters */ |
|
155 |
+ cmds, /* Exported functions */ |
|
156 |
+ params, /* Exported parameters */ |
|
157 | 157 |
0, /* exported statistics */ |
158 |
- avpops_init, /* Module initialization function */ |
|
158 |
+ 0, /* exported MI functions */ |
|
159 |
+ avpops_init,/* Module initialization function */ |
|
159 | 160 |
(response_function) 0, |
160 | 161 |
(destroy_function) 0, |
161 | 162 |
(child_init_function) avpops_child_init /* per-child init function */ |
... | ... |
@@ -107,6 +107,7 @@ static int w_process_register_norpl(struct sip_msg* msg, char* str,char* str2); |
107 | 107 |
static int cpl_process_register(struct sip_msg* msg, int no_rpl); |
108 | 108 |
static int fixup_cpl_run_script(void** param, int param_no); |
109 | 109 |
static int cpl_init(void); |
110 |
+static int mi_child_init(); |
|
110 | 111 |
static int cpl_child_init(int rank); |
111 | 112 |
static int cpl_exit(void); |
112 | 113 |
|
... | ... |
@@ -115,12 +116,12 @@ static int cpl_exit(void); |
115 | 116 |
* Exported functions |
116 | 117 |
*/ |
117 | 118 |
static cmd_export_t cmds[] = { |
118 |
- {"cpl_run_script", cpl_invoke_script, 2, fixup_cpl_run_script, |
|
119 |
- REQUEST_ROUTE}, |
|
120 |
- {"cpl_process_register", w_process_register, 0, 0, |
|
121 |
- REQUEST_ROUTE}, |
|
122 |
- {"cpl_process_register_norpl",w_process_register_norpl,0,0, |
|
123 |
- REQUEST_ROUTE}, |
|
119 |
+ {"cpl_run_script", cpl_invoke_script, 2, |
|
120 |
+ fixup_cpl_run_script, REQUEST_ROUTE}, |
|
121 |
+ {"cpl_process_register", w_process_register, 0, |
|
122 |
+ 0, REQUEST_ROUTE}, |
|
123 |
+ {"cpl_process_register_norpl",w_process_register_norpl, 0, |
|
124 |
+ 0, REQUEST_ROUTE}, |
|
124 | 125 |
{0, 0, 0, 0, 0} |
125 | 126 |
}; |
126 | 127 |
|
... | ... |
@@ -150,11 +151,25 @@ static param_export_t params[] = { |
150 | 151 |
}; |
151 | 152 |
|
152 | 153 |
|
154 |
+/* |
|
155 |
+ * Exported MI functions |
|
156 |
+ */ |
|
157 |
+static mi_export_t mi_cmds[] = { |
|
158 |
+ { "LOAD_CPL", mi_cpl_load, 0, mi_child_init }, |
|
159 |
+ { "REMOVE_CPL", mi_cpl_remove, 0, 0 }, |
|
160 |
+ { "GET_CPL", mi_cpl_get, 0, 0 }, |
|
161 |
+ { 0, 0, 0, 0} |
|
162 |
+}; |
|
163 |
+ |
|
164 |
+ |
|
165 |
+ |
|
166 |
+ |
|
153 | 167 |
struct module_exports exports = { |
154 | 168 |
"cpl-c", |
155 | 169 |
cmds, /* Exported functions */ |
156 | 170 |
params, /* Exported parameters */ |
157 | 171 |
0, /* exported statistics */ |
172 |
+ mi_cmds, /* exported MI functions */ |
|
158 | 173 |
cpl_init, /* Module initialization function */ |
159 | 174 |
(response_function) 0, |
160 | 175 |
(destroy_function) cpl_exit, |
... | ... |
@@ -347,20 +362,6 @@ static int cpl_init(void) |
347 | 362 |
goto error; |
348 | 363 |
} |
349 | 364 |
|
350 |
- /* register MI commands */ |
|
351 |
- if (register_mi_cmd( mi_cpl_load, "LOAD_CPL", 0)!=0) { |
|
352 |
- LOG(L_ERR,"ERROR:cpl_init: failed to register MI command\n"); |
|
353 |
- goto error; |
|
354 |
- } |
|
355 |
- if (register_mi_cmd( mi_cpl_load, "REMOVE_CPL", 0)!=0) { |
|
356 |
- LOG(L_ERR,"ERROR:cpl_init: failed to register MI command\n"); |
|
357 |
- goto error; |
|
358 |
- } |
|
359 |
- if (register_mi_cmd( mi_cpl_load, "GET_CPL", 0)!=0) { |
|
360 |
- LOG(L_ERR,"ERROR:cpl_init: failed to register MI command\n"); |
|
361 |
- goto error; |
|
362 |
- } |
|
363 |
- |
|
364 | 365 |
/* build a pipe for sending commands to aux process */ |
365 | 366 |
if ( pipe( cpl_env.cmd_pipe )==-1 ) { |
366 | 367 |
LOG(L_CRIT,"ERROR:cpl_init: cannot create command pipe: %s!\n", |
... | ... |
@@ -414,8 +415,8 @@ static int cpl_child_init(int rank) |
414 | 415 |
{ |
415 | 416 |
pid_t pid; |
416 | 417 |
|
417 |
- /* don't do anything for main process and TCP manager process */ |
|
418 |
- if (rank==PROC_MAIN || rank==PROC_TCP_MAIN) |
|
418 |
+ /* don't do anything for non-worker process */ |
|
419 |
+ if (rank<1 && rank!=PROC_FIFO) |
|
419 | 420 |
return 0; |
420 | 421 |
|
421 | 422 |
/* only child 1 will fork the aux process */ |
... | ... |
@@ -442,6 +443,11 @@ error: |
442 | 443 |
} |
443 | 444 |
|
444 | 445 |
|
446 |
+static int mi_child_init() |
|
447 |
+{ |
|
448 |
+ return cpl_db_init(DB_URL, DB_TABLE); |
|
449 |
+} |
|
450 |
+ |
|
445 | 451 |
|
446 | 452 |
static int cpl_exit(void) |
447 | 453 |
{ |
... | ... |
@@ -71,7 +71,8 @@ struct module_exports exports = { |
71 | 71 |
"dbtext", |
72 | 72 |
cmds, /* Exported functions */ |
73 | 73 |
params, /* Exported parameters */ |
74 |
- 0, /* exported statistics */ |
|
74 |
+ 0, /* exported statistics */ |
|
75 |
+ 0, /* exported MI functions */ |
|
75 | 76 |
mod_init, /* module initialization function */ |
76 | 77 |
0, /* response function*/ |
77 | 78 |
destroy, /* destroy function */ |
... | ... |
@@ -100,12 +100,18 @@ static stat_export_t mod_stats[] = { |
100 | 100 |
}; |
101 | 101 |
|
102 | 102 |
|
103 |
+static mi_export_t mi_cmds[] = { |
|
104 |
+ { "dlg_list", mi_print_dlgs, 0, 0}, |
|
105 |
+ { 0, 0, 0, 0} |
|
106 |
+}; |
|
107 |
+ |
|
103 | 108 |
|
104 | 109 |
struct module_exports exports= { |
105 | 110 |
"dialog", /* module's name */ |
106 | 111 |
cmds, /* exported functions */ |
107 | 112 |
mod_params, /* param exports */ |
108 | 113 |
mod_stats, /* exported statistics */ |
114 |
+ mi_cmds, /* exported MI functions */ |
|
109 | 115 |
mod_init, /* module initialization function */ |
110 | 116 |
0, /* reply processing function */ |
111 | 117 |
mod_destroy, |
... | ... |
@@ -257,11 +263,6 @@ static int mod_init(void) |
257 | 263 |
return -1; |
258 | 264 |
} |
259 | 265 |
|
260 |
- if ( register_mi_cmd( mi_print_dlgs, "dlg_list",0)<0 ) { |
|
261 |
- LOG(L_ERR,"ERROR:dialog:mod_init: failed to register MI\n"); |
|
262 |
- return -1; |
|
263 |
- } |
|
264 |
- |
|
265 | 266 |
if(xl_add_extra("dlg_count", it_get_dlg_count, 100, 0 )!=0) { |
266 | 267 |
LOG(L_ERR,"ERROR:dialog:mod_init: failed to register pvar " |
267 | 268 |
"[dlg_no]\n"); |
... | ... |
@@ -99,12 +99,20 @@ static param_export_t params[]={ |
99 | 99 |
}; |
100 | 100 |
|
101 | 101 |
|
102 |
+static mi_export_t mi_cmds[] = { |
|
103 |
+ { "ds_set_state", ds_mi_set, 0, 0 }, |
|
104 |
+ { "ds_list", ds_mi_list, 0, 0 }, |
|
105 |
+ { 0, 0, 0, 0} |
|
106 |
+}; |
|
107 |
+ |
|
108 |
+ |
|
102 | 109 |
/** module exports */ |
103 | 110 |
struct module_exports exports= { |
104 | 111 |
"dispatcher", |
105 | 112 |
cmds, |
106 | 113 |
params, |
107 | 114 |
0, /* exported statistics */ |
115 |
+ mi_cmds, /* exported MI functions */ |
|
108 | 116 |
mod_init, /* module initialization function */ |
109 | 117 |
(response_function) 0, |
110 | 118 |
(destroy_function) destroy, |
... | ... |
@@ -132,20 +140,6 @@ static int mod_init(void) |
132 | 140 |
return -1; |
133 | 141 |
} |
134 | 142 |
|
135 |
- if(register_mi_cmd(ds_mi_set, "ds_set_state", 0)<0) |
|
136 |
- { |
|
137 |
- LOG(L_ERR, |
|
138 |
- "DISPATCHER:mod_init:ERROR: cannot register MI command!\n"); |
|
139 |
- return -1; |
|
140 |
- } |
|
141 |
- |
|
142 |
- if(register_mi_cmd(ds_mi_list, "ds_list", 0)<0) |
|
143 |
- { |
|
144 |
- LOG(L_ERR, |
|
145 |
- "DISPATCHER:mod_init:ERROR: cannot register MI command!!\n"); |
|
146 |
- return -1; |
|
147 |
- } |
|
148 |
- |
|
149 | 143 |
if(ds_load_list(dslistfile)!=0) |
150 | 144 |
{ |
151 | 145 |
LOG(L_ERR, "DISPATCHER:mod_init:ERROR -- couldn't load list file\n"); |
... | ... |
@@ -83,6 +83,7 @@ struct module_exports exports = { |
83 | 83 |
cmds, /* Exported functions */ |
84 | 84 |
params, /* Exported parameters */ |
85 | 85 |
0, /* exported statistics */ |
86 |
+ 0, /* exported MI functions */ |
|
86 | 87 |
mod_init, /* module initialization function */ |
87 | 88 |
0, /* response function */ |
88 | 89 |
0, /* destroy function */ |
... | ... |
@@ -52,6 +52,7 @@ |
52 | 52 |
static int mod_init(void); |
53 | 53 |
static void destroy(void); |
54 | 54 |
static int child_init(int rank); |
55 |
+static int mi_child_init(); |
|
55 | 56 |
static int parameter_fixup(void** param, int param_no); |
56 | 57 |
|
57 | 58 |
MODULE_VERSION |
... | ... |
@@ -111,6 +112,16 @@ static param_export_t params[] = { |
111 | 112 |
}; |
112 | 113 |
|
113 | 114 |
|
115 |
+/* |
|
116 |
+ * Exported MI functions |
|
117 |
+ */ |
|
118 |
+static mi_export_t mi_cmds[] = { |
|
119 |
+ { MI_DOMAIN_RELOAD, mi_domain_reload, 0, mi_child_init }, |
|
120 |
+ { MI_DOMAIN_DUMP, mi_domain_dump, 0, 0 }, |
|
121 |
+ { 0, 0, 0, 0} |
|
122 |
+}; |
|
123 |
+ |
|
124 |
+ |
|
114 | 125 |
/* |
115 | 126 |
* Module interface |
116 | 127 |
*/ |
... | ... |
@@ -119,6 +130,7 @@ struct module_exports exports = { |
119 | 130 |
cmds, /* Exported functions */ |
120 | 131 |
params, /* Exported parameters */ |
121 | 132 |
0, /* exported statistics */ |
133 |
+ mi_cmds, /* exported MI functions */ |
|
122 | 134 |
mod_init, /* module initialization function */ |
123 | 135 |
0, /* response function*/ |
124 | 136 |
destroy, /* destroy function */ |
... | ... |
@@ -157,9 +169,6 @@ static int mod_init(void) |
157 | 169 |
/* Initialize fifo interface */ |
158 | 170 |
(void)init_domain_fifo(); |
159 | 171 |
|
160 |
- /* Initialize MI interface */ |
|
161 |
- (void)init_domain_mi(); |
|
162 |
- |
|
163 | 172 |
if (init_domain_unixsock() < 0) { |
164 | 173 |
LOG(L_ERR, "ERROR: domain:mod_init(): error while initializing" |
165 | 174 |
" unix socket interface\n"); |
... | ... |
@@ -220,6 +229,12 @@ static int child_init(int rank) |
220 | 229 |
} |
221 | 230 |
|
222 | 231 |
|
232 |
+static int mi_child_init() |
|
233 |
+{ |
|
234 |
+ return domain_db_init(db_url.s); |
|
235 |
+} |
|
236 |
+ |
|
237 |
+ |
|
223 | 238 |
static void destroy(void) |
224 | 239 |
{ |
225 | 240 |
/* Destroy is called from the main process only, |
... | ... |
@@ -29,7 +29,6 @@ |
29 | 29 |
|
30 | 30 |
#include "../../dprint.h" |
31 | 31 |
#include "../../db/db.h" |
32 |
-#include "../../mi/mi.h" |
|
33 | 32 |
#include "domain_mod.h" |
34 | 33 |
#include "domain.h" |
35 | 34 |
#include "hash.h" |
... | ... |
@@ -39,7 +38,7 @@ |
39 | 38 |
/* |
40 | 39 |
* MI function to reload domain table |
41 | 40 |
*/ |
42 |
-static struct mi_node* mi_domain_reload(struct mi_node *cmd, void *param) |
|
41 |
+struct mi_node* mi_domain_reload(struct mi_node *cmd, void *param) |
|
43 | 42 |
{ |
44 | 43 |
if (reload_domain_table () == 1) { |
45 | 44 |
return init_mi_tree(MI_200_OK_S, MI_200_OK_LEN); |
... | ... |
@@ -52,7 +51,7 @@ static struct mi_node* mi_domain_reload(struct mi_node *cmd, void *param) |
52 | 51 |
/* |
53 | 52 |
* MI function to print domains from current hash table |
54 | 53 |
*/ |
55 |
-static struct mi_node* mi_domain_dump(struct mi_node *cmd, void *param) |
|
54 |
+struct mi_node* mi_domain_dump(struct mi_node *cmd, void *param) |
|
56 | 55 |
{ |
57 | 56 |
struct mi_node* rpl; |
58 | 57 |
|
... | ... |
@@ -69,22 +68,3 @@ static struct mi_node* mi_domain_dump(struct mi_node *cmd, void *param) |
69 | 68 |
|
70 | 69 |
return rpl; |
71 | 70 |
} |
72 |
- |
|
73 |
- |
|
74 |
-/* |
|
75 |
- * Register domain MI functions |
|
76 |
- */ |
|
77 |
-int init_domain_mi( void ) |
|
78 |
-{ |
|
79 |
- if (register_mi_cmd(mi_domain_reload, MI_DOMAIN_RELOAD, 0) < 0) { |
|
80 |
- LOG(L_CRIT, "Cannot register %s\n",MI_DOMAIN_RELOAD); |
|
81 |
- return -1; |
|
82 |
- } |
|
83 |
- |
|
84 |
- if (register_mi_cmd(mi_domain_dump, MI_DOMAIN_DUMP, 0) < 0) { |
|
85 |
- LOG(L_CRIT, "Cannot register %s\n",MI_DOMAIN_DUMP); |
|
86 |
- return -1; |
|
87 |
- } |
|
88 |
- |
|
89 |
- return 1; |
|
90 |
-} |
... | ... |
@@ -26,9 +26,15 @@ |
26 | 26 |
#ifndef _DOMAIN_MI_H_ |
27 | 27 |
#define _DOMAIN_MI_H_ |
28 | 28 |
|
29 |
+#include "../../mi/mi.h" |
|
30 |
+ |
|
29 | 31 |
#define MI_DOMAIN_RELOAD "domain_reload" |
30 | 32 |
#define MI_DOMAIN_DUMP "domain_dump" |
31 | 33 |
|
32 |
-int init_domain_mi( void ); |
|
34 |
+ |
|
35 |
+struct mi_node* mi_domain_reload(struct mi_node *cmd, void *param); |
|
36 |
+ |
|
37 |
+struct mi_node* mi_domain_dump(struct mi_node *cmd, void *param); |
|
38 |
+ |
|
33 | 39 |
|
34 | 40 |
#endif |
... | ... |
@@ -101,6 +101,7 @@ struct module_exports exports = { |
101 | 101 |
cmds, /* Exported functions */ |
102 | 102 |
params, /* Exported parameters */ |
103 | 103 |
0, /* exported statistics */ |
104 |
+ 0, /* exported MI functions */ |
|
104 | 105 |
mod_init, /* module initialization function */ |
105 | 106 |
0, /* response function*/ |
106 | 107 |
0, /* destroy function */ |
... | ... |
@@ -83,6 +83,7 @@ struct module_exports exports= { |
83 | 83 |
cmds, /* Exported functions */ |
84 | 84 |
params, /* Exported parameters */ |
85 | 85 |
0, /* exported statistics */ |
86 |
+ 0, /* exported MI functions */ |
|
86 | 87 |
mod_init, /* initialization module */ |
87 | 88 |
0, /* response function */ |
88 | 89 |
exec_shutdown, /* destroy function */ |
89 | 90 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,40 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Flatstore module MI interface |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2006 Voice Sistem SRL |
|
7 |
+ * |
|
8 |
+ * This file is part of openser, a free SIP server. |
|
9 |
+ * |
|
10 |
+ * openser is free software; you can redistribute it and/or modify |
|
11 |
+ * it under the terms of the GNU General Public License as published by |
|
12 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
13 |
+ * (at your option) any later version |
|
14 |
+ * |
|
15 |
+ * openser is distributed in the hope that it will be useful, |
|
16 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
+ * GNU General Public License for more details. |
|
19 |
+ * |
|
20 |
+ * You should have received a copy of the GNU General Public License |
|
21 |
+ * along with this program; if not, write to the Free Software |
|
22 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+#include "flatstore_mod.h" |
|
26 |
+#include "flat_mi.h" |
|
27 |
+ |
|
28 |
+ |
|
29 |
+struct mi_node* mi_flat_rotate_cmd(struct mi_node* cmd, void* param) |
|
30 |
+{ |
|
31 |
+ struct mi_node *rpl; |
|
32 |
+ |
|
33 |
+ rpl = init_mi_tree(MI_200_OK_S, MI_200_OK_LEN); |
|
34 |
+ if(rpl == NULL) |
|
35 |
+ return rpl; |
|
36 |
+ |
|
37 |
+ *flat_rotate = time(0); |
|
38 |
+ |
|
39 |
+ return rpl; |
|
40 |
+} |
0 | 41 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,35 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Flatstore module MI interface |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2006 Voice Sistem RL |
|
7 |
+ * |
|
8 |
+ * This file is part of openser, a free SIP server. |
|
9 |
+ * |
|
10 |
+ * openser is free software; you can redistribute it and/or modify |
|
11 |
+ * it under the terms of the GNU General Public License as published by |
|
12 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
13 |
+ * (at your option) any later version |
|
14 |
+ * |
|
15 |
+ * openser is distributed in the hope that it will be useful, |
|
16 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
+ * GNU General Public License for more details. |
|
19 |
+ * |
|
20 |
+ * You should have received a copy of the GNU General Public License |
|
21 |
+ * along with this program; if not, write to the Free Software |
|
22 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
+ */ |
|
24 |
+ |
|
25 |
+#ifndef _FLATSTORE_MI_H_ |
|
26 |
+#define _FLATSTORE_MI_H_ |
|
27 |
+ |
|
28 |
+#include "../../mi/mi.h" |
|
29 |
+ |
|
30 |
+#define MI_FLAT_ROTATE "flat_rotate" |
|
31 |
+ |
|
32 |
+struct mi_node* mi_flat_rotate_cmd(struct mi_node* cmd, void* param); |
|
33 |
+ |
|
34 |
+#endif /* _FLATSTORE_MI_H_ */ |
|
35 |
+ |
... | ... |
@@ -31,6 +31,7 @@ |
31 | 31 |
#include "../../mem/shm_mem.h" |
32 | 32 |
#include "flatstore.h" |
33 | 33 |
#include "flat_fifo.h" |
34 |
+#include "flat_mi.h" |
|
34 | 35 |
#include "flatstore_mod.h" |
35 | 36 |
|
36 | 37 |
MODULE_VERSION |
... | ... |
@@ -63,7 +64,7 @@ char* flat_delimiter = "|"; |
63 | 64 |
* Timestamp of the last log rotation request from |
64 | 65 |
* the FIFO interface |
65 | 66 |
*/ |
66 |
-time_t* flat_rotate; |
|
67 |
+time_t* flat_rotate; |
|
67 | 68 |
|
68 | 69 |
time_t local_timestamp; |
69 | 70 |
|
... | ... |
@@ -88,11 +89,20 @@ static param_export_t params[] = { |
88 | 89 |
}; |
89 | 90 |
|
90 | 91 |
|
91 |
-struct module_exports exports = { |
|
92 |
+/* |
|
93 |
+ * Exported parameters |
|
94 |
+ */ |
|
95 |
+static mi_export_t mi_cmds[] = { |
|
96 |
+ { MI_FLAT_ROTATE, mi_flat_rotate_cmd, 0, 0 }, |
|
97 |
+ { 0, 0, 0, 0} |
|
98 |
+}; |
|
99 |
+ |
|
100 |
+struct module_exports exports = { |
|
92 | 101 |
"flatstore", |
93 | 102 |
cmds, |
94 | 103 |
params, /* module parameters */ |
95 | 104 |
0, /* exported statistics */ |
105 |
+ mi_cmds, /* exported MI functions */ |
|
96 | 106 |
mod_init, /* module initialization function */ |
97 | 107 |
0, /* response function*/ |
98 | 108 |
mod_destroy, /* destroy function */ |
... | ... |
@@ -68,6 +68,11 @@ static int set_gflag(struct sip_msg*, char *, char *); |
68 | 68 |
static int reset_gflag(struct sip_msg*, char *, char *); |
69 | 69 |
static int is_gflag(struct sip_msg*, char *, char *); |
70 | 70 |
|
71 |
+static struct mi_node* mi_set_gflag(struct mi_node* cmd, void* param ); |
|
72 |
+static struct mi_node* mi_reset_gflag(struct mi_node* cmd, void* param ); |
|
73 |
+static struct mi_node* mi_is_gflag(struct mi_node* cmd, void* param ); |
|
74 |
+static struct mi_node* mi_get_gflags(struct mi_node* cmd, void* param ); |
|
75 |
+ |
|
71 | 76 |
static int fixup_str2int( void** param, int param_no); |
72 | 77 |
|
73 | 78 |
static int mod_init(void); |
... | ... |
@@ -86,16 +91,25 @@ static cmd_export_t cmds[]={ |
86 | 91 |
{0, 0, 0, 0, 0} |
87 | 92 |
}; |
88 | 93 |
|
89 |
-static param_export_t params[]={ |
|
94 |
+static param_export_t params[]={ |
|
90 | 95 |
{"initial", INT_PARAM, &initial}, |
91 | 96 |
{0,0,0} |
92 | 97 |
}; |
93 | 98 |
|
99 |
+static mi_export_t mi_cmds[] = { |
|
100 |
+ { FIFO_SET_GFLAG, mi_set_gflag, 0, 0 }, |
|
101 |
+ { FIFO_RESET_GFLAG, mi_reset_gflag, 0, 0 }, |
|
102 |
+ { FIFO_IS_GFLAG, mi_is_gflag, 0, 0 }, |
|
103 |
+ { FIFO_GET_GFLAGS, mi_get_gflags, 0, 0 }, |
|
104 |
+ { 0, 0, 0, 0} |
|
105 |
+}; |
|
106 |
+ |
|
94 | 107 |
struct module_exports exports = { |
95 | 108 |
"gflags", |
96 | 109 |
cmds, /* exported functions */ |
97 | 110 |
params, /* exported parameters */ |
98 | 111 |
0, /* exported statistics */ |
112 |
+ mi_cmds, /* exported MI functions */ |
|
99 | 113 |
mod_init, /* module initialization function */ |
100 | 114 |
0, /* response function*/ |
101 | 115 |
mod_destroy, /* destroy function */ |
... | ... |
@@ -289,7 +303,7 @@ error: |
289 | 303 |
|
290 | 304 |
|
291 | 305 |
|
292 |
-struct mi_node* mi_reset_gflag(struct mi_node* cmd, void* param ) |
|
306 |
+static struct mi_node* mi_reset_gflag(struct mi_node* cmd, void* param ) |
|
293 | 307 |
{ |
294 | 308 |
unsigned int flag; |
295 | 309 |
struct mi_node* node = NULL; |
... | ... |
@@ -314,7 +328,7 @@ error: |
314 | 328 |
|
315 | 329 |
|
316 | 330 |
|
317 |
-struct mi_node* mi_is_gflag(struct mi_node* cmd, void* param ) |
|
331 |
+static struct mi_node* mi_is_gflag(struct mi_node* cmd, void* param ) |
|
318 | 332 |
{ |
319 | 333 |
unsigned int flag; |
320 | 334 |
struct mi_node* rpl= NULL; |
... | ... |
@@ -353,7 +367,7 @@ error_param: |
353 | 367 |
} |
354 | 368 |
|
355 | 369 |
|
356 |
-struct mi_node* mi_get_gflags(struct mi_node* cmd, void* param ) |
|
370 |
+static struct mi_node* mi_get_gflags(struct mi_node* cmd, void* param ) |
|
357 | 371 |
{ |
358 | 372 |
struct mi_node* rpl= NULL; |
359 | 373 |
struct mi_node* node= NULL; |
... | ... |
@@ -378,7 +392,6 @@ error: |
378 | 392 |
|
379 | 393 |
|
380 | 394 |
|
381 |
- |
|
382 | 395 |
static int mod_init(void) |
383 | 396 |
{ |
384 | 397 |
gflags=(unsigned int *) shm_malloc(sizeof(unsigned int)); |
... | ... |
@@ -404,23 +417,6 @@ static int mod_init(void) |
404 | 417 |
return -1; |
405 | 418 |
} |
406 | 419 |
|
407 |
- if (register_mi_cmd(mi_set_gflag, FIFO_SET_GFLAG, 0) < 0) { |
|
408 |
- LOG(L_CRIT, "Cannot register MI %s\n",FIFO_SET_GFLAG); |
|
409 |
- return -1; |
|
410 |
- } |
|
411 |
- if (register_mi_cmd(mi_reset_gflag, FIFO_RESET_GFLAG, 0) < 0) { |
|
412 |
- LOG(L_CRIT, "Cannot register MI %s\n",FIFO_RESET_GFLAG); |
|
413 |
- return -1; |
|
414 |
- } |
|
415 |
- if (register_mi_cmd(mi_is_gflag, FIFO_IS_GFLAG, 0) < 0) { |
|
416 |
- LOG(L_CRIT, "Cannot register MI %s\n",FIFO_SET_GFLAG); |
|
417 |
- return -1; |
|
418 |
- } |
|
419 |
- if (register_mi_cmd(mi_get_gflags, FIFO_GET_GFLAGS, 0) < 0) { |
|
420 |
- LOG(L_CRIT, "Cannot register MI %s\n",FIFO_SET_GFLAG); |
|
421 |
- return -1; |
|
422 |
- } |
|
423 |
- |
|
424 | 420 |
return 0; |
425 | 421 |
} |
426 | 422 |
|
... | ... |
@@ -157,6 +157,7 @@ struct module_exports exports = { |
157 | 157 |
cmds, /* Exported functions */ |
158 | 158 |
params, /* Exported parameters */ |
159 | 159 |
0, /* exported statistics */ |
160 |
+ 0, /* exported MI functions */ |
|
160 | 161 |
mod_init, /* module initialization function */ |
161 | 162 |
0, /* response function */ |
162 | 163 |
destroy, /* destroy function */ |
... | ... |
@@ -84,6 +84,7 @@ struct module_exports exports = { |
84 | 84 |
cmds, /* Exported functions */ |
85 | 85 |
params, /* Exported parameters */ |
86 | 86 |
0, /* exported statistics */ |
87 |
+ 0, /* exported MI functions */ |
|
87 | 88 |
mod_init, /* module initialization function */ |
88 | 89 |
0, /* response function */ |
89 | 90 |
0, /* destroy function */ |
... | ... |
@@ -91,8 +91,8 @@ static int imc_manager(struct sip_msg*, char *, char *); |
91 | 91 |
static int imc_list_rooms(FILE *stream, char *response_file); |
92 | 92 |
static int imc_list_members(FILE *stream, char *response_file); |
93 | 93 |
|
94 |
-struct mi_node* imc_mi_list_rooms(struct mi_node* cmd, void* param); |
|
95 |
-struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param); |
|
94 |
+static struct mi_node* imc_mi_list_rooms(struct mi_node* cmd, void* param); |
|
95 |
+static struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param); |
|
96 | 96 |
|
97 | 97 |
void destroy(void); |
98 | 98 |
int imc_list_randm(FILE *stream); |
... | ... |
@@ -102,7 +102,6 @@ int imc_list_members2(FILE* stream, imc_room_p room); |
102 | 102 |
struct tm_binds tmb; |
103 | 103 |
|
104 | 104 |
/** TM callback function */ |
105 |
-//static void imc_tm_callback( struct cell *t, int type, struct tmcb_params *ps); |
|
106 | 105 |
void inv_callback( struct cell *t, int type, struct tmcb_params *ps); |
107 | 106 |
|
108 | 107 |
static cmd_export_t cmds[]={ |
... | ... |
@@ -112,7 +111,7 @@ static cmd_export_t cmds[]={ |
112 | 111 |
|
113 | 112 |
|
114 | 113 |
static param_export_t params[]={ |
115 |
- { "db_url", STR_PARAM, &db_url.s}, |
|
114 |
+ {"db_url", STR_PARAM, &db_url.s}, |
|
116 | 115 |
{"hash_size", INT_PARAM, &imc_hash_size}, |
117 | 116 |
{"imc_cmd_start_char", STR_PARAM, &imc_cmd_start_str}, |
118 | 117 |
{0,0,0} |
... | ... |
@@ -130,10 +129,17 @@ stat_export_t imc_stats[] = { |
130 | 129 |
|
131 | 130 |
#endif |
132 | 131 |
|
132 |
+static mi_export_t mi_cmds[] = { |
|
133 |
+ { "imc_list_rooms", imc_mi_list_rooms, 0, 0 }, |
|
134 |
+ { "imc_list_members", imc_mi_list_members, 0, 0 }, |
|
135 |
+ { 0, 0, 0, 0} |
|
136 |
+}; |
|
137 |
+ |
|
138 |
+ |
|
133 | 139 |
|
134 | 140 |
/** module exports */ |
135 | 141 |
struct module_exports exports= { |
136 |
- "imc", /* module name */ |
|
142 |
+ "imc", /* module name */ |
|
137 | 143 |
cmds, /* exported commands */ |
138 | 144 |
params, /* exported parameters */ |
139 | 145 |
#ifdef STATISTICS |
... | ... |
@@ -141,6 +147,7 @@ struct module_exports exports= { |
141 | 147 |
#else |
142 | 148 |
0, /* exported statistics */ |
143 | 149 |
#endif |
150 |
+ mi_cmds, /* exported MI functions */ |
|
144 | 151 |
mod_init, /* mod init */ |
145 | 152 |
(response_function) 0, /* response handler */ |
146 | 153 |
(destroy_function) destroy, /* destroy function */ |
... | ... |
@@ -404,20 +411,6 @@ static int mod_init(void) |
404 | 411 |
return -1; |
405 | 412 |
} |
406 | 413 |
|
407 |
- if(register_mi_cmd(imc_mi_list_rooms, "imc_list_rooms", 0)<0) |
|
408 |
- { |
|
409 |
- LOG(L_ERR, "IMC:mod_init: error - unable to register MI cmd" |
|
410 |
- " 'imc_list_rooms'\n"); |
|
411 |
- return -1; |
|
412 |
- } |
|
413 |
- |
|
414 |
- if(register_mi_cmd(imc_mi_list_members, "imc_list_members", 0)<0) |
|
415 |
- { |
|
416 |
- LOG(L_ERR,"IMC:mod_init: error - unable to register MI cmd" |
|
417 |
- "'imc_list_members'\n"); |
|
418 |
- return -1; |
|
419 |
- } |
|
420 |
- |
|
421 | 414 |
if(imc_cmd_start_str) |
422 | 415 |
imc_cmd_start_char = imc_cmd_start_str[0]; |
423 | 416 |
|
... | ... |
@@ -1428,7 +1421,7 @@ void destroy(void) |
1428 | 1421 |
|
1429 | 1422 |
} |
1430 | 1423 |
|
1431 |
- imc_htable_destroy(); |
|
1424 |
+ imc_htable_destroy(); |
|
1432 | 1425 |
} |
1433 | 1426 |
|
1434 | 1427 |
int imc_list_randm(FILE *stream) |
... | ... |
@@ -1467,7 +1460,8 @@ int imc_list_members2(FILE* stream, imc_room_p room) |
1467 | 1460 |
while(member) |
1468 | 1461 |
{ |
1469 | 1462 |
DBG("Member: name= %.*s\ndomain= %.*s\nflag= %d\n",member->user.len, |
1470 |
- member->user.s, member->domain.len, member->domain.s, member->flags); |
|
1463 |
+ member->user.s, member->domain.len, member->domain.s, |
|
1464 |
+ member->flags); |
|
1471 | 1465 |
member = member->next; |
1472 | 1466 |
} |
1473 | 1467 |
|
... | ... |
@@ -1479,9 +1473,7 @@ int imc_list_rooms(FILE *stream, char *response_file){ |
1479 | 1473 |
int i; |
1480 | 1474 |
FILE *freply=NULL; |
1481 | 1475 |
imc_room_p irp = NULL; |
1482 |
- // irp_temp=NULL; |
|
1483 | 1476 |
|
1484 |
- |
|
1485 | 1477 |
freply = open_reply_pipe(response_file); |
1486 | 1478 |
if(freply==NULL) |
1487 | 1479 |
{ |
... | ... |
@@ -1489,7 +1481,7 @@ int imc_list_rooms(FILE *stream, char *response_file){ |
1489 | 1481 |
response_file); |
1490 | 1482 |
return -1; |
1491 | 1483 |
} |
1492 |
- |
|
1484 |
+ |
|
1493 | 1485 |
for(i=0; i<imc_hash_size; i++) |
1494 | 1486 |
{ |
1495 | 1487 |
irp = _imc_htable[i].rooms; |
... | ... |
@@ -1504,59 +1496,66 @@ int imc_list_rooms(FILE *stream, char *response_file){ |
1504 | 1496 |
if(freply!=NULL) |
1505 | 1497 |
fclose(freply); |
1506 | 1498 |
|
1507 |
- return 0; |
|
1508 |
- |
|
1499 |
+ return 0; |
|
1509 | 1500 |
} |
1510 |
-/************************* MI ***********************/ |
|
1511 |
-struct mi_node* imc_mi_list_rooms(struct mi_node* cmd, void* param){ |
|
1512 | 1501 |
|
1502 |
+ |
|
1503 |
+ |
|
1504 |
+/************************* MI ***********************/ |
|
1505 |
+static struct mi_node* imc_mi_list_rooms(struct mi_node* cmd, void* param) |
|
1506 |
+{ |
|
1513 | 1507 |
int i, len; |
1514 | 1508 |
struct mi_node* rpl= NULL; |
1515 | 1509 |
struct mi_node* node= NULL; |
1516 | 1510 |
struct mi_attr* attr= NULL; |
1517 | 1511 |
imc_room_p irp = NULL; |
1518 | 1512 |
char* p = NULL; |
1519 |
- // irp_temp=NULL; |
|
1520 |
- |
|
1513 |
+ |
|
1521 | 1514 |
rpl= init_mi_tree(MI_200_OK_S, MI_200_OK_LEN); |
1522 | 1515 |
if(rpl == NULL) |
1523 | 1516 |
return 0; |
1524 | 1517 |
|
1525 | 1518 |
for(i=0; i<imc_hash_size; i++) |
1526 | 1519 |
{ |
1520 |
+ lock_get(&_imc_htable[i].lock); |
|
1527 | 1521 |
irp = _imc_htable[i].rooms; |
1528 | 1522 |
while(irp){ |
1529 | 1523 |
node = add_mi_node_child(rpl, 0, "ROOM", 4, 0, 0); |
1530 | 1524 |
if( node == NULL) |
1531 | 1525 |
goto error; |
1532 | 1526 |
|
1533 |
- attr= add_mi_attr(node, 0, "URI", 3, irp->uri.s, irp->uri.len); |
|
1527 |
+ attr= add_mi_attr(node, MI_DUP_VALUE, "URI", 3, irp->uri.s, |
|
1528 |
+ irp->uri.len); |
|
1534 | 1529 |
if(attr == NULL) |
1535 | 1530 |
goto error; |
1536 | 1531 |
|
1537 |
- p = int2str(irp->nr_of_members, &len); |
|
1532 |
+ p = int2str(irp->nr_of_members, &len); |
|
1538 | 1533 |
attr= add_mi_attr(node, 0, "MEMBERS", 7,p, len ); |
1539 | 1534 |
if(attr == NULL) |
1540 | 1535 |
goto error; |
1541 | 1536 |
|
1542 |
- attr= add_mi_attr(node, 0, "OWNER", 5, irp->uri.s, irp->uri.len); |
|
1537 |
+ attr= add_mi_attr(node, MI_DUP_VALUE, "OWNER", 5, irp->uri.s, |
|
1538 |
+ irp->uri.len); |
|
1543 | 1539 |
if(attr == NULL) |
1544 | 1540 |
goto error; |
1545 | 1541 |
|
1546 | 1542 |
irp = irp->next; |
1547 | 1543 |
} |
1544 |
+ lock_release(&_imc_htable[i].lock); |
|
1548 | 1545 |
} |
1549 |
- |
|
1546 |
+ |
|
1550 | 1547 |
return rpl; |
1551 | 1548 |
|
1552 | 1549 |
error: |
1550 |
+ lock_release(&_imc_htable[i].lock); |
|
1553 | 1551 |
free_mi_tree(rpl); |
1554 | 1552 |
return 0; |
1555 | 1553 |
|
1556 | 1554 |
} |
1557 | 1555 |
|
1558 |
-struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param){ |
|
1559 |
- |
|
1556 |
+ |
|
1557 |
+static struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param) |
|
1558 |
+{ |
|
1560 | 1559 |
int i, len; |
1561 | 1560 |
struct mi_node* rpl = NULL; |
1562 | 1561 |
struct mi_node* node= NULL; |
... | ... |
@@ -1567,7 +1566,6 @@ struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param){ |
1567 | 1566 |
imc_room_p room; |
1568 | 1567 |
struct sip_uri inv_uri, *pinv_uri; |
1569 | 1568 |
imc_member_p imp=NULL; |
1570 |
- int room_released=0; |
|
1571 | 1569 |
char* p = NULL; |
1572 | 1570 |
|
1573 | 1571 |
node= cmd->kids; |
... | ... |
@@ -1581,7 +1579,6 @@ struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param){ |
1581 | 1579 |
if(room_name.s == NULL || room_name.len == 0) |
1582 | 1580 |
{ |
1583 | 1581 |
LOG(L_ERR, "IMC:imc_mi_list_members: error - no room name!\n"); |
1584 |
- free_mi_tree(rpl); |
|
1585 | 1582 |
return init_mi_tree("400 room name not found", 23); |
1586 | 1583 |
} |
1587 | 1584 |
rnbuf[room_name.len] = '\0'; |
... | ... |
@@ -1606,7 +1603,8 @@ struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param){ |
1606 | 1603 |
if(rpl == NULL) |
1607 | 1604 |
return 0; |
1608 | 1605 |
|
1609 |
- node_r = add_mi_node_child(rpl, 0, "ROOM", 4, room_name.s, room_name.len); |
|
1606 |
+ node_r = add_mi_node_child(rpl, MI_DUP_VALUE, "ROOM", 4, room_name.s, |
|
1607 |
+ room_name.len); |
|
1610 | 1608 |
if(node_r == NULL) |
1611 | 1609 |
goto error; |
1612 | 1610 |
|
... | ... |
@@ -1616,7 +1614,8 @@ struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param){ |
1616 | 1614 |
while(imp) |
1617 | 1615 |
{ |
1618 | 1616 |
i++; |
1619 |
- node = add_mi_node_child(node_r, 0, "MEMBER",6, imp->uri.s, imp->uri.len); |
|
1617 |
+ node = add_mi_node_child(node_r, MI_DUP_VALUE, "MEMBER",6, imp->uri.s, |
|
1618 |
+ imp->uri.len); |
|
1620 | 1619 |
if(node == NULL) |
1621 | 1620 |
goto error; |
1622 | 1621 |
imp = imp->next; |
... | ... |
@@ -1624,18 +1623,15 @@ struct mi_node* imc_mi_list_members(struct mi_node* cmd, void* param){ |
1624 | 1623 |
|
1625 | 1624 |
p = int2str(i, &len); |
1626 | 1625 |
attr= add_mi_attr(node_r, MI_DUP_VALUE, "NR_OF_MEMBERS", 13, p, len); |
1627 |
- if(attr == 0) |
|
1626 |
+ if(attr == 0) |
|
1628 | 1627 |
goto error; |
1629 | 1628 |
|
1630 |
- |
|
1631 |
- if(room!=NULL) |
|
1632 |
- { |
|
1633 |
- room_released = imc_release_room(room); |
|
1634 |
- } |
|
1629 |
+ imc_release_room(room); |
|
1635 | 1630 |
|
1636 | 1631 |
return rpl; |
1637 | 1632 |
|
1638 | 1633 |
error: |
1634 |
+ imc_release_room(room); |
|
1639 | 1635 |
free_mi_tree(rpl); |
1640 | 1636 |
return 0; |
1641 | 1637 |
|
... | ... |
@@ -1652,7 +1648,6 @@ int imc_list_members(FILE *stream, char *response_file){ |
1652 | 1648 |
imc_room_p room; |
1653 | 1649 |
struct sip_uri inv_uri, *pinv_uri; |
1654 | 1650 |
imc_member_p imp=NULL; |
1655 |
- int room_released=0; |
|
1656 | 1651 |
|
1657 | 1652 |
freply = open_reply_pipe(response_file); |
1658 | 1653 |
if(freply==NULL) |
... | ... |
@@ -1704,15 +1699,12 @@ int imc_list_members(FILE *stream, char *response_file){ |
1704 | 1699 |
|
1705 | 1700 |
fprintf(freply, "Number of members: %d\n",i); |
1706 | 1701 |
|
1707 |
- if(room!=NULL) |
|
1708 |
- { |
|
1709 |
- room_released = imc_release_room(room); |
|
1710 |
- } |
|
1702 |
+ imc_release_room(room); |
|
1711 | 1703 |
|
1712 | 1704 |
if(freply!=NULL) |
1713 | 1705 |
fclose(freply); |
1714 | 1706 |
|
1715 |
- return 0; |
|
1707 |
+ return 0; |
|
1716 | 1708 |
|
1717 | 1709 |
} |
1718 | 1710 |
|
... | ... |
@@ -1791,7 +1783,7 @@ send_message: |
1791 | 1783 |
to_uri_s.s = to_uri_buf; |
1792 | 1784 |
to_uri_s.len = ((del_member_t *)(*ps->param))->inv_uri.len; |
1793 | 1785 |
strncpy(to_uri_s.s,((del_member_t *)(*ps->param))->inv_uri.s , |
1794 |
- ((del_member_t *)(*ps->param))->inv_uri.len); |
|
1786 |
+ ((del_member_t *)(*ps->param))->inv_uri.len); |
|
1795 | 1787 |
|
1796 | 1788 |
DBG("to: %.*s\nfrom: %.*s\nbody: %.*s\n", |
1797 | 1789 |
to_uri_s.len, to_uri_s.s , from_uri_s.len, from_uri_s.s, |
... | ... |
@@ -1823,10 +1815,5 @@ error: |
1823 | 1815 |
if((del_member_t *)(*ps->param)) |
1824 | 1816 |
shm_free(*ps->param); |
1825 | 1817 |
return; |
1818 |
+} |
|
1826 | 1819 |
|
1827 |
-} |
|
1828 |
- |
|
1829 |
- |
|
1830 |
- |
|
1831 |
- |
|
1832 |
- |
... | ... |
@@ -171,6 +171,7 @@ struct module_exports exports= { |
171 | 171 |
cmds, /* Exported functions */ |
172 | 172 |
params, /* Exported parameters */ |
173 | 173 |
0, /* exported statistics */ |
174 |
+ 0, /* exported MI functions */ |
|
174 | 175 |
mod_init, /* module initialization function */ |
175 | 176 |
(response_function) 0, |
176 | 177 |
(destroy_function) destroy, |
... | ... |
@@ -75,8 +75,9 @@ MODULE_VERSION |
75 | 75 |
|
76 | 76 |
static void destroy(void); /* Module destroy function */ |
77 | 77 |
static int child_init(int rank); /* Per-child initialization function */ |
78 |
+static int mi_child_init(void); |
|
78 | 79 |
static int mod_init(void); /* Module initialization function */ |
79 |
-static int fixstring2int(void **param, int param_count); /* string to int fixup */ |
|
80 |
+static int fixstring2int(void **param, int param_count); |
|
80 | 81 |
|
81 | 82 |
int reload_gws ( void ); |
82 | 83 |
|
... | ... |
@@ -238,15 +239,24 @@ int next_contacts (struct sip_msg*, char*, char*); |
238 | 239 |
* Exported functions |
239 | 240 |
*/ |
240 | 241 |
static cmd_export_t cmds[] = { |
241 |
- {"load_gws", load_gws, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE}, |
|
242 |
- {"load_gws", load_gws_grp, 1, fixstring2int, REQUEST_ROUTE | FAILURE_ROUTE}, |
|
243 |
- {"next_gw", next_gw, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE}, |
|
244 |
- {"from_gw", from_gw, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, |
|
245 |
- {"from_gw", from_gw_grp, 1, fixstring2int, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, |
|
246 |
- {"to_gw", to_gw, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE}, |
|
247 |
- {"to_gw", to_gw_grp, 1, fixstring2int, REQUEST_ROUTE | FAILURE_ROUTE}, |
|
248 |
- {"load_contacts", load_contacts, 0, 0, REQUEST_ROUTE}, |
|
249 |
- {"next_contacts", next_contacts, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE}, |
|
242 |
+ {"load_gws", load_gws, 0, 0, |
|
243 |
+ REQUEST_ROUTE | FAILURE_ROUTE}, |
|
244 |
+ {"load_gws", load_gws_grp, 1, fixstring2int, |
|
245 |
+ REQUEST_ROUTE | FAILURE_ROUTE}, |
|
246 |
+ {"next_gw", next_gw, 0, 0, |
|
247 |
+ REQUEST_ROUTE | FAILURE_ROUTE}, |
|
248 |
+ {"from_gw", from_gw, 0, 0, |
|
249 |
+ REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, |
|
250 |
+ {"from_gw", from_gw_grp, 1, fixstring2int, |
|
251 |
+ REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, |
|
252 |
+ {"to_gw", to_gw, 0, 0, |
|
253 |
+ REQUEST_ROUTE | FAILURE_ROUTE}, |
|
254 |
+ {"to_gw", to_gw_grp, 1, fixstring2int, |
|
255 |
+ REQUEST_ROUTE | FAILURE_ROUTE}, |
|
256 |
+ {"load_contacts", load_contacts, 0, 0, |
|
257 |
+ REQUEST_ROUTE}, |
|
258 |
+ {"next_contacts", next_contacts, 0, 0, |
|
259 |
+ REQUEST_ROUTE | FAILURE_ROUTE}, |
|
250 | 260 |
{0, 0, 0, 0, 0} |
251 | 261 |
}; |
252 | 262 |
|
... | ... |
@@ -280,6 +290,16 @@ static param_export_t params[] = { |
280 | 290 |
}; |
281 | 291 |
|
282 | 292 |
|
293 |
+/* |
|
294 |
+ * Exported MI functions |
|
295 |
+ */ |
|
296 |
+static mi_export_t mi_cmds[] = { |
|
297 |
+ { MI_LCR_RELOAD, mi_lcr_reload, 0, mi_child_init }, |
|
298 |
+ { MI_LCR_DUMP, mi_lcr_dump, 0, 0 }, |
|
299 |
+ { 0, 0, 0, 0} |
|
300 |
+}; |
|
301 |
+ |
|
302 |
+ |
|
283 | 303 |
/* |
284 | 304 |
* Module interface |
285 | 305 |
*/ |
... | ... |
@@ -287,7 +307,8 @@ struct module_exports exports = { |
287 | 307 |
"lcr", |
288 | 308 |
cmds, /* Exported functions */ |
289 | 309 |
params, /* Exported parameters */ |
290 |
- 0, /* exported statistics */ |
|
310 |
+ 0, /* exported statistics */ |
|
311 |
+ mi_cmds, /* exported MI functions */ |
|
291 | 312 |
mod_init, /* module initialization function */ |
292 | 313 |
0, /* response function */ |
293 | 314 |
destroy, /* destroy function */ |
... | ... |
@@ -371,16 +392,26 @@ int lcr_db_ver(char* db_url, str* name) |
371 | 392 |
*/ |
372 | 393 |
static int child_init(int rank) |
373 | 394 |
{ |
395 |
+ /* don't do anything for non-worker process */ |
|
396 |
+ if (rank<1 && rank!=PROC_FIFO) |
|
397 |
+ return 0; |
|
398 |
+ |
|
374 | 399 |
if (lcr_db_init(db_url.s) < 0) { |
375 | 400 |
LOG(L_ERR, "ERROR: lcr:child_init():" |
376 | 401 |
" Unable to connect to the database\n"); |
377 | 402 |
return -1; |
378 | 403 |
} |
379 |
- |
|
404 |
+ |
|
380 | 405 |
return 0; |
381 | 406 |
} |
382 | 407 |
|
383 | 408 |
|
409 |
+static int mi_child_init() |
|
410 |
+{ |
|
411 |
+ return lcr_db_init(db_url.s); |
|
412 |
+} |
|
413 |
+ |
|
414 |
+ |
|
384 | 415 |
/* |
385 | 416 |
* Module initialization function that is called before the main process forks |
386 | 417 |
*/ |
... | ... |
@@ -444,9 +475,6 @@ static int mod_init(void) |
444 | 475 |
/* Initialize fifo interface */ |
445 | 476 |
(void)init_lcr_fifo(); |
446 | 477 |
|
447 |
- /* Initialize MI interface */ |
|
448 |
- (void)init_lcr_mi(); |
|
449 |
- |
|
450 | 478 |
/* Initializing gw tables and gw table pointer variable */ |
451 | 479 |
gws_1 = (struct gw_info *)shm_malloc(sizeof(struct gw_info) * (MAX_NO_OF_GWS + 1)); |
452 | 480 |
if (gws_1 == 0) { |
... | ... |
@@ -30,14 +30,13 @@ |
30 | 30 |
#include "lcr_mod.h" |
31 | 31 |
#include "../../dprint.h" |
32 | 32 |
#include "../../db/db.h" |
33 |
-#include "../../mi/mi.h" |
|
34 | 33 |
#include "mi.h" |
35 | 34 |
|
36 | 35 |
|
37 | 36 |
/* |
38 | 37 |
* MI function to reload lcr table(s) |
39 | 38 |
*/ |
40 |
-static struct mi_node* mi_lcr_reload(struct mi_node* cmd, void* param) |
|
39 |
+struct mi_node* mi_lcr_reload(struct mi_node* cmd, void* param) |
|
41 | 40 |
{ |
42 | 41 |
if (reload_gws () == 1) |
43 | 42 |
return init_mi_tree(MI_200_OK_S, MI_200_OK_LEN); |
... | ... |
@@ -49,7 +48,7 @@ static struct mi_node* mi_lcr_reload(struct mi_node* cmd, void* param) |
49 | 48 |
/* |
50 | 49 |
* MI function to print gws from current gw table |
51 | 50 |
*/ |
52 |
-static struct mi_node* mi_lcr_dump(struct mi_node* cmd, void* param) |
|
51 |
+struct mi_node* mi_lcr_dump(struct mi_node* cmd, void* param) |
|
53 | 52 |
{ |
54 | 53 |
struct mi_node* rpl= NULL; |
55 | 54 |
|
... | ... |
@@ -65,20 +64,3 @@ static struct mi_node* mi_lcr_dump(struct mi_node* cmd, void* param) |
65 | 64 |
return rpl; |
66 | 65 |
} |
67 | 66 |
|
68 |
-/* |
|
69 |
- * Register lcr MI functions |
|
70 |
- */ |
|
71 |
-int init_lcr_mi( void ) |
|
72 |
-{ |
|
73 |
- if (register_mi_cmd(mi_lcr_reload, MI_LCR_RELOAD, 0) < 0) { |
|
74 |
- LOG(L_CRIT, "Cannot register MI %s\n",MI_LCR_RELOAD); |
|
75 |
- return -1; |
|
76 |
- } |
|
77 |
- |
|
78 |
- if (register_mi_cmd(mi_lcr_dump, MI_LCR_DUMP, 0) < 0) { |
|
79 |
- LOG(L_CRIT, "Cannot register MI %s\n",MI_LCR_DUMP); |
|
80 |
- return -1; |
|
81 |
- } |
|
82 |
- |
|
83 |
- return 0; |
|
84 |
-} |
... | ... |
@@ -30,9 +30,13 @@ |
30 | 30 |
#ifndef _LCR_MI_H_ |
31 | 31 |
#define _LCR_MI_H_ |
32 | 32 |
|
33 |
+#include "../../mi/mi.h" |
|
34 |
+ |
|
33 | 35 |
#define MI_LCR_RELOAD "lcr_reload" |
34 | 36 |
#define MI_LCR_DUMP "lcr_dump" |
35 | 37 |
|
36 |
-int init_lcr_mi( void ); |
|
38 |
+struct mi_node* mi_lcr_reload(struct mi_node* cmd, void* param); |
|
39 |
+ |
|
40 |
+struct mi_node* mi_lcr_dump(struct mi_node* cmd, void* param); |
|
37 | 41 |
|
38 | 42 |
#endif |
... | ... |
@@ -111,10 +111,11 @@ struct module_exports exports = { |
111 | 111 |
cmds, /* Exported functions */ |
112 | 112 |
params, /* Exported parameters */ |
113 | 113 |
0, /* exported statistics */ |
114 |
+ 0, /* exported MI functions */ |
|
114 | 115 |
mod_init, /* module initialization function */ |
115 |
- 0, /* response function */ |
|
116 |
+ 0, /* response function */ |
|
116 | 117 |
destroy, /* destroy function */ |
117 |
- 0 /* child initialization function */ |
|
118 |
+ 0 /* child initialization function */ |
|
118 | 119 |
}; |
119 | 120 |
|
120 | 121 |
|
... | ... |
@@ -207,6 +207,7 @@ struct module_exports exports = { |
207 | 207 |
commands, // module exported functions |
208 | 208 |
parameters, // module exported parameters |
209 | 209 |
NULL, // exported statistics |
210 |
+ NULL, /* exported MI functions */ |
|
210 | 211 |
mod_init, // module init (before any kid is created. kids will inherit) |
211 | 212 |
NULL, // reply processing |
212 | 213 |
NULL, // destroy function |
... | ... |
@@ -85,6 +85,7 @@ struct module_exports exports = { |
85 | 85 |
0, /* exported functions */ |
86 | 86 |
mi_params, /* exported parameters */ |
87 | 87 |
0, /* exported statistics */ |
88 |
+ 0, /* exported MI functions */ |
|
88 | 89 |
mi_mod_init, /* module initialization function */ |
89 | 90 |
(response_function) 0, /* response handling function */ |
90 | 91 |
(destroy_function) mi_destroy, /* destroy function */ |
... | ... |
@@ -206,6 +207,12 @@ static int mi_child_init(int rank) |
206 | 207 |
exit(-1); |
207 | 208 |
} |
208 | 209 |
|
210 |
+ if( init_mi_child()!=0) { |
|
211 |
+ LOG(L_CRIT,"CRITICAL:mi_fifo:mi_child_init: faild to init the " |
|
212 |
+ "mi process\n"); |
|
213 |
+ exit(-1); |
|
214 |
+ } |
|
215 |
+ |
|
209 | 216 |
if ( mi_parser_init(read_buf_size)!=0 ) { |
210 | 217 |
LOG(L_CRIT, "CRITICAL:mi_fifo:mi_child_init: failed to init " |
211 | 218 |
"the command parser\n"); |
... | ... |
@@ -228,6 +228,7 @@ struct module_exports exports= { |
228 | 228 |
#else |
229 | 229 |
0, /* exported statistics */ |
230 | 230 |
#endif |
231 |
+ 0, /* exported MI functions */ |
|
231 | 232 |
mod_init, /* module initialization function */ |
232 | 233 |
(response_function) 0, /* response handler */ |
233 | 234 |
(destroy_function) destroy, /* module destroy function */ |
... | ... |
@@ -76,6 +76,7 @@ struct module_exports exports = { |
76 | 76 |
cmds, |
77 | 77 |
params, /* module parameters */ |
78 | 78 |
0, /* exported statistics */ |
79 |
+ 0, /* exported MI functions */ |
|
79 | 80 |
mysql_mod_init, /* module initialization function */ |
80 | 81 |
0, /* response function*/ |
81 | 82 |
0, /* destroy function */ |
... | ... |
@@ -75,6 +75,7 @@ struct module_exports exports = { |
75 | 75 |
cmds, /* Exported functions */ |
76 | 76 |
params, /* Exported parameters */ |
77 | 77 |
0, /* exported statistics */ |
78 |
+ 0, /* exported MI functions */ |
|
78 | 79 |
mod_init, /* Initialization function */ |
79 | 80 |
0, /* Response function */ |
80 | 81 |
0, /* Destroy function */ |
... | ... |
@@ -130,6 +130,7 @@ struct module_exports exports = { |
130 | 130 |
cmds, /* Exported functions */ |
131 | 131 |
params, /* Exported parameters */ |
132 | 132 |
0, /* exported statistics */ |
133 |
+ 0, /* exported MI functions */ |
|
133 | 134 |
pa_mod_init, /* module initialization function */ |
134 | 135 |
0, /* response function*/ |
135 | 136 |
pa_destroy, /* destroy function */ |
... | ... |
@@ -97,6 +97,7 @@ struct module_exports exports = { |
97 | 97 |
cmds, /* Exported functions */ |
98 | 98 |
params, /* Exported parameters */ |
99 | 99 |
0, /* exported statistics */ |
100 |
+ 0, /* exported MI functions */ |
|
100 | 101 |
mod_init, /* module initialization function */ |
101 | 102 |
0, /* response function */ |
102 | 103 |
destroy, /* destroy function */ |
... | ... |
@@ -86,11 +86,12 @@ str prefix = {"", 0}; |
86 | 86 |
int sync_time = 600; |
87 | 87 |
int clean_time = 900; |
88 | 88 |
|
89 |
-static int w_prefix2domain(struct sip_msg* msg, char* str1, char* str2); |
|
90 |
-static int w_prefix2domain_1(struct sip_msg* msg, char* mode, char* str2); |
|
91 |
-static int mod_init(void); |
|
89 |
+static int w_prefix2domain(struct sip_msg* msg, char* str1, char* str2); |
|
90 |
+static int w_prefix2domain_1(struct sip_msg* msg, char* mode, char* str2); |
|
91 |
+static int mod_init(void); |
|
92 | 92 |
static void mod_destroy(void); |
93 |
-static int child_init(int r); |
|
93 |
+static int child_init(); |
|
94 |
+static int mod_child_init(int r); |
|
94 | 95 |
|
95 | 96 |
static int prefix2domain(struct sip_msg*, int mode); |
96 | 97 |
static int get_domainprefix_unixsock(str* msg); |
... | ... |
@@ -98,6 +99,10 @@ static int pdt_fifo_add(FILE *stream, char *response_file); |
98 | 99 |
static int pdt_fifo_delete(FILE *stream, char *response_file); |
99 | 100 |
static int pdt_fifo_list(FILE *stream, char *response_file); |
100 | 101 |
|
102 |
+static struct mi_node* pdt_mi_add(struct mi_node*, void* param); |
|
103 |
+static struct mi_node* pdt_mi_delete(struct mi_node*, void* param); |
|
104 |
+static struct mi_node* pdt_mi_list(struct mi_node*, void* param); |
|
105 |
+ |
|
101 | 106 |
int update_new_uri(struct sip_msg *msg, int plen, str *d, int mode); |
102 | 107 |
int pdt_load_db(); |
103 | 108 |
int pdt_sync_cache(); |
... | ... |
@@ -122,16 +127,25 @@ static param_export_t params[]={ |
122 | 127 |
{0, 0, 0} |
123 | 128 |
}; |
124 | 129 |
|
130 |
+static mi_export_t mi_cmds[] = { |
|
131 |
+ { "pdt_add", pdt_mi_add, 0, child_init }, |
|
132 |
+ { "pdt_delete", pdt_mi_delete, 0, 0 }, |
|
133 |
+ { "pdt_list", pdt_mi_list, 0, 0 }, |
|
134 |
+ { 0, 0, 0, 0} |
|
135 |
+}; |
|
136 |
+ |
|
137 |
+ |
|
125 | 138 |
struct module_exports exports = { |
126 | 139 |
"pdt", |
127 | 140 |
cmds, |
128 | 141 |
params, |
129 |
- 0, |
|
130 |
- mod_init, /* module initialization function */ |
|
131 |
- 0, /* response function */ |
|
132 |
- mod_destroy, /* destroy function */ |
|
133 |
- child_init /* per child init function */ |
|
134 |
-}; |
|
142 |
+ 0, |
|
143 |
+ mi_cmds, /* exported MI functions */ |
|
144 |
+ mod_init, /* module initialization function */ |
|
145 |
+ 0, /* response function */ |
|
146 |
+ mod_destroy, /* destroy function */ |
|
147 |
+ mod_child_init /* per child init function */ |
|
148 |
+}; |
|
135 | 149 |
|
136 | 150 |
|
137 | 151 |
|
... | ... |
@@ -251,18 +265,35 @@ error1: |
251 | 265 |
db_con = 0; |
252 | 266 |
} |
253 | 267 |
return -1; |
254 |
-} |
|
268 |
+} |
|
255 | 269 |
|
256 |
-/* each child get a new connection to the database */ |
|
257 |
-static int child_init(int r) |
|
270 |
+ |
|
271 |
+static int child_init() |
|
258 | 272 |
{ |
259 |
- DBG("PDT:child_init #%d / pid <%d>\n", r, getpid()); |
|
273 |
+ db_con = pdt_dbf.init(db_url); |
|
274 |
+ if(db_con==NULL) |
|
275 |
+ { |
|
276 |
+ LOG(L_ERR,"ERROR:PDT:child_init: failed to connect to database\n"); |
|
277 |
+ return -1; |
|
278 |
+ } |
|
279 |
+ |
|
280 |
+ if (pdt_dbf.use_table(db_con, db_table) < 0) |
|
281 |
+ { |
|
282 |
+ LOG(L_ERR, "ERROR:PDT:child_init: use_table failed\n"); |
|
283 |
+ return -1; |
|
284 |
+ } |
|
285 |
+ return 0; |
|
286 |
+} |
|
260 | 287 |
|
288 |
+ |
|
289 |
+/* each child get a new connection to the database */ |
|
290 |
+static int mod_child_init(int r) |
|
291 |
+{ |
|
261 | 292 |
if(r>0) |
262 | 293 |
{ |
263 | 294 |
if(_dhash==NULL) |
264 | 295 |
{ |
265 |
- LOG(L_ERR,"PDT:child_init #%d: ERROR no domain hash\n", r); |
|
296 |
+ LOG(L_ERR,"ERROR:PDT:mod_child_init #%d: no domain hash\n", r); |
|
266 | 297 |
return -1; |
267 | 298 |
} |
268 | 299 |
|
... | ... |
@@ -276,28 +307,20 @@ static int child_init(int r) |
276 | 307 |
_ptree = 0; |
277 | 308 |
} |
278 | 309 |
} |
279 |
- |
|
280 |
- db_con = pdt_dbf.init(db_url); |
|
281 |
- if(db_con==NULL) |
|
282 |
- { |
|
283 |
- LOG(L_ERR,"PDT:child_init #%d: Error while connecting database\n",r); |
|
284 |
- return -1; |
|
285 |
- } |
|
286 |
- |
|
287 |
- if (pdt_dbf.use_table(db_con, db_table) < 0) |
|
288 |
- { |
|
289 |
- LOG(L_ERR, "PDT:child_init #%d: Error in use_table\n", r); |
|
310 |
+ |
|
311 |
+ if ( child_init()!=0 ) |
|
290 | 312 |
return -1; |
291 |
- } |
|
313 |
+ |
|
292 | 314 |
if(sync_time<=0) |
293 | 315 |
sync_time = 300; |
294 | 316 |
sync_time += r%60; |
295 | 317 |
|
296 |
- DBG("PDT:child_init #%d: Database connection opened successfully\n",r); |
|
297 |
- |
|
318 |
+ DBG("PDT:mod_child_init #%d: Database connection opened successfully\n",r); |
|
319 |
+ |
|
298 | 320 |
return 0; |
299 | 321 |
} |
300 | 322 |
|
323 |
+ |
|
301 | 324 |
static void mod_destroy(void) |
302 | 325 |
{ |
303 | 326 |
DBG("PDT: mod_destroy : Cleaning up\n"); |
... | ... |
@@ -1014,6 +1037,376 @@ static int pdt_fifo_list(FILE *stream, char *response_file) |
1014 | 1037 |
return 0; |
1015 | 1038 |
} |
1016 | 1039 |
|
1040 |
+ |
|
1041 |
+/**************************** MI ***************************/ |
|
1042 |
+ |
|
1043 |
+ |
|
1044 |
+/** |
|
1045 |
+ * "pdt_add" syntax : |
|
1046 |
+ * sdomain |
|
1047 |
+ * prefix |
|
1048 |
+ * domain |
|
1049 |
+ */ |
|
1050 |
+struct mi_node* pdt_mi_add(struct mi_node* cmd, void* param) |
|
1051 |
+{ |
|
1052 |
+ db_key_t db_keys[NR_KEYS] = {sdomain_column, prefix_column, domain_column}; |
|
1053 |
+ db_val_t db_vals[NR_KEYS]; |
|
1054 |
+ db_op_t db_ops[NR_KEYS] = {OP_EQ, OP_EQ}; |
|
1055 |
+ int i= 0; |
|
1056 |
+ str sd, sp, sdomain; |
|
1057 |
+ struct mi_node* node= NULL; |
|
1058 |
+ |
|
1059 |
+ if(_dhash==NULL) |
|
1060 |
+ { |
|
1061 |
+ LOG(L_ERR, "PDT:pdt_mi_add: strange situation\n"); |
|
1062 |
+ return init_mi_tree( "500 server error",16); |
|
1063 |
+ } |
|
1064 |
+ |
|
1065 |
+ /* read sdomain */ |
|
1066 |
+ node = cmd->kids; |
|
1067 |
+ if(node == NULL) |
|
1068 |
+ goto error1; |
|
1069 |
+ |
|
1070 |
+ sdomain = node->value; |
|
1071 |
+ if(sdomain.s == NULL || sdomain.len== 0) |
|
1072 |
+ return init_mi_tree( "400 domain not found", 20); |
|
1073 |
+ |
|
1074 |
+ if(*sdomain.s=='.' ) |
|
1075 |
+ return init_mi_tree("400 empty param",15); |
|
1076 |
+ |
|
1077 |
+ /* read prefix */ |
|
1078 |
+ node = node->next; |
|
1079 |
+ if(node == NULL) |
|