Browse Source

AVP CLASS & TRACK specification in the script changed to following options:

-f. (or none) FROM USER
-t.  TO USER
-fd. FROM DOMAIN
-td. TO DOMAIN
-g.  GLOBAL (FROM by default)
Michal Matyska 19 năm trước cách đây
mục cha
commit
18cf23c0a8
2 tập tin đã thay đổi với 56 bổ sung47 xóa
  1. 9 11
      cfg.lex
  2. 47 36
      cfg.y

+ 9 - 11
cfg.lex

@@ -199,11 +199,11 @@ MINUS	"-"
 /* Attribute specification */
 ATTR_MARK   "$"|"%"
 SELECT_MARK  "@"
-ATTR_FROM   "from"|"f"
-ATTR_TO     "to"|"t"
-ATTR_USER   "user"|"u"
-ATTR_DOMAIN "domain"|"d"
-ATTR_GLOBAL "global"|"g"
+ATTR_FROMUSER     "f"
+ATTR_TOUSER       "t"
+ATTR_FROMDOMAIN   "fd"
+ATTR_TODOMAIN     "td"
+ATTR_GLOBAL       "g"
 
 /* config vars. */
 DEBUG	debug
@@ -504,12 +504,10 @@ EAT_ABLE	[\ \t\b\r]
 
 
 <INITIAL>{ATTR_MARK}    { count(); state = ATTR_S; BEGIN(ATTR); return ATTR_MARK; }
-<ATTR>{ATTR_FROM}       { count(); return ATTR_FROM; }
-<ATTR>{ATTR_TO}         { count(); return ATTR_TO; }
-<ATTR>{LBRACK}          { count(); return LBRACK; }
-<ATTR>{RBRACK}          { count(); return RBRACK; }
-<ATTR>{ATTR_USER}       { count(); return ATTR_USER; }
-<ATTR>{ATTR_DOMAIN}     { count(); return ATTR_DOMAIN; }
+<ATTR>{ATTR_FROMUSER}   { count(); return ATTR_FROMUSER; }
+<ATTR>{ATTR_TOUSER}     { count(); return ATTR_TOUSER; }
+<ATTR>{ATTR_FROMDOMAIN} { count(); return ATTR_FROMDOMAIN; }
+<ATTR>{ATTR_TODOMAIN}   { count(); return ATTR_TODOMAIN; }
 <ATTR>{ATTR_GLOBAL}     { count(); return ATTR_GLOBAL; }
 <ATTR>{DOT}             { count(); return DOT; }
 <ATTR>{ID}		{ count(); addstr(&s_buf, yytext, yyleng); 

+ 47 - 36
cfg.y

@@ -277,10 +277,10 @@ static struct socket_id* mk_listen_id(char*, int, int);
 
 %token ATTR_MARK
 %token SELECT_MARK
-%token ATTR_FROM
-%token ATTR_TO
-%token ATTR_USER
-%token ATTR_DOMAIN
+%token ATTR_FROMUSER
+%token ATTR_TOUSER
+%token ATTR_FROMDOMAIN
+%token ATTR_TODOMAIN
 %token ATTR_GLOBAL
 %token ADDEQ
 
@@ -336,7 +336,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
 %type <strval> host_sep
 %type <intval> uri_type
 %type <attr> attr_id
-%type <intval> class_id
+//%type <intval> class_id
 %type <intval> assign_op
 %type <select> select_id
 /*%type <route_el> rules;
@@ -1292,10 +1292,10 @@ if_cmd:		IF exp stm				{ $$=mk_action3( IF_T,
 									}
 	;
 
-class_id : LBRACK ATTR_USER RBRACK { $$ = AVP_CLASS_USER; }
-         | LBRACK ATTR_DOMAIN RBRACK { $$ = AVP_CLASS_DOMAIN; }
-         | LBRACK ATTR_GLOBAL RBRACK { $$ = AVP_CLASS_GLOBAL; }
-;
+//class_id : LBRACK ATTR_USER RBRACK { $$ = AVP_CLASS_USER; }
+//         | LBRACK ATTR_DOMAIN RBRACK { $$ = AVP_CLASS_DOMAIN; }
+//         | LBRACK ATTR_GLOBAL RBRACK { $$ = AVP_CLASS_GLOBAL; }
+//;
 
 select_param : ID { 
 		    if (sel.n >= MAX_SELECT_PARAMS-1) {
@@ -1341,37 +1341,48 @@ attr_id : ATTR_MARK ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp
                          s_attr->name.s.s = $2; s_attr->name.s.len = strlen($2); 
                          $$ = s_attr; 
                        }
-        | ATTR_MARK class_id DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
-                                      if (!s_attr) { yyerror("No memory left"); }
-                                      s_attr->type = AVP_NAME_STR | $2;
-                                      s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4); 
-                                      $$ = s_attr; 
-                                    }
-        | ATTR_MARK ATTR_FROM DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
+//        | ATTR_MARK class_id DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
+//                                      if (!s_attr) { yyerror("No memory left"); }
+//                                      s_attr->type = AVP_NAME_STR | $2;
+//                                      s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4); 
+//                                      $$ = s_attr; 
+//                                    }
+        | ATTR_MARK ATTR_FROMUSER DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
+                                       if (!s_attr) { yyerror("No memory left"); }
+                                       s_attr->type = AVP_NAME_STR | AVP_TRACK_FROM | AVP_CLASS_USER;
+                                       s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4);
+                                       $$ = s_attr;
+                                     }
+        | ATTR_MARK ATTR_TOUSER DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
+                                       if (!s_attr) { yyerror("No memory left"); }
+                                       s_attr->type = AVP_NAME_STR | AVP_TRACK_TO | AVP_CLASS_USER;
+                                       s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4);
+                                       $$ = s_attr;
+                                     }
+        | ATTR_MARK ATTR_FROMDOMAIN DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
+                                       if (!s_attr) { yyerror("No memory left"); }
+                                       s_attr->type = AVP_NAME_STR | AVP_TRACK_FROM | AVP_CLASS_DOMAIN;
+                                       s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4);
+                                       $$ = s_attr;
+                                     }
+        | ATTR_MARK ATTR_TODOMAIN DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
+                                       if (!s_attr) { yyerror("No memory left"); }
+                                       s_attr->type = AVP_NAME_STR | AVP_TRACK_TO | AVP_CLASS_DOMAIN;
+                                       s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4);
+                                       $$ = s_attr;
+                                     }
+        | ATTR_MARK ATTR_GLOBAL DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
                                        if (!s_attr) { yyerror("No memory left"); }
-                                       s_attr->type = AVP_NAME_STR | AVP_TRACK_FROM;
+                                       s_attr->type = AVP_NAME_STR | AVP_CLASS_GLOBAL;
                                        s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4);
                                        $$ = s_attr;
                                      }
-        | ATTR_MARK ATTR_TO DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
-                                     if (!s_attr) { yyerror("No memory left"); }
-                                     s_attr->type = AVP_NAME_STR | AVP_TRACK_TO; 
-                                     s_attr->name.s.s = $4; s_attr->name.s.len = strlen($4); 
-                                     $$ = s_attr;
-                                   }
-        | ATTR_MARK ATTR_FROM class_id DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
-                                               if (!s_attr) { yyerror("No memory left"); }
-                                               s_attr->type = AVP_NAME_STR | AVP_TRACK_FROM | $3; 
-                                               s_attr->name.s.s = $5; 
-                                               s_attr->name.s.len = strlen($5);
-                                               $$ = s_attr;
-                                              }
-        | ATTR_MARK ATTR_TO class_id DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
-                                              if (!s_attr) { yyerror("No memory left"); }
-                                              s_attr->type = AVP_NAME_STR | AVP_TRACK_TO | $3;
-                                              s_attr->name.s.s = $5; s_attr->name.s.len = strlen($5);
-                                             $$ = s_attr;
-                                            }
+//        | ATTR_MARK ATTR_TO class_id DOT ID { s_attr = (struct avp_spec*)pkg_malloc(sizeof(struct avp_spec));
+//                                              if (!s_attr) { yyerror("No memory left"); }
+//                                              s_attr->type = AVP_NAME_STR | AVP_TRACK_TO | $3;
+//                                              s_attr->name.s.s = $5; s_attr->name.s.len = strlen($5);
+//                                             $$ = s_attr;
+//                                            }
 ;
 
 assign_op : ADDEQ { $$ = ADD_T; }