- 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,72 +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 |
-* \file |
|
22 |
-* \brief Kamailio core :: Flag handling |
|
23 |
-* \ingroup core |
|
24 |
-* Module: \ref core |
|
25 |
-*/ |
|
26 |
- |
|
27 |
- |
|
28 |
- |
|
29 |
-#ifndef _FLAGS_H |
|
30 |
-#define _FLAGS_H |
|
31 |
- |
|
32 |
-enum { FL_WHITE=1, FL_YELLOW, FL_GREEN, FL_RED, FL_BLUE, FL_MAGENTA, |
|
33 |
- FL_BROWN, FL_BLACK, FL_ACC, FL_MAX }; |
|
34 |
- |
|
35 |
-typedef unsigned int flag_t; |
|
36 |
- |
|
37 |
-#define MAX_FLAG ((unsigned int)( sizeof(flag_t) * CHAR_BIT - 1 )) |
|
38 |
- |
|
39 |
-struct sip_msg; |
|
40 |
- |
|
41 |
-int setflag( struct sip_msg* msg, flag_t flag ); |
|
42 |
-int resetflag( struct sip_msg* msg, flag_t flag ); |
|
43 |
-int isflagset( struct sip_msg* msg, flag_t flag ); |
|
44 |
- |
|
45 |
- |
|
46 |
-/* Script flag functions. Script flags are global flags that keep their |
|
47 |
- * value regardless of the SIP message being processed. |
|
48 |
- */ |
|
49 |
- |
|
50 |
-/* Set the value of all the global flags */ |
|
51 |
-int setsflagsval(flag_t val); |
|
52 |
- |
|
53 |
-/* Set the given flag to 1. Parameter flag contains the index of the flag */ |
|
54 |
-int setsflag(flag_t flag); |
|
55 |
- |
|
56 |
-/* Reset the given flag to 0. Parameter flag contains the index of the flag */ |
|
57 |
-int resetsflag(flag_t flag); |
|
58 |
- |
|
59 |
-/* Returns 1 if the given flag is set and -1 otherwise */ |
|
60 |
-int issflagset(flag_t flag); |
|
61 |
- |
|
62 |
-/* Get the value of all the script flags combined */ |
|
63 |
-flag_t getsflags(void); |
|
64 |
- |
|
65 |
-int flag_in_range( flag_t flag ); |
|
66 |
- |
|
67 |
-int register_flag(char* name, int pos); |
|
68 |
-int get_flag_no(char* name, int len); |
|
69 |
-int check_flag(int pos); |
|
70 |
-void init_named_flags(void); |
|
71 |
- |
|
72 |
-#endif |
... | ... |
@@ -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,6 +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 |
*/ |
20 |
+/*! |
|
21 |
+* \file |
|
22 |
+* \brief Kamailio core :: Flag handling |
|
23 |
+* \ingroup core |
|
24 |
+* Module: \ref core |
|
25 |
+*/ |
|
27 | 26 |
|
28 | 27 |
|
29 | 28 |
|
... | ... |
@@ -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 |
|
28 | 28 |
|
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)
This patch adds support for script flags identical to those present in
the kamailio core. Script flags is a global set of flags which preserve
their value for the duration of script processing. Script flags are kept
in a global variable in the sip-router core.
There are several functions that can be used to manipulate the value
of script flags:
* setflagsval - This function sets the value of _all_ script flags
at once. The new value of all the flags must be combined in the
single function parameter.
* setsflag - This function sets one particular script flag to 1. The
function gets the index of the flag (counting from 0) as a
parameter.
* resetsflag - This function sets one particular script flag to 0. The
function gets the index of the flag (counting from 0) as a parameter.
* issflagset - Test the value of a script flag. Returns 1 if the flag
is set and -1 otherwise.
* getsflags - Returns the value of all script flags combined into a
single variable of type flag_t. This function can be used to make a
backup copy of script flags.
... | ... |
@@ -43,6 +43,26 @@ int setflag( struct sip_msg* msg, flag_t flag ); |
43 | 43 |
int resetflag( struct sip_msg* msg, flag_t flag ); |
44 | 44 |
int isflagset( struct sip_msg* msg, flag_t flag ); |
45 | 45 |
|
46 |
+ |
|
47 |
+/* Script flag functions. Script flags are global flags that keep their |
|
48 |
+ * value regardless of the SIP message being processed. |
|
49 |
+ */ |
|
50 |
+ |
|
51 |
+/* Set the value of all the global flags */ |
|
52 |
+int setsflagsval(flag_t val); |
|
53 |
+ |
|
54 |
+/* Set the given flag to 1. Parameter flag contains the index of the flag */ |
|
55 |
+int setsflag(flag_t flag); |
|
56 |
+ |
|
57 |
+/* Reset the given flag to 0. Parameter flag contains the index of the flag */ |
|
58 |
+int resetsflag(flag_t flag); |
|
59 |
+ |
|
60 |
+/* Returns 1 if the given flag is set and -1 otherwise */ |
|
61 |
+int issflagset(flag_t flag); |
|
62 |
+ |
|
63 |
+/* Get the value of all the script flags combined */ |
|
64 |
+flag_t getsflags(void); |
|
65 |
+ |
|
46 | 66 |
int flag_in_range( flag_t flag ); |
47 | 67 |
|
48 | 68 |
int register_flag(char* name, int pos); |
... | ... |
@@ -35,7 +35,7 @@ enum { FL_WHITE=1, FL_YELLOW, FL_GREEN, FL_RED, FL_BLUE, FL_MAGENTA, |
35 | 35 |
|
36 | 36 |
typedef unsigned int flag_t; |
37 | 37 |
|
38 |
-#define MAX_FLAG ( sizeof(flag_t) * CHAR_BIT - 1 ) |
|
38 |
+#define MAX_FLAG ((unsigned int)( sizeof(flag_t) * CHAR_BIT - 1 )) |
|
39 | 39 |
|
40 | 40 |
struct sip_msg; |
41 | 41 |
|
... | ... |
@@ -1,8 +1,32 @@ |
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 |
|
5 | 28 |
|
29 |
+ |
|
6 | 30 |
#ifndef _FLAGS_H |
7 | 31 |
#define _FLAGS_H |
8 | 32 |
|
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,24 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ */ |
|
4 |
+ |
|
5 |
+ |
|
6 |
+#ifndef _FLAGS_H |
|
7 |
+#define _FLAGS_H |
|
8 |
+ |
|
9 |
+enum { FL_WHITE=1, FL_YELLOW, FL_GREEN, FL_RED, FL_BLUE, FL_MAGENTA, |
|
10 |
+ FL_BROWN, FL_BLACK, FL_ACC, FL_MAX }; |
|
11 |
+ |
|
12 |
+typedef unsigned long flag_t; |
|
13 |
+ |
|
14 |
+#define MAX_FLAG ( sizeof(flag_t) * CHAR_BIT - 1 ) |
|
15 |
+ |
|
16 |
+struct sip_msg; |
|
17 |
+ |
|
18 |
+int setflag( struct sip_msg* msg, flag_t flag ); |
|
19 |
+int resetflag( struct sip_msg* msg, flag_t flag ); |
|
20 |
+int isflagset( struct sip_msg* msg, flag_t flag ); |
|
21 |
+ |
|
22 |
+int flag_in_range( flag_t flag ); |
|
23 |
+ |
|
24 |
+#endif |