Browse code

sctp: new module for SCTP transport

- moved the sctp specific code from core to a module to make it easy to
enable/disable sctp by loading/not loading the module instead of
recompiling

Daniel-Constantin Mierla authored on 25/05/2013 07:33:39
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,139 +0,0 @@
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
- * sctp_stats.h - sctp statistics macros
20
- */
21
-/*
22
- * History:
23
- * --------
24
- *  2009-04-28  initial version (andrei)
25
-*/
26
-
27
-#ifndef __sctp_stats_h
28
-#define __sctp_stats_h
29
-
30
-
31
-/* enable sctp stats by default */
32
-#ifndef NO_SCTP_STATS
33
-#define USE_SCTP_STATS
34
-#endif
35
-
36
-#ifndef USE_SCTP_STATS
37
-
38
-#define INIT_SCTP_STATS() 0 /* success */
39
-#define DESTROY_SCTP_STATS()
40
-
41
-#define SCTP_STATS_ESTABLISHED()
42
-#define SCTP_STATS_CONNECT_FAILED()
43
-#define SCTP_STATS_LOCAL_REJECT()
44
-#define SCTP_STATS_REMOTE_SHUTDOWN()
45
-#define SCTP_STATS_ASSOC_SHUTDOWN()
46
-#define SCTP_STATS_COMM_LOST()
47
-#define SCTP_STATS_SENDQ_FULL()
48
-#define SCTP_STATS_SEND_FAILED()
49
-#define SCTP_STATS_SEND_FORCE_RETRY()
50
-
51
-#else /* USE_SCTP_STATS */
52
-
53
-#include "counters.h"
54
-
55
-struct sctp_counters_h {
56
-	counter_handle_t established;
57
-	counter_handle_t connect_failed;
58
-	counter_handle_t local_reject;
59
-	counter_handle_t remote_shutdown;
60
-	counter_handle_t assoc_shutdown;
61
-	counter_handle_t comm_lost;
62
-	counter_handle_t sendq_full;
63
-	counter_handle_t send_failed;
64
-	counter_handle_t send_force_retry;
65
-};
66
-
67
-extern struct sctp_counters_h sctp_cnts_h;
68
-
69
-int sctp_stats_init();
70
-void sctp_stats_destroy();
71
-
72
-#define INIT_SCTP_STATS() sctp_stats_init() /* success */
73
-
74
-#define DESTROY_SCTP_STATS() sctp_stats_destroy()
75
-
76
-
77
-/** called each time a new sctp assoc. is established.
78
- * sctp notification: SCTP_COMM_UP.
79
- */
80
-#define SCTP_STATS_ESTABLISHED() \
81
-	counter_inc(sctp_cnts_h.established)
82
-
83
-/** called each time a new outgoing connection/assoc open fails.
84
- *  sctp notification: SCTP_CANT_STR_ASSOC
85
- */
86
-#define SCTP_STATS_CONNECT_FAILED() \
87
-	counter_inc(sctp_cnts_h.connect_failed)
88
-
89
-/** called each time a new incoming connection is rejected.  */
90
-#define SCTP_STATS_LOCAL_REJECT() \
91
-	counter_inc(sctp_cnts_h.local_reject)
92
-
93
-
94
-/** called each time a connection is closed by the peer.
95
-  * sctp notification: SCTP_SHUTDOWN_EVENT
96
-  */
97
-#define SCTP_STATS_REMOTE_SHUTDOWN() \
98
-	counter_inc(sctp_cnts_h.remote_shutdown)
99
-
100
-
101
-/** called each time a connection is shutdown.
102
-  * sctp notification: SCTP_SHUTDOWN_COMP
103
-  */
104
-#define SCTP_STATS_ASSOC_SHUTDOWN() \
105
-	counter_inc(sctp_cnts_h.assoc_shutdown)
106
-
107
-
108
-/** called each time an established connection is closed due to some error.
109
-  * sctp notification: SCTP_COMM_LOST
110
-  */
111
-#define SCTP_STATS_COMM_LOST() \
112
-	counter_inc(sctp_cnts_h.comm_lost)
113
-
114
-
115
-/** called each time a send fails due to the buffering capacity being exceeded.
116
-  * (send fails due to full kernel buffers)
117
-  */
118
-#define SCTP_STATS_SENDQ_FULL() \
119
-	counter_inc(sctp_cnts_h.sendq_full)
120
-
121
-
122
-/** called each time a send fails.
123
-  * (send fails for any reason except buffers full)
124
-  * sctp notification: SCTP_SEND_FAILED
125
-  */
126
-#define SCTP_STATS_SEND_FAILED() \
127
-	counter_inc(sctp_cnts_h.send_failed)
128
-
129
-/** called each time a failed send is force-retried.
130
-  * (possible only if sctp_send_retries is != 0)
131
-  */
132
-#define SCTP_STATS_SEND_FORCE_RETRY() \
133
-	counter_inc(sctp_cnts_h.send_force_retry)
134
-
135
-#endif /* USE_SCTP_STATS */
136
-
137
-#endif /*__sctp_stats_h*/
138
-
139
-/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
Browse code

sctp: enable statistics

sctp statistics implemented using the counters api.
Enabled by default (unless compiles with -DNO_SCTP_STATS).
E.g.:
$ sercmd cnt.grp_get_all sctp
{
assoc_shutdown: 1
comm_lost: 0
connect_failed: 1
established: 1
local_reject: 0
remote_shutdown: 1
send_force_retry: 0
sendq_full: 0
}

Andrei Pelinescu-Onciul authored on 08/08/2010 22:35:04
Showing 1 changed files
... ...
@@ -28,6 +28,11 @@
28 28
 #define __sctp_stats_h
29 29
 
30 30
 
31
+/* enable sctp stats by default */
32
+#ifndef NO_SCTP_STATS
33
+#define USE_SCTP_STATS
34
+#endif
35
+
31 36
 #ifndef USE_SCTP_STATS
32 37
 
33 38
 #define INIT_SCTP_STATS() 0 /* success */
... ...
@@ -45,59 +50,87 @@
45 50
 
46 51
 #else /* USE_SCTP_STATS */
47 52
 
48
-#define INIT_SCTP_STATS() 0 /* success */
53
+#include "counters.h"
49 54
 
50
-#define DESTROY_SCTP_STATS()
55
+struct sctp_counters_h {
56
+	counter_handle_t established;
57
+	counter_handle_t connect_failed;
58
+	counter_handle_t local_reject;
59
+	counter_handle_t remote_shutdown;
60
+	counter_handle_t assoc_shutdown;
61
+	counter_handle_t comm_lost;
62
+	counter_handle_t sendq_full;
63
+	counter_handle_t send_failed;
64
+	counter_handle_t send_force_retry;
65
+};
66
+
67
+extern struct sctp_counters_h sctp_cnts_h;
68
+
69
+int sctp_stats_init();
70
+void sctp_stats_destroy();
71
+
72
+#define INIT_SCTP_STATS() sctp_stats_init() /* success */
73
+
74
+#define DESTROY_SCTP_STATS() sctp_stats_destroy()
51 75
 
52 76
 
53 77
 /** called each time a new sctp assoc. is established.
54 78
  * sctp notification: SCTP_COMM_UP.
55 79
  */
56
-#define SCTP_STATS_ESTABLISHED()
80
+#define SCTP_STATS_ESTABLISHED() \
81
+	counter_inc(sctp_cnts_h.established)
57 82
 
58 83
 /** called each time a new outgoing connection/assoc open fails.
59 84
  *  sctp notification: SCTP_CANT_STR_ASSOC
60 85
  */
61
-#define SCTP_STATS_CONNECT_FAILED()
86
+#define SCTP_STATS_CONNECT_FAILED() \
87
+	counter_inc(sctp_cnts_h.connect_failed)
62 88
 
63 89
 /** called each time a new incoming connection is rejected.  */
64
-#define SCTP_STATS_LOCAL_REJECT()
90
+#define SCTP_STATS_LOCAL_REJECT() \
91
+	counter_inc(sctp_cnts_h.local_reject)
65 92
 
66 93
 
67 94
 /** called each time a connection is closed by the peer.
68 95
   * sctp notification: SCTP_SHUTDOWN_EVENT
69 96
   */
70
-#define SCTP_STATS_REMOTE_SHUTDOWN()
97
+#define SCTP_STATS_REMOTE_SHUTDOWN() \
98
+	counter_inc(sctp_cnts_h.remote_shutdown)
71 99
 
72 100
 
73 101
 /** called each time a connection is shutdown.
74 102
   * sctp notification: SCTP_SHUTDOWN_COMP
75 103
   */
76
-#define SCTP_STATS_ASSOC_SHUTDOWN()
104
+#define SCTP_STATS_ASSOC_SHUTDOWN() \
105
+	counter_inc(sctp_cnts_h.assoc_shutdown)
77 106
 
78 107
 
79 108
 /** called each time an established connection is closed due to some error.
80 109
   * sctp notification: SCTP_COMM_LOST
81 110
   */
82
-#define SCTP_STATS_COMM_LOST()
111
+#define SCTP_STATS_COMM_LOST() \
112
+	counter_inc(sctp_cnts_h.comm_lost)
83 113
 
84 114
 
85 115
 /** called each time a send fails due to the buffering capacity being exceeded.
86 116
   * (send fails due to full kernel buffers)
87 117
   */
88
-#define SCTP_STATS_SENDQ_FULL()
118
+#define SCTP_STATS_SENDQ_FULL() \
119
+	counter_inc(sctp_cnts_h.sendq_full)
89 120
 
90 121
 
91 122
 /** called each time a send fails.
92 123
   * (send fails for any reason except buffers full)
93 124
   * sctp notification: SCTP_SEND_FAILED
94 125
   */
95
-#define SCTP_STATS_SEND_FAILED()
126
+#define SCTP_STATS_SEND_FAILED() \
127
+	counter_inc(sctp_cnts_h.send_failed)
96 128
 
97 129
 /** called each time a failed send is force-retried.
98 130
   * (possible only if sctp_send_retries is != 0)
99 131
   */
100
-#define SCTP_STATS_SEND_FORCE_RETRY()
132
+#define SCTP_STATS_SEND_FORCE_RETRY() \
133
+	counter_inc(sctp_cnts_h.send_force_retry)
101 134
 
102 135
 #endif /* USE_SCTP_STATS */
103 136
 
Browse code

sctp: SCTP_STATS_ASSOC_SHUTDOWN

Statistics placeholder for counting shutdowns.

Andrei Pelinescu-Onciul authored on 23/12/2009 15:58:45
Showing 1 changed files
... ...
@@ -37,6 +37,7 @@
37 37
 #define SCTP_STATS_CONNECT_FAILED()
38 38
 #define SCTP_STATS_LOCAL_REJECT()
39 39
 #define SCTP_STATS_REMOTE_SHUTDOWN()
40
+#define SCTP_STATS_ASSOC_SHUTDOWN()
40 41
 #define SCTP_STATS_COMM_LOST()
41 42
 #define SCTP_STATS_SENDQ_FULL()
42 43
 #define SCTP_STATS_SEND_FAILED()
... ...
@@ -69,6 +70,12 @@
69 70
 #define SCTP_STATS_REMOTE_SHUTDOWN()
70 71
 
71 72
 
73
+/** called each time a connection is shutdown.
74
+  * sctp notification: SCTP_SHUTDOWN_COMP
75
+  */
76
+#define SCTP_STATS_ASSOC_SHUTDOWN()
77
+
78
+
72 79
 /** called each time an established connection is closed due to some error.
73 80
   * sctp notification: SCTP_COMM_LOST
74 81
   */
Browse code

sctp: internal macro-hooks for stats

Added macros for sctp statistics. (for now empty, keeping
more statistics will only involve redefining them):

SCTP_STATS_ESTABLISHED() - new association is opened successfully
SCTP_STATS_CONNECT_FAILED() - attempt to open new assoc. failed
SCTP_STATS_LOCAL_REJECT() - local reject of a "connect" attempt
(unused for now)
SCTP_STATS_REMOTE_SHUTDOWN()
SCTP_STATS_COMM_LOST() - error on open association
SCTP_STATS_SENDQ_FULL() - send failed due to full buffers (kernel)
SCTP_STATS_SEND_FAILED() - send failed for some other reason
SCTP_STATS_SEND_FORCE_RETRY() - send failed and retried
(sctp_send_retries!=0)

Andrei Pelinescu-Onciul authored on 30/04/2009 16:38:54
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,99 @@
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
+ * sctp_stats.h - sctp statistics macros
20
+ */
21
+/*
22
+ * History:
23
+ * --------
24
+ *  2009-04-28  initial version (andrei)
25
+*/
26
+
27
+#ifndef __sctp_stats_h
28
+#define __sctp_stats_h
29
+
30
+
31
+#ifndef USE_SCTP_STATS
32
+
33
+#define INIT_SCTP_STATS() 0 /* success */
34
+#define DESTROY_SCTP_STATS()
35
+
36
+#define SCTP_STATS_ESTABLISHED()
37
+#define SCTP_STATS_CONNECT_FAILED()
38
+#define SCTP_STATS_LOCAL_REJECT()
39
+#define SCTP_STATS_REMOTE_SHUTDOWN()
40
+#define SCTP_STATS_COMM_LOST()
41
+#define SCTP_STATS_SENDQ_FULL()
42
+#define SCTP_STATS_SEND_FAILED()
43
+#define SCTP_STATS_SEND_FORCE_RETRY()
44
+
45
+#else /* USE_SCTP_STATS */
46
+
47
+#define INIT_SCTP_STATS() 0 /* success */
48
+
49
+#define DESTROY_SCTP_STATS()
50
+
51
+
52
+/** called each time a new sctp assoc. is established.
53
+ * sctp notification: SCTP_COMM_UP.
54
+ */
55
+#define SCTP_STATS_ESTABLISHED()
56
+
57
+/** called each time a new outgoing connection/assoc open fails.
58
+ *  sctp notification: SCTP_CANT_STR_ASSOC
59
+ */
60
+#define SCTP_STATS_CONNECT_FAILED()
61
+
62
+/** called each time a new incoming connection is rejected.  */
63
+#define SCTP_STATS_LOCAL_REJECT()
64
+
65
+
66
+/** called each time a connection is closed by the peer.
67
+  * sctp notification: SCTP_SHUTDOWN_EVENT
68
+  */
69
+#define SCTP_STATS_REMOTE_SHUTDOWN()
70
+
71
+
72
+/** called each time an established connection is closed due to some error.
73
+  * sctp notification: SCTP_COMM_LOST
74
+  */
75
+#define SCTP_STATS_COMM_LOST()
76
+
77
+
78
+/** called each time a send fails due to the buffering capacity being exceeded.
79
+  * (send fails due to full kernel buffers)
80
+  */
81
+#define SCTP_STATS_SENDQ_FULL()
82
+
83
+
84
+/** called each time a send fails.
85
+  * (send fails for any reason except buffers full)
86
+  * sctp notification: SCTP_SEND_FAILED
87
+  */
88
+#define SCTP_STATS_SEND_FAILED()
89
+
90
+/** called each time a failed send is force-retried.
91
+  * (possible only if sctp_send_retries is != 0)
92
+  */
93
+#define SCTP_STATS_SEND_FORCE_RETRY()
94
+
95
+#endif /* USE_SCTP_STATS */
96
+
97
+#endif /*__sctp_stats_h*/
98
+
99
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */