[sr-dev] git:master: core: request_route alised to main route block

Daniel-Constantin Mierla miconda at gmail.com
Sun May 22 17:25:30 CEST 2011


Module: sip-router
Branch: master
Commit: 3bf9b2c6fd7f65af8aef54f37858fb7e48e50ab6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3bf9b2c6fd7f65af8aef54f37858fb7e48e50ab6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun May 22 14:48:05 2011 +0200

core: request_route alised to main route block

- request_route { ... } can be used instead of main route { ... }
- more suggestive in relation with its purpose and easier to spot and
  refer to it

---

 cfg.lex |    2 ++
 cfg.y   |    9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/cfg.lex b/cfg.lex
index 50c23cc..02439ae 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -200,6 +200,7 @@ SEND_TCP	send_tcp
 LOG		log
 ERROR	error
 ROUTE	route
+ROUTE_REQUEST request_route
 ROUTE_FAILURE failure_route
 ROUTE_ONREPLY onreply_route
 ROUTE_BRANCH branch_route
@@ -585,6 +586,7 @@ SUBST       subst
 <INITIAL>{AVPFLAGS_DECL}	{ count(); yylval.strval=yytext; return AVPFLAGS_DECL; }
 <INITIAL>{MSGLEN}	{ count(); yylval.strval=yytext; return MSGLEN; }
 <INITIAL>{ROUTE}	{ count(); yylval.strval=yytext; return ROUTE; }
+<INITIAL>{ROUTE_REQUEST}	{ count(); yylval.strval=yytext; return ROUTE_REQUEST; }
 <INITIAL>{ROUTE_ONREPLY}	{ count(); yylval.strval=yytext;
 								return ROUTE_ONREPLY; }
 <INITIAL>{ROUTE_FAILURE}	{ count(); yylval.strval=yytext;
diff --git a/cfg.y b/cfg.y
index 1da6b8c..f67ce7c 100644
--- a/cfg.y
+++ b/cfg.y
@@ -307,6 +307,7 @@ extern char *finame;
 %token LOG_TOK
 %token ERROR
 %token ROUTE
+%token ROUTE_REQUEST
 %token ROUTE_FAILURE
 %token ROUTE_ONREPLY
 %token ROUTE_BRANCH
@@ -1769,8 +1770,13 @@ route_name:		NUMBER	{
 			|	STRING	{ $$=$1; }
 ;
 
+
+route_main:	ROUTE { ; }
+		  | ROUTE_REQUEST { ; }
+;
+
 route_stm:
-	ROUTE LBRACE actions RBRACE {
+	route_main LBRACE actions RBRACE {
 	#ifdef SHM_MEM
 		if (!shm_initialized() && init_shm()<0) {
 			yyerror("Can't initialize shared memory");
@@ -1798,6 +1804,7 @@ route_stm:
 		push($6, &main_rt.rlist[i_tmp]);
 	}
 	| ROUTE error { yyerror("invalid  route  statement"); }
+	| ROUTE_REQUEST error { yyerror("invalid  request_route  statement"); }
 	;
 failure_route_stm:
 	ROUTE_FAILURE LBRACE actions RBRACE {




More information about the sr-dev mailing list