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
00026
00027
00028
00029
00030
00031 #include <stdio.h>
00032 #include <string.h>
00033 #include <stdlib.h>
00034
00035 #include "../../sr_module.h"
00036 #include "qos_load.h"
00037 #include "qos_handlers.h"
00038
00039
00040 MODULE_VERSION
00041
00042 static int mod_init(void);
00043 static void mod_destroy(void);
00044
00045
00046
00047 static int qos_flag = -1;
00048
00049
00050
00051
00052 struct dlg_binds dialog_st;
00053 struct dlg_binds *dlg_binds = &dialog_st;
00054
00055
00056 static cmd_export_t cmds[]={
00057 {"load_qos", (cmd_function)load_qos, 0, 0, 0, 0},
00058 {0,0,0,0,0,0}
00059 };
00060
00061
00062
00063
00064 static param_export_t mod_params[]={
00065 { "qos_flag", INT_PARAM, &qos_flag},
00066 { 0,0,0 }
00067 };
00068
00069
00070 struct module_exports exports= {
00071 "qos",
00072 DEFAULT_DLFLAGS,
00073 cmds,
00074 mod_params,
00075 0,
00076 0,
00077 0,
00078 0,
00079 mod_init,
00080 0,
00081 mod_destroy,
00082 0
00083 };
00084
00085 int load_qos( struct qos_binds *qosb)
00086 {
00087 qosb->register_qoscb = register_qoscb;
00088 return 1;
00089 }
00090
00091
00099 static int mod_init(void)
00100 {
00101 if (qos_flag == -1) {
00102 LM_ERR("no qos flag set!!\n");
00103 return -1;
00104 }
00105 else if (qos_flag > MAX_FLAG) {
00106 LM_ERR("invalid qos flag %d!!\n", qos_flag);
00107 return -1;
00108 }
00109
00110
00111 if (init_qos_callbacks()!=0) {
00112 LM_ERR("cannot init callbacks\n");
00113 return -1;
00114 }
00115
00116
00117 if (load_dlg_api(&dialog_st) != 0) {
00118 LM_ERR("Can't load dialog hooks");
00119 return(-1);
00120 }
00121
00122
00123 dialog_st.register_dlgcb(NULL, DLGCB_CREATED, qos_dialog_created_CB, NULL, NULL);
00124
00125
00126
00127
00128 return 0;
00129 }
00130
00131 static void mod_destroy(void)
00132 {
00133 destroy_qos_callbacks();
00134 }
00135