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,118 +0,0 @@
1
-/* 
2
- * Copyright (C) 2006 iptelorg GmbH
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 :: non-sip callbacks, called whenever a message with protocol != SIP/2.0
24
- * is received (the message must have at least a sip like first line or
25
- * else they will be dropped before this callbacks are called
26
- *
27
- * \ingroup core
28
- * Module: \ref core
29
- */
30
-
31
-#include "nonsip_hooks.h"
32
-#include "mem/mem.h"
33
-
34
-static struct nonsip_hook* nonsip_hooks;
35
-static unsigned int nonsip_max_hooks=MAX_NONSIP_HOOKS;
36
-static int last_hook_idx=0;
37
-
38
-
39
-
40
-int init_nonsip_hooks()
41
-{
42
-	nonsip_hooks=pkg_malloc(nonsip_max_hooks*
43
-									sizeof(struct nonsip_hook));
44
-	if (nonsip_hooks==0){
45
-		goto error;
46
-	}
47
-	memset(nonsip_hooks, 0, nonsip_max_hooks*sizeof(struct nonsip_hook));
48
-	return 0;
49
-error:
50
-	LM_ERR("memory allocation failure\n");
51
-	return -1;
52
-}
53
-
54
-
55
-
56
-void destroy_nonsip_hooks()
57
-{
58
-	int r;
59
-	
60
-	if (nonsip_hooks){
61
-		for (r=0; r<last_hook_idx; r++){
62
-			if (nonsip_hooks[r].destroy)
63
-				nonsip_hooks[r].destroy();
64
-		}
65
-		pkg_free(nonsip_hooks);
66
-		nonsip_hooks=0;
67
-	}
68
-}
69
-
70
-
71
-
72
-/* allocates a new hook
73
- * returns 0 on success and -1 on error */
74
-int register_nonsip_msg_hook(struct nonsip_hook *h)
75
-{
76
-	struct nonsip_hook* tmp;
77
-	int new_max_hooks;
78
-	
79
-	if (nonsip_max_hooks==0)
80
-		goto error;
81
-	if (last_hook_idx >= nonsip_max_hooks){
82
-		new_max_hooks=2*nonsip_max_hooks;
83
-		tmp=pkg_realloc(nonsip_hooks, 
84
-				new_max_hooks*sizeof(struct nonsip_hook));
85
-		if (tmp==0){
86
-			goto error;
87
-		}
88
-		nonsip_hooks=tmp;
89
-		/* init the new chunk */
90
-		memset(&nonsip_hooks[last_hook_idx+1], 0, 
91
-					(new_max_hooks-nonsip_max_hooks-1)*
92
-						sizeof(struct nonsip_hook));
93
-		nonsip_max_hooks=new_max_hooks;
94
-	}
95
-	nonsip_hooks[last_hook_idx]=*h;
96
-	last_hook_idx++;
97
-	return 0;
98
-error:
99
-	return -1;
100
-}
101
-
102
-
103
-
104
-int nonsip_msg_run_hooks(struct sip_msg* msg)
105
-{
106
-	int r;
107
-	int ret;
108
-	
109
-	ret=NONSIP_MSG_DROP; /* default, if no hook installed, drop */
110
-	for (r=0; r<last_hook_idx; r++){
111
-		ret=nonsip_hooks[r].on_nonsip_req(msg);
112
-		if (ret!=NONSIP_MSG_PASS) break;
113
-	}
114
-	return ret;
115
-}
116
-
117
-
118
-
Browse code

core Update headers, change "SIP-router" to "Kamailio", update doxygen file headers

Olle E. Johansson authored on 03/01/2015 14:15:58
Showing 1 changed files
... ...
@@ -8,11 +8,6 @@
8 8
  * the Free Software Foundation; either version 2 of the License, or
9 9
  * (at your option) any later version
10 10
  *
11
- * For a license to use the ser software under conditions
12
- * other than those described here, or to purchase support for this
13
- * software, please contact iptel.org by e-mail at the following addresses:
14
- *    info@iptel.org
15
- *
16 11
  * Kamailio is distributed in the hope that it will be useful,
17 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Browse code

Core Removed history, svn $id$ and doxygen udpates on the .c files

Olle E. Johansson authored on 03/01/2015 09:53:17
Showing 1 changed files
... ...
@@ -1,11 +1,9 @@
1 1
 /* 
2
- * $Id$
3
- * 
4 2
  * Copyright (C) 2006 iptelorg GmbH
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
... ...
@@ -15,7 +13,7 @@
15 13
  * software, please contact iptel.org by e-mail at the following addresses:
16 14
  *    info@iptel.org
17 15
  *
18
- * ser is distributed in the hope that it will be useful,
16
+ * Kamailio is distributed in the hope that it will be useful,
19 17
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 18
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 19
  * GNU General Public License for more details.
... ...
@@ -24,20 +22,13 @@
24 22
  * along with this program; if not, write to the Free Software
25 23
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
26 24
  */
27
-/*
28
- * non-sip callbacks, called whenever a message with protocol != SIP/2.0
29
- * is received (the message must have at least a sip like first line or
30
- * else they will be dropped before this callbacks are called
31
- */
32
-/* 
33
- * History:
34
- * --------
35
- *  2006-11-29  created by andrei
36
- */
37 25
 
38 26
 /*!
39 27
  * \file
40
- * \brief SIP-router core :: 
28
+ * \brief Kamailio core :: non-sip callbacks, called whenever a message with protocol != SIP/2.0
29
+ * is received (the message must have at least a sip like first line or
30
+ * else they will be dropped before this callbacks are called
31
+ *
41 32
  * \ingroup core
42 33
  * Module: \ref core
43 34
  */
Browse code

nonsip_hooks.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 20:38:02
Showing 1 changed files
... ...
@@ -61,7 +61,7 @@ int init_nonsip_hooks()
61 61
 	memset(nonsip_hooks, 0, nonsip_max_hooks*sizeof(struct nonsip_hook));
62 62
 	return 0;
63 63
 error:
64
-	LOG(L_ERR, "nonsip_hooks: memory allocation failure\n");
64
+	LM_ERR("memory allocation failure\n");
65 65
 	return -1;
66 66
 }
67 67
 
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
... ...
@@ -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
  * non-sip callbacks, called whenever a message with protocol != SIP/2.0
Browse code

Adding doxygen template to all core .c files

Please fill in after the :: to explain the function of this file.

oej authored on 10/10/2009 13:54:13
Showing 1 changed files
... ...
@@ -35,6 +35,13 @@
35 35
  *  2006-11-29  created by andrei
36 36
  */
37 37
 
38
+/*!
39
+ * \file
40
+ * \brief SIP-router core :: 
41
+ * \ingroup core
42
+ * Module: \ref core
43
+ */
44
+
38 45
 #include "nonsip_hooks.h"
39 46
 #include "mem/mem.h"
40 47
 
Browse code

- added special callbacks for non-sip msg (e.g http), They are called every time a message with the first line in sip/http format is received and the protocol != SIP. These callbacks are needed as a part of an xmlrpc bug fix.

Andrei Pelinescu-Onciul authored on 11/12/2006 15:47:32
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,125 @@
1
+/* 
2
+ * $Id$
3
+ * 
4
+ * Copyright (C) 2006 iptelorg GmbH
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
26
+ */
27
+/*
28
+ * non-sip callbacks, called whenever a message with protocol != SIP/2.0
29
+ * is received (the message must have at least a sip like first line or
30
+ * else they will be dropped before this callbacks are called
31
+ */
32
+/* 
33
+ * History:
34
+ * --------
35
+ *  2006-11-29  created by andrei
36
+ */
37
+
38
+#include "nonsip_hooks.h"
39
+#include "mem/mem.h"
40
+
41
+static struct nonsip_hook* nonsip_hooks;
42
+static unsigned int nonsip_max_hooks=MAX_NONSIP_HOOKS;
43
+static int last_hook_idx=0;
44
+
45
+
46
+
47
+int init_nonsip_hooks()
48
+{
49
+	nonsip_hooks=pkg_malloc(nonsip_max_hooks*
50
+									sizeof(struct nonsip_hook));
51
+	if (nonsip_hooks==0){
52
+		goto error;
53
+	}
54
+	memset(nonsip_hooks, 0, nonsip_max_hooks*sizeof(struct nonsip_hook));
55
+	return 0;
56
+error:
57
+	LOG(L_ERR, "nonsip_hooks: memory allocation failure\n");
58
+	return -1;
59
+}
60
+
61
+
62
+
63
+void destroy_nonsip_hooks()
64
+{
65
+	int r;
66
+	
67
+	if (nonsip_hooks){
68
+		for (r=0; r<last_hook_idx; r++){
69
+			if (nonsip_hooks[r].destroy)
70
+				nonsip_hooks[r].destroy();
71
+		}
72
+		pkg_free(nonsip_hooks);
73
+		nonsip_hooks=0;
74
+	}
75
+}
76
+
77
+
78
+
79
+/* allocates a new hook
80
+ * returns 0 on success and -1 on error */
81
+int register_nonsip_msg_hook(struct nonsip_hook *h)
82
+{
83
+	struct nonsip_hook* tmp;
84
+	int new_max_hooks;
85
+	
86
+	if (nonsip_max_hooks==0)
87
+		goto error;
88
+	if (last_hook_idx >= nonsip_max_hooks){
89
+		new_max_hooks=2*nonsip_max_hooks;
90
+		tmp=pkg_realloc(nonsip_hooks, 
91
+				new_max_hooks*sizeof(struct nonsip_hook));
92
+		if (tmp==0){
93
+			goto error;
94
+		}
95
+		nonsip_hooks=tmp;
96
+		/* init the new chunk */
97
+		memset(&nonsip_hooks[last_hook_idx+1], 0, 
98
+					(new_max_hooks-nonsip_max_hooks-1)*
99
+						sizeof(struct nonsip_hook));
100
+		nonsip_max_hooks=new_max_hooks;
101
+	}
102
+	nonsip_hooks[last_hook_idx]=*h;
103
+	last_hook_idx++;
104
+	return 0;
105
+error:
106
+	return -1;
107
+}
108
+
109
+
110
+
111
+int nonsip_msg_run_hooks(struct sip_msg* msg)
112
+{
113
+	int r;
114
+	int ret;
115
+	
116
+	ret=NONSIP_MSG_DROP; /* default, if no hook installed, drop */
117
+	for (r=0; r<last_hook_idx; r++){
118
+		ret=nonsip_hooks[r].on_nonsip_req(msg);
119
+		if (ret!=NONSIP_MSG_PASS) break;
120
+	}
121
+	return ret;
122
+}
123
+
124
+
125
+