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) 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 :: Actions
24
- * \ingroup core
25
- * Module: \ref core
26
- */
27
-
28
-
29
-#ifndef action_h
30
-#define action_h
31
-
32
-#define USE_LONGJMP
33
-
34
-#include "route_struct.h"
35
-
36
-#include "parser/msg_parser.h"
37
-
38
-#ifdef USE_LONGJMP
39
-#include <setjmp.h>
40
-#endif
41
-
42
-
43
-typedef struct run_act_ctx {
44
-	int rec_lev;
45
-	int run_flags;
46
-	int last_retcode; /* return from last route */
47
-#ifdef USE_LONGJMP
48
-	jmp_buf jmp_env;
49
-#endif
50
-} run_act_ctx_t;
51
-
52
-
53
-#define init_run_actions_ctx(ph) \
54
-	do{\
55
-		(ph)->rec_lev=(ph)->run_flags=(ph)->last_retcode=0; \
56
-	}while(0)
57
-
58
-int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
59
-int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
60
-
61
-int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
62
-
63
-cfg_action_t *get_cfg_crt_action(void);
64
-int get_cfg_crt_line(void);
65
-char *get_cfg_crt_name(void);
66
-
67
-void set_max_recursive_level(unsigned int lev);
68
-
69
-#ifdef USE_LONGJMP
70
-int run_actions_safe(struct run_act_ctx* c, struct action* a,
71
-						struct sip_msg* msg);
72
-#else /*! USE_LONGJMP */
73
-#define run_actions_safe(c, a, m) run_actions(c, a, m)
74
-#endif /* USE_LONGJMP */
75
-
76
-void log_prefix_set(sip_msg_t *msg);
77
-
78
-int run_child_one_init_route(void);
79
-
80
-#endif
Browse code

core: typedef'ed the action context structure

Daniel-Constantin Mierla authored on 13/04/2016 22:05:04
Showing 1 changed files
... ...
@@ -40,14 +40,14 @@
40 40
 #endif
41 41
 
42 42
 
43
-struct run_act_ctx{
43
+typedef struct run_act_ctx {
44 44
 	int rec_lev;
45 45
 	int run_flags;
46 46
 	int last_retcode; /* return from last route */
47 47
 #ifdef USE_LONGJMP
48 48
 	jmp_buf jmp_env;
49 49
 #endif
50
-};
50
+} run_act_ctx_t;
51 51
 
52 52
 
53 53
 #define init_run_actions_ctx(ph) \
Browse code

core: new feature to execute event_route[core:worker-one-init]

- the event_route[core:worker-one-init] is executed if defined in
kamailio.cfg after the first udp sip worker process executed the
child_init() for all modules, before starting to process sip traffic
- note that due to forking, other sip workers can get faster to
listening for sip traffic

Daniel-Constantin Mierla authored on 07/10/2015 10:11:23
Showing 1 changed files
... ...
@@ -75,4 +75,6 @@ int run_actions_safe(struct run_act_ctx* c, struct action* a,
75 75
 
76 76
 void log_prefix_set(sip_msg_t *msg);
77 77
 
78
+int run_child_one_init_route(void);
79
+
78 80
 #endif
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
... ...
@@ -20,7 +20,7 @@
20 20
 
21 21
 /*!
22 22
  * \file
23
- * \brief SIP-router core :: Actions
23
+ * \brief Kamailio core :: Actions
24 24
  * \ingroup core
25 25
  * Module: \ref core
26 26
  */
Browse code

core : Update include files - delete IDs, update doxygen, delete history

Olle E. Johansson authored on 03/01/2015 10:55:48
Showing 1 changed files
... ...
@@ -1,22 +1,14 @@
1 1
 /*
2
- * $Id$
3
- *
4
- *
5 2
  * Copyright (C) 2001-2003 FhG Fokus
6 3
  *
7
- * This file is part of ser, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
8 5
  *
9
- * ser is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
10 7
  * it under the terms of the GNU General Public License as published by
11 8
  * the Free Software Foundation; either version 2 of the License, or
12 9
  * (at your option) any later version
13 10
  *
14
- * For a license to use the ser software under conditions
15
- * other than those described here, or to purchase support for this
16
- * software, please contact iptel.org by e-mail at the following addresses:
17
- *    info@iptel.org
18
- *
19
- * ser is distributed in the hope that it will be useful,
11
+ * Kamailio is distributed in the hope that it will be useful,
20 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 14
  * GNU General Public License for more details.
... ...
@@ -28,7 +20,7 @@
28 20
 
29 21
 /*!
30 22
  * \file
31
- * \brief SIP-router core ::
23
+ * \brief SIP-router core :: Actions
32 24
  * \ingroup core
33 25
  * Module: \ref core
34 26
  */
Browse code

core: new parameter - log_prefix

- can be used to set what prefix to be printed for each log message
while processing a SIP message
- can contain variables
- example:
log_prefix="[$mt $hdr(CSeq) $ci]"

Daniel-Constantin Mierla authored on 10/09/2014 22:16:53
Showing 1 changed files
... ...
@@ -81,4 +81,6 @@ int run_actions_safe(struct run_act_ctx* c, struct action* a,
81 81
 #define run_actions_safe(c, a, m) run_actions(c, a, m)
82 82
 #endif /* USE_LONGJMP */
83 83
 
84
+void log_prefix_set(sip_msg_t *msg);
85
+
84 86
 #endif
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -23,7 +23,7 @@
23 23
  *
24 24
  * You should have received a copy of the GNU General Public License
25 25
  * along with this program; if not, write to the Free Software
26
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 27
  */
28 28
 
29 29
 /*!
Browse code

core: new global parameter max_recursive_level

- replace define ROUTE_MAX_REC_LEV with config paramter
- number of allowed recusive levels can be set in config now
- it affects calls of route blocks and chained if { ... } else if { ...
} else ...

Daniel-Constantin Mierla authored on 29/03/2014 23:22:17
Showing 1 changed files
... ...
@@ -72,6 +72,8 @@ cfg_action_t *get_cfg_crt_action(void);
72 72
 int get_cfg_crt_line(void);
73 73
 char *get_cfg_crt_name(void);
74 74
 
75
+void set_max_recursive_level(unsigned int lev);
76
+
75 77
 #ifdef USE_LONGJMP
76 78
 int run_actions_safe(struct run_act_ctx* c, struct action* a,
77 79
 						struct sip_msg* msg);
Browse code

core: added wrapper functions to return cfg line and name for current action

Daniel-Constantin Mierla authored on 16/09/2013 07:53:15
Showing 1 changed files
... ...
@@ -69,6 +69,8 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
69 69
 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
70 70
 
71 71
 cfg_action_t *get_cfg_crt_action(void);
72
+int get_cfg_crt_line(void);
73
+char *get_cfg_crt_name(void);
72 74
 
73 75
 #ifdef USE_LONGJMP
74 76
 int run_actions_safe(struct run_act_ctx* c, struct action* a,
Browse code

core: store current executed cfg action in a global variable

- can be retrieved by module to access name of config file and the line

Daniel-Constantin Mierla authored on 15/09/2013 20:35:38
Showing 1 changed files
... ...
@@ -68,6 +68,7 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
68 68
 
69 69
 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
70 70
 
71
+cfg_action_t *get_cfg_crt_action(void);
71 72
 
72 73
 #ifdef USE_LONGJMP
73 74
 int run_actions_safe(struct run_act_ctx* c, struct action* a,
Browse code

core: fix end-script commands in expr. leaks

When having commands that end the script immediately in
assignments (e.g. $foo = { drop; }) or in expressions
(e.g. if ($v + { drop; } > 0)), the script was terminated
immediately via longjmp. However this might leave some un-freed
variables.
This fix introduces a safe version of run_actions()
(run_actions_safe()) that will not use longjmp() to immediately
end the whole script on drop, returning instead to its caller.

Andrei Pelinescu-Onciul authored on 29/09/2010 14:30:40
Showing 1 changed files
... ...
@@ -68,4 +68,12 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
68 68
 
69 69
 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
70 70
 
71
+
72
+#ifdef USE_LONGJMP
73
+int run_actions_safe(struct run_act_ctx* c, struct action* a,
74
+						struct sip_msg* msg);
75
+#else /*! USE_LONGJMP */
76
+#define run_actions_safe(c, a, m) run_actions(c, a, m)
77
+#endif /* USE_LONGJMP */
78
+
71 79
 #endif
Browse code

- Doxygen updates on core files - Add project name to doxygen in Makefile

oej authored on 19/10/2009 20:35:43
Showing 1 changed files
... ...
@@ -26,6 +26,13 @@
26 26
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27 27
  */
28 28
 
29
+/*!
30
+ * \file
31
+ * \brief SIP-router core ::
32
+ * \ingroup core
33
+ * Module: \ref core
34
+ */
35
+
29 36
 
30 37
 #ifndef action_h
31 38
 #define action_h
Browse code

core: run_top_route() can be give action context

- functions calling run_top_route() can get access to context fields if
they need
- modules updated to new function signature

Daniel-Constantin Mierla authored on 09/07/2009 09:23:14
Showing 1 changed files
... ...
@@ -59,6 +59,6 @@ struct run_act_ctx{
59 59
 int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
60 60
 int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
61 61
 
62
-int run_top_route(struct action* a, sip_msg_t* msg);
62
+int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
63 63
 
64 64
 #endif
Browse code

Introducing run_top_route function

Function run_top_route can be used to initialize the environment before
a SIP message starts processing in *_route blocks. Internally it resets
the script flags, resets the select buffer, initializes the environment
using init_run_actions_ctx and passes control to the specified route
section.

Jan Janak authored on 29/03/2009 15:53:58
Showing 1 changed files
... ...
@@ -59,8 +59,6 @@ struct run_act_ctx{
59 59
 int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
60 60
 int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
61 61
 
62
-
63
-
64
-
62
+int run_top_route(struct action* a, sip_msg_t* msg);
65 63
 
66 64
 #endif
Browse code

- fix: run_actions() & friends used some static variables to save some internal state (run_flags, last_ret a.s.o). Problems would appear when different routes (e.g. main route and an onsend route) would execute in the same process (e.g. an onsend route return would exit also the main route). Now run_actions(), do_action() and eval_expr() take an extra "context" parameter (which must be initialized before use).

Andrei Pelinescu-Onciul authored on 14/06/2007 23:12:26
Showing 1 changed files
... ...
@@ -30,14 +30,34 @@
30 30
 #ifndef action_h
31 31
 #define action_h
32 32
 
33
-#include "parser/msg_parser.h"
33
+#define USE_LONGJMP
34
+
34 35
 #include "route_struct.h"
35 36
 
36
-extern unsigned int run_flags;
37
-extern int last_retcode;
37
+#include "parser/msg_parser.h"
38
+
39
+#ifdef USE_LONGJMP
40
+#include <setjmp.h>
41
+#endif
42
+
43
+
44
+struct run_act_ctx{
45
+	int rec_lev;
46
+	int run_flags;
47
+	int last_retcode; /* return from last route */
48
+#ifdef USE_LONGJMP
49
+	jmp_buf jmp_env;
50
+#endif
51
+};
52
+
53
+
54
+#define init_run_actions_ctx(ph) \
55
+	do{\
56
+		(ph)->rec_lev=(ph)->run_flags=(ph)->last_retcode=0; \
57
+	}while(0)
38 58
 
39
-int do_action(struct action* a, struct sip_msg* msg);
40
-int run_actions(struct action* a, struct sip_msg* msg);
59
+int do_action(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
60
+int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
41 61
 
42 62
 
43 63
 
Browse code

- run_flags published in header file. It may require any module command that calls run_actions, e.g. to absorb return.

Tomas Mandys authored on 17/06/2006 09:40:59
Showing 1 changed files
... ...
@@ -21,8 +21,8 @@
21 21
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 22
  * GNU General Public License for more details.
23 23
  *
24
- * You should have received a copy of the GNU General Public License 
25
- * along with this program; if not, write to the Free Software 
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with this program; if not, write to the Free Software
26 26
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27 27
  */
28 28
 
... ...
@@ -33,6 +33,7 @@
33 33
 #include "parser/msg_parser.h"
34 34
 #include "route_struct.h"
35 35
 
36
+extern unsigned int run_flags;
36 37
 extern int last_retcode;
37 38
 
38 39
 int do_action(struct action* a, struct sip_msg* msg);
Browse code

- return [val] support (returns from the current route with value val, by default 1) - exit [val] support (exits the script with code val, where 0 means drop, >0 means do default actions and <0 means error) - drop is now equivalent to exit 0 - drop should be faster when used to exit deep routes - break is now equivalent with return 1 - the return code can be checked with $?, e.g.: if ($?==1) {...} else if ($?==-1){...} else {...}.

Andrei Pelinescu-Onciul authored on 12/12/2005 23:47:56
Showing 1 changed files
... ...
@@ -33,6 +33,8 @@
33 33
 #include "parser/msg_parser.h"
34 34
 #include "route_struct.h"
35 35
 
36
+extern int last_retcode;
37
+
36 38
 int do_action(struct action* a, struct sip_msg* msg);
37 39
 int run_actions(struct action* a, struct sip_msg* msg);
38 40
 
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:45:09
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
  * $Id$
3 3
  *
4 4
  *
5
- * Copyright (C) 2001-2003 Fhg Fokus
5
+ * Copyright (C) 2001-2003 FhG Fokus
6 6
  *
7 7
  * This file is part of ser, a free SIP server.
8 8
  *
Browse code

GPLization banner introduced to *.[hc] files

Jiri Kuthan authored on 19/09/2002 12:23:52
Showing 1 changed files
... ...
@@ -1,8 +1,32 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
+ *
5
+ * Copyright (C) 2001-2003 Fhg Fokus
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4 27
  */
5 28
 
29
+
6 30
 #ifndef action_h
7 31
 #define action_h
8 32
 
Browse code

TM callbacks, acc, flags

Jiri Kuthan authored on 13/05/2002 01:15:40
Showing 1 changed files
... ...
@@ -6,7 +6,7 @@
6 6
 #ifndef action_h
7 7
 #define action_h
8 8
 
9
-#include "msg_parser.h"
9
+#include "parser/msg_parser.h"
10 10
 #include "route_struct.h"
11 11
 
12 12
 int do_action(struct action* a, struct sip_msg* msg);
Browse code

- compiles ok

Andrei Pelinescu-Onciul authored on 21/09/2001 15:24:24
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,19 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ */
5
+
6
+#ifndef action_h
7
+#define action_h
8
+
9
+#include "msg_parser.h"
10
+#include "route_struct.h"
11
+
12
+int do_action(struct action* a, struct sip_msg* msg);
13
+int run_actions(struct action* a, struct sip_msg* msg);
14
+
15
+
16
+
17
+
18
+
19
+#endif