Module: sip-router
Branch: master
Commit: 34b688d7ecba60268bae2a24e62dcc4a0d80c91f
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=34b688d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Jun 1 20:36:54 2009 +0300
core: added km_parse_avp_spec()
- K compatible avp spec parser
---
usr_avp.c | 18 ++++++++++++++++++
usr_avp.h | 1 +
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/usr_avp.c b/usr_avp.c
index 2a25dfd..17d4cc9 100644
--- a/usr_avp.c
+++ b/usr_avp.c
@@ -1031,6 +1031,24 @@ void free_avp_ident(avp_ident_t* attr)
}
}
+int km_parse_avp_spec( str *name, int *type, int_str *avp_name)
+{
+ char *p;
+ int index = 0;
+
+ if (name==0 || name->s==0 || name->len==0)
+ return -1;
+
+ p = (char*)memchr((void*)name->s, ':', name->len);
+ if (p==NULL) {
+ /* it's an avp alias */
+ return lookup_avp_galias( name, type, avp_name);
+ } else {
+ return parse_avp_name( name, type, avp_name, &index);
+ }
+}
+
+
int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index)
{
str alias;
diff --git a/usr_avp.h b/usr_avp.h
index 871c310..324bad4 100644
--- a/usr_avp.h
+++ b/usr_avp.h
@@ -216,6 +216,7 @@ int add_avp_galias(str *alias, int type, int_str avp_name);
int parse_avp_ident( str *name, avp_ident_t* attr);
int parse_avp_name( str *name, int *type, int_str *avp_name, int *index);
int parse_avp_spec( str *name, int *type, int_str *avp_name, int *index);
+int km_parse_avp_spec( str *name, int *type, int_str *avp_name);
void free_avp_name( avp_flags_t *type, int_str *avp_name);
/* Free an ident obtained with parse_avp_ident() */
void free_avp_ident(avp_ident_t* attr);