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,97 +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_ev.h - sctp events
20
- */
21
-/*
22
- * History:
23
- * --------
24
- *  2009-04-28  initial version (andrei)
25
-*/
26
-
27
-#ifndef __sctp_ev_h
28
-#define __sctp_ev_h
29
-
30
-#include <errno.h>
31
-#include <string.h>
32
-
33
-#ifndef USE_SCTP_EV
34
-
35
-#define SCTP_EV_ASSOC_CHANGE(lip, lport, src, reason, state)
36
-#define SCTP_EV_PEER_ADDR_CHANGE(lip, lport, src, reason, state, addr_su)
37
-#define SCTP_EV_REMOTE_ERROR(lip, lport, src, err)
38
-#define SCTP_EV_SEND_FAILED(lip, lport, src, err)
39
-#define SCTP_EV_SHUTDOWN_EVENT(lip, lport, src)
40
-#define SCTP_EV_SENDER_DRY_EVENT(lip, lport, src)
41
-
42
-#else /* USE_SCTP_EV */
43
-
44
-#include "ip_addr.h"
45
-
46
-
47
-/** an association has either been opened or closed.
48
- * called for each SCTP_ASSOC_CHANGE event.
49
- *
50
- * @param err - if 0 it should be ignored (no corresp. libc error), if non-0
51
- *                it will contain the errno.
52
- * @param lip   - pointer to an ip_addr containing the local ip
53
- *                   or 0 if dynamic (WARNING can be 0).
54
- * @param lport - pointer to an ip_addr containing the local port or 0
55
- *                   if unknown/dynamic.
56
- * @param src   - pointer to a sockaddr_union containing the src.
57
- * @param proto - protocol used
58
- */
59
-#define SCTP_EV_ASSOC_CHANGE(lip, lport, src, reason, state) \
60
-	DBG("SCTP_ASSOC_CHANGE from %s on %s:%d: %s\n", \
61
-			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, reason)
62
-
63
-/** an address part of an assoc. changed state.
64
- * called for the SCTP_PEER_ADDR_CHANGE event.*/
65
-#define SCTP_EV_PEER_ADDR_CHANGE(lip, lport, src, reason, state, addr_su) \
66
-	DBG("SCTP_PEER_ADDR_CHANGE from %s on %s:%d: %s\n", \
67
-			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, reason)
68
-
69
-/** remote operation error from the peer.
70
- * called for the SCTP_REMOTE_ERROR event.*/
71
-#define SCTP_EV_REMOTE_ERROR(lip, lport, src, err) \
72
-	DBG("SCTP_REMOTE_ERROR from %s on %s:%d: %d\n", \
73
-			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, err)
74
-
75
-/** send failed.
76
- * called for the SCTP_SEND_FAILED event.*/
77
-#define SCTP_EV_SEND_FAILED(lip, lport, src, err) \
78
-	DBG("SCTP_SEND_FAILED from %s on %s:%d: %d\n", \
79
-			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, err)
80
-
81
-/** the peer has sent a shutdown.
82
- * called for the SCTP_SHUTDOWN_EVENT event.*/
83
-#define SCTP_EV_SHUTDOWN_EVENT(lip, lport, src) \
84
-	DBG("SCTP_SHUTDOWN_EVENT from %s on %s:%d\n", \
85
-			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport)
86
-
87
-/** kernel has finished sending all the queued data.
88
- * called for the SCTP_SENDER_DRY_EVENT event.*/
89
-#define SCTP_EV_SENDER_DRY_EVENT(lip, lport, src) \
90
-	DBG("SCTP_SENDER_DRY_EVENT from %s on %s:%d\n", \
91
-			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport)
92
-
93
-#endif /* USE_SCTP_EV */
94
-
95
-#endif /*__sctp_ev_h*/
96
-
97
-/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
Browse code

sctp: internal macro/hooks for sctp events

Added macros for sctp events (for now empty, or defined to simple
example DBG()):

SCTP_EV_ASSOC_CHANGE
SCTP_EV_PEER_ADDR_CHANGE
SCTP_EV_REMOTE_ERROR
SCTP_EV_SEND_FAILED
SCTP_EV_SHUTDOWN_EVENT
SCTP_EV_SENDER_DRY_EVENT

Andrei Pelinescu-Onciul authored on 30/04/2009 16:39:10
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,97 @@
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_ev.h - sctp events
20
+ */
21
+/*
22
+ * History:
23
+ * --------
24
+ *  2009-04-28  initial version (andrei)
25
+*/
26
+
27
+#ifndef __sctp_ev_h
28
+#define __sctp_ev_h
29
+
30
+#include <errno.h>
31
+#include <string.h>
32
+
33
+#ifndef USE_SCTP_EV
34
+
35
+#define SCTP_EV_ASSOC_CHANGE(lip, lport, src, reason, state)
36
+#define SCTP_EV_PEER_ADDR_CHANGE(lip, lport, src, reason, state, addr_su)
37
+#define SCTP_EV_REMOTE_ERROR(lip, lport, src, err)
38
+#define SCTP_EV_SEND_FAILED(lip, lport, src, err)
39
+#define SCTP_EV_SHUTDOWN_EVENT(lip, lport, src)
40
+#define SCTP_EV_SENDER_DRY_EVENT(lip, lport, src)
41
+
42
+#else /* USE_SCTP_EV */
43
+
44
+#include "ip_addr.h"
45
+
46
+
47
+/** an association has either been opened or closed.
48
+ * called for each SCTP_ASSOC_CHANGE event.
49
+ *
50
+ * @param err - if 0 it should be ignored (no corresp. libc error), if non-0
51
+ *                it will contain the errno.
52
+ * @param lip   - pointer to an ip_addr containing the local ip
53
+ *                   or 0 if dynamic (WARNING can be 0).
54
+ * @param lport - pointer to an ip_addr containing the local port or 0
55
+ *                   if unknown/dynamic.
56
+ * @param src   - pointer to a sockaddr_union containing the src.
57
+ * @param proto - protocol used
58
+ */
59
+#define SCTP_EV_ASSOC_CHANGE(lip, lport, src, reason, state) \
60
+	DBG("SCTP_ASSOC_CHANGE from %s on %s:%d: %s\n", \
61
+			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, reason)
62
+
63
+/** an address part of an assoc. changed state.
64
+ * called for the SCTP_PEER_ADDR_CHANGE event.*/
65
+#define SCTP_EV_PEER_ADDR_CHANGE(lip, lport, src, reason, state, addr_su) \
66
+	DBG("SCTP_PEER_ADDR_CHANGE from %s on %s:%d: %s\n", \
67
+			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, reason)
68
+
69
+/** remote operation error from the peer.
70
+ * called for the SCTP_REMOTE_ERROR event.*/
71
+#define SCTP_EV_REMOTE_ERROR(lip, lport, src, err) \
72
+	DBG("SCTP_REMOTE_ERROR from %s on %s:%d: %d\n", \
73
+			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, err)
74
+
75
+/** send failed.
76
+ * called for the SCTP_SEND_FAILED event.*/
77
+#define SCTP_EV_SEND_FAILED(lip, lport, src, err) \
78
+	DBG("SCTP_SEND_FAILED from %s on %s:%d: %d\n", \
79
+			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport, err)
80
+
81
+/** the peer has sent a shutdown.
82
+ * called for the SCTP_SHUTDOWN_EVENT event.*/
83
+#define SCTP_EV_SHUTDOWN_EVENT(lip, lport, src) \
84
+	DBG("SCTP_SHUTDOWN_EVENT from %s on %s:%d\n", \
85
+			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport)
86
+
87
+/** kernel has finished sending all the queued data.
88
+ * called for the SCTP_SENDER_DRY_EVENT event.*/
89
+#define SCTP_EV_SENDER_DRY_EVENT(lip, lport, src) \
90
+	DBG("SCTP_SENDER_DRY_EVENT from %s on %s:%d\n", \
91
+			su2a(src, sizeof(*(src))), ip_addr2a(lip), lport)
92
+
93
+#endif /* USE_SCTP_EV */
94
+
95
+#endif /*__sctp_ev_h*/
96
+
97
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */