- 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,89 +0,0 @@ |
1 |
-/* |
|
2 |
- * regexp and regexp substitutions implementations |
|
3 |
- * |
|
4 |
- * Copyright (C) 2001-2003 FhG Fokus |
|
5 |
- * |
|
6 |
- * This file is part of Kamailio, a free SIP server. |
|
7 |
- * |
|
8 |
- * Kamailio 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 |
- * Kamailio is distributed in the hope that it will be useful, |
|
14 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
- * GNU General Public License for more details. |
|
17 |
- * |
|
18 |
- * You should have received a copy of the GNU General Public License |
|
19 |
- * along with this program; if not, write to the Free Software |
|
20 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
21 |
- * |
|
22 |
- * |
|
23 |
- */ |
|
24 |
-/*! |
|
25 |
- * \file |
|
26 |
- * \brief Kamailio core :: regexp and regexp substitutions implementations |
|
27 |
- * \author andrei |
|
28 |
- * \ingroup core |
|
29 |
- * Module: \ref core |
|
30 |
- */ |
|
31 |
- |
|
32 |
-#ifndef _re_h |
|
33 |
-#define _re_h |
|
34 |
- |
|
35 |
-#include "str.h" |
|
36 |
-#include "pvar.h" |
|
37 |
-#include "parser/msg_parser.h" |
|
38 |
-#include <sys/types.h> /* for regex */ |
|
39 |
-#include <regex.h> |
|
40 |
- |
|
41 |
-#define WITH_SEP 1 |
|
42 |
-#define WITHOUT_SEP 0 |
|
43 |
- |
|
44 |
-enum replace_special { REPLACE_NMATCH, REPLACE_CHAR, REPLACE_URI, |
|
45 |
- REPLACE_SPEC }; |
|
46 |
- |
|
47 |
-struct replace_with{ |
|
48 |
- int offset; /* offset in string */ |
|
49 |
- int size; /* size of replace "anchor" in string */ |
|
50 |
- enum replace_special type; |
|
51 |
- union{ |
|
52 |
- int nmatch; |
|
53 |
- char c; |
|
54 |
- pv_spec_t spec; |
|
55 |
- }u; |
|
56 |
-}; |
|
57 |
- |
|
58 |
-struct subst_expr{ |
|
59 |
- regex_t* re; |
|
60 |
- str replacement; |
|
61 |
- int replace_all; |
|
62 |
- int n_escapes; /* escapes number (replace[] size) */ |
|
63 |
- int max_pmatch ; /* highest () referenced */ |
|
64 |
- struct replace_with replace[1]; /* 0 does not work on all compilers */ |
|
65 |
-}; |
|
66 |
- |
|
67 |
-struct replace_lst{ |
|
68 |
- int offset; |
|
69 |
- int size; /* at offset, delete size bytes and replace them with rpl */ |
|
70 |
- str rpl; |
|
71 |
- struct replace_lst *next; |
|
72 |
-}; |
|
73 |
- |
|
74 |
- |
|
75 |
- |
|
76 |
-void subst_expr_free(struct subst_expr* se); |
|
77 |
-void replace_lst_free(struct replace_lst* l); |
|
78 |
-int parse_repl(struct replace_with * rw, char ** begin, |
|
79 |
- char * end, int *max_token_nb, int flag); |
|
80 |
-struct subst_expr* subst_parser(str* subst); |
|
81 |
-struct replace_lst* subst_run( struct subst_expr* se, const char* input, |
|
82 |
- struct sip_msg* msg, int *count); |
|
83 |
-str* subst_str(const char* input, struct sip_msg* msg, |
|
84 |
- struct subst_expr* se, int* count); |
|
85 |
- |
|
86 |
- |
|
87 |
- |
|
88 |
-#endif |
|
89 |
- |
... | ... |
@@ -1,23 +1,16 @@ |
1 | 1 |
/* |
2 |
- * $Id$ |
|
3 |
- * |
|
4 | 2 |
* regexp and regexp substitutions implementations |
5 | 3 |
* |
6 | 4 |
* Copyright (C) 2001-2003 FhG Fokus |
7 | 5 |
* |
8 |
- * This file is part of ser, a free SIP server. |
|
6 |
+ * This file is part of Kamailio, a free SIP server. |
|
9 | 7 |
* |
10 |
- * ser is free software; you can redistribute it and/or modify |
|
8 |
+ * Kamailio is free software; you can redistribute it and/or modify |
|
11 | 9 |
* it under the terms of the GNU General Public License as published by |
12 | 10 |
* the Free Software Foundation; either version 2 of the License, or |
13 | 11 |
* (at your option) any later version |
14 | 12 |
* |
15 |
- * For a license to use the ser software under conditions |
|
16 |
- * other than those described here, or to purchase support for this |
|
17 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
18 |
- * info@iptel.org |
|
19 |
- * |
|
20 |
- * ser is distributed in the hope that it will be useful, |
|
13 |
+ * Kamailio is distributed in the hope that it will be useful, |
|
21 | 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | 16 |
* GNU General Public License for more details. |
... | ... |
@@ -27,10 +20,13 @@ |
27 | 20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
28 | 21 |
* |
29 | 22 |
* |
30 |
- * History: |
|
31 |
- * -------- |
|
32 |
- * 2003-08-04 created by andrei |
|
33 |
- * 2004-11-12 minor api extension, added *count (andrei) |
|
23 |
+ */ |
|
24 |
+/*! |
|
25 |
+ * \file |
|
26 |
+ * \brief Kamailio core :: regexp and regexp substitutions implementations |
|
27 |
+ * \author andrei |
|
28 |
+ * \ingroup core |
|
29 |
+ * Module: \ref core |
|
34 | 30 |
*/ |
35 | 31 |
|
36 | 32 |
#ifndef _re_h |
... | ... |
@@ -24,7 +24,7 @@ |
24 | 24 |
* |
25 | 25 |
* You should have received a copy of the GNU General Public License |
26 | 26 |
* along with this program; if not, write to the Free Software |
27 |
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
27 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
28 | 28 |
* |
29 | 29 |
* |
30 | 30 |
* History: |
* Move the replace parser into a separate function called parse_repl
* Declare the function in the header file
* Add support for PV_MARKER (pseudo-variable marker $) to the parser
... | ... |
@@ -79,6 +79,8 @@ struct replace_lst{ |
79 | 79 |
|
80 | 80 |
void subst_expr_free(struct subst_expr* se); |
81 | 81 |
void replace_lst_free(struct replace_lst* l); |
82 |
+int parse_repl(struct replace_with * rw, char ** begin, |
|
83 |
+ char * end, int *max_token_nb, int flag); |
|
82 | 84 |
struct subst_expr* subst_parser(str* subst); |
83 | 85 |
struct replace_lst* subst_run( struct subst_expr* se, const char* input, |
84 | 86 |
struct sip_msg* msg, int *count); |
* Define WITH_SEP and WITHOUT_SEP for k. compatiblity
* Extend enum replace_special with REPLACE_SPEC
* Add pv_spec_t type to the union in replace_with
... | ... |
@@ -37,11 +37,16 @@ |
37 | 37 |
#define _re_h |
38 | 38 |
|
39 | 39 |
#include "str.h" |
40 |
+#include "pvar.h" |
|
40 | 41 |
#include "parser/msg_parser.h" |
41 | 42 |
#include <sys/types.h> /* for regex */ |
42 | 43 |
#include <regex.h> |
43 | 44 |
|
44 |
-enum replace_special { REPLACE_NMATCH, REPLACE_CHAR, REPLACE_URI }; |
|
45 |
+#define WITH_SEP 1 |
|
46 |
+#define WITHOUT_SEP 0 |
|
47 |
+ |
|
48 |
+enum replace_special { REPLACE_NMATCH, REPLACE_CHAR, REPLACE_URI, |
|
49 |
+ REPLACE_SPEC }; |
|
45 | 50 |
|
46 | 51 |
struct replace_with{ |
47 | 52 |
int offset; /* offset in string */ |
... | ... |
@@ -50,6 +55,7 @@ struct replace_with{ |
50 | 55 |
union{ |
51 | 56 |
int nmatch; |
52 | 57 |
char c; |
58 |
+ pv_spec_t spec; |
|
53 | 59 |
}u; |
54 | 60 |
}; |
55 | 61 |
|
For more info see http://mail.iptel.org/pipermail/serdev/2004-July/002271.html
(whole thread).
... | ... |
@@ -30,6 +30,7 @@ |
30 | 30 |
* History: |
31 | 31 |
* -------- |
32 | 32 |
* 2003-08-04 created by andrei |
33 |
+ * 2004-11-12 minor api extension, added *count (andrei) |
|
33 | 34 |
*/ |
34 | 35 |
|
35 | 36 |
#ifndef _re_h |
... | ... |
@@ -74,8 +75,9 @@ void subst_expr_free(struct subst_expr* se); |
74 | 75 |
void replace_lst_free(struct replace_lst* l); |
75 | 76 |
struct subst_expr* subst_parser(str* subst); |
76 | 77 |
struct replace_lst* subst_run( struct subst_expr* se, const char* input, |
77 |
- struct sip_msg* msg); |
|
78 |
-str* subst_str(const char* input, struct sip_msg* msg, struct subst_expr* se); |
|
78 |
+ struct sip_msg* msg, int *count); |
|
79 |
+str* subst_str(const char* input, struct sip_msg* msg, |
|
80 |
+ struct subst_expr* se, int* count); |
|
79 | 81 |
|
80 | 82 |
|
81 | 83 |
|
... | ... |
@@ -73,9 +73,9 @@ struct replace_lst{ |
73 | 73 |
void subst_expr_free(struct subst_expr* se); |
74 | 74 |
void replace_lst_free(struct replace_lst* l); |
75 | 75 |
struct subst_expr* subst_parser(str* subst); |
76 |
-struct replace_lst* subst_run( struct subst_expr* se, char* input, |
|
76 |
+struct replace_lst* subst_run( struct subst_expr* se, const char* input, |
|
77 | 77 |
struct sip_msg* msg); |
78 |
-str* subst_str(char* input, struct sip_msg* msg, struct subst_expr* se); |
|
78 |
+str* subst_str(const char* input, struct sip_msg* msg, struct subst_expr* se); |
|
79 | 79 |
|
80 | 80 |
|
81 | 81 |
|
... | ... |
@@ -63,7 +63,7 @@ struct subst_expr{ |
63 | 63 |
|
64 | 64 |
struct replace_lst{ |
65 | 65 |
int offset; |
66 |
- int size; /* at offset, delete size bytes and replace them with rpl */; |
|
66 |
+ int size; /* at offset, delete size bytes and replace them with rpl */ |
|
67 | 67 |
str rpl; |
68 | 68 |
struct replace_lst *next; |
69 | 69 |
}; |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,83 @@ |
1 |
+/* |
|
2 |
+ * $Id$ |
|
3 |
+ * |
|
4 |
+ * regexp and regexp substitutions implementations |
|
5 |
+ * |
|
6 |
+ * Copyright (C) 2001-2003 Fhg Fokus |
|
7 |
+ * |
|
8 |
+ * This file is part of ser, a free SIP server. |
|
9 |
+ * |
|
10 |
+ * ser is free software; you can redistribute it and/or modify |
|
11 |
+ * it under the terms of the GNU General Public License as published by |
|
12 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
13 |
+ * (at your option) any later version |
|
14 |
+ * |
|
15 |
+ * For a license to use the ser software under conditions |
|
16 |
+ * other than those described here, or to purchase support for this |
|
17 |
+ * software, please contact iptel.org by e-mail at the following addresses: |
|
18 |
+ * info@iptel.org |
|
19 |
+ * |
|
20 |
+ * ser is distributed in the hope that it will be useful, |
|
21 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
+ * GNU General Public License for more details. |
|
24 |
+ * |
|
25 |
+ * You should have received a copy of the GNU General Public License |
|
26 |
+ * along with this program; if not, write to the Free Software |
|
27 |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
28 |
+ * |
|
29 |
+ * |
|
30 |
+ * History: |
|
31 |
+ * -------- |
|
32 |
+ * 2003-08-04 created by andrei |
|
33 |
+ */ |
|
34 |
+ |
|
35 |
+#ifndef _re_h |
|
36 |
+#define _re_h |
|
37 |
+ |
|
38 |
+#include "str.h" |
|
39 |
+#include "parser/msg_parser.h" |
|
40 |
+#include <sys/types.h> /* for regex */ |
|
41 |
+#include <regex.h> |
|
42 |
+ |
|
43 |
+enum replace_special { REPLACE_NMATCH, REPLACE_CHAR, REPLACE_URI }; |
|
44 |
+ |
|
45 |
+struct replace_with{ |
|
46 |
+ int offset; /* offset in string */ |
|
47 |
+ int size; /* size of replace "anchor" in string */ |
|
48 |
+ enum replace_special type; |
|
49 |
+ union{ |
|
50 |
+ int nmatch; |
|
51 |
+ char c; |
|
52 |
+ }; |
|
53 |
+}; |
|
54 |
+ |
|
55 |
+struct subst_expr{ |
|
56 |
+ regex_t* re; |
|
57 |
+ str replacement; |
|
58 |
+ int replace_all; |
|
59 |
+ int n_escapes; /* escapes number (replace[] size) */ |
|
60 |
+ int max_pmatch ; /* highest () referenced */ |
|
61 |
+ struct replace_with replace[1]; /* 0 does not work on all compilers */ |
|
62 |
+}; |
|
63 |
+ |
|
64 |
+struct replace_lst{ |
|
65 |
+ int offset; |
|
66 |
+ int size; /* at offset, delete size bytes and replace them with rpl */; |
|
67 |
+ str rpl; |
|
68 |
+ struct replace_lst *next; |
|
69 |
+}; |
|
70 |
+ |
|
71 |
+ |
|
72 |
+ |
|
73 |
+void subst_expr_free(struct subst_expr* se); |
|
74 |
+void replace_lst_free(struct replace_lst* l); |
|
75 |
+struct subst_expr* subst_parser(str* subst); |
|
76 |
+struct replace_lst* subst_run( struct subst_expr* se, char* input, |
|
77 |
+ struct sip_msg* msg); |
|
78 |
+str* subst_str(char* input, struct sip_msg* msg, struct subst_expr* se); |
|
79 |
+ |
|
80 |
+ |
|
81 |
+ |
|
82 |
+#endif |
|
83 |
+ |