9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #ifndef SUN_NIO_CH_SCTP_H
27 #define SUN_NIO_CH_SCTP_H
28
29 #ifdef __solaris__
30
31 #define _XPG4_2
32 #define __EXTENSIONS__
33 #include <sys/socket.h>
34 #include <netinet/sctp.h>
35 #include "jni.h"
36
37 /* Current Solaris headers don't comply with draft rfc */
38 #ifndef SCTP_EOF
39 #define SCTP_EOF MSG_EOF
40 #endif
41
42 #ifndef SCTP_UNORDERED
43 #define SCTP_UNORDERED MSG_UNORDERED
44 #endif
45
46 /* The current version of the socket API extension shipped with Solaris does
47 * not define the following options that the Java API (optionally) supports */
48 #ifndef SCTP_EXPLICIT_EOR
49 #define SCTP_EXPLICIT_EOR -1
50 #endif
51 #ifndef SCTP_FRAGMENT_INTERLEAVE
52 #define SCTP_FRAGMENT_INTERLEAVE -1
53 #endif
54 #ifndef SCTP_SET_PEER_PRIMARY_ADDR
55 #define SCTP_SET_PEER_PRIMARY_ADDR -1
56 #endif
57
58 /* Function types to support dynamic linking of socket API extension functions
59 * for SCTP. This is so that there is no linkage depandancy during build or
60 * runtime for libsctp.*/
61 typedef int sctp_getladdrs_func(int sock, sctp_assoc_t id, void **addrs);
62 typedef int sctp_freeladdrs_func(void* addrs);
63 typedef int sctp_getpaddrs_func(int sock, sctp_assoc_t id, void **addrs);
64 typedef int sctp_freepaddrs_func(void *addrs);
65 typedef int sctp_bindx_func(int sock, void *addrs, int addrcnt, int flags);
66 typedef int sctp_peeloff_func(int sock, sctp_assoc_t id);
67
68
69
70 #else /* __linux__ */
71 #include <stdint.h>
72 #include <linux/types.h>
73 #include <sys/socket.h>
74 #include <netinet/in.h>
75 #include "jni.h"
76
77 //Causes compiler error if not found, should make warning and uncomment
78 /*#include <netinet/sctp.h>*/
79
80 #ifndef IPPROTO_SCTP
81 #define IPPROTO_SCTP 132
82 #endif
83
84 /* The current version of lksctp does
85 * not define the following option that the Java API (optionally) supports */
86 #ifndef SCTP_EXPLICIT_EOR
87 #define SCTP_EXPLICIT_EOR -1
88 #endif
89
90 /* Definitions taken from lksctp-tools-1.0.8/src/include/netinet/sctp.h */
302 struct sctp_paddr_change sn_paddr_change;
303 struct sctp_remote_error sn_remote_error;
304 struct sctp_send_failed sn_send_failed;
305 struct sctp_shutdown_event sn_shutdown_event;
306 struct sctp_adaptation_event sn_adaptation_event;
307 struct sctp_pdapi_event sn_pdapi_event;
308 };
309
310 #endif /* SCTP_INITMSG */
311
312 /* Function types to support dynamic linking of socket API extension functions
313 * for SCTP. This is so that there is no linkage depandancy during build or
314 * runtime for libsctp.*/
315 typedef int sctp_getladdrs_func(int sd, sctp_assoc_t id, struct sockaddr **addrs);
316 typedef int sctp_freeladdrs_func(struct sockaddr *addrs);
317 typedef int sctp_getpaddrs_func(int sd, sctp_assoc_t id, struct sockaddr **addrs);
318 typedef int sctp_freepaddrs_func(struct sockaddr *addrs);
319 typedef int sctp_bindx_func(int sd, struct sockaddr *addrs, int addrcnt, int flags);
320 typedef int sctp_peeloff_func(int sock, sctp_assoc_t id);
321
322
323 #endif /* __linux__ */
324
325 extern sctp_getladdrs_func* nio_sctp_getladdrs;
326 extern sctp_freeladdrs_func* nio_sctp_freeladdrs;
327 extern sctp_getpaddrs_func* nio_sctp_getpaddrs;
328 extern sctp_freepaddrs_func* nio_sctp_freepaddrs;
329 extern sctp_bindx_func* nio_sctp_bindx;
330 extern sctp_peeloff_func* nio_sctp_peeloff;
331
332 jboolean loadSocketExtensionFuncs(JNIEnv* env);
333
334 #endif /* !SUN_NIO_CH_SCTP_H */
|
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #ifndef SUN_NIO_CH_SCTP_H
27 #define SUN_NIO_CH_SCTP_H
28
29 #include <stdint.h>
30 #include <linux/types.h>
31 #include <sys/socket.h>
32 #include <netinet/in.h>
33 #include "jni.h"
34
35 //Causes compiler error if not found, should make warning and uncomment
36 /*#include <netinet/sctp.h>*/
37
38 #ifndef IPPROTO_SCTP
39 #define IPPROTO_SCTP 132
40 #endif
41
42 /* The current version of lksctp does
43 * not define the following option that the Java API (optionally) supports */
44 #ifndef SCTP_EXPLICIT_EOR
45 #define SCTP_EXPLICIT_EOR -1
46 #endif
47
48 /* Definitions taken from lksctp-tools-1.0.8/src/include/netinet/sctp.h */
260 struct sctp_paddr_change sn_paddr_change;
261 struct sctp_remote_error sn_remote_error;
262 struct sctp_send_failed sn_send_failed;
263 struct sctp_shutdown_event sn_shutdown_event;
264 struct sctp_adaptation_event sn_adaptation_event;
265 struct sctp_pdapi_event sn_pdapi_event;
266 };
267
268 #endif /* SCTP_INITMSG */
269
270 /* Function types to support dynamic linking of socket API extension functions
271 * for SCTP. This is so that there is no linkage depandancy during build or
272 * runtime for libsctp.*/
273 typedef int sctp_getladdrs_func(int sd, sctp_assoc_t id, struct sockaddr **addrs);
274 typedef int sctp_freeladdrs_func(struct sockaddr *addrs);
275 typedef int sctp_getpaddrs_func(int sd, sctp_assoc_t id, struct sockaddr **addrs);
276 typedef int sctp_freepaddrs_func(struct sockaddr *addrs);
277 typedef int sctp_bindx_func(int sd, struct sockaddr *addrs, int addrcnt, int flags);
278 typedef int sctp_peeloff_func(int sock, sctp_assoc_t id);
279
280
281 extern sctp_getladdrs_func* nio_sctp_getladdrs;
282 extern sctp_freeladdrs_func* nio_sctp_freeladdrs;
283 extern sctp_getpaddrs_func* nio_sctp_getpaddrs;
284 extern sctp_freepaddrs_func* nio_sctp_freepaddrs;
285 extern sctp_bindx_func* nio_sctp_bindx;
286 extern sctp_peeloff_func* nio_sctp_peeloff;
287
288 jboolean loadSocketExtensionFuncs(JNIEnv* env);
289
290 #endif /* !SUN_NIO_CH_SCTP_H */
|