示例#1
0
/*
 * Check if host in Request URI is local
 */
int is_uri_host_local(struct sip_msg* _msg, char* _s1, char* _s2)
{
	str branch;
	qvalue_t q;
	struct sip_uri puri;

	if ((route_type == REQUEST_ROUTE) || (route_type == BRANCH_ROUTE)) {
		if (parse_sip_msg_uri(_msg) < 0) {
			LM_ERR("Error while parsing R-URI\n");
			return -1;
		}
		return is_domain_local(&(_msg->parsed_uri.host));
	} else if (route_type == FAILURE_ROUTE) {
			branch.s = get_branch(0, &branch.len, &q, 0, 0, 0, 0);
			if (branch.s) {
				if (parse_uri(branch.s, branch.len, &puri) < 0) {
					LM_ERR("Error while parsing branch URI\n");
					return -1;
				}
				return is_domain_local(&(puri.host));
			} else {
				LM_ERR("Branch is missing, error in script\n");
				return -1;
			}
	} else {
		LM_ERR("Unsupported route type\n");
		return -1;
	}
}
示例#2
0
/*
 * Check if host in Request URI is local
 */
int is_uri_host_local(struct sip_msg* _msg, char* _s1, char* _s2)
{
	if (parse_sip_msg_uri(_msg) < 0) {
		LM_ERR("Error while parsing R-URI\n");
		return -1;
	}
	return is_domain_local(_msg, &(_msg->parsed_uri.host), _s1);
}
示例#3
0
文件: domain.c 项目: OPSF/uClinux
/*
 * Check if host in Request URI is local
 */
int is_uri_host_local(struct sip_msg* _msg, char* _s1, char* _s2)
{
	if (parse_sip_msg_uri(_msg) < 0) {
	    LOG(L_ERR, "is_uri_host_local(): Error while parsing URI\n");
	    return -1;
	}

	return is_domain_local(&(_msg->parsed_uri.host));
}
示例#4
0
/*
 * Check if host in From uri is local
 */
int is_from_local(struct sip_msg* _msg, char* _s1, char* _s2)
{
	struct sip_uri *puri;

	if ((puri=parse_from_uri(_msg))==NULL) {
		LM_ERR("Error while parsing From header\n");
		return -2;
	}

	return is_domain_local(_msg, &(puri->host), _s1);

}
示例#5
0
static int is_domain_alias(char* name, int len, unsigned short port,
														unsigned short proto)
{
	str domain;

	domain.s = name;
	domain.len = len;
	if (is_domain_local(&domain)==1) {
		return 1;
	}
	return 0;
}
示例#6
0
文件: domain.c 项目: OPSF/uClinux
/*
 * Check if host in From uri is local
 */
int is_from_local(struct sip_msg* _msg, char* _s1, char* _s2)
{
	str uri;
	struct sip_uri puri;

	if (parse_from_header(_msg) < 0) {
		LOG(L_ERR, "is_from_local(): Error while parsing From header\n");
		return -2;
	}

	uri = get_from(_msg)->uri;

	if (parse_uri(uri.s, uri.len, &puri) < 0) {
		LOG(L_ERR, "is_from_local(): Error while parsing URI\n");
		return -3;
	}

	return is_domain_local(&(puri.host));

}
示例#7
0
/*
 * Check if domain given as value of pseudo variable parameter is local
 */
int w_is_domain_local(struct sip_msg* _msg, char* _sp, char* _s2)
{
    pv_spec_t *sp;
    pv_value_t pv_val;

    sp = (pv_spec_t *)_sp;

    if (sp && (pv_get_spec_value(_msg, sp, &pv_val) == 0)) {
	if (pv_val.flags & PV_VAL_STR) {
	    if (pv_val.rs.len == 0 || pv_val.rs.s == NULL) {
		LM_DBG("Missing domain name\n");
		return -1;
	    }
	    return is_domain_local(_msg, &(pv_val.rs), _s2);
	} else {
	   LM_DBG("Pseudo variable value is not string\n");
	   return -1;
	}
    } else {
	LM_DBG("Cannot get pseudo variable value\n");
	return -1;
    }
}