1 /* |
1 /* |
2 * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
30 #else |
30 #else |
31 #include <sys/types.h> |
31 #include <sys/types.h> |
32 #include <sys/socket.h> |
32 #include <sys/socket.h> |
33 #include <netinet/in.h> |
33 #include <netinet/in.h> |
34 #include <netinet/tcp.h> |
34 #include <netinet/tcp.h> |
|
35 #endif |
|
36 |
|
37 /* Defines SO_REUSEPORT */ |
|
38 #if !defined(SO_REUSEPORT) |
|
39 #ifdef _WIN32 |
|
40 #define SO_REUSEPORT 0 |
|
41 #elif __linux__ |
|
42 #define SO_REUSEPORT 15 |
|
43 #elif __solaris__ |
|
44 #define SO_REUSEPORT 0x100e |
|
45 #elif defined(AIX) || defined(MACOSX) |
|
46 #define SO_REUSEPORT 0x0200 |
|
47 #else |
|
48 #define SO_REUSEPORT 0 |
|
49 #endif |
35 #endif |
50 #endif |
36 |
51 |
37 /** |
52 /** |
38 * Generates sun.nio.ch.SocketOptionRegistry, a class that maps Java-level |
53 * Generates sun.nio.ch.SocketOptionRegistry, a class that maps Java-level |
39 * socket options to the platform specific level and option. |
54 * socket options to the platform specific level and option. |
100 emit_unspec("StandardSocketOptions.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE); |
115 emit_unspec("StandardSocketOptions.SO_KEEPALIVE", SOL_SOCKET, SO_KEEPALIVE); |
101 emit_unspec("StandardSocketOptions.SO_LINGER", SOL_SOCKET, SO_LINGER); |
116 emit_unspec("StandardSocketOptions.SO_LINGER", SOL_SOCKET, SO_LINGER); |
102 emit_unspec("StandardSocketOptions.SO_SNDBUF", SOL_SOCKET, SO_SNDBUF); |
117 emit_unspec("StandardSocketOptions.SO_SNDBUF", SOL_SOCKET, SO_SNDBUF); |
103 emit_unspec("StandardSocketOptions.SO_RCVBUF", SOL_SOCKET, SO_RCVBUF); |
118 emit_unspec("StandardSocketOptions.SO_RCVBUF", SOL_SOCKET, SO_RCVBUF); |
104 emit_unspec("StandardSocketOptions.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR); |
119 emit_unspec("StandardSocketOptions.SO_REUSEADDR", SOL_SOCKET, SO_REUSEADDR); |
|
120 emit_unspec("StandardSocketOptions.SO_REUSEPORT", SOL_SOCKET, SO_REUSEPORT); |
105 emit_unspec("StandardSocketOptions.TCP_NODELAY", IPPROTO_TCP, TCP_NODELAY); |
121 emit_unspec("StandardSocketOptions.TCP_NODELAY", IPPROTO_TCP, TCP_NODELAY); |
106 |
122 |
107 emit_inet("StandardSocketOptions.IP_TOS", IPPROTO_IP, IP_TOS); |
123 emit_inet("StandardSocketOptions.IP_TOS", IPPROTO_IP, IP_TOS); |
108 emit_inet("StandardSocketOptions.IP_MULTICAST_IF", IPPROTO_IP, IP_MULTICAST_IF); |
124 emit_inet("StandardSocketOptions.IP_MULTICAST_IF", IPPROTO_IP, IP_MULTICAST_IF); |
109 emit_inet("StandardSocketOptions.IP_MULTICAST_TTL", IPPROTO_IP, IP_MULTICAST_TTL); |
125 emit_inet("StandardSocketOptions.IP_MULTICAST_TTL", IPPROTO_IP, IP_MULTICAST_TTL); |