... | ... |
@@ -666,8 +666,8 @@ int main(int argc, char** argv) |
666 | 666 |
goto error; |
667 | 667 |
} |
668 | 668 |
|
669 |
- /*init builtin modules*/ |
|
670 |
- init_builtin_modules(); |
|
669 |
+ /*register builtin modules*/ |
|
670 |
+ register_builtin_modules(); |
|
671 | 671 |
|
672 | 672 |
yyin=cfg_stream; |
673 | 673 |
if ((yyparse()!=0)||(cfg_errors)){ |
... | ... |
@@ -675,7 +675,11 @@ int main(int argc, char** argv) |
675 | 675 |
goto error; |
676 | 676 |
} |
677 | 677 |
|
678 |
- |
|
678 |
+ if (init_modules() != 0) { |
|
679 |
+ fprintf(stderr, "ERROR: error while initializing modules\n"); |
|
680 |
+ goto error; |
|
681 |
+ } |
|
682 |
+ |
|
679 | 683 |
print_rl(); |
680 | 684 |
/* fix routing lists */ |
681 | 685 |
if ( (r=fix_rls())!=0){ |
682 | 686 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,37 @@ |
1 |
+#include "modparam.h" |
|
2 |
+#include "dprint.h" |
|
3 |
+#include <string.h> |
|
4 |
+ |
|
5 |
+ |
|
6 |
+int set_mod_param(char* _mod, char* _name, modparam_t _type, void* _val) |
|
7 |
+{ |
|
8 |
+ void* ptr; |
|
9 |
+ |
|
10 |
+ if (!_mod) { |
|
11 |
+ LOG(L_ERR, "set_mod_param(): Invalid _mod parameter value\n"); |
|
12 |
+ return -1; |
|
13 |
+ } |
|
14 |
+ |
|
15 |
+ if (!_name) { |
|
16 |
+ LOG(L_ERR, "set_mod_param(): Invalid _name parameter value\n"); |
|
17 |
+ return -2; |
|
18 |
+ } |
|
19 |
+ |
|
20 |
+ ptr = find_param_export(_mod, _name, _type); |
|
21 |
+ if (!ptr) { |
|
22 |
+ LOG(L_ERR, "set_mod_param(): Parameter not found\n"); |
|
23 |
+ return -3; |
|
24 |
+ } |
|
25 |
+ |
|
26 |
+ switch(_type) { |
|
27 |
+ case STR_PARAM: |
|
28 |
+ *((char**)ptr) = strdup((char*)_val); |
|
29 |
+ break; |
|
30 |
+ |
|
31 |
+ case INT_PARAM: |
|
32 |
+ *((int*)ptr) = (int)_val; |
|
33 |
+ break; |
|
34 |
+ } |
|
35 |
+ |
|
36 |
+ return 0; |
|
37 |
+} |