1 /*
2  * Copyright (C) 2001-2003 FhG Fokus
3  *
4  * This file is part of Kamailio, a free SIP server.
5  *
6  * Kamailio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version
10  *
11  * Kamailio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 /*!
22  * \file
23  * \brief Kamailio core :: Actions
24  * \ingroup core
25  * Module: \ref core
26  */
27 
28 
29 #ifndef action_h
30 #define action_h
31 
32 #define USE_LONGJMP
33 
34 #include "route_struct.h"
35 
36 #include "parser/msg_parser.h"
37 
38 #ifdef USE_LONGJMP
39 #include <setjmp.h>
40 #endif
41 
42 
43 typedef struct run_act_ctx {
44 	int rec_lev;
45 	int run_flags;
46 	int last_retcode; /* return from last route */
47 #ifdef USE_LONGJMP
48 	jmp_buf jmp_env;
49 #endif
50 } run_act_ctx_t;
51 
52 
53 #define init_run_actions_ctx(ph) \
54 	do{\
55 		(ph)->rec_lev=(ph)->run_flags=(ph)->last_retcode=0; \
56 	}while(0)
57 
58 int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
59 int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
60 
61 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
62 
63 cfg_action_t *get_cfg_crt_action(void);
64 int get_cfg_crt_line(void);
65 char *get_cfg_crt_file_name(void);
66 char *get_cfg_crt_route_name(void);
67 
68 void set_max_recursive_level(unsigned int lev);
69 
70 #ifdef USE_LONGJMP
71 int run_actions_safe(struct run_act_ctx* c, struct action* a,
72 						struct sip_msg* msg);
73 #else /*! USE_LONGJMP */
74 #define run_actions_safe(c, a, m) run_actions(c, a, m)
75 #endif /* USE_LONGJMP */
76 
77 void log_prefix_set(sip_msg_t *msg);
78 
79 int run_child_one_init_route(void);
80 
81 #endif
82