• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • Directories
  • File List
  • Globals

switch.h

00001 /* 
00002  * $Id$
00003  * 
00004  * Copyright (C) 2009 iptelorg GmbH
00005  *
00006  * Permission to use, copy, modify, and distribute this software for any
00007  * purpose with or without fee is hereby granted, provided that the above
00008  * copyright notice and this permission notice appear in all copies.
00009  *
00010  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00011  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00012  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
00013  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00014  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00015  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00016  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00017  */
00018 /*
00019  * /home/andrei/sr.git/switch.h
00020  */
00021 /*
00022  * History:
00023  * --------
00024  *  2009-02-02  initial version (andrei)
00025 */
00026 
00027 #ifndef __switch_h
00028 #define __switch_h
00029 
00030 #include <stddef.h>
00031 #include <regex.h>
00032 
00033 #include "route_struct.h"
00034 
00035 
00036 struct case_stms{
00037         struct rval_expr* ct_rve;
00038         struct action* actions;
00039         struct case_stms* next;
00040         struct case_stms** append;
00041         int type;     
00042         int re_flags; 
00043         int is_default;
00044         union {
00045                 int match_int;
00046                 str match_str;
00047                 regex_t* match_re;
00048         } label;  
00049 };
00050 
00051 
00052 struct switch_cond_table{
00053         int n;                  
00054         int* cond;              
00055         struct action** jump;   
00056         struct action* def;     
00057 };
00058 
00059 
00060 struct switch_jmp_table{
00061         int first;              
00062         int last;               
00063         struct action** tbl;    
00064         struct switch_cond_table rest; 
00065 };
00066 
00067 
00068 enum match_str_type { MATCH_UNKNOWN, MATCH_INT, MATCH_STR, MATCH_RE };
00069 
00070 struct match_str{
00071         enum match_str_type type;
00072         int flags;               
00073         union{
00074                 str s;              /* string */
00075                 regex_t* regex;     
00076         }l;
00077 };
00078 
00079 struct match_cond_table{
00080         int n;                   
00081         struct match_str* match; 
00082         struct action** jump;    
00083         struct action* def;      
00084 };
00085 
00086 int fix_switch(struct action* t);
00087 
00088 #endif /*__switch_h*/
00089 
00090 /* vi: set ts=4 sw=4 tw=79:ai:cindent: */

Generated on Tue May 22 2012 13:10:16 for SIP Router by  doxygen 1.7.1