Browse Source

parser: added hook for reg-id param of Contact header

Daniel-Constantin Mierla 13 years ago
parent
commit
506be363fa
4 changed files with 10 additions and 1 deletions
  1. 3 1
      parser/contact/contact.c
  2. 1 0
      parser/contact/contact.h
  3. 4 0
      parser/parse_param.c
  4. 2 0
      parser/parse_param.h

+ 3 - 1
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);

+ 1 - 0
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 */

+ 4 - 0
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 '+':

+ 2 - 0
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 */
 };