00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00048 #include <stdio.h>
00049 #include <stdlib.h>
00050 #include <string.h>
00051
00052 #include "../../sr_module.h"
00053 #include "../../mem/mem.h"
00054 #include "../../mod_fix.h"
00055 #include "../rr/api.h"
00056
00057 #include "path.h"
00058 #include "path_mod.h"
00059
00060 MODULE_VERSION
00061
00062
00065 int use_received = 0;
00066
00070 static int mod_init(void);
00071
00075 struct rr_binds path_rrb;
00076
00077
00081 static cmd_export_t cmds[] = {
00082 { "add_path", (cmd_function)add_path, 0,
00083 0, 0, REQUEST_ROUTE },
00084 { "add_path", (cmd_function)add_path_usr, 1,
00085 fixup_str_null, 0, REQUEST_ROUTE },
00086 { "add_path_received", (cmd_function)add_path_received, 0,
00087 0, 0, REQUEST_ROUTE },
00088 { "add_path_received", (cmd_function)add_path_received_usr, 1,
00089 fixup_str_null, 0, REQUEST_ROUTE },
00090 { 0, 0, 0, 0, 0, 0 }
00091 };
00092
00093
00097 static param_export_t params[] = {
00098 {"use_received", INT_PARAM, &use_received },
00099 { 0, 0, 0 }
00100 };
00101
00102
00106 struct module_exports exports = {
00107 "path",
00108 DEFAULT_DLFLAGS,
00109 cmds,
00110 params,
00111 0,
00112 0,
00113 0,
00114 0,
00115 mod_init,
00116 0,
00117 0,
00118 0
00119 };
00120
00121
00122 static int mod_init(void)
00123 {
00124 if (use_received) {
00125 if (load_rr_api(&path_rrb) != 0) {
00126 LM_ERR("failed to load rr-API\n");
00127 return -1;
00128 }
00129 if (path_rrb.register_rrcb(path_rr_callback, 0) != 0) {
00130 LM_ERR("failed to register rr callback\n");
00131 return -1;
00132 }
00133 }
00134
00135 return 0;
00136 }