Ejemplo n.º 1
0
int parse_avp_spec( str *name, int *avp_name)
{
	int id, extra;

	if (name==0 || name->s==0 || name->len==0)
		return -1;

	extra = last_avp_index_shm ? 1 : 0;

	if (name->len > 2 && name->s[1] == AVP_NAME_DELIM &&
			(name->s[0] == 'i' || name->s[0] == 's'))
		LM_WARN("Deprecated AVP name format \"%.*s\" - use \"%.*s\" instead\n",
				name->len, name->s, name->len - 2, name->s + 2);

	id = lookup_avp_alias_str(name, extra);
	if (id < 0) {
		id = extra ? new_avp_extra_alias(name) : new_avp_alias(name);
		if (id < 0) {
			LM_ERR("cannot add new avp\n");
			return -1;
		}
	}
	if (avp_name)
		*avp_name = id;
	return 0;
}
Ejemplo n.º 2
0
static int parse_avp_spec_aux( str *name, int *avp_name, int extra)
{
	int id;

	if (name==0 || name->s==0 || name->len==0)
		return -1;

	id = lookup_avp_alias_str(name, extra);
	if (id < 0) {
		if (name->len > 2 && name->s[1] == AVP_NAME_DELIM &&
				(name->s[0] == 'i' || name->s[0] == 's'))
			LM_WARN("Deprecated AVP name format \"%.*s\" - use \"%.*s\" instead\n",
					name->len, name->s, name->len - 2, name->s + 2);
		id = extra ? new_avp_extra_alias(name) : new_avp_alias(name);
		if (id < 0)
			return -1;
	}
	if (avp_name)
		*avp_name = id;
	return 0;
}