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,97 +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
- * \file
22
- * \brief Kamailio core :: Proxy 
23
- * \ingroup core
24
- * \author andrei
25
- * Module: \ref core
26
- */
27
-
28
-#ifndef proxy_h
29
-#define proxy_h
30
-
31
-#include <netdb.h>
32
-#include "ip_addr.h"
33
-#include "str.h"
34
-#include "config.h"
35
-
36
-struct proxy_l{
37
-	struct proxy_l* next;
38
-	str name; /* original name */
39
-	struct hostent host; /* addresses */
40
-	unsigned short port;
41
-	unsigned short reserved; /*align*/
42
-	int proto;
43
-	
44
-	/* socket ? */
45
-
46
-	int addr_idx;	/* crt. addr. idx. */
47
-	int ok; /* 0 on error */
48
-	/*statistics*/
49
-	int tx;
50
-	int tx_bytes;
51
-	int errors;
52
-};
53
-
54
-extern struct proxy_l* proxies;
55
-
56
-struct proxy_l* add_proxy(str* name, unsigned short port, int proto);
57
-struct proxy_l* mk_proxy(str* name, unsigned short port, int proto);
58
-struct proxy_l* mk_shm_proxy(str* name, unsigned short port, int proto);
59
-struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short port,
60
-									int proto);
61
-void free_proxy(struct proxy_l* p);
62
-void free_shm_proxy(struct proxy_l* p);
63
-
64
-
65
-
66
-/** returns 0 on success, -1 on error (unknown af/bug) */
67
-inline static int proxy2su(union sockaddr_union* su, struct proxy_l* p)
68
-{
69
-	/* if error try next ip address if possible */
70
-	if (p->ok==0){
71
-		if (p->host.h_addr_list[p->addr_idx+1])
72
-			p->addr_idx++;
73
-		else p->addr_idx=0;
74
-		p->ok=1;
75
-	}
76
-	
77
-	return hostent2su(su, &p->host, p->addr_idx,
78
-				(p->port)?p->port:((p->proto==PROTO_TLS)?SIPS_PORT:SIP_PORT) );
79
-}
80
-
81
-
82
-
83
-/** mark proxy either as ok (err>=0) or as bad (err<0) */
84
-inline static void proxy_mark(struct proxy_l* p, int err)
85
-{
86
-	if (err<0){
87
-		p->errors++;
88
-		p->ok=0;
89
-	}else{
90
-		p->tx++;
91
-	}
92
-}
93
-
94
-
95
-
96
-#endif
97
-
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,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.
... ...
@@ -25,12 +17,13 @@
25 17
  * along with this program; if not, write to the Free Software 
26 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 19
  */
28
- /*
29
-  * History:
30
-  * -------
31
-  *  2003-02-13  added proto to struct proxy_l & to *_proxy functions (andrei)
32
-  */
33
-
20
+/*!
21
+ * \file
22
+ * \brief Kamailio core :: Proxy 
23
+ * \ingroup core
24
+ * \author andrei
25
+ * Module: \ref core
26
+ */
34 27
 
35 28
 #ifndef proxy_h
36 29
 #define proxy_h
... ...
@@ -70,7 +63,7 @@ void free_shm_proxy(struct proxy_l* p);
70 63
 
71 64
 
72 65
 
73
-/* returns 0 on success, -1 on error (unknown af/bug) */
66
+/** returns 0 on success, -1 on error (unknown af/bug) */
74 67
 inline static int proxy2su(union sockaddr_union* su, struct proxy_l* p)
75 68
 {
76 69
 	/* if error try next ip address if possible */
... ...
@@ -87,7 +80,7 @@ inline static int proxy2su(union sockaddr_union* su, struct proxy_l* p)
87 80
 
88 81
 
89 82
 
90
-/* mark as proxy either as ok (err>=0) or as bad (err<0) */
83
+/** mark proxy either as ok (err>=0) or as bad (err<0) */
91 84
 inline static void proxy_mark(struct proxy_l* p, int err)
92 85
 {
93 86
 	if (err<0){
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

Shared memory versions of mk_proxy and free_proxy.

This patch adds function mk_shm_proxy, which is the shared memory
version of function mk_proxy. In addition to that it adds function
free_shm_proxy which is the shared memory version of free_proxy.

To avoid code duplication, we turned the body of the original
hostent_cpy function into macro called HOSTENT_CPY, the macro takes
malloc and free functions as parameters. The macro is then called in
the body of hostent_cpy with pkg_malloc and pkg_free as parameters and
in the body of hostent_shm_cpy with shm_malloc and shm_free as
parameters.

We did the same to mk_proxy function. The original body of the function
was converted into macro MK_PROXY which, again, takes memory allocation
functions as we all the hostent copy function as parameters.

Jan Janak authored on 31/03/2009 00:47:44
Showing 1 changed files
... ...
@@ -62,9 +62,11 @@ extern struct proxy_l* proxies;
62 62
 
63 63
 struct proxy_l* add_proxy(str* name, unsigned short port, int proto);
64 64
 struct proxy_l* mk_proxy(str* name, unsigned short port, int proto);
65
+struct proxy_l* mk_shm_proxy(str* name, unsigned short port, int proto);
65 66
 struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short port,
66 67
 									int proto);
67 68
 void free_proxy(struct proxy_l* p);
69
+void free_shm_proxy(struct proxy_l* p);
68 70
 
69 71
 
70 72
 
Browse code

- more dest_info conversions: - forward_request takes now a dest_info parameter - various something2dst conversions functions - got rid of the temprary mk_proxy when forwarding after the uri - updated all the affected modules

WARNING: not tested, use with care

Andrei Pelinescu-Onciul authored on 18/04/2006 19:56:48
Showing 1 changed files
... ...
@@ -38,6 +38,7 @@
38 38
 #include <netdb.h>
39 39
 #include "ip_addr.h"
40 40
 #include "str.h"
41
+#include "config.h"
41 42
 
42 43
 struct proxy_l{
43 44
 	struct proxy_l* next;
... ...
@@ -66,5 +67,36 @@ struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short port,
66 67
 void free_proxy(struct proxy_l* p);
67 68
 
68 69
 
70
+
71
+/* returns 0 on success, -1 on error (unknown af/bug) */
72
+inline static int proxy2su(union sockaddr_union* su, struct proxy_l* p)
73
+{
74
+	/* if error try next ip address if possible */
75
+	if (p->ok==0){
76
+		if (p->host.h_addr_list[p->addr_idx+1])
77
+			p->addr_idx++;
78
+		else p->addr_idx=0;
79
+		p->ok=1;
80
+	}
81
+	
82
+	return hostent2su(su, &p->host, p->addr_idx,
83
+				(p->port)?p->port:((p->proto==PROTO_TLS)?SIPS_PORT:SIP_PORT) );
84
+}
85
+
86
+
87
+
88
+/* mark as proxy either as ok (err>=0) or as bad (err<0) */
89
+inline static void proxy_mark(struct proxy_l* p, int err)
90
+{
91
+	if (err<0){
92
+		p->errors++;
93
+		p->ok=0;
94
+	}else{
95
+		p->tx++;
96
+	}
97
+}
98
+
99
+
100
+
69 101
 #endif
70 102
 
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
  *
... ...
@@ -28,7 +28,7 @@
28 28
  /*
29 29
   * History:
30 30
   * -------
31
-  *  2003-02-13  added proto to struct proxy_l & to *_proxy fucntions (andrei)
31
+  *  2003-02-13  added proto to struct proxy_l & to *_proxy functions (andrei)
32 32
   */
33 33
 
34 34
 
... ...
@@ -51,7 +51,7 @@ struct proxy_l{
51 51
 
52 52
 	int addr_idx;	/* crt. addr. idx. */
53 53
 	int ok; /* 0 on error */
54
-	/*statisticis*/
54
+	/*statistics*/
55 55
 	int tx;
56 56
 	int tx_bytes;
57 57
 	int errors;
Browse code

- tm tcp support (though no timers yet) changelist (random order): - forward.c: removed calls to upd_send & tcp_send & replaced them with calls to msg_send - ip_addr.h: added struct dest_info (used in tm rbs) - proxy.c: all *proxy fucntions require also the protocol - resolve.c: added proto to sip_resolvehost, for SRV lookups - tags.h: changed TOTAG_LEN into TOTAG_VALUE_LEN, to solve redefinition conflict with tm/t_msgbuilder.h - modules/sl/sl_funcs.c: modified sl_send_reply to use the transport independend msg_send - modules/tm/t_funcs.c: modified send_pr_buffer to use msg_send & rb->dst - modules/tm/t_fwd.c: added proto to various functions - modules/tm/t_lookup.c: init_rb() is proto indep. & it uses struct dest_info - modules/tm/t_msgbuilder.c: build_uac_request uses proto - modules/tm/t_reply.c: updated to use rb->dst, fixed TOTAG_LEN bug - modules/tm/tm.c: added t_forward_nonack_{udp, tcp}, t_relay_to_{udp,tcp}, t_replicate_{udp, tcp} - modules/tm/uac.c: t_uac, t _uac_dlg, gethfblock, uri2proxy changed to use proto & rb->dst - modules/tm/ut.h: added proto to uri2proxy

old tag & version: pre6-tcp4
new tag & version (current): pre6-tcp5-tm

Andrei Pelinescu-Onciul authored on 19/02/2003 17:16:41
Showing 1 changed files
... ...
@@ -25,6 +25,11 @@
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-02-13  added proto to struct proxy_l & to *_proxy fucntions (andrei)
32
+  */
28 33
 
29 34
 
30 35
 #ifndef proxy_h
... ...
@@ -40,6 +45,7 @@ struct proxy_l{
40 45
 	struct hostent host; /* addresses */
41 46
 	unsigned short port;
42 47
 	unsigned short reserved; /*align*/
48
+	int proto;
43 49
 	
44 50
 	/* socket ? */
45 51
 
... ...
@@ -53,9 +59,10 @@ struct proxy_l{
53 59
 
54 60
 extern struct proxy_l* proxies;
55 61
 
56
-struct proxy_l* add_proxy(str* name, unsigned short port);
57
-struct proxy_l* mk_proxy(str* name, unsigned short port);
58
-struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short port);
62
+struct proxy_l* add_proxy(str* name, unsigned short port, int proto);
63
+struct proxy_l* mk_proxy(str* name, unsigned short port, int proto);
64
+struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short port,
65
+									int proto);
59 66
 void free_proxy(struct proxy_l* p);
60 67
 
61 68
 
Browse code

parse_uri cleanup: - It does no create copy of strings anymore - Fields are not zero terminated - Prototype of some low-level functions changed to accept str* instead of char*, that includes: mk_proxy, sip_resolvehost, str2ip, str2ip6, ip_addr2he - All modules updated (hopefully)

Jan Janak authored on 17/12/2002 18:14:32
Showing 1 changed files
... ...
@@ -32,10 +32,11 @@
32 32
 
33 33
 #include <netdb.h>
34 34
 #include "ip_addr.h"
35
+#include "str.h"
35 36
 
36 37
 struct proxy_l{
37 38
 	struct proxy_l* next;
38
-	char* name; /* original name */
39
+	str name; /* original name */
39 40
 	struct hostent host; /* addresses */
40 41
 	unsigned short port;
41 42
 	unsigned short reserved; /*align*/
... ...
@@ -52,8 +53,8 @@ struct proxy_l{
52 53
 
53 54
 extern struct proxy_l* proxies;
54 55
 
55
-struct proxy_l* add_proxy(char* name, unsigned short port);
56
-struct proxy_l* mk_proxy(char* name, unsigned short port);
56
+struct proxy_l* add_proxy(str* name, unsigned short port);
57
+struct proxy_l* mk_proxy(str* name, unsigned short port);
57 58
 struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short port);
58 59
 void free_proxy(struct proxy_l* p);
59 60
 
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 proxy_h
7 31
 #define proxy_h
8 32
 
Browse code

- ipv6 support (-DUSE_IPV6) - changed all the sockaddr/ip addr structures - added gethostbyname/addr wrappers (resolve.h)

Andrei Pelinescu-Onciul authored on 26/05/2002 13:50:48
Showing 1 changed files
... ...
@@ -7,6 +7,7 @@
7 7
 #define proxy_h
8 8
 
9 9
 #include <netdb.h>
10
+#include "ip_addr.h"
10 11
 
11 12
 struct proxy_l{
12 13
 	struct proxy_l* next;
... ...
@@ -29,7 +30,7 @@ extern struct proxy_l* proxies;
29 30
 
30 31
 struct proxy_l* add_proxy(char* name, unsigned short port);
31 32
 struct proxy_l* mk_proxy(char* name, unsigned short port);
32
-struct proxy_l* mk_proxy_from_ip(unsigned int ip, unsigned short port);
33
+struct proxy_l* mk_proxy_from_ip(struct ip_addr* ip, unsigned short port);
33 34
 void free_proxy(struct proxy_l* p);
34 35
 
35 36
 
Browse code

script hardwired and ACK maching fixed

Bogdan-Andrei Iancu authored on 15/01/2002 17:36:44
Showing 1 changed files
... ...
@@ -29,6 +29,7 @@ extern struct proxy_l* proxies;
29 29
 
30 30
 struct proxy_l* add_proxy(char* name, unsigned short port);
31 31
 struct proxy_l* mk_proxy(char* name, unsigned short port);
32
+struct proxy_l* mk_proxy_from_ip(unsigned int ip, unsigned short port);
32 33
 void free_proxy(struct proxy_l* p);
33 34
 
34 35
 
Browse code

- fixed a memroy leak (rewritehost/uri/etc.) - added forward to uri support (forward(uri:host, uri:port) ). - improved free_lump_list speed (could be dangerous)

Andrei Pelinescu-Onciul authored on 26/10/2001 20:28:55
Showing 1 changed files
... ...
@@ -28,6 +28,8 @@ struct proxy_l{
28 28
 extern struct proxy_l* proxies;
29 29
 
30 30
 struct proxy_l* add_proxy(char* name, unsigned short port);
31
+struct proxy_l* mk_proxy(char* name, unsigned short port);
32
+void free_proxy(struct proxy_l* p);
31 33
 
32 34
 
33 35
 #endif
Browse code

- compiles ok

Andrei Pelinescu-Onciul authored on 21/09/2001 15:24:24
Showing 1 changed files
... ...
@@ -27,6 +27,8 @@ struct proxy_l{
27 27
 
28 28
 extern struct proxy_l* proxies;
29 29
 
30
+struct proxy_l* add_proxy(char* name, unsigned short port);
31
+
30 32
 
31 33
 #endif
32 34
 
Browse code

- still to do action,c

Andrei Pelinescu-Onciul authored on 20/09/2001 17:17:26
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,32 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ */
5
+
6
+#ifndef proxy_h
7
+#define proxy_h
8
+
9
+#include <netdb.h>
10
+
11
+struct proxy_l{
12
+	struct proxy_l* next;
13
+	char* name; /* original name */
14
+	struct hostent host; /* addresses */
15
+	unsigned short port;
16
+	unsigned short reserved; /*align*/
17
+	
18
+	/* socket ? */
19
+
20
+	int addr_idx;	/* crt. addr. idx. */
21
+	int ok; /* 0 on error */
22
+	/*statisticis*/
23
+	int tx;
24
+	int tx_bytes;
25
+	int errors;
26
+};
27
+
28
+extern struct proxy_l* proxies;
29
+
30
+
31
+#endif
32
+