00001 /* 00002 * $Id: route.h 5003 2008-09-26 11:01:51Z henningw $ 00003 * 00004 * Copyright (C) 2001-2003 FhG Fokus 00005 * 00006 * This file is part of Kamailio, a free SIP server. 00007 * 00008 * Kamailio 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 * Kamailio is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 /*! 00024 * \file 00025 * \brief SIP routing engine 00026 */ 00027 00028 #ifndef route_h 00029 #define route_h 00030 00031 #include <sys/types.h> 00032 #include <regex.h> 00033 #include <netdb.h> 00034 00035 #include "pvar.h" 00036 #include "config.h" 00037 #include "error.h" 00038 #include "route_struct.h" 00039 #include "parser/msg_parser.h" 00040 00041 /*#include "cfg_parser.h" */ 00042 00043 00044 extern struct action* rlist[RT_NO]; /*!< main "script table" */ 00045 extern struct action* onreply_rlist[ONREPLY_RT_NO]; /*!< main reply route table */ 00046 extern struct action* failure_rlist[FAILURE_RT_NO]; /*!< Failure route table */ 00047 extern struct action* branch_rlist[BRANCH_RT_NO]; /*!< Branch routes table */ 00048 #ifdef USE_LOCAL_ROUTE 00049 extern struct action* local_rlist; /*!< Local route table */ 00050 #endif 00051 extern struct action* error_rlist; /*!< Error route table */ 00052 00053 #define REQUEST_ROUTE 1 /*!< Request route block */ 00054 #define FAILURE_ROUTE 2 /*!< Negative-reply route block */ 00055 #define ONREPLY_ROUTE 4 /*!< Received-reply route block */ 00056 #define BRANCH_ROUTE 8 /*!< Sending-branch route block */ 00057 #define ERROR_ROUTE 16 /*!< Error-handling route block */ 00058 #define LOCAL_ROUTE 32 /*!< Local-requests route block */ 00059 00060 extern int route_type; 00061 00062 #define set_route_type(_new_type) \ 00063 do{\ 00064 route_type=_new_type;\ 00065 }while(0) 00066 00067 #define swap_route_type(_backup, _new_type) \ 00068 do{\ 00069 _backup=route_type;\ 00070 route_type=_new_type;\ 00071 }while(0) 00072 00073 #define is_route_type(_type) (route_type==_type) 00074 00075 void init_route_lists(void); 00076 void push(struct action* a, struct action** head); 00077 int add_actions(struct action* a, struct action** head); 00078 void print_rl(void); 00079 int fix_rls(void); 00080 int check_rls(void); 00081 00082 int eval_expr(struct expr* e, struct sip_msg* msg, pv_value_t *val); 00083 00084 00085 #endif
1.5.6