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,110 +0,0 @@
1
-/*
2
- *
3
- * Copyright (C) 2001-2003 FhG Fokus
4
- *
5
- * This file is part of Kamailio, a free SIP server.
6
- *
7
- * Kamailio is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version
11
- *
12
- * Kamailio is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License 
18
- * along with this program; if not, write to the Free Software 
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
- */
21
-/*!
22
-* \file
23
-* \brief Kamailio core :: Name/alias handling
24
-* \author andrei
25
-* \ingroup core
26
-* Module: \ref core
27
-*/
28
-
29
-
30
-
31
-#include "str.h"
32
-#include "dprint.h"
33
-#include "mem/mem.h"
34
-
35
-
36
-
37
-struct host_alias{
38
-	str alias;
39
-	unsigned short port;
40
-	unsigned short proto;
41
-	struct host_alias* next;
42
-};
43
-
44
-
45
-extern struct host_alias* aliases;
46
-
47
-
48
-
49
-/** returns 1 if  name is in the alias list; if port=0, port no is ignored
50
- * if proto=0, proto is ignored*/
51
-static inline int grep_aliases(char* name, int len, unsigned short port,
52
-								unsigned short proto)
53
-{
54
-	struct  host_alias* a;
55
-	
56
-	if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
57
-		/* ipv6 reference, skip [] */
58
-		name++;
59
-		len-=2;
60
-	}
61
-	for(a=aliases;a;a=a->next)
62
-		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
63
-				(a->port==port)) && ((a->proto==0) || (proto==0) || 
64
-				(a->proto==proto)) && (strncasecmp(a->alias.s, name, len)==0))
65
-			return 1;
66
-	return 0;
67
-}
68
-
69
-
70
-
71
-/** adds an alias to the list (only if it isn't already there)
72
- * if port==0, the alias will match all the ports
73
- * if proto==0, the alias will match all the protocols
74
- * returns 1 if a new alias was added, 0 if a matching alias was already on
75
- * the list and  -1 on error */
76
-static inline int add_alias(char* name, int len, unsigned short port, 
77
-								unsigned short proto)
78
-{
79
-	struct host_alias* a;
80
-	
81
-	if ((port) && (proto)){
82
-		/* don't add if there is already an alias matching it */
83
-		if (grep_aliases(name,len, port, proto)) return 0;
84
-	}else{
85
-		/* don't add if already in the list with port or proto ==0*/
86
-		for(a=aliases;a;a=a->next)
87
-			if ((a->alias.len==len) && (a->port==port) && (a->proto==proto) &&
88
-					(strncasecmp(a->alias.s, name, len)==0))
89
-				return 0;
90
-	}
91
-	a=(struct host_alias*)pkg_malloc(sizeof(struct host_alias));
92
-	if(a==0) goto error;
93
-	a->alias.s=(char*)pkg_malloc(len+1);
94
-	if (a->alias.s==0) goto error;
95
-	a->alias.len=len;
96
-	memcpy(a->alias.s, name, len);
97
-	a->alias.s[len]=0; /* null terminate for easier printing*/
98
-	a->port=port;
99
-	a->proto=proto;
100
-	a->next=aliases;
101
-	aliases=a;
102
-	return 1;
103
-error:
104
-	LM_ERR("memory allocation error\n");
105
-	if (a) pkg_free(a);
106
-	return -1;
107
-}
108
-
109
-
110
-
Browse code

Core Update of doxygen, removal of history, changing "ser" to "kamailio"

Olle E. Johansson authored on 03/01/2015 14:03:24
Showing 1 changed files
... ...
@@ -1,22 +1,15 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  *
5 3
  * Copyright (C) 2001-2003 FhG Fokus
6 4
  *
7
- * This file is part of ser, a free SIP server.
5
+ * This file is part of Kamailio, a free SIP server.
8 6
  *
9
- * ser is free software; you can redistribute it and/or modify
7
+ * Kamailio is free software; you can redistribute it and/or modify
10 8
  * it under the terms of the GNU General Public License as published by
11 9
  * the Free Software Foundation; either version 2 of the License, or
12 10
  * (at your option) any later version
13 11
  *
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,
12
+ * Kamailio is distributed in the hope that it will be useful,
20 13
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 14
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 15
  * GNU General Public License for more details.
... ...
@@ -25,12 +18,13 @@
25 18
  * along with this program; if not, write to the Free Software 
26 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 20
  */
28
-/*
29
- * History:
30
- * --------
31
- *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
32
- *  2003-10-21  support for proto added: proto:host:port (andrei)
33
- */
21
+/*!
22
+* \file
23
+* \brief Kamailio core :: Name/alias handling
24
+* \author andrei
25
+* \ingroup core
26
+* Module: \ref core
27
+*/
34 28
 
35 29
 
36 30
 
... ...
@@ -52,7 +46,7 @@ extern struct host_alias* aliases;
52 46
 
53 47
 
54 48
 
55
-/* returns 1 if  name is in the alias list; if port=0, port no is ignored
49
+/** returns 1 if  name is in the alias list; if port=0, port no is ignored
56 50
  * if proto=0, proto is ignored*/
57 51
 static inline int grep_aliases(char* name, int len, unsigned short port,
58 52
 								unsigned short proto)
... ...
@@ -74,7 +68,7 @@ static inline int grep_aliases(char* name, int len, unsigned short port,
74 68
 
75 69
 
76 70
 
77
-/* adds an alias to the list (only if it isn't already there)
71
+/** adds an alias to the list (only if it isn't already there)
78 72
  * if port==0, the alias will match all the ports
79 73
  * if proto==0, the alias will match all the protocols
80 74
  * returns 1 if a new alias was added, 0 if a matching alias was already on
Browse code

name_alias.h: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 18:51:32
Showing 1 changed files
... ...
@@ -107,7 +107,7 @@ static inline int add_alias(char* name, int len, unsigned short port,
107 107
 	aliases=a;
108 108
 	return 1;
109 109
 error:
110
-	LOG(L_ERR, "ERROR: add_alias: memory allocation error\n");
110
+	LM_ERR("memory allocation error\n");
111 111
 	if (a) pkg_free(a);
112 112
 	return -1;
113 113
 }
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
  * History:
Browse code

core and modules: make IPv6 default, remove compile time flags

* Make IPv6 the default in the core and affected modules
* it has been default switched on since a long time, and was introduced in 2002
* even on embedded systems one probably want now proper IPv6 support
* there was an issue in cygwin in 2008, but IPv6 is there also available since v1.7
* remove over 160 #ifdefs, cleanup the code a lot and removes many of rarely
tested alternative code paths to ease support of the codebase
* note for gentoo maintainer: please review your packages, they will maybe not
work now correctly anymore if somebody specified -ipv6 in the use flags

Henning Westerholt authored on 18/05/2013 08:07:25
Showing 1 changed files
... ...
@@ -59,13 +59,11 @@ static inline int grep_aliases(char* name, int len, unsigned short port,
59 59
 {
60 60
 	struct  host_alias* a;
61 61
 	
62
-#ifdef USE_IPV6
63 62
 	if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
64 63
 		/* ipv6 reference, skip [] */
65 64
 		name++;
66 65
 		len-=2;
67 66
 	}
68
-#endif
69 67
 	for(a=aliases;a;a=a->next)
70 68
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
71 69
 				(a->port==port)) && ((a->proto==0) || (proto==0) || 
Browse code

- added grep_sock_info and updated check_self to use it

Andrei Pelinescu-Onciul authored on 10/10/2004 16:19:00
Showing 1 changed files
... ...
@@ -59,6 +59,13 @@ static inline int grep_aliases(char* name, int len, unsigned short port,
59 59
 {
60 60
 	struct  host_alias* a;
61 61
 	
62
+#ifdef USE_IPV6
63
+	if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
64
+		/* ipv6 reference, skip [] */
65
+		name++;
66
+		len-=2;
67
+	}
68
+#endif
62 69
 	for(a=aliases;a;a=a->next)
63 70
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
64 71
 				(a->port==port)) && ((a->proto==0) || (proto==0) || 
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

- aliases proto support

Andrei Pelinescu-Onciul authored on 21/10/2003 23:28:46
Showing 1 changed files
... ...
@@ -29,6 +29,7 @@
29 29
  * History:
30 30
  * --------
31 31
  *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
32
+ *  2003-10-21  support for proto added: proto:host:port (andrei)
32 33
  */
33 34
 
34 35
 
... ...
@@ -42,6 +43,7 @@
42 43
 struct host_alias{
43 44
 	str alias;
44 45
 	unsigned short port;
46
+	unsigned short proto;
45 47
 	struct host_alias* next;
46 48
 };
47 49
 
... ...
@@ -50,19 +52,17 @@ extern struct host_alias* aliases;
50 52
 
51 53
 
52 54
 
53
-/* returns 1 if  name is in the alias list; if port=0, port no is ignored*/
54
-static inline int grep_aliases(char* name, int len, unsigned short port)
55
+/* returns 1 if  name is in the alias list; if port=0, port no is ignored
56
+ * if proto=0, proto is ignored*/
57
+static inline int grep_aliases(char* name, int len, unsigned short port,
58
+								unsigned short proto)
55 59
 {
56 60
 	struct  host_alias* a;
57 61
 	
58 62
 	for(a=aliases;a;a=a->next)
59
-#ifdef USE_TLS
60 63
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
61
-					(port==tls_port_no) ||
62
-#else
63
-		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
64
-#endif
65
-				(a->port==port)) && (strncasecmp(a->alias.s, name, len)==0))
64
+				(a->port==port)) && ((a->proto==0) || (proto==0) || 
65
+				(a->proto==proto)) && (strncasecmp(a->alias.s, name, len)==0))
66 66
 			return 1;
67 67
 	return 0;
68 68
 }
... ...
@@ -71,14 +71,24 @@ static inline int grep_aliases(char* name, int len, unsigned short port)
71 71
 
72 72
 /* adds an alias to the list (only if it isn't already there)
73 73
  * if port==0, the alias will match all the ports
74
- * returns 1 if a new alias was added, 0 if the alias was already on the list
75
- * and  -1 on error */
76
-static inline int add_alias(char* name, int len, unsigned short port)
74
+ * if proto==0, the alias will match all the protocols
75
+ * returns 1 if a new alias was added, 0 if a matching alias was already on
76
+ * the list and  -1 on error */
77
+static inline int add_alias(char* name, int len, unsigned short port, 
78
+								unsigned short proto)
77 79
 {
78 80
 	struct host_alias* a;
79 81
 	
80
-	if ((port) && grep_aliases(name,len, port)) return 0;
81
-	a=0;
82
+	if ((port) && (proto)){
83
+		/* don't add if there is already an alias matching it */
84
+		if (grep_aliases(name,len, port, proto)) return 0;
85
+	}else{
86
+		/* don't add if already in the list with port or proto ==0*/
87
+		for(a=aliases;a;a=a->next)
88
+			if ((a->alias.len==len) && (a->port==port) && (a->proto==proto) &&
89
+					(strncasecmp(a->alias.s, name, len)==0))
90
+				return 0;
91
+	}
82 92
 	a=(struct host_alias*)pkg_malloc(sizeof(struct host_alias));
83 93
 	if(a==0) goto error;
84 94
 	a->alias.s=(char*)pkg_malloc(len+1);
... ...
@@ -87,6 +97,7 @@ static inline int add_alias(char* name, int len, unsigned short port)
87 97
 	memcpy(a->alias.s, name, len);
88 98
 	a->alias.s[len]=0; /* null terminate for easier printing*/
89 99
 	a->port=port;
100
+	a->proto=proto;
90 101
 	a->next=aliases;
91 102
 	aliases=a;
92 103
 	return 1;
Browse code

- checkself ipv6 and case insensitiveness fixes

Andrei Pelinescu-Onciul authored on 21/08/2003 15:34:27
Showing 1 changed files
... ...
@@ -57,7 +57,8 @@ static inline int grep_aliases(char* name, int len, unsigned short port)
57 57
 	
58 58
 	for(a=aliases;a;a=a->next)
59 59
 #ifdef USE_TLS
60
-		if ((a->alias.len==len) && ((a->port==0) || (port==0) || (port==tls_port_no) ||
60
+		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
61
+					(port==tls_port_no) ||
61 62
 #else
62 63
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
63 64
 #endif
Browse code

- check_self matches TLS connections.

Jan Janak authored on 20/08/2003 12:58:06
Showing 1 changed files
... ...
@@ -56,7 +56,11 @@ static inline int grep_aliases(char* name, int len, unsigned short port)
56 56
 	struct  host_alias* a;
57 57
 	
58 58
 	for(a=aliases;a;a=a->next)
59
+#ifdef USE_TLS
60
+		if ((a->alias.len==len) && ((a->port==0) || (port==0) || (port==tls_port_no) ||
61
+#else
59 62
 		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
63
+#endif
60 64
 				(a->port==port)) && (strncasecmp(a->alias.s, name, len)==0))
61 65
 			return 1;
62 66
 	return 0;
Browse code

- replaced all mallocs/frees w/ pkg_malloc/pkg_free - minor lock_dealloc warning fixes

Andrei Pelinescu-Onciul authored on 19/03/2003 18:41:58
Showing 1 changed files
... ...
@@ -25,11 +25,17 @@
25 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
+/*
29
+ * History:
30
+ * --------
31
+ *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
32
+ */
28 33
 
29 34
 
30 35
 
31 36
 #include "str.h"
32 37
 #include "dprint.h"
38
+#include "mem/mem.h"
33 39
 
34 40
 
35 41
 
... ...
@@ -68,9 +74,9 @@ static inline int add_alias(char* name, int len, unsigned short port)
68 74
 	
69 75
 	if ((port) && grep_aliases(name,len, port)) return 0;
70 76
 	a=0;
71
-	a=(struct host_alias*)malloc(sizeof(struct host_alias));
77
+	a=(struct host_alias*)pkg_malloc(sizeof(struct host_alias));
72 78
 	if(a==0) goto error;
73
-	a->alias.s=(char*)malloc(len+1);
79
+	a->alias.s=(char*)pkg_malloc(len+1);
74 80
 	if (a->alias.s==0) goto error;
75 81
 	a->alias.len=len;
76 82
 	memcpy(a->alias.s, name, len);
... ...
@@ -81,7 +87,7 @@ static inline int add_alias(char* name, int len, unsigned short port)
81 87
 	return 1;
82 88
 error:
83 89
 	LOG(L_ERR, "ERROR: add_alias: memory allocation error\n");
84
-	if (a) free(a);
90
+	if (a) pkg_free(a);
85 91
 	return -1;
86 92
 }
87 93
 
Browse code

- myself matches now also the uri port - modified check_self, add_alias & grep_alias to accept port numbers - added loopback check - modified get_send_socket to return the first non loopback ipv4 interface if bind_address==0

Andrei Pelinescu-Onciul authored on 23/10/2002 15:12:20
Showing 1 changed files
... ...
@@ -35,6 +35,7 @@
35 35
 
36 36
 struct host_alias{
37 37
 	str alias;
38
+	unsigned short port;
38 39
 	struct host_alias* next;
39 40
 };
40 41
 
... ...
@@ -43,13 +44,14 @@ extern struct host_alias* aliases;
43 44
 
44 45
 
45 46
 
46
-/* returns 1 if  name is in the alias list*/
47
-static inline int grep_aliases(char* name, int len)
47
+/* returns 1 if  name is in the alias list; if port=0, port no is ignored*/
48
+static inline int grep_aliases(char* name, int len, unsigned short port)
48 49
 {
49 50
 	struct  host_alias* a;
50 51
 	
51 52
 	for(a=aliases;a;a=a->next)
52
-		if ((a->alias.len==len) && (strncasecmp(a->alias.s, name, len)==0))
53
+		if ((a->alias.len==len) && ((a->port==0) || (port==0) || 
54
+				(a->port==port)) && (strncasecmp(a->alias.s, name, len)==0))
53 55
 			return 1;
54 56
 	return 0;
55 57
 }
... ...
@@ -57,13 +59,14 @@ static inline int grep_aliases(char* name, int len)
57 59
 
58 60
 
59 61
 /* adds an alias to the list (only if it isn't already there)
62
+ * if port==0, the alias will match all the ports
60 63
  * returns 1 if a new alias was added, 0 if the alias was already on the list
61 64
  * and  -1 on error */
62
-static inline int add_alias(char* name, int len)
65
+static inline int add_alias(char* name, int len, unsigned short port)
63 66
 {
64 67
 	struct host_alias* a;
65 68
 	
66
-	if (grep_aliases(name,len)) return 0;
69
+	if ((port) && grep_aliases(name,len, port)) return 0;
67 70
 	a=0;
68 71
 	a=(struct host_alias*)malloc(sizeof(struct host_alias));
69 72
 	if(a==0) goto error;
... ...
@@ -72,6 +75,7 @@ static inline int add_alias(char* name, int len)
72 75
 	a->alias.len=len;
73 76
 	memcpy(a->alias.s, name, len);
74 77
 	a->alias.s[len]=0; /* null terminate for easier printing*/
78
+	a->port=port;
75 79
 	a->next=aliases;
76 80
 	aliases=a;
77 81
 	return 1;
Browse code

GPLization banner introduced to *.[hc] files

Jiri Kuthan authored on 19/09/2002 12:23:52
Showing 1 changed files
... ...
@@ -1,9 +1,33 @@
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
 
6 29
 
30
+
7 31
 #include "str.h"
8 32
 #include "dprint.h"
9 33
 
Browse code

- added aliases (names that ser will think are his own) - now the offical name will be put in sock_info[r] and the aliases in the. host_alias list. - added new script config. parameter: alias=

Andrei Pelinescu-Onciul authored on 20/08/2002 09:34:12
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,61 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ */
5
+
6
+
7
+#include "str.h"
8
+#include "dprint.h"
9
+
10
+
11
+
12
+struct host_alias{
13
+	str alias;
14
+	struct host_alias* next;
15
+};
16
+
17
+
18
+extern struct host_alias* aliases;
19
+
20
+
21
+
22
+/* returns 1 if  name is in the alias list*/
23
+static inline int grep_aliases(char* name, int len)
24
+{
25
+	struct  host_alias* a;
26
+	
27
+	for(a=aliases;a;a=a->next)
28
+		if ((a->alias.len==len) && (strncasecmp(a->alias.s, name, len)==0))
29
+			return 1;
30
+	return 0;
31
+}
32
+
33
+
34
+
35
+/* adds an alias to the list (only if it isn't already there)
36
+ * returns 1 if a new alias was added, 0 if the alias was already on the list
37
+ * and  -1 on error */
38
+static inline int add_alias(char* name, int len)
39
+{
40
+	struct host_alias* a;
41
+	
42
+	if (grep_aliases(name,len)) return 0;
43
+	a=0;
44
+	a=(struct host_alias*)malloc(sizeof(struct host_alias));
45
+	if(a==0) goto error;
46
+	a->alias.s=(char*)malloc(len+1);
47
+	if (a->alias.s==0) goto error;
48
+	a->alias.len=len;
49
+	memcpy(a->alias.s, name, len);
50
+	a->alias.s[len]=0; /* null terminate for easier printing*/
51
+	a->next=aliases;
52
+	aliases=a;
53
+	return 1;
54
+error:
55
+	LOG(L_ERR, "ERROR: add_alias: memory allocation error\n");
56
+	if (a) free(a);
57
+	return -1;
58
+}
59
+
60
+
61
+