- 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,39 +0,0 @@ |
1 |
-/* |
|
2 |
- * Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com) |
|
3 |
- * |
|
4 |
- * Permission to use, copy, modify, and distribute this software for any |
|
5 |
- * purpose with or without fee is hereby granted, provided that the above |
|
6 |
- * copyright notice and this permission notice appear in all copies. |
|
7 |
- * |
|
8 |
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
9 |
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
10 |
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
11 |
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
12 |
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
13 |
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
14 |
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
15 |
- */ |
|
16 |
-/*! |
|
17 |
- * \file |
|
18 |
- * \brief Kamailio core :: Config preprocessor directives |
|
19 |
- * \ingroup core |
|
20 |
- * Module: \ref core |
|
21 |
- */ |
|
22 |
- |
|
23 |
-#ifndef _PPCFG_H_ |
|
24 |
-#define _PPCFG_H_ |
|
25 |
- |
|
26 |
-int pp_subst_add(char *data); |
|
27 |
-int pp_substdef_add(char *data, int mode); |
|
28 |
-int pp_subst_run(char **data); |
|
29 |
- |
|
30 |
-int pp_define(int len, const char *text); |
|
31 |
-int pp_define_set(int len, char *text); |
|
32 |
-int pp_define_set_type(int type); |
|
33 |
- |
|
34 |
-void pp_ifdef_level_update(int val); |
|
35 |
-void pp_ifdef_level_check(void); |
|
36 |
- |
|
37 |
-#endif /*_PPCFG_H_*/ |
|
38 |
- |
|
39 |
-/* vi: set ts=4 sw=4 tw=79:ai:cindent: */ |
... | ... |
@@ -1,6 +1,4 @@ |
1 | 1 |
/* |
2 |
- * $Id$ |
|
3 |
- * |
|
4 | 2 |
* Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com) |
5 | 3 |
* |
6 | 4 |
* Permission to use, copy, modify, and distribute this software for any |
... | ... |
@@ -15,8 +13,11 @@ |
15 | 13 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 14 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 15 |
*/ |
18 |
-/* |
|
19 |
- * ppcfg.h - config preprocessor directives |
|
16 |
+/*! |
|
17 |
+ * \file |
|
18 |
+ * \brief Kamailio core :: Config preprocessor directives |
|
19 |
+ * \ingroup core |
|
20 |
+ * Module: \ref core |
|
20 | 21 |
*/ |
21 | 22 |
|
22 | 23 |
#ifndef _PPCFG_H_ |
- should help discovering if a conditional block is left unclosed
... | ... |
@@ -30,6 +30,9 @@ int pp_define(int len, const char *text); |
30 | 30 |
int pp_define_set(int len, char *text); |
31 | 31 |
int pp_define_set_type(int type); |
32 | 32 |
|
33 |
+void pp_ifdef_level_update(int val); |
|
34 |
+void pp_ifdef_level_check(void); |
|
35 |
+ |
|
33 | 36 |
#endif /*_PPCFG_H_*/ |
34 | 37 |
|
35 | 38 |
/* vi: set ts=4 sw=4 tw=79:ai:cindent: */ |
- similar to substdef but the defined value will be enclosed in double
quotes
- #!trydef - don't define if it is already done
- #!redef - redefine even already defined
- both have the prototype like #!define
- prototype
!!substdef '/regexp/replacement/flags'
- separator char '/' can be replaced with any other character to avoid
conflicts
- it adds a preprocessor substitution like '!!subst' and in addition
defines the regexp to replacement, like
!!define regexp replacement
- useful when you need to replace tokens present as ID and inside string
values
... | ... |
@@ -23,10 +23,11 @@ |
23 | 23 |
#define _PPCFG_H_ |
24 | 24 |
|
25 | 25 |
int pp_subst_add(char *data); |
26 |
+int pp_substdef_add(char *data); |
|
26 | 27 |
int pp_subst_run(char **data); |
27 | 28 |
|
28 |
-int pp_define(int len, const char * text); |
|
29 |
-int pp_define_set(int len, char * text); |
|
29 |
+int pp_define(int len, const char *text); |
|
30 |
+int pp_define_set(int len, char *text); |
|
30 | 31 |
|
31 | 32 |
#endif /*_PPCFG_H_*/ |
32 | 33 |
|
- defines can be specified from command line with option -A
- these defines are available from begining of parsing the config
- examples:
- '-A WITH_AUTH' is like having '#!define WITH_AUTH' at top of cfg
- '-A LISTENIP=127.0.0.1' is like '#!define LISTENIP=127.0.0.1'
- you can define values for IDs
- defined IDs are replaced at startup, during config parsing, e.g.,:
$var(x) = 100 + MYINT;
- is interpreted as:
$var(x) = 100 + 123;
- you can have multi-line defined IDs
while($var(i)<5) { \
xlog("++++ $var(i)\n"); \
$var(i) = $var(i) + 1; \
}
- then in routing block
route {
...
IDLOOP
...
}
- new preprocessor directive
- perform substitutions inside the strings of config (not that define is
replacing only IDs - alphanumeric tokens not enclosed in quotes)
- #!subst offers an easy way to search and replace inside strings before
cfg parsing. E.g.,:
modparam("acc", "db_url", "mysql://user:DBPASSWD@localhost/db")
- will do the substitution of db password in db_url parameter value
- number of allowed defines set to 256
- credits to Andrei for quick hints on ID defines
- notes:
- multilines defines are reduced to single line, so line counter
should be fine
- column counter goes inside the define value, but you have to omit
the \ and CR for the accurate inside-define position
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,30 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com) |
|
5 |
+ * |
|
6 |
+ * Permission to use, copy, modify, and distribute this software for any |
|
7 |
+ * purpose with or without fee is hereby granted, provided that the above |
|
8 |
+ * copyright notice and this permission notice appear in all copies. |
|
9 |
+ * |
|
10 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
11 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
12 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
13 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
14 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
15 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
16 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
17 |
+ */ |
|
18 |
+/* |
|
19 |
+ * ppcfg.h - config preprocessor directives |
|
20 |
+ */ |
|
21 |
+ |
|
22 |
+#ifndef _PPCFG_H_ |
|
23 |
+#define _PPCFG_H_ |
|
24 |
+ |
|
25 |
+int pp_subst_add(char *data); |
|
26 |
+int pp_subst_run(char **data); |
|
27 |
+ |
|
28 |
+#endif /*_PPCFG_H_*/ |
|
29 |
+ |
|
30 |
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */ |