Browse code

core: added km_parse_avp_spec()

- K compatible avp spec parser

Daniel-Constantin Mierla authored on 01/06/2009 17:36:54
Showing 2 changed files
... ...
@@ -1031,6 +1031,24 @@ void free_avp_ident(avp_ident_t* attr)
1031 1031
 	}
1032 1032
 }
1033 1033
 
1034
+int km_parse_avp_spec( str *name, int *type, int_str *avp_name)
1035
+{
1036
+	char *p;
1037
+	int index = 0;
1038
+
1039
+	if (name==0 || name->s==0 || name->len==0)
1040
+		return -1;
1041
+
1042
+	p = (char*)memchr((void*)name->s, ':', name->len);
1043
+	if (p==NULL) {
1044
+		/* it's an avp alias */
1045
+		return lookup_avp_galias( name, type, avp_name);
1046
+	} else {
1047
+		return parse_avp_name( name, type, avp_name, &index);
1048
+	}
1049
+}
1050
+
1051
+
1034 1052
 int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index)
1035 1053
 {
1036 1054
 	str alias;
... ...
@@ -216,6 +216,7 @@ int add_avp_galias(str *alias, int type, int_str avp_name);
216 216
 int parse_avp_ident( str *name, avp_ident_t* attr);
217 217
 int parse_avp_name( str *name, int *type, int_str *avp_name, int *index);
218 218
 int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index);
219
+int km_parse_avp_spec( str *name, int *type, int_str *avp_name);
219 220
 void free_avp_name( avp_flags_t *type, int_str *avp_name);
220 221
 /* Free an ident obtained with parse_avp_ident() */
221 222
 void free_avp_ident(avp_ident_t* attr);