5 * Copyright (C) 2001-2003 FhG Fokus
7 * This file is part of ser, a free SIP server.
9 * ser is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version
14 * For a license to use the ser software under conditions
15 * other than those described here, or to purchase support for this
16 * software, please contact iptel.org by e-mail at the following addresses:
19 * ser is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 * 2003-04-12 FORCE_RPORT_T added (andrei)
32 * 2003-04-22 strip_tail added (jiri)
33 * 2003-10-10 >,<,>=,<=, != and MSGLEN_O added (andrei)
34 * 2003-10-28 FORCE_TCP_ALIAS added (andrei)
35 * 2004-02-24 added LOAD_AVP_T and AVP_TO_URI_T (bogdan)
36 * 2005-12-11 added SND{IP,PORT,PROTO,AF}_O & TO{IP,PORT}_O (andrei)
37 * 2005-12-19 select framework added SELECT_O and SELECT_ST (mma)
38 * 2008-12-17 added UDP_MTU_TRY_PROTO_T (andrei)
42 #ifndef route_struct_h
43 #define route_struct_h
45 #include <sys/types.h>
50 #define EXPR_DROP -127 /* used only by the expression and if evaluator */
52 * Other important values (no macros for them yet):
54 * expr false = 0 (used only inside the expression and if evaluator)
56 * action continue or if used in condition true = 1
57 * action drop/quit/stop script processing = 0
58 * action error or if used in condition false = -1 (<0 and !=EXPR_DROP)
63 enum { EXP_T=1, ELEM_T };
64 enum { LOGAND_OP=1, LOGOR_OP, NOT_OP, BINAND_OP, BINOR_OP };
65 enum { EQUAL_OP=10, MATCH_OP, GT_OP, LT_OP, GTE_OP, LTE_OP, DIFF_OP, NO_OP };
66 enum { METHOD_O=1, URI_O, FROM_URI_O, TO_URI_O, SRCIP_O, SRCPORT_O,
67 DSTIP_O, DSTPORT_O, PROTO_O, AF_O, MSGLEN_O, DEFAULT_O, ACTION_O,
68 NUMBER_O, AVP_O, SNDIP_O, SNDPORT_O, TOIP_O, TOPORT_O, SNDPROTO_O,
69 SNDAF_O, RETCODE_O, SELECT_O};
71 enum { FORWARD_T=1, SEND_T, DROP_T, LOG_T, ERROR_T, ROUTE_T, EXEC_T,
72 SET_HOST_T, SET_HOSTPORT_T, SET_USER_T, SET_USERPASS_T,
73 SET_PORT_T, SET_URI_T, SET_HOSTPORTTRANS_T,
75 SETFLAG_T, RESETFLAG_T, ISFLAGSET_T ,
77 LEN_GT_T, PREFIX_T, STRIP_T,STRIP_TAIL_T,
96 enum { NOSUBTYPE=0, STRING_ST, NET_ST, NUMBER_ST, IP_ST, RE_ST, PROXY_ST,
97 EXPR_ST, ACTIONS_ST, MODEXP_ST, MODFIXUP_ST, URIHOST_ST, URIPORT_ST,
98 MYSELF_ST, STR_ST, SOCKID_ST, SOCKETINFO_ST, ACTION_ST, AVP_ST, SELECT_ST,
105 /* Expression operand */
108 long numval; /* must have the same size as a void*/
119 int type; /* exp, exp_elem */
120 int op; /* and, or, not | ==, =~ */
138 #define MAX_ACTIONS 4
141 int type; /* forward, drop, log, send ...*/
143 action_u_t val[MAX_ACTIONS];
147 struct expr* mk_exp(int op, struct expr* left, struct expr* right);
148 struct expr* mk_elem(int op, int ltype, void* lparam, int rtype, void* rparam);
150 struct action* mk_action(int type, int count/* of couples {type,val} */, .../* int type1, void *val1 [, int type2, void *val2, ...] */);
151 struct action* append_action(struct action* a, struct action* b);
153 void print_action(struct action* a);
154 void print_actions(struct action* a);
155 void print_expr(struct expr* exp);