|
@@ -37,11 +37,11 @@
|
|
MODULE_VERSION
|
|
MODULE_VERSION
|
|
|
|
|
|
/* internal global variables */
|
|
/* internal global variables */
|
|
-struct tm_binds rd_tmb; /*imported functions from tm */
|
|
|
|
|
|
+struct tm_binds rd_tmb; /*imported functions from tm */
|
|
|
|
|
|
/* global parameter variables */
|
|
/* global parameter variables */
|
|
str uacred_acc_db_table = str_init("acc");
|
|
str uacred_acc_db_table = str_init("acc");
|
|
-str uacred_acc_fct_s = str_init("acc_log_request");
|
|
|
|
|
|
+str uacred_acc_fct_s = str_init("acc_log_request");
|
|
|
|
|
|
/* private parameter variables */
|
|
/* private parameter variables */
|
|
char *deny_filter_s = 0;
|
|
char *deny_filter_s = 0;
|
|
@@ -52,7 +52,7 @@ unsigned int bflags = 0;
|
|
int flags_hdr_mode = 0;
|
|
int flags_hdr_mode = 0;
|
|
|
|
|
|
#define ACCEPT_RULE_STR "accept"
|
|
#define ACCEPT_RULE_STR "accept"
|
|
-#define DENY_RULE_STR "deny"
|
|
|
|
|
|
+#define DENY_RULE_STR "deny"
|
|
#define DEFAULT_Q_VALUE 10
|
|
#define DEFAULT_Q_VALUE 10
|
|
|
|
|
|
int _redirect_q_value = DEFAULT_Q_VALUE;
|
|
int _redirect_q_value = DEFAULT_Q_VALUE;
|
|
@@ -65,112 +65,106 @@ acc_api_t _uacred_accb = {0};
|
|
|
|
|
|
static int redirect_init(void);
|
|
static int redirect_init(void);
|
|
static int child_init(int rank);
|
|
static int child_init(int rank);
|
|
-static int w_set_deny(struct sip_msg* msg, char *dir, char *foo);
|
|
|
|
-static int w_set_accept(struct sip_msg* msg, char *dir, char *foo);
|
|
|
|
-static int w_get_redirect1(struct sip_msg* msg, char *dir, char *foo);
|
|
|
|
-static int w_get_redirect2(struct sip_msg* msg, char *dir, char *foo);
|
|
|
|
|
|
+static int w_set_deny(struct sip_msg *msg, char *dir, char *foo);
|
|
|
|
+static int w_set_accept(struct sip_msg *msg, char *dir, char *foo);
|
|
|
|
+static int w_get_redirect1(struct sip_msg *msg, char *dir, char *foo);
|
|
|
|
+static int w_get_redirect2(struct sip_msg *msg, char *dir, char *foo);
|
|
static int regexp_compile(char *re_s, regex_t **re);
|
|
static int regexp_compile(char *re_s, regex_t **re);
|
|
-static int get_redirect_fixup(void** param, int param_no);
|
|
|
|
-static int setf_fixup(void** param, int param_no);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-static cmd_export_t cmds[] = {
|
|
|
|
- {"set_deny_filter", (cmd_function)w_set_deny, 2, setf_fixup, 0,
|
|
|
|
- FAILURE_ROUTE },
|
|
|
|
- {"set_accept_filter", (cmd_function)w_set_accept, 2, setf_fixup, 0,
|
|
|
|
- FAILURE_ROUTE },
|
|
|
|
- {"get_redirects", (cmd_function)w_get_redirect2, 2, get_redirect_fixup, 0,
|
|
|
|
- FAILURE_ROUTE },
|
|
|
|
- {"get_redirects", (cmd_function)w_get_redirect1, 1, get_redirect_fixup, 0,
|
|
|
|
- FAILURE_ROUTE },
|
|
|
|
- {0, 0, 0, 0, 0, 0}
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static param_export_t params[] = {
|
|
|
|
- {"deny_filter", PARAM_STRING, &deny_filter_s },
|
|
|
|
- {"accept_filter", PARAM_STRING, &accept_filter_s },
|
|
|
|
- {"default_filter", PARAM_STRING, &def_filter_s },
|
|
|
|
- {"acc_function", PARAM_STR, &uacred_acc_fct_s },
|
|
|
|
- {"acc_db_table", PARAM_STR, &uacred_acc_db_table },
|
|
|
|
- {"bflags", INT_PARAM, &bflags },
|
|
|
|
- {"flags_hdr_mode", INT_PARAM, &flags_hdr_mode },
|
|
|
|
- {"q_value", INT_PARAM, &_redirect_q_value },
|
|
|
|
- {0, 0, 0}
|
|
|
|
-};
|
|
|
|
|
|
+static int get_redirect_fixup(void **param, int param_no);
|
|
|
|
+static int setf_fixup(void **param, int param_no);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+static cmd_export_t cmds[] = {{"set_deny_filter", (cmd_function)w_set_deny, 2,
|
|
|
|
+ setf_fixup, 0, FAILURE_ROUTE},
|
|
|
|
+ {"set_accept_filter", (cmd_function)w_set_accept, 2, setf_fixup, 0,
|
|
|
|
+ FAILURE_ROUTE},
|
|
|
|
+ {"get_redirects", (cmd_function)w_get_redirect2, 2, get_redirect_fixup,
|
|
|
|
+ 0, FAILURE_ROUTE},
|
|
|
|
+ {"get_redirects", (cmd_function)w_get_redirect1, 1, get_redirect_fixup,
|
|
|
|
+ 0, FAILURE_ROUTE},
|
|
|
|
+ {0, 0, 0, 0, 0, 0}};
|
|
|
|
+
|
|
|
|
+static param_export_t params[] = {{"deny_filter", PARAM_STRING, &deny_filter_s},
|
|
|
|
+ {"accept_filter", PARAM_STRING, &accept_filter_s},
|
|
|
|
+ {"default_filter", PARAM_STRING, &def_filter_s},
|
|
|
|
+ {"acc_function", PARAM_STR, &uacred_acc_fct_s},
|
|
|
|
+ {"acc_db_table", PARAM_STR, &uacred_acc_db_table},
|
|
|
|
+ {"bflags", INT_PARAM, &bflags},
|
|
|
|
+ {"flags_hdr_mode", INT_PARAM, &flags_hdr_mode},
|
|
|
|
+ {"q_value", INT_PARAM, &_redirect_q_value}, {0, 0, 0}};
|
|
|
|
|
|
|
|
|
|
struct module_exports exports = {
|
|
struct module_exports exports = {
|
|
- "uac_redirect", /* module name */
|
|
|
|
- DEFAULT_DLFLAGS, /* dlopen flags */
|
|
|
|
- cmds, /* exported functions */
|
|
|
|
- params, /* exported parameters */
|
|
|
|
- 0, /* exported RPC functions */
|
|
|
|
- 0, /* exported pseudo-variables */
|
|
|
|
- 0, /* response handling function */
|
|
|
|
- redirect_init, /* module initialization function */
|
|
|
|
- child_init, /* per-child init function */
|
|
|
|
- 0 /* module destroy function */
|
|
|
|
|
|
+ "uac_redirect", /* module name */
|
|
|
|
+ DEFAULT_DLFLAGS, /* dlopen flags */
|
|
|
|
+ cmds, /* exported functions */
|
|
|
|
+ params, /* exported parameters */
|
|
|
|
+ 0, /* exported RPC functions */
|
|
|
|
+ 0, /* exported pseudo-variables */
|
|
|
|
+ 0, /* response handling function */
|
|
|
|
+ redirect_init, /* module initialization function */
|
|
|
|
+ child_init, /* per-child init function */
|
|
|
|
+ 0 /* module destroy function */
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
int get_nr_max(char *s, unsigned char *max)
|
|
int get_nr_max(char *s, unsigned char *max)
|
|
{
|
|
{
|
|
unsigned short nr;
|
|
unsigned short nr;
|
|
int err;
|
|
int err;
|
|
|
|
|
|
- if ( s[0]=='*' && s[1]==0 ) {
|
|
|
|
|
|
+ if(s[0] == '*' && s[1] == 0) {
|
|
/* is '*' -> infinit ;-) */
|
|
/* is '*' -> infinit ;-) */
|
|
*max = 0;
|
|
*max = 0;
|
|
return 0;
|
|
return 0;
|
|
} else {
|
|
} else {
|
|
/* must be a positive number less than 255 */
|
|
/* must be a positive number less than 255 */
|
|
nr = str2s(s, strlen(s), &err);
|
|
nr = str2s(s, strlen(s), &err);
|
|
- if (err==0){
|
|
|
|
- if (nr>255){
|
|
|
|
- LM_ERR("number too big <%d> (max=255)\n",nr);
|
|
|
|
|
|
+ if(err == 0) {
|
|
|
|
+ if(nr > 255) {
|
|
|
|
+ LM_ERR("number too big <%d> (max=255)\n", nr);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
*max = (unsigned char)nr;
|
|
*max = (unsigned char)nr;
|
|
return 0;
|
|
return 0;
|
|
- }else{
|
|
|
|
- LM_ERR("bad number <%s>\n",s);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ LM_ERR("bad number <%s>\n", s);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static int get_redirect_fixup(void** param, int param_no)
|
|
|
|
|
|
+static int get_redirect_fixup(void **param, int param_no)
|
|
{
|
|
{
|
|
- unsigned char maxb,maxt;
|
|
|
|
|
|
+ unsigned char maxb, maxt;
|
|
char *p;
|
|
char *p;
|
|
char *s;
|
|
char *s;
|
|
|
|
|
|
- s = (char*)*param;
|
|
|
|
- if (param_no==1) {
|
|
|
|
- if ( (p=strchr(s,':'))!=0 ) {
|
|
|
|
|
|
+ s = (char *)*param;
|
|
|
|
+ if(param_no == 1) {
|
|
|
|
+ if((p = strchr(s, ':')) != 0) {
|
|
/* have max branch also */
|
|
/* have max branch also */
|
|
*p = 0;
|
|
*p = 0;
|
|
- if (get_nr_max(p+1, &maxb)!=0)
|
|
|
|
|
|
+ if(get_nr_max(p + 1, &maxb) != 0)
|
|
return E_UNSPEC;
|
|
return E_UNSPEC;
|
|
} else {
|
|
} else {
|
|
maxb = 0; /* infinit */
|
|
maxb = 0; /* infinit */
|
|
}
|
|
}
|
|
|
|
|
|
/* get max total */
|
|
/* get max total */
|
|
- if (get_nr_max(s, &maxt)!=0)
|
|
|
|
|
|
+ if(get_nr_max(s, &maxt) != 0)
|
|
return E_UNSPEC;
|
|
return E_UNSPEC;
|
|
|
|
|
|
pkg_free(*param);
|
|
pkg_free(*param);
|
|
- *param=(void*)(long)( (((unsigned short)maxt)<<8) | maxb);
|
|
|
|
- } else if (param_no==2) {
|
|
|
|
|
|
+ *param = (void *)(long)((((unsigned short)maxt) << 8) | maxb);
|
|
|
|
+ } else if(param_no == 2) {
|
|
/* acc function loaded? */
|
|
/* acc function loaded? */
|
|
- if (uacred_acc_fct_s.s==0 || uacred_acc_fct_s.s[0]=='\0') {
|
|
|
|
|
|
+ if(uacred_acc_fct_s.s == 0 || uacred_acc_fct_s.s[0] == '\0') {
|
|
LM_ERR("acc support enabled, but no acc function defined\n");
|
|
LM_ERR("acc support enabled, but no acc function defined\n");
|
|
return E_UNSPEC;
|
|
return E_UNSPEC;
|
|
}
|
|
}
|
|
- if (_uacred_accb.acc_request==NULL) {
|
|
|
|
|
|
+ if(_uacred_accb.acc_request == NULL) {
|
|
/* bind the ACC API */
|
|
/* bind the ACC API */
|
|
if(acc_load_api(&_uacred_accb) < 0) {
|
|
if(acc_load_api(&_uacred_accb) < 0) {
|
|
LM_ERR("cannot bind to ACC API\n");
|
|
LM_ERR("cannot bind to ACC API\n");
|
|
@@ -184,54 +178,53 @@ static int get_redirect_fixup(void** param, int param_no)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static int setf_fixup(void** param, int param_no)
|
|
|
|
|
|
+static int setf_fixup(void **param, int param_no)
|
|
{
|
|
{
|
|
unsigned short nr;
|
|
unsigned short nr;
|
|
regex_t *filter;
|
|
regex_t *filter;
|
|
char *s;
|
|
char *s;
|
|
|
|
|
|
- s = (char*)*param;
|
|
|
|
- if (param_no==1) {
|
|
|
|
|
|
+ s = (char *)*param;
|
|
|
|
+ if(param_no == 1) {
|
|
/* compile the filter */
|
|
/* compile the filter */
|
|
- if (regexp_compile( s, &filter)<0) {
|
|
|
|
|
|
+ if(regexp_compile(s, &filter) < 0) {
|
|
LM_ERR("cannot init filter <%s>\n", s);
|
|
LM_ERR("cannot init filter <%s>\n", s);
|
|
return E_BAD_RE;
|
|
return E_BAD_RE;
|
|
}
|
|
}
|
|
pkg_free(*param);
|
|
pkg_free(*param);
|
|
- *param = (void*)filter;
|
|
|
|
- } else if (param_no==2) {
|
|
|
|
- if (s==0 || s[0]==0) {
|
|
|
|
|
|
+ *param = (void *)filter;
|
|
|
|
+ } else if(param_no == 2) {
|
|
|
|
+ if(s == 0 || s[0] == 0) {
|
|
nr = 0;
|
|
nr = 0;
|
|
- } else if (strcasecmp(s,"reset_all")==0) {
|
|
|
|
- nr = RESET_ADDED|RESET_DEFAULT;
|
|
|
|
- } else if (strcasecmp(s,"reset_default")==0) {
|
|
|
|
|
|
+ } else if(strcasecmp(s, "reset_all") == 0) {
|
|
|
|
+ nr = RESET_ADDED | RESET_DEFAULT;
|
|
|
|
+ } else if(strcasecmp(s, "reset_default") == 0) {
|
|
nr = RESET_DEFAULT;
|
|
nr = RESET_DEFAULT;
|
|
- } else if (strcasecmp(s,"reset_added")==0) {
|
|
|
|
|
|
+ } else if(strcasecmp(s, "reset_added") == 0) {
|
|
nr = RESET_ADDED;
|
|
nr = RESET_ADDED;
|
|
} else {
|
|
} else {
|
|
- LM_ERR("unknown reset type <%s>\n",s);
|
|
|
|
|
|
+ LM_ERR("unknown reset type <%s>\n", s);
|
|
return E_UNSPEC;
|
|
return E_UNSPEC;
|
|
}
|
|
}
|
|
pkg_free(*param);
|
|
pkg_free(*param);
|
|
- *param = (void*)(long)nr;
|
|
|
|
|
|
+ *param = (void *)(long)nr;
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
static int regexp_compile(char *re_s, regex_t **re)
|
|
static int regexp_compile(char *re_s, regex_t **re)
|
|
{
|
|
{
|
|
*re = 0;
|
|
*re = 0;
|
|
- if (re_s==0 || strlen(re_s)==0 ) {
|
|
|
|
|
|
+ if(re_s == 0 || strlen(re_s) == 0) {
|
|
return 0;
|
|
return 0;
|
|
} else {
|
|
} else {
|
|
- if ((*re=pkg_malloc(sizeof(regex_t)))==0) {
|
|
|
|
|
|
+ if((*re = pkg_malloc(sizeof(regex_t))) == 0) {
|
|
PKG_MEM_ERROR;
|
|
PKG_MEM_ERROR;
|
|
return E_OUT_OF_MEM;
|
|
return E_OUT_OF_MEM;
|
|
}
|
|
}
|
|
- if (regcomp(*re, re_s, REG_EXTENDED|REG_ICASE|REG_NEWLINE) ){
|
|
|
|
|
|
+ if(regcomp(*re, re_s, REG_EXTENDED | REG_ICASE | REG_NEWLINE)) {
|
|
pkg_free(*re);
|
|
pkg_free(*re);
|
|
*re = 0;
|
|
*re = 0;
|
|
LM_ERR("regexp_compile:bad regexp <%s>\n", re_s);
|
|
LM_ERR("regexp_compile:bad regexp <%s>\n", re_s);
|
|
@@ -242,13 +235,12 @@ static int regexp_compile(char *re_s, regex_t **re)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
static int redirect_init(void)
|
|
static int redirect_init(void)
|
|
{
|
|
{
|
|
regex_t *filter;
|
|
regex_t *filter;
|
|
|
|
|
|
/* load the TM API */
|
|
/* load the TM API */
|
|
- if (load_tm_api(&rd_tmb)!=0) {
|
|
|
|
|
|
+ if(load_tm_api(&rd_tmb) != 0) {
|
|
LM_ERR("failed to load TM API\n");
|
|
LM_ERR("failed to load TM API\n");
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
@@ -265,31 +257,31 @@ static int redirect_init(void)
|
|
init_filters();
|
|
init_filters();
|
|
|
|
|
|
/* what's the default rule? */
|
|
/* what's the default rule? */
|
|
- if (def_filter_s) {
|
|
|
|
- if ( !strcasecmp(def_filter_s,ACCEPT_RULE_STR) ) {
|
|
|
|
- set_default_rule( ACCEPT_RULE );
|
|
|
|
- } else if ( !strcasecmp(def_filter_s,DENY_RULE_STR) ) {
|
|
|
|
- set_default_rule( DENY_RULE );
|
|
|
|
|
|
+ if(def_filter_s) {
|
|
|
|
+ if(!strcasecmp(def_filter_s, ACCEPT_RULE_STR)) {
|
|
|
|
+ set_default_rule(ACCEPT_RULE);
|
|
|
|
+ } else if(!strcasecmp(def_filter_s, DENY_RULE_STR)) {
|
|
|
|
+ set_default_rule(DENY_RULE);
|
|
} else {
|
|
} else {
|
|
- LM_ERR("unknown default filter <%s>\n",def_filter_s);
|
|
|
|
|
|
+ LM_ERR("unknown default filter <%s>\n", def_filter_s);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/* if accept filter specify, compile it */
|
|
/* if accept filter specify, compile it */
|
|
- if (regexp_compile(accept_filter_s, &filter)<0) {
|
|
|
|
|
|
+ if(regexp_compile(accept_filter_s, &filter) < 0) {
|
|
LM_ERR("failed to init accept filter\n");
|
|
LM_ERR("failed to init accept filter\n");
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
- add_default_filter( ACCEPT_FILTER, filter);
|
|
|
|
|
|
+ add_default_filter(ACCEPT_FILTER, filter);
|
|
|
|
|
|
/* if deny filter specify, compile it */
|
|
/* if deny filter specify, compile it */
|
|
- if (regexp_compile(deny_filter_s, &filter)<0) {
|
|
|
|
|
|
+ if(regexp_compile(deny_filter_s, &filter) < 0) {
|
|
LM_ERR("failed to init deny filter\n");
|
|
LM_ERR("failed to init deny filter\n");
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
- add_default_filter( DENY_FILTER, filter);
|
|
|
|
|
|
+ add_default_filter(DENY_FILTER, filter);
|
|
|
|
|
|
- if(sruid_init(&_redirect_sruid, '-', "rdir", SRUID_INC)<0)
|
|
|
|
|
|
+ if(sruid_init(&_redirect_sruid, '-', "rdir", SRUID_INC) < 0)
|
|
return -1;
|
|
return -1;
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -299,21 +291,21 @@ error:
|
|
|
|
|
|
static int child_init(int rank)
|
|
static int child_init(int rank)
|
|
{
|
|
{
|
|
- if(sruid_init(&_redirect_sruid, '-', "rdir", SRUID_INC)<0)
|
|
|
|
|
|
+ if(sruid_init(&_redirect_sruid, '-', "rdir", SRUID_INC) < 0)
|
|
return -1;
|
|
return -1;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static inline void msg_tracer(struct sip_msg* msg, int reset)
|
|
|
|
|
|
+static inline void msg_tracer(struct sip_msg *msg, int reset)
|
|
{
|
|
{
|
|
- static unsigned int id = 0;
|
|
|
|
|
|
+ static unsigned int id = 0;
|
|
static unsigned int set = 0;
|
|
static unsigned int set = 0;
|
|
|
|
|
|
- if (reset) {
|
|
|
|
|
|
+ if(reset) {
|
|
set = 0;
|
|
set = 0;
|
|
} else {
|
|
} else {
|
|
- if (set) {
|
|
|
|
- if (id!=msg->id) {
|
|
|
|
|
|
+ if(set) {
|
|
|
|
+ if(id != msg->id) {
|
|
LM_WARN("filters set but not used -> resetting to default\n");
|
|
LM_WARN("filters set but not used -> resetting to default\n");
|
|
reset_filters();
|
|
reset_filters();
|
|
id = msg->id;
|
|
id = msg->id;
|
|
@@ -326,59 +318,63 @@ static inline void msg_tracer(struct sip_msg* msg, int reset)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static int w_set_deny(struct sip_msg* msg, char *re, char *flags)
|
|
|
|
|
|
+static int w_set_deny(struct sip_msg *msg, char *re, char *flags)
|
|
{
|
|
{
|
|
- msg_tracer( msg, 0);
|
|
|
|
- return (add_filter( DENY_FILTER, (regex_t*)re, (int)(long)flags)==0)?1:-1;
|
|
|
|
|
|
+ msg_tracer(msg, 0);
|
|
|
|
+ return (add_filter(DENY_FILTER, (regex_t *)re, (int)(long)flags) == 0) ? 1
|
|
|
|
+ : -1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static int w_set_accept(struct sip_msg* msg, char *re, char *flags)
|
|
|
|
|
|
+static int w_set_accept(struct sip_msg *msg, char *re, char *flags)
|
|
{
|
|
{
|
|
- msg_tracer( msg, 0);
|
|
|
|
- return (add_filter( ACCEPT_FILTER, (regex_t*)re, (int)(long)flags)==0)?1:-1;
|
|
|
|
|
|
+ msg_tracer(msg, 0);
|
|
|
|
+ return (add_filter(ACCEPT_FILTER, (regex_t *)re, (int)(long)flags) == 0)
|
|
|
|
+ ? 1
|
|
|
|
+ : -1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static int w_get_redirect2(struct sip_msg* msg, char *max_c, char *reason)
|
|
|
|
|
|
+static int w_get_redirect2(struct sip_msg *msg, char *max_c, char *reason)
|
|
{
|
|
{
|
|
int n;
|
|
int n;
|
|
unsigned short max;
|
|
unsigned short max;
|
|
str sreason = {0};
|
|
str sreason = {0};
|
|
|
|
|
|
- if(reason!=NULL) {
|
|
|
|
- if(fixup_get_svalue(msg, (gparam_t*)reason, &sreason)<0) {
|
|
|
|
|
|
+ if(reason != NULL) {
|
|
|
|
+ if(fixup_get_svalue(msg, (gparam_t *)reason, &sreason) < 0) {
|
|
LM_ERR("failed to get reason parameter\n");
|
|
LM_ERR("failed to get reason parameter\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- msg_tracer( msg, 0);
|
|
|
|
|
|
+ msg_tracer(msg, 0);
|
|
/* get the contacts */
|
|
/* get the contacts */
|
|
max = (unsigned short)(long)max_c;
|
|
max = (unsigned short)(long)max_c;
|
|
- n = get_redirect(msg , (max>>8)&0xff, max&0xff, (reason)?&sreason:NULL, bflags);
|
|
|
|
|
|
+ n = get_redirect(msg, (max >> 8) & 0xff, max & 0xff,
|
|
|
|
+ (reason) ? &sreason : NULL, bflags);
|
|
reset_filters();
|
|
reset_filters();
|
|
/* reset the tracer */
|
|
/* reset the tracer */
|
|
- msg_tracer( msg, 1);
|
|
|
|
|
|
+ msg_tracer(msg, 1);
|
|
|
|
|
|
return n;
|
|
return n;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-static int w_get_redirect1(struct sip_msg* msg, char *max_c, char *foo)
|
|
|
|
|
|
+static int w_get_redirect1(struct sip_msg *msg, char *max_c, char *foo)
|
|
{
|
|
{
|
|
return w_get_redirect2(msg, max_c, 0);
|
|
return w_get_redirect2(msg, max_c, 0);
|
|
}
|
|
}
|
|
|
|
|
|
-static int ki_get_redirects_acc(sip_msg_t* msg, int max_c, int max_b,
|
|
|
|
- str *reason)
|
|
|
|
|
|
+static int ki_get_redirects_acc(
|
|
|
|
+ sip_msg_t *msg, int max_c, int max_b, str *reason)
|
|
{
|
|
{
|
|
int n;
|
|
int n;
|
|
|
|
|
|
msg_tracer(msg, 0);
|
|
msg_tracer(msg, 0);
|
|
/* get the contacts */
|
|
/* get the contacts */
|
|
- n = get_redirect(msg, max_c, max_b, (reason && reason->len>0)?reason:NULL,
|
|
|
|
- bflags);
|
|
|
|
|
|
+ n = get_redirect(msg, max_c, max_b,
|
|
|
|
+ (reason && reason->len > 0) ? reason : NULL, bflags);
|
|
reset_filters();
|
|
reset_filters();
|
|
/* reset the tracer */
|
|
/* reset the tracer */
|
|
msg_tracer(msg, 1);
|
|
msg_tracer(msg, 1);
|
|
@@ -386,7 +382,7 @@ static int ki_get_redirects_acc(sip_msg_t* msg, int max_c, int max_b,
|
|
return n;
|
|
return n;
|
|
}
|
|
}
|
|
|
|
|
|
-static int ki_get_redirects(sip_msg_t* msg, int max_c, int max_b)
|
|
|
|
|
|
+static int ki_get_redirects(sip_msg_t *msg, int max_c, int max_b)
|
|
{
|
|
{
|
|
int n;
|
|
int n;
|
|
|
|
|
|
@@ -400,7 +396,7 @@ static int ki_get_redirects(sip_msg_t* msg, int max_c, int max_b)
|
|
return n;
|
|
return n;
|
|
}
|
|
}
|
|
|
|
|
|
-static int ki_get_redirects_all(sip_msg_t* msg)
|
|
|
|
|
|
+static int ki_get_redirects_all(sip_msg_t *msg)
|
|
{
|
|
{
|
|
int n;
|
|
int n;
|
|
|
|
|