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,123 +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
-/*! \file
17
- * \brief Kamailio core :: tcp_stats.h - tcp statistics macros
18
- * \ingroup core
19
- */
20
-
21
-#ifndef __tcp_stats_h
22
-#define __tcp_stats_h
23
-
24
-/* enable tcp stats by default */
25
-#ifndef NO_TCP_STATS
26
-#define USE_TCP_STATS
27
-#endif
28
-
29
-#ifndef USE_TCP_STATS
30
-
31
-#define INIT_TCP_STATS() 0 /* success */
32
-#define DESTROY_TCP_STATS()
33
-
34
-#define TCP_STATS_ESTABLISHED(state)
35
-#define TCP_STATS_CONNECT_FAILED()
36
-#define TCP_STATS_LOCAL_REJECT()
37
-#define TCP_STATS_CON_TIMEOUT()
38
-#define TCP_STATS_CON_RESET()
39
-#define TCP_STATS_SEND_TIMEOUT()
40
-#define TCP_STATS_SENDQ_FULL()
41
-
42
-#else /* USE_TCP_STATS */
43
-
44
-#include "counters.h"
45
-
46
-struct tcp_counters_h {
47
-	counter_handle_t established;
48
-	counter_handle_t passive_open;
49
-	counter_handle_t connect_success;
50
-	counter_handle_t connect_failed;
51
-	counter_handle_t local_reject;
52
-	counter_handle_t con_timeout;
53
-	counter_handle_t con_reset;
54
-	counter_handle_t send_timeout;
55
-	counter_handle_t sendq_full;
56
-};
57
-
58
-extern struct tcp_counters_h tcp_cnts_h;
59
-
60
-int tcp_stats_init(void);
61
-void tcp_stats_destroy(void);
62
-
63
-#define INIT_TCP_STATS() tcp_stats_init()
64
-
65
-#define DESTROY_TCP_STATS() tcp_stats_destroy()
66
-
67
-
68
-/** called each time a new tcp connection is established.
69
- *  @param state - S_CONN_ACCEPT if it was the result of an accept()
70
- *               - S_CONN_CONNECT if it was the result of a connect()
71
- * Note: in general it will be called when the first packet was received or
72
- *   sent on the new connection and not immediately after accept() or 
73
- *   connect()
74
- */
75
-#define TCP_STATS_ESTABLISHED(state) \
76
-	do { \
77
-		counter_inc(tcp_cnts_h.established); \
78
-		if (state == S_CONN_ACCEPT) \
79
-			counter_inc(tcp_cnts_h.passive_open); \
80
-		else \
81
-			counter_inc(tcp_cnts_h.connect_success); \
82
-	}while(0)
83
-
84
-/** called each time a new outgoing connection fails.  */
85
-#define TCP_STATS_CONNECT_FAILED() \
86
-	counter_inc(tcp_cnts_h.connect_failed)
87
-
88
-/** called each time a new incoming connection is rejected.
89
- * (accept() denied due to maximum number of TCP connections being exceeded)
90
- */
91
-#define TCP_STATS_LOCAL_REJECT() \
92
-	counter_inc(tcp_cnts_h.local_reject)
93
-
94
-
95
-/** called each time a connection lifetime expires.
96
-  * (the connection is closed for being idle for too long)
97
-  */
98
-#define TCP_STATS_CON_TIMEOUT() \
99
-	counter_inc(tcp_cnts_h.con_timeout)
100
-
101
-
102
-/** called each time a TCP RST is received on an established connection.  */
103
-#define TCP_STATS_CON_RESET() \
104
-	counter_inc(tcp_cnts_h.con_reset)
105
-
106
-/** called each time a send operation fails due to a timeout.
107
-  * FIXME: it works only in async mode (in sync. mode a send might timeout
108
-  *  but the stats won't be increased).
109
-  */
110
-#define TCP_STATS_SEND_TIMEOUT() \
111
-	counter_inc(tcp_cnts_h.send_timeout)
112
-
113
-/** called each time a send fails due to the buffering capacity being exceeded.
114
-  * (used only in tcp async mode)
115
-  */
116
-#define TCP_STATS_SENDQ_FULL() \
117
-	counter_inc(tcp_cnts_h.sendq_full)
118
-
119
-#endif /* USE_TCP_STATS */
120
-
121
-#endif /*__tcp_stats_h*/
122
-
123
-/* 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,10 @@
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
- * tcp_stats.h - tcp statistics macros
16
+/*! \file
17
+ * \brief Kamailio core :: tcp_stats.h - tcp statistics macros
18
+ * \ingroup core
20 19
  */
21
-/*
22
- * History:
23
- * --------
24
- *  2009-04-08  initial version (andrei)
25
-*/
26 20
 
27 21
 #ifndef __tcp_stats_h
28 22
 #define __tcp_stats_h
Browse code

core: Added void to declarations of functions with empty argument list

In C language, a declaration in the form int f(); is equivalent to int f(...);, thus being able to accept an indefinit number of parameters. With the -Wstrict-prototypes GCC options, these declarations are reported as "function declaration isn’t a prototype".
On some cases, this may trick the compiler into generating unoptimized code (like preparing to handle variadic argument list).
In all cases having a declaration int f() and a definition inf f(int) is missleading, even if standard compliant.
This is still Work in Progress. (maybe adding the -Wstrict-prototypes option to default is desireable)

Marius Zbihlei authored on 02/04/2012 14:19:17
Showing 1 changed files
... ...
@@ -63,8 +63,8 @@ struct tcp_counters_h {
63 63
 
64 64
 extern struct tcp_counters_h tcp_cnts_h;
65 65
 
66
-int tcp_stats_init();
67
-void tcp_stats_destroy();
66
+int tcp_stats_init(void);
67
+void tcp_stats_destroy(void);
68 68
 
69 69
 #define INIT_TCP_STATS() tcp_stats_init()
70 70
 
Browse code

tcp: enable tcp statistics

tcp statistics implemented using the counters api.
Enabled by default (unless compiles with -DNO_TCP_STATS).
E.g.:
$ sercmd cnt.grp_get_all tcp
{
con_reset: 4
con_timeout: 0
connect_failed: 6
connect_success: 1
established: 12
local_reject: 0
passive_open: 11
send_timeout: 0
sendq_full: 0
}

Andrei Pelinescu-Onciul authored on 08/08/2010 22:16:54
Showing 1 changed files
... ...
@@ -27,6 +27,11 @@
27 27
 #ifndef __tcp_stats_h
28 28
 #define __tcp_stats_h
29 29
 
30
+/* enable tcp stats by default */
31
+#ifndef NO_TCP_STATS
32
+#define USE_TCP_STATS
33
+#endif
34
+
30 35
 #ifndef USE_TCP_STATS
31 36
 
32 37
 #define INIT_TCP_STATS() 0 /* success */
... ...
@@ -42,9 +47,28 @@
42 47
 
43 48
 #else /* USE_TCP_STATS */
44 49
 
45
-#define INIT_TCP_STATS() 0 /* success */
50
+#include "counters.h"
46 51
 
47
-#define DESTROY_TCP_STATS()
52
+struct tcp_counters_h {
53
+	counter_handle_t established;
54
+	counter_handle_t passive_open;
55
+	counter_handle_t connect_success;
56
+	counter_handle_t connect_failed;
57
+	counter_handle_t local_reject;
58
+	counter_handle_t con_timeout;
59
+	counter_handle_t con_reset;
60
+	counter_handle_t send_timeout;
61
+	counter_handle_t sendq_full;
62
+};
63
+
64
+extern struct tcp_counters_h tcp_cnts_h;
65
+
66
+int tcp_stats_init();
67
+void tcp_stats_destroy();
68
+
69
+#define INIT_TCP_STATS() tcp_stats_init()
70
+
71
+#define DESTROY_TCP_STATS() tcp_stats_destroy()
48 72
 
49 73
 
50 74
 /** called each time a new tcp connection is established.
... ...
@@ -54,36 +78,49 @@
54 78
  *   sent on the new connection and not immediately after accept() or 
55 79
  *   connect()
56 80
  */
57
-#define TCP_STATS_ESTABLISHED(state)
81
+#define TCP_STATS_ESTABLISHED(state) \
82
+	do { \
83
+		counter_inc(tcp_cnts_h.established); \
84
+		if (state == S_CONN_ACCEPT) \
85
+			counter_inc(tcp_cnts_h.passive_open); \
86
+		else \
87
+			counter_inc(tcp_cnts_h.connect_success); \
88
+	}while(0)
58 89
 
59 90
 /** called each time a new outgoing connection fails.  */
60
-#define TCP_STATS_CONNECT_FAILED()
91
+#define TCP_STATS_CONNECT_FAILED() \
92
+	counter_inc(tcp_cnts_h.connect_failed)
61 93
 
62 94
 /** called each time a new incoming connection is rejected.
63 95
  * (accept() denied due to maximum number of TCP connections being exceeded)
64 96
  */
65
-#define TCP_STATS_LOCAL_REJECT()
97
+#define TCP_STATS_LOCAL_REJECT() \
98
+	counter_inc(tcp_cnts_h.local_reject)
66 99
 
67 100
 
68 101
 /** called each time a connection lifetime expires.
69 102
   * (the connection is closed for being idle for too long)
70 103
   */
71
-#define TCP_STATS_CON_TIMEOUT()
104
+#define TCP_STATS_CON_TIMEOUT() \
105
+	counter_inc(tcp_cnts_h.con_timeout)
72 106
 
73 107
 
74 108
 /** called each time a TCP RST is received on an established connection.  */
75
-#define TCP_STATS_CON_RESET()
109
+#define TCP_STATS_CON_RESET() \
110
+	counter_inc(tcp_cnts_h.con_reset)
76 111
 
77 112
 /** called each time a send operation fails due to a timeout.
78 113
   * FIXME: it works only in async mode (in sync. mode a send might timeout
79 114
   *  but the stats won't be increased).
80 115
   */
81
-#define TCP_STATS_SEND_TIMEOUT()
116
+#define TCP_STATS_SEND_TIMEOUT() \
117
+	counter_inc(tcp_cnts_h.send_timeout)
82 118
 
83 119
 /** called each time a send fails due to the buffering capacity being exceeded.
84 120
   * (used only in tcp async mode)
85 121
   */
86
-#define TCP_STATS_SENDQ_FULL()
122
+#define TCP_STATS_SENDQ_FULL() \
123
+	counter_inc(tcp_cnts_h.sendq_full)
87 124
 
88 125
 #endif /* USE_TCP_STATS */
89 126
 
Browse code

tcp: stats: added init & destroy macros

Andrei Pelinescu-Onciul authored on 10/04/2009 10:24:40
Showing 1 changed files
... ...
@@ -27,6 +27,26 @@
27 27
 #ifndef __tcp_stats_h
28 28
 #define __tcp_stats_h
29 29
 
30
+#ifndef USE_TCP_STATS
31
+
32
+#define INIT_TCP_STATS() 0 /* success */
33
+#define DESTROY_TCP_STATS()
34
+
35
+#define TCP_STATS_ESTABLISHED(state)
36
+#define TCP_STATS_CONNECT_FAILED()
37
+#define TCP_STATS_LOCAL_REJECT()
38
+#define TCP_STATS_CON_TIMEOUT()
39
+#define TCP_STATS_CON_RESET()
40
+#define TCP_STATS_SEND_TIMEOUT()
41
+#define TCP_STATS_SENDQ_FULL()
42
+
43
+#else /* USE_TCP_STATS */
44
+
45
+#define INIT_TCP_STATS() 0 /* success */
46
+
47
+#define DESTROY_TCP_STATS()
48
+
49
+
30 50
 /** called each time a new tcp connection is established.
31 51
  *  @param state - S_CONN_ACCEPT if it was the result of an accept()
32 52
  *               - S_CONN_CONNECT if it was the result of a connect()
... ...
@@ -65,7 +85,7 @@
65 85
   */
66 86
 #define TCP_STATS_SENDQ_FULL()
67 87
 
68
-
88
+#endif /* USE_TCP_STATS */
69 89
 
70 90
 #endif /*__tcp_stats_h*/
71 91
 
Browse code

tcp: internal macro-hooks for stats & events

- added macros for tcp statistics (for now empty, keeping
more statistics will only involve redefining them):

TCP_STATS_ESTABLISHED(state) - new connection established
TCP_STATS_CONNECT_FAILED() - new outgoing connection failed
TCP_STATS_LOCAL_REJECT() - new incoming connection rejected
(max. no exceeded)
TCP_STATS_CON_TIMEOUT() - connection closed for being idle too
long
TCP_STATS_SEND_TIMEOUT() - send fails due to a timeout
TCP_STATS_SENDQ_FULL() - send fails because of the buffering
capacity being exceed (async mode
only)

- added macros for various tcp events (for now some of them are
used for logging):

TCP_EV_CONNECT_RST(...) - connect attempt received RST
TCP_EV_CONNECT_UNREACHABLE(...)
TCP_EV_CONNECT_TIMEOUT(...)
TCP_EV_CONNECT_NO_MORE_PORTS(...)
TCP_EV_CONNECT_ERR(...) - other connect error
TCP_EV_SEND_TIMEOUT(...)
TCP_EV_SENDQ_FULL(...)
TCP_EV_IDLE_CONN_CLOSED(...)

Andrei Pelinescu-Onciul authored on 09/04/2009 19:10:56
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,72 @@
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
+ * tcp_stats.h - tcp statistics macros
20
+ */
21
+/*
22
+ * History:
23
+ * --------
24
+ *  2009-04-08  initial version (andrei)
25
+*/
26
+
27
+#ifndef __tcp_stats_h
28
+#define __tcp_stats_h
29
+
30
+/** called each time a new tcp connection is established.
31
+ *  @param state - S_CONN_ACCEPT if it was the result of an accept()
32
+ *               - S_CONN_CONNECT if it was the result of a connect()
33
+ * Note: in general it will be called when the first packet was received or
34
+ *   sent on the new connection and not immediately after accept() or 
35
+ *   connect()
36
+ */
37
+#define TCP_STATS_ESTABLISHED(state)
38
+
39
+/** called each time a new outgoing connection fails.  */
40
+#define TCP_STATS_CONNECT_FAILED()
41
+
42
+/** called each time a new incoming connection is rejected.
43
+ * (accept() denied due to maximum number of TCP connections being exceeded)
44
+ */
45
+#define TCP_STATS_LOCAL_REJECT()
46
+
47
+
48
+/** called each time a connection lifetime expires.
49
+  * (the connection is closed for being idle for too long)
50
+  */
51
+#define TCP_STATS_CON_TIMEOUT()
52
+
53
+
54
+/** called each time a TCP RST is received on an established connection.  */
55
+#define TCP_STATS_CON_RESET()
56
+
57
+/** called each time a send operation fails due to a timeout.
58
+  * FIXME: it works only in async mode (in sync. mode a send might timeout
59
+  *  but the stats won't be increased).
60
+  */
61
+#define TCP_STATS_SEND_TIMEOUT()
62
+
63
+/** called each time a send fails due to the buffering capacity being exceeded.
64
+  * (used only in tcp async mode)
65
+  */
66
+#define TCP_STATS_SENDQ_FULL()
67
+
68
+
69
+
70
+#endif /*__tcp_stats_h*/
71
+
72
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */