예제 #1
0
파일: ratelimit.c 프로젝트: gbour/kamailio
static int w_rl_check_forced(struct sip_msg* msg, char *p1, char *p2)
{
	int pipe = -1;
	pv_value_t pv_val;

	if (p1 && (pv_get_spec_value(msg, (pv_spec_t *)p1, &pv_val) == 0)) {
		if (pv_val.flags & PV_VAL_INT) {
			pipe = pv_val.ri;
			LM_DBG("pipe=%d\n", pipe);
		} else if (pv_val.flags & PV_VAL_STR) {
			if(str2int(&(pv_val.rs), (unsigned int*)&pipe) != 0) {
				LM_ERR("Unable to get pipe from pv '%.*s'"
					"=> defaulting to method type checking\n",
					pv_val.rs.len, pv_val.rs.s);
				pipe = -1;
			}
		} else {
			LM_ERR("pv not a str or int => defaulting to method type checking\n");
			pipe = -1;
		}
	} else {
		LM_ERR("Unable to get pipe from pv:%p"
			" => defaulting to method type checking\n", p1);
		pipe = -1;
	}
	return rl_check(msg, pipe);
}
예제 #2
0
파일: ratelimit.c 프로젝트: gbour/kamailio
static int w_rl_check_forced_pipe(struct sip_msg* msg, char *p1, char *p2)
{
	int pipe;

	pipe = (int)(unsigned int)(unsigned long)p1;
	LM_DBG("trying pipe %d\n", pipe);
	return rl_check(msg, pipe);
}
예제 #3
0
static int w_rl_check(struct sip_msg* msg, char *p1, char *p2) 
{
	int pipe;

	LOG(L_DBG, "w_rl_check (%p, %p)\n", p1, p2);

	if (!p1 || get_int_fparam(&pipe, msg, (fparam_t *)p1) < 0) {
		LOG(L_DBG, "using the pipe associated with the current req. method\n");
		pipe = -1;
	}

	return rl_check(msg, pipe);
}
예제 #4
0
파일: ratelimit.c 프로젝트: gbour/kamailio
static int w_rl_check_default(struct sip_msg* msg, char *p1, char *p2)
{
	return rl_check(msg, -1);
}