Module: sip-router
Branch: master
Commit: 506be363fa75b04540f724644fabb7f48cd60eab
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=506be36…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Apr 17 00:16:52 2012 +0200
parser: added hook for reg-id param of Contact header
---
parser/contact/contact.c | 4 +++-
parser/contact/contact.h | 1 +
parser/parse_param.c | 4 ++++
parser/parse_param.h | 2 ++
4 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/parser/contact/contact.c b/parser/contact/contact.c
index 4b953f3..cc8bc5a 100644
--- a/parser/contact/contact.c
+++ b/parser/contact/contact.c
@@ -248,6 +248,7 @@ int parse_contacts(str* _s, contact_t** _c)
c->received = hooks.contact.received;
c->methods = hooks.contact.methods;
c->instance = hooks.contact.instance;
+ c->reg_id = hooks.contact.reg_id;
if (_s->len == 0) goto ok;
}
@@ -315,8 +316,9 @@ void print_contacts(FILE* _o, contact_t* _c)
fprintf(_o, "q : %p\n", ptr->q);
fprintf(_o, "expires : %p\n", ptr->expires);
fprintf(_o, "received: %p\n", ptr->received);
- fprintf(_o, "methods : %p\n", ptr->methods);
+ fprintf(_o, "methods : %p\n", ptr->methods);
fprintf(_o, "instance: %p\n", ptr->instance);
+ fprintf(_o, "reg-id : %p\n", ptr->reg_id);
fprintf(_o, "len : %d\n", ptr->len);
if (ptr->params) {
print_params(_o, ptr->params);
diff --git a/parser/contact/contact.h b/parser/contact/contact.h
index 1865bd4..71d9f50 100644
--- a/parser/contact/contact.h
+++ b/parser/contact/contact.h
@@ -51,6 +51,7 @@ typedef struct contact {
param_t* methods; /* methods parameter hook */
param_t* received; /* received parameter hook */
param_t* instance; /* sip.instance parameter hook */
+ param_t* reg_id; /* reg-id parameter hook */
param_t* params; /* List of all parameters */
int len; /* Total length of the element */
struct contact* next; /* Next contact in the list */
diff --git a/parser/parse_param.c b/parser/parse_param.c
index 951d1d6..986b873 100644
--- a/parser/parse_param.c
+++ b/parser/parse_param.c
@@ -159,6 +159,10 @@ static inline void parse_contact_class(param_hooks_t* _h, param_t*
_p)
(!strncasecmp(_p->name.s + 1, "eceived", 7))) {
_p->type = P_RECEIVED;
_h->contact.received = _p;
+ } else if((_p->name.len == 6) &&
+ (!strncasecmp(_p->name.s + 1, "eg-id", 5))) {
+ _p->type = P_REG_ID;
+ _h->contact.reg_id = _p;
}
break;
case '+':
diff --git a/parser/parse_param.h b/parser/parse_param.h
index edcc62f..e0b15fd 100644
--- a/parser/parse_param.h
+++ b/parser/parse_param.h
@@ -62,6 +62,7 @@ typedef enum ptype {
P_DSTIP, /*!< URI: dstip parameter */
P_DSTPORT, /*!< URi: dstport parameter */
P_INSTANCE, /*!< Contact: sip.instance parameter */
+ P_REG_ID, /*!< Contact: reg-id parameter */
P_FTAG, /*!< URI: ftag parameter */
P_CALL_ID, /*!< Dialog event package: call-id */
P_FROM_TAG, /*!< Dialog event package: from-tag */
@@ -104,6 +105,7 @@ struct contact_hooks {
struct param* methods; /*!< methods parameter */
struct param* received; /*!< received parameter */
struct param* instance; /*!< sip.instance parameter */
+ struct param* reg_id; /*!< reg-id parameter */
};