Module: sip-router
Branch: master
Commit: 1dd730471dd0620d02b08ce69648c94fc0943818
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1dd7304…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Apr 13 14:38:48 2012 +0200
parser: added hook to gr (gruu) parameter in sip_uri_t
- gr is specified by GRUU RFC5627
---
parser/msg_parser.h | 2 +
parser/parse_uri.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 54 insertions(+), 1 deletions(-)
diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index cf78326..593c4b4 100644
--- a/parser/msg_parser.h
+++ b/parser/msg_parser.h
@@ -212,6 +212,7 @@ struct sip_uri {
str method;
str lr;
str r2; /*!< ser specific rr parameter */
+ str gr;
str transport_val; /*!< transport value */
str ttl_val; /*!< TTL value */
str user_param_val; /*!< User= param value */
@@ -219,6 +220,7 @@ struct sip_uri {
str method_val; /*!< Method value */
str lr_val; /*!< lr value placeholder for lr=on a.s.o*/
str r2_val;
+ str gr_val;
#ifdef USE_COMP
unsigned short comp;
#endif
diff --git a/parser/parse_uri.c b/parser/parse_uri.c
index e6cedcf..a244cf2 100644
--- a/parser/parse_uri.c
+++ b/parser/parse_uri.c
@@ -82,6 +82,8 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
PLR_L, PLR_R_FIN, PLR_eq,
/* r2 */
PR2_R, PR2_2_FIN, PR2_eq,
+ /* gr */
+ PGR_G, PGR_R_FIN, PGR_eq,
#ifdef USE_COMP
/* comp */
PCOMP_C, PCOMP_O, PCOMP_M, PCOMP_P, PCOMP_eq,
@@ -644,6 +646,11 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
b=p;
state=PR2_R;
break;
+ case 'g':
+ case 'G':
+ b=p;
+ state=PGR_G;
+ break;
#ifdef USE_COMP
case 'c':
case 'C':
@@ -856,6 +863,42 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
state=URI_VAL_P;
}
break;
+ /* gr */
+ param_switch(PGR_G, 'r', 'R', PGR_R_FIN);
+ case PGR_R_FIN:
+ switch(*p){
+ case '@':
+ still_at_user;
+ break;
+ case '=':
+ state=PGR_eq;
+ break;
+ semicolon_case;
+ uri->gr.s=b;
+ uri->gr.len=(p-b);
+ break;
+ question_case;
+ uri->gr.s=b;
+ uri->gr.len=(p-b);
+ break;
+ colon_case;
+ break;
+ default:
+ state=URI_PARAM_P;
+ }
+ break;
+ /* handle gr=something case */
+ case PGR_eq:
+ param=&uri->gr;
+ param_val=&uri->gr_val;
+ switch(*p){
+ param_common_cases;
+ default:
+ v=p;
+ state=URI_VAL_P;
+ }
+ break;
+
#ifdef USE_COMP
param_switch(PCOMP_C, 'o', 'O' , PCOMP_O);
param_switch(PCOMP_O, 'm', 'M' , PCOMP_M);
@@ -1007,7 +1050,8 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
case PM_D:
case PM_eq:
case PLR_L: /* lr */
- case PR2_R: /* r2 */
+ case PR2_R: /* r2 */
+ case PGR_G: /* gr */
#ifdef USE_COMP
case PCOMP_C:
case PCOMP_O:
@@ -1033,6 +1077,13 @@ int parse_uri(char* buf, int len, struct sip_uri* uri)
uri->r2.s=b;
uri->r2.len=p-b;
break;
+ case PGR_R_FIN:
+ case PGR_eq:
+ uri->params.s=s;
+ uri->params.len=p-s;
+ uri->gr.s=b;
+ uri->gr.len=p-b;
+ break;
case URI_VAL_P:
/* intermediate value states */
case VU_U: