1 /*
2 * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation. Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26 */
27 @@END_COPYRIGHT@@
28
29 #include <stdio.h>
30 #ifdef _WIN32
31 #include <winsock2.h>
32 #include <ws2tcpip.h>
33 #else
34 #include <sys/types.h>
35 #include <sys/socket.h>
36 #include <netinet/in.h>
37 #include <netinet/tcp.h>
38 #endif
39
40 /* Defines SO_REUSEPORT */
41 #if !defined(SO_REUSEPORT)
42 #ifdef _WIN32
43 #define SO_REUSEPORT 0
44 #elif defined(__linux__)
45 #define SO_REUSEPORT 15
46 #elif defined(__solaris__)
47 #define SO_REUSEPORT 0x100e
48 #elif defined(AIX) || defined(MACOSX)
49 #define SO_REUSEPORT 0x0200
50 #else
51 #define SO_REUSEPORT 0
52 #endif
53 #endif
54
55 /* On Solaris, "sun" is defined as a macro. Undefine to make package
56 declaration valid */
57 #undef sun
58
59 /* To be able to name the Java constants the same as the C constants without
60 having the preprocessor rewrite those identifiers, add PREFIX_ to all
61 identifiers matching a C constant. The PREFIX_ is filtered out in the
62 makefile. */
63
64 @@START_HERE@@
65
66 package sun.nio.ch;
67 import java.net.SocketOption;
68 import java.net.StandardSocketOptions;
69 import java.net.ProtocolFamily;
70 import java.net.StandardProtocolFamily;
71 import java.util.Map;
72 import java.util.HashMap;
73 class SocketOptionRegistry {
74
75 private SocketOptionRegistry() { }
76
77 private static class RegistryKey {
|
1 /*
2 * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation. Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26 */
27 @@END_COPYRIGHT@@
28
29 #include <stdio.h>
30 #ifdef _WIN32
31 #include <winsock2.h>
32 #include <ws2tcpip.h>
33 #else
34 #include <sys/types.h>
35 #include <sys/socket.h>
36 #include <netinet/in.h>
37 #include <netinet/tcp.h>
38 #endif
39
40 /* Defines SO_REUSEPORT */
41 #if !defined(SO_REUSEPORT)
42 #ifdef _WIN32
43 #define SO_REUSEPORT 0
44 #elif defined(__linux__)
45 #define SO_REUSEPORT 15
46 #elif defined(AIX) || defined(MACOSX)
47 #define SO_REUSEPORT 0x0200
48 #else
49 #define SO_REUSEPORT 0
50 #endif
51 #endif
52
53 /* To be able to name the Java constants the same as the C constants without
54 having the preprocessor rewrite those identifiers, add PREFIX_ to all
55 identifiers matching a C constant. The PREFIX_ is filtered out in the
56 makefile. */
57
58 @@START_HERE@@
59
60 package sun.nio.ch;
61 import java.net.SocketOption;
62 import java.net.StandardSocketOptions;
63 import java.net.ProtocolFamily;
64 import java.net.StandardProtocolFamily;
65 import java.util.Map;
66 import java.util.HashMap;
67 class SocketOptionRegistry {
68
69 private SocketOptionRegistry() { }
70
71 private static class RegistryKey {
|