author | mbaesken |
Fri, 22 Nov 2019 10:29:12 +0100 | |
changeset 59243 | fb1d9bf1be2b |
parent 59197 | bb3472aa26c8 |
child 59256 | aa516a7cf95e |
permissions | -rw-r--r-- |
2 | 1 |
/* |
53741
38b6110d5db2
8218882: NET_Writev is declared, NET_WriteV is defined
bpb
parents:
53422
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
#ifndef NET_UTILS_MD_H |
|
27 |
#define NET_UTILS_MD_H |
|
28 |
||
41771
18c9669e76ca
8167481: cleanup of headers and includes for native libnet
clanger
parents:
41380
diff
changeset
|
29 |
#include <netdb.h> |
46862
cb4b080576fa
8180003: Remove sys/ prefix from poll.h and signal.h includes
mikael
parents:
44921
diff
changeset
|
30 |
#include <poll.h> |
2 | 31 |
#include <sys/socket.h> |
32 |
||
41380
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
33 |
/************************************************************************ |
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
34 |
* Macros and constants |
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
35 |
*/ |
2 | 36 |
|
45061
74b09ee3cd55
8179905: Remove the use of gettimeofday in Networking code
vtewari
parents:
44921
diff
changeset
|
37 |
#define NET_NSEC_PER_MSEC 1000000 |
74b09ee3cd55
8179905: Remove the use of gettimeofday in Networking code
vtewari
parents:
44921
diff
changeset
|
38 |
#define NET_NSEC_PER_SEC 1000000000 |
74b09ee3cd55
8179905: Remove the use of gettimeofday in Networking code
vtewari
parents:
44921
diff
changeset
|
39 |
#define NET_NSEC_PER_USEC 1000 |
74b09ee3cd55
8179905: Remove the use of gettimeofday in Networking code
vtewari
parents:
44921
diff
changeset
|
40 |
|
49985
44e581f54d08
8202181: Correctly specify size of hostname buffer in Unix Inet*AddressImpl_getLocalHostName implementations
clanger
parents:
47216
diff
changeset
|
41 |
/* in case NI_MAXHOST is not defined in netdb.h */ |
44e581f54d08
8202181: Correctly specify size of hostname buffer in Unix Inet*AddressImpl_getLocalHostName implementations
clanger
parents:
47216
diff
changeset
|
42 |
#ifndef NI_MAXHOST |
44e581f54d08
8202181: Correctly specify size of hostname buffer in Unix Inet*AddressImpl_getLocalHostName implementations
clanger
parents:
47216
diff
changeset
|
43 |
#define NI_MAXHOST 1025 |
44e581f54d08
8202181: Correctly specify size of hostname buffer in Unix Inet*AddressImpl_getLocalHostName implementations
clanger
parents:
47216
diff
changeset
|
44 |
#endif |
44e581f54d08
8202181: Correctly specify size of hostname buffer in Unix Inet*AddressImpl_getLocalHostName implementations
clanger
parents:
47216
diff
changeset
|
45 |
|
36115 | 46 |
/* Defines SO_REUSEPORT */ |
47 |
#ifndef SO_REUSEPORT |
|
48 |
#ifdef __linux__ |
|
49 |
#define SO_REUSEPORT 15 |
|
51878
511a9946f83e
8211146: fix problematic elif-tests after recent gcc warning changes Werror=undef
mbaesken
parents:
49985
diff
changeset
|
50 |
#elif defined(__solaris__) |
36115 | 51 |
#define SO_REUSEPORT 0x100e |
52 |
#elif defined(AIX) || defined(MACOSX) |
|
53 |
#define SO_REUSEPORT 0x0200 |
|
54 |
#else |
|
55 |
#define SO_REUSEPORT 0 |
|
56 |
#endif |
|
57 |
#endif |
|
58 |
||
2 | 59 |
/* |
2938
b3338e271fcb
6807602: Increase MAX_BUFFER_LEN and MAX_HEAP_BUFFER_LEN on 64-bit Solaris and Linux
chegar
parents:
2
diff
changeset
|
60 |
* On 64-bit JDKs we use a much larger stack and heap buffer. |
2 | 61 |
*/ |
2938
b3338e271fcb
6807602: Increase MAX_BUFFER_LEN and MAX_HEAP_BUFFER_LEN on 64-bit Solaris and Linux
chegar
parents:
2
diff
changeset
|
62 |
#ifdef _LP64 |
b3338e271fcb
6807602: Increase MAX_BUFFER_LEN and MAX_HEAP_BUFFER_LEN on 64-bit Solaris and Linux
chegar
parents:
2
diff
changeset
|
63 |
#define MAX_BUFFER_LEN 65536 |
b3338e271fcb
6807602: Increase MAX_BUFFER_LEN and MAX_HEAP_BUFFER_LEN on 64-bit Solaris and Linux
chegar
parents:
2
diff
changeset
|
64 |
#define MAX_HEAP_BUFFER_LEN 131072 |
b3338e271fcb
6807602: Increase MAX_BUFFER_LEN and MAX_HEAP_BUFFER_LEN on 64-bit Solaris and Linux
chegar
parents:
2
diff
changeset
|
65 |
#else |
2 | 66 |
#define MAX_BUFFER_LEN 8192 |
67 |
#define MAX_HEAP_BUFFER_LEN 65536 |
|
2938
b3338e271fcb
6807602: Increase MAX_BUFFER_LEN and MAX_HEAP_BUFFER_LEN on 64-bit Solaris and Linux
chegar
parents:
2
diff
changeset
|
68 |
#endif |
2 | 69 |
|
41380
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
70 |
typedef union { |
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
71 |
struct sockaddr sa; |
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
72 |
struct sockaddr_in sa4; |
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
73 |
struct sockaddr_in6 sa6; |
c27cf95dd7e6
8167295: Further cleanup to the native parts of libnet/libnio
clanger
parents:
40937
diff
changeset
|
74 |
} SOCKETADDRESS; |
2 | 75 |
|
76 |
/************************************************************************ |
|
43100 | 77 |
* Functions |
2 | 78 |
*/ |
23033
0cc7c83fde3c
8035949: Remove unused macro USE_SELECT and clean up Unix version of net_util_md.{c,h}
simonis
parents:
23028
diff
changeset
|
79 |
|
45061
74b09ee3cd55
8179905: Remove the use of gettimeofday in Networking code
vtewari
parents:
44921
diff
changeset
|
80 |
int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp); |
43100 | 81 |
int NET_Read(int s, void* buf, size_t len); |
82 |
int NET_NonBlockingRead(int s, void* buf, size_t len); |
|
83 |
int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, |
|
84 |
struct sockaddr *from, socklen_t *fromlen); |
|
85 |
int NET_Send(int s, void *msg, int len, unsigned int flags); |
|
86 |
int NET_SendTo(int s, const void *msg, int len, unsigned int |
|
87 |
flags, const struct sockaddr *to, int tolen); |
|
88 |
int NET_Connect(int s, struct sockaddr *addr, int addrlen); |
|
89 |
int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen); |
|
90 |
int NET_SocketClose(int s); |
|
91 |
int NET_Dup2(int oldfd, int newfd); |
|
92 |
int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout); |
|
93 |
||
94 |
void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env, |
|
95 |
const char* hostname, |
|
96 |
int gai_error); |
|
97 |
void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, |
|
98 |
const char *defaultDetail); |
|
99 |
void NET_SetTrafficClass(SOCKETADDRESS *sa, int trafficClass); |
|
100 |
||
23033
0cc7c83fde3c
8035949: Remove unused macro USE_SELECT and clean up Unix version of net_util_md.{c,h}
simonis
parents:
23028
diff
changeset
|
101 |
#ifdef __solaris__ |
0cc7c83fde3c
8035949: Remove unused macro USE_SELECT and clean up Unix version of net_util_md.{c,h}
simonis
parents:
23028
diff
changeset
|
102 |
int net_getParam(char *driver, char *param); |
0cc7c83fde3c
8035949: Remove unused macro USE_SELECT and clean up Unix version of net_util_md.{c,h}
simonis
parents:
23028
diff
changeset
|
103 |
#endif |
2 | 104 |
|
105 |
#endif /* NET_UTILS_MD_H */ |