00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00044
00045
00046
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
00061
00062
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;
00078 int entries;
00079 struct str_hash_table names;
00080 };
00081
00082
00083
00084 extern struct route_list main_rt;
00085
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
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
00109 int fix_actions(struct action* a);
00110 int fix_expr(struct expr* exp);
00111
00112
00113
00114 #endif