- 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 :: Script callbacks |
|
24 |
- * \ingroup core |
|
25 |
- * Module: \ref core |
|
26 |
- */ |
|
27 |
- |
|
28 |
-#ifndef _SCRIPT_CB_H_ |
|
29 |
-#define _SCRIPT_CB_H_ |
|
30 |
- |
|
31 |
-#include "parser/msg_parser.h" |
|
32 |
- |
|
33 |
-typedef int (cb_function)(struct sip_msg *msg, unsigned int flags, void *param); |
|
34 |
- |
|
35 |
- |
|
36 |
-#define PRE_SCRIPT_CB (1<<30) |
|
37 |
-#define POST_SCRIPT_CB (1<<31) |
|
38 |
- |
|
39 |
-/* Pre- and post-script callback flags. Use these flags to register |
|
40 |
- * for the callbacks, and to check the type of the callback from the |
|
41 |
- * functions. |
|
42 |
- * (Power of 2 so more callbacks can be registered at once.) |
|
43 |
- */ |
|
44 |
-enum script_cb_flag { REQUEST_CB=1, FAILURE_CB=2, ONREPLY_CB=4, |
|
45 |
- BRANCH_CB=8, ONSEND_CB=16, ERROR_CB=32, |
|
46 |
- LOCAL_CB=64, EVENT_CB=128, BRANCH_FAILURE_CB=256 }; |
|
47 |
- |
|
48 |
-/* Callback types used for executing the callbacks. |
|
49 |
- * Keep in sync with script_cb_flag!!! |
|
50 |
- */ |
|
51 |
-enum script_cb_type { REQUEST_CB_TYPE=1, FAILURE_CB_TYPE, ONREPLY_CB_TYPE, |
|
52 |
- BRANCH_CB_TYPE, ONSEND_CB_TYPE, ERROR_CB_TYPE, |
|
53 |
- LOCAL_CB_TYPE, EVENT_CB_TYPE, BRANCH_FAILURE_CB_TYPE, MAX_CB_TYPE }; |
|
54 |
- |
|
55 |
-struct script_cb{ |
|
56 |
- cb_function *cbf; |
|
57 |
- struct script_cb *next; |
|
58 |
- void *param; |
|
59 |
-}; |
|
60 |
- |
|
61 |
-/* Register pre- or post-script callbacks. |
|
62 |
- * Returns -1 on error, 0 on success |
|
63 |
- */ |
|
64 |
-int register_script_cb( cb_function f, unsigned int flags, void *param ); |
|
65 |
- |
|
66 |
-int init_script_cb(void); |
|
67 |
-void destroy_script_cb(void); |
|
68 |
- |
|
69 |
-/* Execute pre-script callbacks of a given type. |
|
70 |
- * Returns 0 on error, 1 on success |
|
71 |
- */ |
|
72 |
-int exec_pre_script_cb( struct sip_msg *msg, enum script_cb_type type); |
|
73 |
- |
|
74 |
-/* Execute post-script callbacks of a given type. |
|
75 |
- * Always returns 1, success. |
|
76 |
- */ |
|
77 |
-int exec_post_script_cb( struct sip_msg *msg, enum script_cb_type type); |
|
78 |
- |
|
79 |
-#endif |
|
80 |
- |
... | ... |
@@ -1,21 +1,14 @@ |
1 | 1 |
/* |
2 |
- * $Id$ |
|
3 |
- * |
|
4 | 2 |
* Copyright (C) 2001-2003 FhG Fokus |
5 | 3 |
* |
6 |
- * This file is part of ser, a free SIP server. |
|
4 |
+ * This file is part of Kamailio, a free SIP server. |
|
7 | 5 |
* |
8 |
- * ser is free software; you can redistribute it and/or modify |
|
6 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
9 | 7 |
* it under the terms of the GNU General Public License as published by |
10 | 8 |
* the Free Software Foundation; either version 2 of the License, or |
11 | 9 |
* (at your option) any later version |
12 | 10 |
* |
13 |
- * For a license to use the ser software under conditions |
|
14 |
- * other than those described here, or to purchase support for this |
|
15 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
16 |
- * info@iptel.org |
|
17 |
- * |
|
18 |
- * ser is distributed in the hope that it will be useful, |
|
11 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
19 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | 14 |
* GNU General Public License for more details. |
... | ... |
@@ -24,11 +17,12 @@ |
24 | 17 |
* along with this program; if not, write to the Free Software |
25 | 18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
26 | 19 |
* |
27 |
- * History: |
|
28 |
- * -------- |
|
29 |
- * 2005-02-13 script callbacks devided into request and reply types (bogdan) |
|
30 |
- * 2009-06-01 Added pre- and post-script callback support for all types |
|
31 |
- * of route blocks. (Miklos) |
|
20 |
+ */ |
|
21 |
+/*! |
|
22 |
+ * \file |
|
23 |
+ * \brief Kamailio core :: Script callbacks |
|
24 |
+ * \ingroup core |
|
25 |
+ * Module: \ref core |
|
32 | 26 |
*/ |
33 | 27 |
|
34 | 28 |
#ifndef _SCRIPT_CB_H_ |
... | ... |
@@ -22,7 +22,7 @@ |
22 | 22 |
* |
23 | 23 |
* You should have received a copy of the GNU General Public License |
24 | 24 |
* along with this program; if not, write to the Free Software |
25 |
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
25 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
26 | 26 |
* |
27 | 27 |
* History: |
28 | 28 |
* -------- |
... | ... |
@@ -49,14 +49,14 @@ typedef int (cb_function)(struct sip_msg *msg, unsigned int flags, void *param); |
49 | 49 |
*/ |
50 | 50 |
enum script_cb_flag { REQUEST_CB=1, FAILURE_CB=2, ONREPLY_CB=4, |
51 | 51 |
BRANCH_CB=8, ONSEND_CB=16, ERROR_CB=32, |
52 |
- LOCAL_CB=64, EVENT_CB=128 }; |
|
52 |
+ LOCAL_CB=64, EVENT_CB=128, BRANCH_FAILURE_CB=256 }; |
|
53 | 53 |
|
54 | 54 |
/* Callback types used for executing the callbacks. |
55 | 55 |
* Keep in sync with script_cb_flag!!! |
56 | 56 |
*/ |
57 | 57 |
enum script_cb_type { REQUEST_CB_TYPE=1, FAILURE_CB_TYPE, ONREPLY_CB_TYPE, |
58 | 58 |
BRANCH_CB_TYPE, ONSEND_CB_TYPE, ERROR_CB_TYPE, |
59 |
- LOCAL_CB_TYPE, EVENT_CB_TYPE }; |
|
59 |
+ LOCAL_CB_TYPE, EVENT_CB_TYPE, BRANCH_FAILURE_CB_TYPE, MAX_CB_TYPE }; |
|
60 | 60 |
|
61 | 61 |
struct script_cb{ |
62 | 62 |
cb_function *cbf; |
Remove new branch_failure_route in favour of an event_route
This reverts commit a5946574cb9917f0a9a90ea547c9357f3f6477bd.
... | ... |
@@ -49,15 +49,14 @@ typedef int (cb_function)(struct sip_msg *msg, unsigned int flags, void *param); |
49 | 49 |
*/ |
50 | 50 |
enum script_cb_flag { REQUEST_CB=1, FAILURE_CB=2, ONREPLY_CB=4, |
51 | 51 |
BRANCH_CB=8, ONSEND_CB=16, ERROR_CB=32, |
52 |
- LOCAL_CB=64, EVENT_CB=128, BRANCH_FAILURE_CB=256 }; |
|
52 |
+ LOCAL_CB=64, EVENT_CB=128 }; |
|
53 | 53 |
|
54 | 54 |
/* Callback types used for executing the callbacks. |
55 | 55 |
* Keep in sync with script_cb_flag!!! |
56 | 56 |
*/ |
57 | 57 |
enum script_cb_type { REQUEST_CB_TYPE=1, FAILURE_CB_TYPE, ONREPLY_CB_TYPE, |
58 | 58 |
BRANCH_CB_TYPE, ONSEND_CB_TYPE, ERROR_CB_TYPE, |
59 |
- LOCAL_CB_TYPE, EVENT_CB_TYPE, BRANCH_FAILURE_CB_TYPE, |
|
60 |
- CB_TYPE_MAX}; |
|
59 |
+ LOCAL_CB_TYPE, EVENT_CB_TYPE }; |
|
61 | 60 |
|
62 | 61 |
struct script_cb{ |
63 | 62 |
cb_function *cbf; |
- New branch_failure_route defined
- cfg route is called but xlog() causes segfault
... | ... |
@@ -49,14 +49,15 @@ typedef int (cb_function)(struct sip_msg *msg, unsigned int flags, void *param); |
49 | 49 |
*/ |
50 | 50 |
enum script_cb_flag { REQUEST_CB=1, FAILURE_CB=2, ONREPLY_CB=4, |
51 | 51 |
BRANCH_CB=8, ONSEND_CB=16, ERROR_CB=32, |
52 |
- LOCAL_CB=64, EVENT_CB=128 }; |
|
52 |
+ LOCAL_CB=64, EVENT_CB=128, BRANCH_FAILURE_CB=256 }; |
|
53 | 53 |
|
54 | 54 |
/* Callback types used for executing the callbacks. |
55 | 55 |
* Keep in sync with script_cb_flag!!! |
56 | 56 |
*/ |
57 | 57 |
enum script_cb_type { REQUEST_CB_TYPE=1, FAILURE_CB_TYPE, ONREPLY_CB_TYPE, |
58 | 58 |
BRANCH_CB_TYPE, ONSEND_CB_TYPE, ERROR_CB_TYPE, |
59 |
- LOCAL_CB_TYPE, EVENT_CB_TYPE }; |
|
59 |
+ LOCAL_CB_TYPE, EVENT_CB_TYPE, BRANCH_FAILURE_CB_TYPE, |
|
60 |
+ CB_TYPE_MAX}; |
|
60 | 61 |
|
61 | 62 |
struct script_cb{ |
62 | 63 |
cb_function *cbf; |
In C language, a declaration in the form int f(); is equivalent to int f(...);, thus being able to accept an indefinit number of parameters. With the -Wstrict-prototypes GCC options, these declarations are reported as "function declaration isn’t a prototype".
On some cases, this may trick the compiler into generating unoptimized code (like preparing to handle variadic argument list).
In all cases having a declaration int f() and a definition inf f(int) is missleading, even if standard compliant.
This is still Work in Progress. (maybe adding the -Wstrict-prototypes option to default is desireable)
... | ... |
@@ -69,8 +69,8 @@ struct script_cb{ |
69 | 69 |
*/ |
70 | 70 |
int register_script_cb( cb_function f, unsigned int flags, void *param ); |
71 | 71 |
|
72 |
-int init_script_cb(); |
|
73 |
-void destroy_script_cb(); |
|
72 |
+int init_script_cb(void); |
|
73 |
+void destroy_script_cb(void); |
|
74 | 74 |
|
75 | 75 |
/* Execute pre-script callbacks of a given type. |
76 | 76 |
* Returns 0 on error, 1 on success |
- Added pre- and post-script callback support
for all kind of route blocks.
- req/rpl is changed to be a flag, so more callback types
can be registered at once this way. The flag is passed to
the callback function.
... | ... |
@@ -27,6 +27,8 @@ |
27 | 27 |
* History: |
28 | 28 |
* -------- |
29 | 29 |
* 2005-02-13 script callbacks devided into request and reply types (bogdan) |
30 |
+ * 2009-06-01 Added pre- and post-script callback support for all types |
|
31 |
+ * of route blocks. (Miklos) |
|
30 | 32 |
*/ |
31 | 33 |
|
32 | 34 |
#ifndef _SCRIPT_CB_H_ |
... | ... |
@@ -34,30 +36,51 @@ |
34 | 36 |
|
35 | 37 |
#include "parser/msg_parser.h" |
36 | 38 |
|
37 |
-typedef int (cb_function)( struct sip_msg *msg, void *param ); |
|
39 |
+typedef int (cb_function)(struct sip_msg *msg, unsigned int flags, void *param); |
|
38 | 40 |
|
39 | 41 |
|
40 |
-#define PRE_SCRIPT_CB (1<<0) |
|
41 |
-#define POST_SCRIPT_CB (1<<1) |
|
42 |
-#define REQ_TYPE_CB (1<<2) |
|
43 |
-#define RPL_TYPE_CB (1<<3) |
|
42 |
+#define PRE_SCRIPT_CB (1<<30) |
|
43 |
+#define POST_SCRIPT_CB (1<<31) |
|
44 | 44 |
|
45 |
+/* Pre- and post-script callback flags. Use these flags to register |
|
46 |
+ * for the callbacks, and to check the type of the callback from the |
|
47 |
+ * functions. |
|
48 |
+ * (Power of 2 so more callbacks can be registered at once.) |
|
49 |
+ */ |
|
50 |
+enum script_cb_flag { REQUEST_CB=1, FAILURE_CB=2, ONREPLY_CB=4, |
|
51 |
+ BRANCH_CB=8, ONSEND_CB=16, ERROR_CB=32, |
|
52 |
+ LOCAL_CB=64, EVENT_CB=128 }; |
|
53 |
+ |
|
54 |
+/* Callback types used for executing the callbacks. |
|
55 |
+ * Keep in sync with script_cb_flag!!! |
|
56 |
+ */ |
|
57 |
+enum script_cb_type { REQUEST_CB_TYPE=1, FAILURE_CB_TYPE, ONREPLY_CB_TYPE, |
|
58 |
+ BRANCH_CB_TYPE, ONSEND_CB_TYPE, ERROR_CB_TYPE, |
|
59 |
+ LOCAL_CB_TYPE, EVENT_CB_TYPE }; |
|
45 | 60 |
|
46 | 61 |
struct script_cb{ |
47 | 62 |
cb_function *cbf; |
48 | 63 |
struct script_cb *next; |
49 |
- unsigned int id; |
|
50 | 64 |
void *param; |
51 | 65 |
}; |
52 | 66 |
|
53 |
-int register_script_cb( cb_function f, int type, void *param ); |
|
67 |
+/* Register pre- or post-script callbacks. |
|
68 |
+ * Returns -1 on error, 0 on success |
|
69 |
+ */ |
|
70 |
+int register_script_cb( cb_function f, unsigned int flags, void *param ); |
|
71 |
+ |
|
72 |
+int init_script_cb(); |
|
54 | 73 |
void destroy_script_cb(); |
55 | 74 |
|
56 |
-int exec_pre_req_cb( struct sip_msg *msg); |
|
57 |
-int exec_post_req_cb( struct sip_msg *msg); |
|
75 |
+/* Execute pre-script callbacks of a given type. |
|
76 |
+ * Returns 0 on error, 1 on success |
|
77 |
+ */ |
|
78 |
+int exec_pre_script_cb( struct sip_msg *msg, enum script_cb_type type); |
|
58 | 79 |
|
59 |
-int exec_pre_rpl_cb( struct sip_msg *msg); |
|
60 |
-int exec_post_rpl_cb( struct sip_msg *msg); |
|
80 |
+/* Execute post-script callbacks of a given type. |
|
81 |
+ * Always returns 1, success. |
|
82 |
+ */ |
|
83 |
+int exec_post_script_cb( struct sip_msg *msg, enum script_cb_type type); |
|
61 | 84 |
|
62 | 85 |
#endif |
63 | 86 |
|
... | ... |
@@ -23,6 +23,10 @@ |
23 | 23 |
* You should have received a copy of the GNU General Public License |
24 | 24 |
* along with this program; if not, write to the Free Software |
25 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 |
+ * |
|
27 |
+ * History: |
|
28 |
+ * -------- |
|
29 |
+ * 2005-02-13 script callbacks devided into request and reply types (bogdan) |
|
26 | 30 |
*/ |
27 | 31 |
|
28 | 32 |
#ifndef _SCRIPT_CB_H_ |
... | ... |
@@ -32,10 +36,11 @@ |
32 | 36 |
|
33 | 37 |
typedef int (cb_function)( struct sip_msg *msg, void *param ); |
34 | 38 |
|
35 |
-typedef enum { |
|
36 |
- PRE_SCRIPT_CB, |
|
37 |
- POST_SCRIPT_CB |
|
38 |
-} callback_t; /* Allowed types of callbacks */ |
|
39 |
+ |
|
40 |
+#define PRE_SCRIPT_CB (1<<0) |
|
41 |
+#define POST_SCRIPT_CB (1<<1) |
|
42 |
+#define REQ_TYPE_CB (1<<2) |
|
43 |
+#define RPL_TYPE_CB (1<<3) |
|
39 | 44 |
|
40 | 45 |
|
41 | 46 |
struct script_cb{ |
... | ... |
@@ -45,10 +50,14 @@ struct script_cb{ |
45 | 50 |
void *param; |
46 | 51 |
}; |
47 | 52 |
|
48 |
-int register_script_cb( cb_function f, callback_t t, void *param ); |
|
49 |
-int exec_pre_cb( struct sip_msg *msg); |
|
50 |
-void exec_post_cb( struct sip_msg *msg); |
|
53 |
+int register_script_cb( cb_function f, int type, void *param ); |
|
51 | 54 |
void destroy_script_cb(); |
52 | 55 |
|
56 |
+int exec_pre_req_cb( struct sip_msg *msg); |
|
57 |
+int exec_post_req_cb( struct sip_msg *msg); |
|
58 |
+ |
|
59 |
+int exec_pre_rpl_cb( struct sip_msg *msg); |
|
60 |
+int exec_post_rpl_cb( struct sip_msg *msg); |
|
61 |
+ |
|
53 | 62 |
#endif |
54 | 63 |
|
... | ... |
@@ -25,6 +25,8 @@ |
25 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 | 26 |
*/ |
27 | 27 |
|
28 |
+#ifndef _SCRIPT_CB_H_ |
|
29 |
+#define _SCRIPT_CB_H_ |
|
28 | 30 |
|
29 | 31 |
#include "parser/msg_parser.h" |
30 | 32 |
|
... | ... |
@@ -48,4 +50,5 @@ int exec_pre_cb( struct sip_msg *msg); |
48 | 50 |
void exec_post_cb( struct sip_msg *msg); |
49 | 51 |
void destroy_script_cb(); |
50 | 52 |
|
53 |
+#endif |
|
51 | 54 |
|
... | ... |
@@ -1,7 +1,31 @@ |
1 | 1 |
/* |
2 | 2 |
* $Id$ |
3 |
+ * |
|
4 |
+ * Copyright (C) 2001-2003 Fhg Fokus |
|
5 |
+ * |
|
6 |
+ * This file is part of ser, a free SIP server. |
|
7 |
+ * |
|
8 |
+ * ser is free software; you can redistribute it and/or modify |
|
9 |
+ * it under the terms of the GNU General Public License as published by |
|
10 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
11 |
+ * (at your option) any later version |
|
12 |
+ * |
|
13 |
+ * For a license to use the ser software under conditions |
|
14 |
+ * other than those described here, or to purchase support for this |
|
15 |
+ * software, please contact iptel.org by e-mail at the following addresses: |
|
16 |
+ * info@iptel.org |
|
17 |
+ * |
|
18 |
+ * ser is distributed in the hope that it will be useful, |
|
19 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
+ * GNU General Public License for more details. |
|
22 |
+ * |
|
23 |
+ * You should have received a copy of the GNU General Public License |
|
24 |
+ * along with this program; if not, write to the Free Software |
|
25 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
3 | 26 |
*/ |
4 | 27 |
|
28 |
+ |
|
5 | 29 |
#include "parser/msg_parser.h" |
6 | 30 |
|
7 | 31 |
typedef int (cb_function)( struct sip_msg *msg, void *param ); |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,26 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ */ |
|
4 |
+ |
|
5 |
+#include "parser/msg_parser.h" |
|
6 |
+ |
|
7 |
+typedef int (cb_function)( struct sip_msg *msg, void *param ); |
|
8 |
+ |
|
9 |
+typedef enum { |
|
10 |
+ PRE_SCRIPT_CB, |
|
11 |
+ POST_SCRIPT_CB |
|
12 |
+} callback_t; /* Allowed types of callbacks */ |
|
13 |
+ |
|
14 |
+ |
|
15 |
+struct script_cb{ |
|
16 |
+ cb_function *cbf; |
|
17 |
+ struct script_cb *next; |
|
18 |
+ unsigned int id; |
|
19 |
+ void *param; |
|
20 |
+}; |
|
21 |
+ |
|
22 |
+int register_script_cb( cb_function f, callback_t t, void *param ); |
|
23 |
+void exec_pre_cb( struct sip_msg *msg); |
|
24 |
+void exec_post_cb( struct sip_msg *msg); |
|
25 |
+ |
|
26 |
+ |