- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,80 +0,0 @@ |
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_name(void); |
|
66 |
- |
|
67 |
-void set_max_recursive_level(unsigned int lev); |
|
68 |
- |
|
69 |
-#ifdef USE_LONGJMP |
|
70 |
-int run_actions_safe(struct run_act_ctx* c, struct action* a, |
|
71 |
- struct sip_msg* msg); |
|
72 |
-#else /*! USE_LONGJMP */ |
|
73 |
-#define run_actions_safe(c, a, m) run_actions(c, a, m) |
|
74 |
-#endif /* USE_LONGJMP */ |
|
75 |
- |
|
76 |
-void log_prefix_set(sip_msg_t *msg); |
|
77 |
- |
|
78 |
-int run_child_one_init_route(void); |
|
79 |
- |
|
80 |
-#endif |
... | ... |
@@ -40,14 +40,14 @@ |
40 | 40 |
#endif |
41 | 41 |
|
42 | 42 |
|
43 |
-struct run_act_ctx{ |
|
43 |
+typedef struct run_act_ctx { |
|
44 | 44 |
int rec_lev; |
45 | 45 |
int run_flags; |
46 | 46 |
int last_retcode; /* return from last route */ |
47 | 47 |
#ifdef USE_LONGJMP |
48 | 48 |
jmp_buf jmp_env; |
49 | 49 |
#endif |
50 |
-}; |
|
50 |
+} run_act_ctx_t; |
|
51 | 51 |
|
52 | 52 |
|
53 | 53 |
#define init_run_actions_ctx(ph) \ |
- the event_route[core:worker-one-init] is executed if defined in
kamailio.cfg after the first udp sip worker process executed the
child_init() for all modules, before starting to process sip traffic
- note that due to forking, other sip workers can get faster to
listening for sip traffic
... | ... |
@@ -1,22 +1,14 @@ |
1 | 1 |
/* |
2 |
- * $Id$ |
|
3 |
- * |
|
4 |
- * |
|
5 | 2 |
* Copyright (C) 2001-2003 FhG Fokus |
6 | 3 |
* |
7 |
- * This file is part of ser, a free SIP server. |
|
4 |
+ * This file is part of Kamailio, a free SIP server. |
|
8 | 5 |
* |
9 |
- * ser is free software; you can redistribute it and/or modify |
|
6 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
10 | 7 |
* it under the terms of the GNU General Public License as published by |
11 | 8 |
* the Free Software Foundation; either version 2 of the License, or |
12 | 9 |
* (at your option) any later version |
13 | 10 |
* |
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: |
|
17 |
- * info@iptel.org |
|
18 |
- * |
|
19 |
- * ser is distributed in the hope that it will be useful, |
|
11 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
20 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | 14 |
* GNU General Public License for more details. |
... | ... |
@@ -28,7 +20,7 @@ |
28 | 20 |
|
29 | 21 |
/*! |
30 | 22 |
* \file |
31 |
- * \brief SIP-router core :: |
|
23 |
+ * \brief SIP-router core :: Actions |
|
32 | 24 |
* \ingroup core |
33 | 25 |
* Module: \ref core |
34 | 26 |
*/ |
- can be used to set what prefix to be printed for each log message
while processing a SIP message
- can contain variables
- example:
log_prefix="[$mt $hdr(CSeq) $ci]"
... | ... |
@@ -23,7 +23,7 @@ |
23 | 23 |
* |
24 | 24 |
* You should have received a copy of the GNU General Public License |
25 | 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 |
|
26 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
27 | 27 |
*/ |
28 | 28 |
|
29 | 29 |
/*! |
- replace define ROUTE_MAX_REC_LEV with config paramter
- number of allowed recusive levels can be set in config now
- it affects calls of route blocks and chained if { ... } else if { ...
} else ...
... | ... |
@@ -72,6 +72,8 @@ cfg_action_t *get_cfg_crt_action(void); |
72 | 72 |
int get_cfg_crt_line(void); |
73 | 73 |
char *get_cfg_crt_name(void); |
74 | 74 |
|
75 |
+void set_max_recursive_level(unsigned int lev); |
|
76 |
+ |
|
75 | 77 |
#ifdef USE_LONGJMP |
76 | 78 |
int run_actions_safe(struct run_act_ctx* c, struct action* a, |
77 | 79 |
struct sip_msg* msg); |
... | ... |
@@ -69,6 +69,8 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
69 | 69 |
int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c); |
70 | 70 |
|
71 | 71 |
cfg_action_t *get_cfg_crt_action(void); |
72 |
+int get_cfg_crt_line(void); |
|
73 |
+char *get_cfg_crt_name(void); |
|
72 | 74 |
|
73 | 75 |
#ifdef USE_LONGJMP |
74 | 76 |
int run_actions_safe(struct run_act_ctx* c, struct action* a, |
- can be retrieved by module to access name of config file and the line
... | ... |
@@ -68,6 +68,7 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
68 | 68 |
|
69 | 69 |
int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c); |
70 | 70 |
|
71 |
+cfg_action_t *get_cfg_crt_action(void); |
|
71 | 72 |
|
72 | 73 |
#ifdef USE_LONGJMP |
73 | 74 |
int run_actions_safe(struct run_act_ctx* c, struct action* a, |
When having commands that end the script immediately in
assignments (e.g. $foo = { drop; }) or in expressions
(e.g. if ($v + { drop; } > 0)), the script was terminated
immediately via longjmp. However this might leave some un-freed
variables.
This fix introduces a safe version of run_actions()
(run_actions_safe()) that will not use longjmp() to immediately
end the whole script on drop, returning instead to its caller.
... | ... |
@@ -68,4 +68,12 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
68 | 68 |
|
69 | 69 |
int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c); |
70 | 70 |
|
71 |
+ |
|
72 |
+#ifdef USE_LONGJMP |
|
73 |
+int run_actions_safe(struct run_act_ctx* c, struct action* a, |
|
74 |
+ struct sip_msg* msg); |
|
75 |
+#else /*! USE_LONGJMP */ |
|
76 |
+#define run_actions_safe(c, a, m) run_actions(c, a, m) |
|
77 |
+#endif /* USE_LONGJMP */ |
|
78 |
+ |
|
71 | 79 |
#endif |
- functions calling run_top_route() can get access to context fields if
they need
- modules updated to new function signature
... | ... |
@@ -59,6 +59,6 @@ struct run_act_ctx{ |
59 | 59 |
int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
60 | 60 |
int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
61 | 61 |
|
62 |
-int run_top_route(struct action* a, sip_msg_t* msg); |
|
62 |
+int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c); |
|
63 | 63 |
|
64 | 64 |
#endif |
Function run_top_route can be used to initialize the environment before
a SIP message starts processing in *_route blocks. Internally it resets
the script flags, resets the select buffer, initializes the environment
using init_run_actions_ctx and passes control to the specified route
section.
... | ... |
@@ -59,8 +59,6 @@ struct run_act_ctx{ |
59 | 59 |
int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
60 | 60 |
int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
61 | 61 |
|
62 |
- |
|
63 |
- |
|
64 |
- |
|
62 |
+int run_top_route(struct action* a, sip_msg_t* msg); |
|
65 | 63 |
|
66 | 64 |
#endif |
... | ... |
@@ -30,14 +30,34 @@ |
30 | 30 |
#ifndef action_h |
31 | 31 |
#define action_h |
32 | 32 |
|
33 |
-#include "parser/msg_parser.h" |
|
33 |
+#define USE_LONGJMP |
|
34 |
+ |
|
34 | 35 |
#include "route_struct.h" |
35 | 36 |
|
36 |
-extern unsigned int run_flags; |
|
37 |
-extern int last_retcode; |
|
37 |
+#include "parser/msg_parser.h" |
|
38 |
+ |
|
39 |
+#ifdef USE_LONGJMP |
|
40 |
+#include <setjmp.h> |
|
41 |
+#endif |
|
42 |
+ |
|
43 |
+ |
|
44 |
+struct run_act_ctx{ |
|
45 |
+ int rec_lev; |
|
46 |
+ int run_flags; |
|
47 |
+ int last_retcode; /* return from last route */ |
|
48 |
+#ifdef USE_LONGJMP |
|
49 |
+ jmp_buf jmp_env; |
|
50 |
+#endif |
|
51 |
+}; |
|
52 |
+ |
|
53 |
+ |
|
54 |
+#define init_run_actions_ctx(ph) \ |
|
55 |
+ do{\ |
|
56 |
+ (ph)->rec_lev=(ph)->run_flags=(ph)->last_retcode=0; \ |
|
57 |
+ }while(0) |
|
38 | 58 |
|
39 |
-int do_action(struct action* a, struct sip_msg* msg); |
|
40 |
-int run_actions(struct action* a, struct sip_msg* msg); |
|
59 |
+int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
|
60 |
+int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg); |
|
41 | 61 |
|
42 | 62 |
|
43 | 63 |
|
... | ... |
@@ -21,8 +21,8 @@ |
21 | 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | 22 |
* GNU General Public License for more details. |
23 | 23 |
* |
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 |
|
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 | 26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
27 | 27 |
*/ |
28 | 28 |
|
... | ... |
@@ -33,6 +33,7 @@ |
33 | 33 |
#include "parser/msg_parser.h" |
34 | 34 |
#include "route_struct.h" |
35 | 35 |
|
36 |
+extern unsigned int run_flags; |
|
36 | 37 |
extern int last_retcode; |
37 | 38 |
|
38 | 39 |
int do_action(struct action* a, struct sip_msg* msg); |
... | ... |
@@ -1,8 +1,32 @@ |
1 | 1 |
/* |
2 | 2 |
* $Id$ |
3 | 3 |
* |
4 |
+ * |
|
5 |
+ * Copyright (C) 2001-2003 Fhg Fokus |
|
6 |
+ * |
|
7 |
+ * This file is part of ser, a free SIP server. |
|
8 |
+ * |
|
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 |
|
13 |
+ * |
|
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: |
|
17 |
+ * info@iptel.org |
|
18 |
+ * |
|
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. |
|
23 |
+ * |
|
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 |
|
4 | 27 |
*/ |
5 | 28 |
|
29 |
+ |
|
6 | 30 |
#ifndef action_h |
7 | 31 |
#define action_h |
8 | 32 |
|
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ */ |
|
5 |
+ |
|
6 |
+#ifndef action_h |
|
7 |
+#define action_h |
|
8 |
+ |
|
9 |
+#include "msg_parser.h" |
|
10 |
+#include "route_struct.h" |
|
11 |
+ |
|
12 |
+int do_action(struct action* a, struct sip_msg* msg); |
|
13 |
+int run_actions(struct action* a, struct sip_msg* msg); |
|
14 |
+ |
|
15 |
+ |
|
16 |
+ |
|
17 |
+ |
|
18 |
+ |
|
19 |
+#endif |