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

route.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 
00029 #ifndef route_h
00030 #define route_h
00031 
00032 #include <sys/types.h>
00033 #include <regex.h>
00034 #include <netdb.h>
00035 
00036 #include "config.h"
00037 #include "error.h"
00038 #include "route_struct.h"
00039 #include "action.h"
00040 #include "parser/msg_parser.h"
00041 #include "str_hash.h"
00042 
00043 /*#include "cfg_parser.h" */
00044 
00045 /* Various types of route sections, make sure that the values defined in the
00046  * macros below occupy disjunct bits so that they can also be used as flags
00047  */
00048 #define REQUEST_ROUTE (1 << 0)
00049 #define FAILURE_ROUTE (1 << 1)
00050 #define TM_ONREPLY_ROUTE (1 << 2)
00051 #define BRANCH_ROUTE  (1 << 3)
00052 #define ONSEND_ROUTE  (1 << 4)
00053 #define ERROR_ROUTE   (1 << 5)
00054 #define LOCAL_ROUTE   (1 << 6)
00055 #define CORE_ONREPLY_ROUTE (1 << 7)
00056 #define ONREPLY_ROUTE (TM_ONREPLY_ROUTE|CORE_ONREPLY_ROUTE)
00057 #define EVENT_ROUTE   REQUEST_ROUTE
00058 #define ANY_ROUTE     (0xFFFFFFFF)
00059 
00060 /* The value of this variable is one of the route types defined above and it
00061  * determines the type of the route being executed, module functions can use
00062  * this value to determine the type of the route they are being executed in
00063  */
00064 extern int route_type;
00065 
00066 #define set_route_type(type) \
00067         do {                                     \
00068                 route_type = (type); \
00069         } while(0)
00070 
00071 #define get_route_type()        route_type
00072 
00073 #define is_route_type(type) (route_type & (type))
00074 
00075 struct route_list{
00076         struct action** rlist;
00077         int idx; /* first empty entry */ 
00078         int entries; /* total number of entries */
00079         struct str_hash_table names; /* name to route index mappings */
00080 };
00081 
00082 
00083 /* main "script table" */
00084 extern struct route_list main_rt;
00085 /* main reply route table */
00086 extern struct route_list onreply_rt;
00087 extern struct route_list failure_rt;
00088 extern struct route_list branch_rt;
00089 extern struct route_list onsend_rt;
00090 extern struct route_list event_rt;
00091 
00092 /* script optimization level */
00093 extern int scr_opt_lev;
00094 
00095 int init_routes(void);
00096 void destroy_routes(void);
00097 int route_get(struct route_list* rt, char* name);
00098 int route_lookup(struct route_list* rt, char* name);
00099 
00100 void push(struct action* a, struct action** head);
00101 int add_actions(struct action* a, struct action** head);
00102 void print_rls(void);
00103 int fix_rls(void);
00104 
00105 int eval_expr(struct run_act_ctx* h, struct expr* e, struct sip_msg* msg);
00106 
00107 
00108 /* fixup functions*/
00109 int fix_actions(struct action* a);
00110 int fix_expr(struct expr* exp);
00111 
00112 
00113 
00114 #endif

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