Module: kamailio Branch: master Commit: 5af1a114d879f36fbe1982c32e27b497926487c0 URL: https://github.com/kamailio/kamailio/commit/5af1a114d879f36fbe1982c32e27b497...
Author: Alex Hermann alex@hexla.nl Committer: Henning Westerholt henningw@users.noreply.github.com Date: 2019-02-11T21:42:26+01:00
core/parser: Add parser for 'flags' param in Contact header
---
Modified: src/core/parser/contact/contact.c Modified: src/core/parser/contact/contact.h Modified: src/core/parser/parse_param.c Modified: src/core/parser/parse_param.h
---
Diff: https://github.com/kamailio/kamailio/commit/5af1a114d879f36fbe1982c32e27b497... Patch: https://github.com/kamailio/kamailio/commit/5af1a114d879f36fbe1982c32e27b497...
---
diff --git a/src/core/parser/contact/contact.c b/src/core/parser/contact/contact.c index 06b85dd5dd..61a40e3bd8 100644 --- a/src/core/parser/contact/contact.c +++ b/src/core/parser/contact/contact.c @@ -244,6 +244,7 @@ int parse_contacts(str* _s, contact_t** _c) c->methods = hooks.contact.methods; c->instance = hooks.contact.instance; c->reg_id = hooks.contact.reg_id; + c->flags = hooks.contact.flags;
if (_s->len == 0) goto ok; } @@ -314,6 +315,7 @@ void print_contacts(FILE* _o, contact_t* _c) 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, "flags : %p\n", ptr->flags); fprintf(_o, "len : %d\n", ptr->len); if (ptr->params) { print_params(_o, ptr->params); diff --git a/src/core/parser/contact/contact.h b/src/core/parser/contact/contact.h index c2d63aef71..b72f9e59d9 100644 --- a/src/core/parser/contact/contact.h +++ b/src/core/parser/contact/contact.h @@ -50,6 +50,7 @@ typedef struct contact { param_t* received; /* received parameter hook */ param_t* instance; /* sip.instance parameter hook */ param_t* reg_id; /* reg-id parameter hook */ + param_t* flags; /* flags 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/src/core/parser/parse_param.c b/src/core/parser/parse_param.c index 5af3993cb9..b80ffbdcc0 100644 --- a/src/core/parser/parse_param.c +++ b/src/core/parser/parse_param.c @@ -173,6 +173,14 @@ static inline void parse_contact_class(param_hooks_t *_h, param_t *_p) _h->contact.ob = _p; } break; + case 'f': + case 'F': + if ((_p->name.len == 5) && + (!strncasecmp(_p->name.s + 1, "lags", 4))) { + _p->type = P_FLAGS; + _h->contact.flags = _p; + } + break; } }
@@ -673,6 +681,9 @@ static inline void print_param(FILE *_o, param_t *_p) case P_METHODS: type = "P_METHODS"; break; + case P_FLAGS: + type = "P_FLAGS"; + break; case P_TRANSPORT: type = "P_TRANSPORT"; break; diff --git a/src/core/parser/parse_param.h b/src/core/parser/parse_param.h index 1007358125..ebb3ac56d6 100644 --- a/src/core/parser/parse_param.h +++ b/src/core/parser/parse_param.h @@ -44,6 +44,7 @@ typedef enum ptype { P_EXPIRES, /*!< Contact: expires parameter */ P_METHODS, /*!< Contact: methods parameter */ P_RECEIVED, /*!< Contact: received parameter */ + P_FLAGS, /*!< Contact: flags parameter */ P_TRANSPORT, /*!< URI: transport parameter */ P_LR, /*!< URI: lr parameter */ P_R2, /*!< URI: r2 parameter (ser specific) */ @@ -98,6 +99,7 @@ struct contact_hooks { struct param* instance; /*!< sip.instance parameter */ struct param* reg_id; /*!< reg-id parameter */ struct param* ob; /*!< ob parameter */ + struct param* flags; /*!< flags parameter */ };