Browse code

core, lib, modules: restructured source code tree

- 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)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,80 +0,0 @@
1
-/* 
2
- * Copyright (C) 2009 iptelorg GmbH
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
-#ifndef __switch_h
18
-#define __switch_h
19
-
20
-#include <stddef.h>
21
-#include <regex.h>
22
-
23
-#include "route_struct.h"
24
-
25
-
26
-struct case_stms{
27
-	struct rval_expr* ct_rve;
28
-	struct action* actions;
29
-	struct case_stms* next;
30
-	struct case_stms** append;
31
-	int type;     /**< type: MATCH_UNKOWN, MATCH_INT, MATCH_STR, MATCH_RE */
32
-	int re_flags; /**< used only for REs */
33
-	int is_default;
34
-	union {
35
-		int match_int;
36
-		str match_str;
37
-		regex_t* match_re;
38
-	} label;  /**< fixed case argument */
39
-};
40
-
41
-
42
-struct switch_cond_table{
43
-	int n;                  /**< size */
44
-	int* cond;              /**< int labels array */
45
-	struct action** jump;   /**< jump points array */
46
-	struct action* def;     /**< default jump  */
47
-};
48
-
49
-
50
-struct switch_jmp_table{
51
-	int first;              /**< first int label in the jump table */
52
-	int last;               /**< last int label in the jump table */
53
-	struct action** tbl;    /**< jmp table [v-first] iff first<=v<=last */
54
-	struct switch_cond_table rest; /**< normal cond. table for the rest */
55
-};
56
-
57
-
58
-enum match_str_type { MATCH_UNKNOWN, MATCH_INT, MATCH_STR, MATCH_RE };
59
-
60
-struct match_str{
61
-	enum match_str_type type;/**< string or RE */
62
-	int flags;               /**< flags for re */
63
-	union{
64
-		str s;              /* string */
65
-		regex_t* regex;     /**< compiled regex */
66
-	}l;
67
-};
68
-
69
-struct match_cond_table{
70
-	int n;                   /**< size */
71
-	struct match_str* match; /**< match array */
72
-	struct action** jump;    /**< jump points array */
73
-	struct action* def;      /**< default jmp */
74
-};
75
-
76
-int fix_switch(struct action* t);
77
-
78
-#endif /*__switch_h*/
79
-
80
-/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
Browse code

core: Modify doxygen, remove history, remove SVN IDs, change "ser" and "sip-router" to "KAMAILIO"

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /* 
2
- * $Id$
3
- * 
4 2
  * Copyright (C) 2009 iptelorg GmbH
5 3
  *
6 4
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -15,14 +13,6 @@
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
- * /home/andrei/sr.git/switch.h
20
- */
21
-/*
22
- * History:
23
- * --------
24
- *  2009-02-02  initial version (andrei)
25
-*/
26 16
 
27 17
 #ifndef __switch_h
28 18
 #define __switch_h
Browse code

core: include stddef.h to let sip-router compile on old distros

Ovidiu Sas authored on 03/06/2011 17:02:00
Showing 1 changed files
... ...
@@ -27,6 +27,7 @@
27 27
 #ifndef __switch_h
28 28
 #define __switch_h
29 29
 
30
+#include <stddef.h>
30 31
 #include <regex.h>
31 32
 
32 33
 #include "route_struct.h"
Browse code

script engine: string switch execution

- support for matching strings and regular expressions in a string
switch (MATCH_T).

Andrei Pelinescu-Onciul authored on 19/02/2009 22:38:37
Showing 1 changed files
... ...
@@ -27,15 +27,24 @@
27 27
 #ifndef __switch_h
28 28
 #define __switch_h
29 29
 
30
+#include <regex.h>
31
+
30 32
 #include "route_struct.h"
31 33
 
34
+
32 35
 struct case_stms{
33 36
 	struct rval_expr* ct_rve;
34 37
 	struct action* actions;
35 38
 	struct case_stms* next;
36 39
 	struct case_stms** append;
37
-	int int_label;
40
+	int type;     /**< type: MATCH_UNKOWN, MATCH_INT, MATCH_STR, MATCH_RE */
41
+	int re_flags; /**< used only for REs */
38 42
 	int is_default;
43
+	union {
44
+		int match_int;
45
+		str match_str;
46
+		regex_t* match_re;
47
+	} label;  /**< fixed case argument */
39 48
 };
40 49
 
41 50
 
... ...
@@ -43,7 +52,7 @@ struct switch_cond_table{
43 52
 	int n;                  /**< size */
44 53
 	int* cond;              /**< int labels array */
45 54
 	struct action** jump;   /**< jump points array */
46
-	struct action* def; /**< default jump  */
55
+	struct action* def;     /**< default jump  */
47 56
 };
48 57
 
49 58
 
... ...
@@ -54,6 +63,25 @@ struct switch_jmp_table{
54 63
 	struct switch_cond_table rest; /**< normal cond. table for the rest */
55 64
 };
56 65
 
66
+
67
+enum match_str_type { MATCH_UNKNOWN, MATCH_INT, MATCH_STR, MATCH_RE };
68
+
69
+struct match_str{
70
+	enum match_str_type type;/**< string or RE */
71
+	int flags;               /**< flags for re */
72
+	union{
73
+		str s;              /* string */
74
+		regex_t* regex;     /**< compiled regex */
75
+	}l;
76
+};
77
+
78
+struct match_cond_table{
79
+	int n;                   /**< size */
80
+	struct match_str* match; /**< match array */
81
+	struct action** jump;    /**< jump points array */
82
+	struct action* def;      /**< default jmp */
83
+};
84
+
57 85
 int fix_switch(struct action* t);
58 86
 
59 87
 #endif /*__switch_h*/
Browse code

script engine: switch() and break execution

- support for executing optimized switch()ed (by fix_switch())
- proper break handling:
- exit a switch() on break (even if the break is inside an if() block)
- if the break is outside a switch, exit the route block
(compatibility with older versions, for new scripts using exit or
drop instead of break is recommended)

Andrei Pelinescu-Onciul authored on 09/02/2009 18:01:35
Showing 1 changed files
... ...
@@ -54,6 +54,7 @@ struct switch_jmp_table{
54 54
 	struct switch_cond_table rest; /**< normal cond. table for the rest */
55 55
 };
56 56
 
57
+int fix_switch(struct action* t);
57 58
 
58 59
 #endif /*__switch_h*/
59 60
 
Browse code

script parsing: C style switch() & case support

- support for parsing C style switch() & case, e.g.:
switch($var){
case 1:
log(1, "1\n");
break;
case 2:
case 3:
default:
log(1, "default\n");
}
(note: this is different from kamailio/openser switch())

Andrei Pelinescu-Onciul authored on 04/02/2009 19:44:26
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,60 @@
1
+/* 
2
+ * $Id$
3
+ * 
4
+ * Copyright (C) 2009 iptelorg GmbH
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
+ * /home/andrei/sr.git/switch.h
20
+ */
21
+/*
22
+ * History:
23
+ * --------
24
+ *  2009-02-02  initial version (andrei)
25
+*/
26
+
27
+#ifndef __switch_h
28
+#define __switch_h
29
+
30
+#include "route_struct.h"
31
+
32
+struct case_stms{
33
+	struct rval_expr* ct_rve;
34
+	struct action* actions;
35
+	struct case_stms* next;
36
+	struct case_stms** append;
37
+	int int_label;
38
+	int is_default;
39
+};
40
+
41
+
42
+struct switch_cond_table{
43
+	int n;                  /**< size */
44
+	int* cond;              /**< int labels array */
45
+	struct action** jump;   /**< jump points array */
46
+	struct action* def; /**< default jump  */
47
+};
48
+
49
+
50
+struct switch_jmp_table{
51
+	int first;              /**< first int label in the jump table */
52
+	int last;               /**< last int label in the jump table */
53
+	struct action** tbl;    /**< jmp table [v-first] iff first<=v<=last */
54
+	struct switch_cond_table rest; /**< normal cond. table for the rest */
55
+};
56
+
57
+
58
+#endif /*__switch_h*/
59
+
60
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */