[sr-dev] git:master: core: internal difference between cfg drop and exit

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 8 23:28:57 CEST 2009


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Jul  8 23:24:52 2009 +0200

core: internal difference between cfg drop and exit

- drop sets the flag for exit and one extra: EXIT_R_F and DROP_R_F
- no difference in processing right now (DROP_R_F not tested anywhere
  yet)

---

 cfg.lex        |    4 +++-
 cfg.y          |   21 +++++++++++++++++++--
 route_struct.h |    1 +
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/cfg.lex b/cfg.lex
index a93a16f..8180948 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -149,7 +149,8 @@ FORWARD_TCP	forward_tcp
 FORWARD_UDP	forward_udp
 FORWARD_TLS	forward_tls
 FORWARD_SCTP	forward_sctp
-DROP	"drop"|"exit"
+DROP	"drop"
+EXIT	"exit"
 RETURN	"return"
 BREAK	"break"
 SEND	send
@@ -486,6 +487,7 @@ EAT_ABLE	[\ \t\b\r]
 <INITIAL>{FORWARD_SCTP}	{count(); yylval.strval=yytext; return FORWARD_SCTP;}
 <INITIAL>{FORWARD_UDP}	{count(); yylval.strval=yytext; return FORWARD_UDP; }
 <INITIAL>{DROP}	{ count(); yylval.strval=yytext; return DROP; }
+<INITIAL>{EXIT}	{ count(); yylval.strval=yytext; return EXIT; }
 <INITIAL>{RETURN}	{ count(); yylval.strval=yytext; return RETURN; }
 <INITIAL>{BREAK}	{ count(); yylval.strval=yytext; return BREAK; }
 <INITIAL>{SEND}	{ count(); yylval.strval=yytext; return SEND; }
diff --git a/cfg.y b/cfg.y
index 487fadb..a5ff046 100644
--- a/cfg.y
+++ b/cfg.y
@@ -265,6 +265,7 @@ static int case_check_default(struct case_stms* stms);
 %token FORWARD_UDP
 %token SEND
 %token SEND_TCP
+%token EXIT
 %token DROP
 %token RETURN
 %token BREAK
@@ -2940,18 +2941,34 @@ func_param:
 
 ret_cmd:
 	DROP LPAREN RPAREN		{
-		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); 
+		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST,
+						(void*)(DROP_R_F|EXIT_R_F)); 
 	}
 	| DROP rval_expr	{
-		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)EXIT_R_F);
+		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST,
+						(void*)(DROP_R_F|EXIT_R_F)); 
 	}
 	| DROP				{
+		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, 
+						(void*)(DROP_R_F|EXIT_R_F)); 
+	}
+	| EXIT LPAREN RPAREN		{
+		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); 
+	}
+	| EXIT rval_expr	{
+		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)EXIT_R_F);
+	}
+	| EXIT				{
 		$$=mk_action(DROP_T, 2, NUMBER_ST, 0, NUMBER_ST, (void*)EXIT_R_F); 
 	}
 	| RETURN			{
 		$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
 						(void*)RETURN_R_F);
 	}
+	| RETURN  LPAREN RPAREN		{
+		$$=mk_action(DROP_T, 2, NUMBER_ST, (void*)1, NUMBER_ST,
+						(void*)RETURN_R_F);
+	}
 	| RETURN rval_expr	{
 		$$=mk_action(DROP_T, 2, RVE_ST, $2, NUMBER_ST, (void*)RETURN_R_F);
 	}
diff --git a/route_struct.h b/route_struct.h
index ea4dd96..340cbf6 100644
--- a/route_struct.h
+++ b/route_struct.h
@@ -109,6 +109,7 @@ enum { NOSUBTYPE=0, STRING_ST, NET_ST, NUMBER_ST, IP_ST, RE_ST, PROXY_ST,
 #define EXIT_R_F   1
 #define RETURN_R_F 2
 #define BREAK_R_F  4
+#define DROP_R_F   8
 
 
 struct cfg_pos{




More information about the sr-dev mailing list