8167481: cleanup of headers and includes for native libnet
Reviewed-by: chegar
This commit is contained in:
parent
5e987e28e1
commit
955f784be9
@ -201,13 +201,13 @@ class InetAddress implements java.io.Serializable {
|
||||
* Specify the address family: Internet Protocol, Version 4
|
||||
* @since 1.4
|
||||
*/
|
||||
static final int IPv4 = 1;
|
||||
@Native static final int IPv4 = 1;
|
||||
|
||||
/**
|
||||
* Specify the address family: Internet Protocol, Version 6
|
||||
* @since 1.4
|
||||
*/
|
||||
static final int IPv6 = 2;
|
||||
@Native static final int IPv6 = 2;
|
||||
|
||||
/* Specify address family preference */
|
||||
static transient final int preferIPv6Address;
|
||||
|
@ -23,20 +23,19 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "jni.h"
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
int IPv6_supported() ;
|
||||
int reuseport_supported() ;
|
||||
#include "java_net_InetAddress.h"
|
||||
|
||||
int IPv6_supported();
|
||||
int reuseport_supported();
|
||||
|
||||
static int IPv6_available;
|
||||
static int REUSEPORT_available;
|
||||
|
||||
JNIEXPORT jint JNICALL ipv6_available()
|
||||
{
|
||||
return IPv6_available ;
|
||||
return IPv6_available;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL reuseport_available()
|
||||
@ -206,11 +205,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
|
||||
jobject iaObj;
|
||||
#ifdef AF_INET6
|
||||
if (him->sa_family == AF_INET6) {
|
||||
#ifdef WIN32
|
||||
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
|
||||
#else
|
||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
||||
#endif
|
||||
jbyte *caddr = (jbyte *)&(him6->sin6_addr);
|
||||
if (NET_IsIPv4Mapped(caddr)) {
|
||||
int address;
|
||||
@ -218,7 +213,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
|
||||
CHECK_NULL_RETURN(iaObj, NULL);
|
||||
address = NET_IPv4MappedToIPv4(caddr);
|
||||
setInetAddress_addr(env, iaObj, address);
|
||||
setInetAddress_family(env, iaObj, IPv4);
|
||||
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
|
||||
} else {
|
||||
jint scope;
|
||||
jboolean ret;
|
||||
@ -227,7 +222,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
|
||||
ret = setInet6Address_ipaddress(env, iaObj, (char *)&(him6->sin6_addr));
|
||||
if (ret == JNI_FALSE)
|
||||
return NULL;
|
||||
setInetAddress_family(env, iaObj, IPv6);
|
||||
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv6);
|
||||
scope = getScopeID(him);
|
||||
setInet6Address_scopeid(env, iaObj, scope);
|
||||
}
|
||||
@ -238,7 +233,7 @@ NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
|
||||
struct sockaddr_in *him4 = (struct sockaddr_in *)him;
|
||||
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
|
||||
CHECK_NULL_RETURN(iaObj, NULL);
|
||||
setInetAddress_family(env, iaObj, IPv4);
|
||||
setInetAddress_family(env, iaObj, java_net_InetAddress_IPv4);
|
||||
setInetAddress_addr(env, iaObj, ntohl(him4->sin_addr.s_addr));
|
||||
*port = ntohs(him4->sin_port);
|
||||
}
|
||||
@ -251,13 +246,10 @@ NET_SockaddrEqualsInetAddress(JNIEnv *env, struct sockaddr *him, jobject iaObj)
|
||||
jint family = AF_INET;
|
||||
|
||||
#ifdef AF_INET6
|
||||
family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
|
||||
family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
|
||||
AF_INET : AF_INET6;
|
||||
if (him->sa_family == AF_INET6) {
|
||||
#ifdef WIN32
|
||||
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
|
||||
#else
|
||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
||||
#endif
|
||||
jbyte *caddrNew = (jbyte *)&(him6->sin6_addr);
|
||||
if (NET_IsIPv4Mapped(caddrNew)) {
|
||||
int addrNew;
|
||||
|
@ -36,12 +36,6 @@
|
||||
|
||||
#define MAX_PACKET_LEN 65536
|
||||
|
||||
#define IPv4 1
|
||||
#define IPv6 2
|
||||
|
||||
#define NET_ERROR(env, ex, msg) \
|
||||
{ if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg); }
|
||||
|
||||
#define NET_WAIT_READ 0x01
|
||||
#define NET_WAIT_WRITE 0x02
|
||||
#define NET_WAIT_CONNECT 0x04
|
||||
@ -127,45 +121,43 @@ JNIEXPORT void JNICALL Java_java_net_Inet6Address_init(JNIEnv *env, jclass cls);
|
||||
JNIEXPORT void JNICALL Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls);
|
||||
|
||||
JNIEXPORT void JNICALL NET_ThrowNew(JNIEnv *env, int errorNum, char *msg);
|
||||
|
||||
int NET_GetError();
|
||||
|
||||
void NET_ThrowCurrent(JNIEnv *env, char *msg);
|
||||
|
||||
jfieldID NET_GetFileDescriptorID(JNIEnv *env);
|
||||
|
||||
JNIEXPORT jint JNICALL ipv6_available() ;
|
||||
JNIEXPORT jint JNICALL ipv6_available();
|
||||
|
||||
JNIEXPORT jint JNICALL reuseport_available() ;
|
||||
JNIEXPORT jint JNICALL reuseport_available();
|
||||
|
||||
JNIEXPORT int JNICALL
|
||||
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr *him, int *len, jboolean v4MappedAddress);
|
||||
NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port,
|
||||
struct sockaddr *him, int *len,
|
||||
jboolean v4MappedAddress);
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port);
|
||||
|
||||
void platformInit();
|
||||
|
||||
void parseExclusiveBindProperty(JNIEnv *env);
|
||||
|
||||
void
|
||||
NET_SetTrafficClass(struct sockaddr *him, int trafficClass);
|
||||
void NET_SetTrafficClass(struct sockaddr *him, int trafficClass);
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
NET_GetPortFromSockaddr(struct sockaddr *him);
|
||||
JNIEXPORT jint JNICALL NET_GetPortFromSockaddr(struct sockaddr *him);
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
NET_SockaddrEqualsInetAddress(JNIEnv *env,struct sockaddr *him, jobject iaObj);
|
||||
|
||||
int
|
||||
NET_IsIPv4Mapped(jbyte* caddr);
|
||||
int NET_IsIPv4Mapped(jbyte* caddr);
|
||||
|
||||
int
|
||||
NET_IPv4MappedToIPv4(jbyte* caddr);
|
||||
int NET_IPv4MappedToIPv4(jbyte* caddr);
|
||||
|
||||
int
|
||||
NET_IsEqual(jbyte* caddr1, jbyte* caddr2);
|
||||
int NET_IsEqual(jbyte* caddr1, jbyte* caddr2);
|
||||
|
||||
int
|
||||
NET_IsZeroAddr(jbyte* caddr);
|
||||
int NET_IsZeroAddr(jbyte* caddr);
|
||||
|
||||
/* Socket operations
|
||||
*
|
||||
@ -191,9 +183,9 @@ NET_MapSocketOptionV6(jint cmd, int *level, int *optname);
|
||||
JNIEXPORT jint JNICALL
|
||||
NET_EnableFastTcpLoopback(int fd);
|
||||
|
||||
int getScopeID (struct sockaddr *);
|
||||
int getScopeID(struct sockaddr *);
|
||||
|
||||
int cmpScopeID (unsigned int, struct sockaddr *);
|
||||
int cmpScopeID(unsigned int, struct sockaddr *);
|
||||
|
||||
unsigned short in_cksum(unsigned short *addr, int len);
|
||||
|
||||
|
@ -22,27 +22,17 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netdb.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef _ALLBSD_SOURCE
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_Inet4AddressImpl.h"
|
||||
@ -293,13 +283,12 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
addr |= ((caddr[2] <<8) & 0xff00);
|
||||
addr |= (caddr[3] & 0xff);
|
||||
memset((char *) &him4, 0, sizeof(him4));
|
||||
him4.sin_addr.s_addr = (uint32_t) htonl(addr);
|
||||
him4.sin_addr.s_addr = htonl(addr);
|
||||
him4.sin_family = AF_INET;
|
||||
sa = (struct sockaddr *) &him4;
|
||||
len = sizeof(him4);
|
||||
|
||||
error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0,
|
||||
NI_NAMEREQD);
|
||||
error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
|
||||
|
||||
if (!error) {
|
||||
ret = (*env)->NewStringUTF(env, host);
|
||||
@ -443,7 +432,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
|
||||
if (!skip) {
|
||||
struct addrinfo *next
|
||||
= (struct addrinfo*) malloc(sizeof(struct addrinfo));
|
||||
= (struct addrinfo *)malloc(sizeof(struct addrinfo));
|
||||
if (!next) {
|
||||
JNU_ThrowOutOfMemoryError(env, "Native heap allocation failed");
|
||||
ret = NULL;
|
||||
@ -528,13 +517,12 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
addr |= ((caddr[2] <<8) & 0xff00);
|
||||
addr |= (caddr[3] & 0xff);
|
||||
memset((void *) &him4, 0, sizeof(him4));
|
||||
him4.sin_addr.s_addr = (uint32_t) htonl(addr);
|
||||
him4.sin_addr.s_addr = htonl(addr);
|
||||
him4.sin_family = AF_INET;
|
||||
sa = (struct sockaddr *) &him4;
|
||||
len = sizeof(him4);
|
||||
|
||||
error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0,
|
||||
NI_NAMEREQD);
|
||||
error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
|
||||
|
||||
if (!error) {
|
||||
ret = (*env)->NewStringUTF(env, host);
|
||||
|
@ -22,29 +22,21 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#ifdef MACOSX
|
||||
#include <netinet/icmp6.h>
|
||||
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h> /* gethostname */
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
#ifndef IPV6_DEFS_H
|
||||
#include <netinet/icmp6.h>
|
||||
#endif
|
||||
|
||||
#include "java_net_Inet4AddressImpl.h"
|
||||
#include "java_net_Inet6AddressImpl.h"
|
||||
@ -504,24 +496,23 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
addr |= ((caddr[2] <<8) & 0xff00);
|
||||
addr |= (caddr[3] & 0xff);
|
||||
memset((void *) &him4, 0, sizeof(him4));
|
||||
him4.sin_addr.s_addr = (uint32_t) htonl(addr);
|
||||
him4.sin_addr.s_addr = htonl(addr);
|
||||
him4.sin_family = AF_INET;
|
||||
sa = (struct sockaddr *) &him4;
|
||||
sa = (struct sockaddr *)&him4;
|
||||
len = sizeof(him4);
|
||||
} else {
|
||||
/*
|
||||
* For IPv6 address construct a sockaddr_in6 structure.
|
||||
*/
|
||||
(*env)->GetByteArrayRegion(env, addrArray, 0, 16, caddr);
|
||||
memset((void *) &him6, 0, sizeof(him6));
|
||||
memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr) );
|
||||
memset((void *)&him6, 0, sizeof(him6));
|
||||
memcpy((void *)&(him6.sin6_addr), caddr, sizeof(struct in6_addr));
|
||||
him6.sin6_family = AF_INET6;
|
||||
sa = (struct sockaddr *) &him6 ;
|
||||
len = sizeof(him6) ;
|
||||
sa = (struct sockaddr *)&him6;
|
||||
len = sizeof(him6);
|
||||
}
|
||||
|
||||
error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0,
|
||||
NI_NAMEREQD);
|
||||
error = getnameinfo(sa, len, host, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
|
||||
|
||||
if (!error) {
|
||||
ret = (*env)->NewStringUTF(env, host);
|
||||
|
@ -22,55 +22,36 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <strings.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
#if defined(__solaris__)
|
||||
#include <sys/dlpi.h>
|
||||
#include <fcntl.h>
|
||||
#include <stropts.h>
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if defined(_AIX)
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in6_var.h>
|
||||
#include <sys/ndd_var.h>
|
||||
#include <sys/kinfo.h>
|
||||
#endif
|
||||
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#if defined(__solaris__)
|
||||
#include <stropts.h>
|
||||
#include <sys/dlpi.h>
|
||||
#include <sys/sockio.h>
|
||||
#if defined(__APPLE__)
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_InetAddress.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
#define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
|
||||
#elif defined(__solaris__)
|
||||
@ -332,7 +313,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
|
||||
{
|
||||
netif *ifs, *curr;
|
||||
#if defined(AF_INET6)
|
||||
int family = (getInetAddress_family(env, iaObj) == IPv4) ? AF_INET : AF_INET6;
|
||||
int family = (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) ? AF_INET : AF_INET6;
|
||||
#else
|
||||
int family = AF_INET;
|
||||
#endif
|
||||
|
@ -22,29 +22,23 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef __solaris__
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stropts.h>
|
||||
#if defined(__solaris__)
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_PlainDatagramSocketImpl.h"
|
||||
#include "java_net_InetAddress.h"
|
||||
#include "java_net_NetworkInterface.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
|
||||
#ifndef BSD_COMP
|
||||
#define BSD_COMP
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#define IPV6_MULTICAST_IF 17
|
||||
#ifndef SO_BSDCOMPAT
|
||||
#define SO_BSDCOMPAT 14
|
||||
@ -58,7 +52,11 @@
|
||||
#endif
|
||||
#endif // __linux__
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef __solaris__
|
||||
#ifndef BSD_COMP
|
||||
#define BSD_COMP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef IPTOS_TOS_MASK
|
||||
#define IPTOS_TOS_MASK 0x1e
|
||||
@ -67,12 +65,6 @@
|
||||
#define IPTOS_PREC_MASK 0xe0
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
#include "java_net_PlainDatagramSocketImpl.h"
|
||||
#include "java_net_NetworkInterface.h"
|
||||
/************************************************************************
|
||||
* PlainDatagramSocketImpl
|
||||
*/
|
||||
@ -151,9 +143,6 @@ static int getFD(JNIEnv *env, jobject this) {
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_net_PlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
||||
|
||||
#ifdef __linux__
|
||||
struct utsname sysinfo;
|
||||
#endif
|
||||
pdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(pdsi_fdID);
|
||||
@ -550,7 +539,8 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
|
||||
|
||||
iaObj = NET_SockaddrToInetAddress(env, &rmtaddr.sa, &port);
|
||||
#ifdef AF_INET6
|
||||
family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
|
||||
family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
|
||||
AF_INET : AF_INET6;
|
||||
#else
|
||||
family = AF_INET;
|
||||
#endif
|
||||
@ -1071,7 +1061,7 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
|
||||
*/
|
||||
for (i = 0; i < len; i++) {
|
||||
addr = (*env)->GetObjectArrayElement(env, addrArray, i);
|
||||
if (getInetAddress_family(env, addr) == IPv4) {
|
||||
if (getInetAddress_family(env, addr) == java_net_InetAddress_IPv4) {
|
||||
in.s_addr = htonl(getInetAddress_addr(env, addr));
|
||||
break;
|
||||
}
|
||||
@ -1970,7 +1960,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
|
||||
ipv6_join_leave = ipv6_available();
|
||||
|
||||
#ifdef __linux__
|
||||
if (getInetAddress_family(env, iaObj) == IPv4) {
|
||||
if (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) {
|
||||
ipv6_join_leave = JNI_FALSE;
|
||||
}
|
||||
#endif
|
||||
@ -2162,7 +2152,8 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
|
||||
jbyte caddr[16];
|
||||
jint family;
|
||||
jint address;
|
||||
family = getInetAddress_family(env, iaObj) == IPv4? AF_INET : AF_INET6;
|
||||
family = getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4 ?
|
||||
AF_INET : AF_INET6;
|
||||
if (family == AF_INET) { /* will convert to IPv4-mapped address */
|
||||
memset((char *) caddr, 0, 16);
|
||||
address = getInetAddress_addr(env, iaObj);
|
||||
|
@ -22,32 +22,8 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#if defined(__linux__)
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
#include <netinet/tcp.h> /* Defines TCP_NODELAY, needed for 2.6 */
|
||||
#include <netinet/in.h>
|
||||
#ifdef __linux__
|
||||
#include <netinet/ip.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __solaris__
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_SocketOptions.h"
|
||||
|
@ -22,20 +22,15 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_SocketInputStream.h"
|
||||
|
||||
/************************************************************************
|
||||
/*
|
||||
* SocketInputStream
|
||||
*/
|
||||
|
||||
|
@ -22,15 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "jni_util.h"
|
||||
#include "jvm.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_SocketOutputStream.h"
|
||||
|
@ -22,59 +22,41 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/tcp.h> /* Defines TCP_NODELAY, needed for 2.6 */
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
#include <netdb.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/tcp.h> // defines TCP_NODELAY
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef _ALLBSD_SOURCE
|
||||
#include <values.h>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#ifndef MAXINT
|
||||
#define MAXINT INT_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __solaris__
|
||||
#include <sys/filio.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <stropts.h>
|
||||
#include <inet/nd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/ioctl.h>
|
||||
#if defined(__linux__)
|
||||
#include <arpa/inet.h>
|
||||
#include <net/route.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#ifndef IPV6_FLOWINFO_SEND
|
||||
#define IPV6_FLOWINFO_SEND 33
|
||||
#endif
|
||||
|
||||
#if defined(__solaris__)
|
||||
#include <inet/nd.h>
|
||||
#include <limits.h>
|
||||
#include <stropts.h>
|
||||
#include <sys/filio.h>
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "jni_util.h"
|
||||
#include "jvm.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_SocketOptions.h"
|
||||
#include "java_net_InetAddress.h"
|
||||
|
||||
#if defined(__linux__) && !defined(IPV6_FLOWINFO_SEND)
|
||||
#define IPV6_FLOWINFO_SEND 33
|
||||
#endif
|
||||
|
||||
#if defined(__solaris__) && !defined(MAXINT)
|
||||
#define MAXINT INT_MAX
|
||||
#endif
|
||||
|
||||
/*
|
||||
* EXCLBIND socket options only on Solaris
|
||||
@ -806,13 +788,15 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
||||
family = getInetAddress_family(env, iaObj);
|
||||
#ifdef AF_INET6
|
||||
/* needs work. 1. family 2. clean up him6 etc deallocate memory */
|
||||
if (ipv6_available() && !(family == IPv4 && v4MappedAddress == JNI_FALSE)) {
|
||||
if (ipv6_available() && !(family == java_net_InetAddress_IPv4 &&
|
||||
v4MappedAddress == JNI_FALSE)) {
|
||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
||||
jbyte caddr[16];
|
||||
jint address;
|
||||
|
||||
|
||||
if (family == IPv4) { /* will convert to IPv4-mapped address */
|
||||
if (family == java_net_InetAddress_IPv4) {
|
||||
// convert to IPv4-mapped address
|
||||
memset((char *) caddr, 0, 16);
|
||||
address = getInetAddress_addr(env, iaObj);
|
||||
if (address == INADDR_ANY) {
|
||||
@ -906,7 +890,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
||||
#else
|
||||
/* handle scope_id for solaris */
|
||||
|
||||
if (family != IPv4) {
|
||||
if (family != java_net_InetAddress_IPv4) {
|
||||
if (ia6_scopeidID) {
|
||||
him6->sin6_scope_id = getInet6Address_scopeid(env, iaObj);
|
||||
}
|
||||
@ -917,14 +901,14 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
||||
{
|
||||
struct sockaddr_in *him4 = (struct sockaddr_in*)him;
|
||||
jint address;
|
||||
if (family == IPv6) {
|
||||
if (family == java_net_InetAddress_IPv6) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Protocol family unavailable");
|
||||
return -1;
|
||||
}
|
||||
memset((char *) him4, 0, sizeof(struct sockaddr_in));
|
||||
address = getInetAddress_addr(env, iaObj);
|
||||
him4->sin_port = htons((short) port);
|
||||
him4->sin_addr.s_addr = (uint32_t) htonl(address);
|
||||
him4->sin_addr.s_addr = htonl(address);
|
||||
him4->sin_family = AF_INET;
|
||||
*len = sizeof(struct sockaddr_in);
|
||||
}
|
||||
|
@ -26,13 +26,9 @@
|
||||
#ifndef NET_UTILS_MD_H
|
||||
#define NET_UTILS_MD_H
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/poll.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int NET_Timeout(int s, long timeout);
|
||||
int NET_Timeout0(int s, long timeout, long currentTime);
|
||||
|
@ -22,10 +22,8 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include "jni.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_DualStackPlainDatagramSocketImpl.h"
|
||||
|
||||
/*
|
||||
|
@ -22,11 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include "jni.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_DualStackPlainSocketImpl.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
|
||||
#define SET_BLOCKING 0
|
||||
#define SET_NONBLOCKING 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -22,24 +22,12 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <process.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <icmpapi.h>
|
||||
#include <WinError.h>
|
||||
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_InetAddress.h"
|
||||
#include "java_net_Inet4AddressImpl.h"
|
||||
#include "net_util.h"
|
||||
#include "icmp.h"
|
||||
|
||||
|
||||
/*
|
||||
* Returns true if hostname is in dotted IP address format. Note that this
|
||||
|
@ -22,38 +22,13 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <process.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <icmpapi.h>
|
||||
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_InetAddress.h"
|
||||
#include "java_net_Inet4AddressImpl.h"
|
||||
#include "java_net_Inet6AddressImpl.h"
|
||||
#include "net_util.h"
|
||||
#include "icmp.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WIN64
|
||||
|
||||
/* Retain this code a little longer to support building in
|
||||
* old environments. _MSC_VER is defined as:
|
||||
* 1200 for MSVC++ 6.0
|
||||
* 1310 for Vc7
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1310
|
||||
#define sockaddr_in6 SOCKADDR_IN6
|
||||
#endif
|
||||
#endif
|
||||
#define uint32_t UINT32
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Inet6AddressImpl
|
||||
@ -300,7 +275,7 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
addr |= ((caddr[2] <<8) & 0xff00);
|
||||
addr |= (caddr[3] & 0xff);
|
||||
memset((char *) &him4, 0, sizeof(him4));
|
||||
him4.sin_addr.s_addr = (uint32_t) htonl(addr);
|
||||
him4.sin_addr.s_addr = htonl(addr);
|
||||
him4.sin_family = AF_INET;
|
||||
sa = (struct sockaddr *) &him4;
|
||||
len = sizeof(him4);
|
||||
|
@ -22,17 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h> /* needed for htonl */
|
||||
#include <iprtrmib.h>
|
||||
#include <assert.h>
|
||||
#include "net_util.h"
|
||||
#include "NetworkInterface.h"
|
||||
|
||||
#include "java_net_NetworkInterface.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "NetworkInterface.h"
|
||||
|
||||
/*
|
||||
* Windows implementation of the java.net.NetworkInterface native methods.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,6 @@
|
||||
#ifndef NETWORK_INTERFACE_H
|
||||
#define NETWORK_INTERFACE_H
|
||||
|
||||
#include <iphlpapi.h>
|
||||
#include "net_util.h"
|
||||
|
||||
/*
|
||||
|
@ -22,19 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h> /* needed for htonl */
|
||||
#include <iprtrmib.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include "net_util.h"
|
||||
#include "NetworkInterface.h"
|
||||
|
||||
#include "java_net_NetworkInterface.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "NetworkInterface.h"
|
||||
#include "net_util.h"
|
||||
|
||||
/*
|
||||
* Windows implementation of the java.net.NetworkInterface native methods.
|
||||
|
@ -22,24 +22,15 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "java_net_SocketInputStream.h"
|
||||
|
||||
#include "net_util.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "java_net_SocketInputStream.h"
|
||||
|
||||
/*************************************************************************
|
||||
* SocketInputStream
|
||||
*/
|
||||
|
||||
static jfieldID IO_fd_fdID;
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -22,19 +22,11 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "java_net_SocketOutputStream.h"
|
||||
|
||||
#include "net_util.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "java_net_SocketOutputStream.h"
|
||||
|
||||
/************************************************************************
|
||||
* SocketOutputStream
|
||||
|
@ -22,15 +22,15 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "net_util.h"
|
||||
#include "NetworkInterface.h"
|
||||
|
||||
#include "java_net_TwoStacksPlainDatagramSocketImpl.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
#include "java_net_NetworkInterface.h"
|
||||
#include "java_net_InetAddress.h"
|
||||
|
||||
#ifndef IPTOS_TOS_MASK
|
||||
#define IPTOS_TOS_MASK 0x1e
|
||||
@ -39,14 +39,6 @@
|
||||
#define IPTOS_PREC_MASK 0xe0
|
||||
#endif
|
||||
|
||||
#include "java_net_TwoStacksPlainDatagramSocketImpl.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
#include "java_net_NetworkInterface.h"
|
||||
|
||||
#include "NetworkInterface.h"
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
|
||||
#define IN_MULTICAST(i) IN_CLASSD(i)
|
||||
@ -439,7 +431,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
|
||||
memset((char *)&lcladdr, 0, sizeof(lcladdr));
|
||||
|
||||
family = getInetAddress_family(env, addressObj);
|
||||
if (family == IPv6 && !ipv6_supported) {
|
||||
if (family == java_net_InetAddress_IPv6 && !ipv6_supported) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Protocol family not supported");
|
||||
return;
|
||||
@ -561,13 +553,13 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_connect0(JNIEnv *env, jobject thi
|
||||
addr = getInetAddress_addr(env, address);
|
||||
|
||||
family = getInetAddress_family(env, address);
|
||||
if (family == IPv6 && !ipv6_supported) {
|
||||
if (family == java_net_InetAddress_IPv6 && !ipv6_supported) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Protocol family not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
fdc = family == IPv4? fd: fd1;
|
||||
fdc = family == java_net_InetAddress_IPv4 ? fd : fd1;
|
||||
|
||||
if (xp_or_later) {
|
||||
/* SIO_UDP_CONNRESET fixes a bug introduced in Windows 2000, which
|
||||
@ -605,12 +597,12 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject
|
||||
jint fd, len;
|
||||
SOCKETADDRESS addr;
|
||||
|
||||
if (family == IPv4) {
|
||||
if (family == java_net_InetAddress_IPv4) {
|
||||
fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
len = sizeof (struct sockaddr_in);
|
||||
len = sizeof(struct sockaddr_in);
|
||||
} else {
|
||||
fdObj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
||||
len = sizeof (struct SOCKADDR_IN6);
|
||||
len = sizeof(struct sockaddr_in6);
|
||||
}
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
@ -678,7 +670,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
||||
}
|
||||
|
||||
family = getInetAddress_family(env, iaObj);
|
||||
if (family == IPv4) {
|
||||
if (family == java_net_InetAddress_IPv4) {
|
||||
fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
} else {
|
||||
if (!ipv6_available()) {
|
||||
@ -906,7 +898,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
|
||||
return 0;
|
||||
}
|
||||
setInetAddress_addr(env, addressObj, ntohl(remote_addr.sa4.sin_addr.s_addr));
|
||||
setInetAddress_family(env, addressObj, IPv4);
|
||||
setInetAddress_family(env, addressObj, java_net_InetAddress_IPv4);
|
||||
|
||||
/* return port */
|
||||
return ntohs(remote_addr.sa4.sin_port);
|
||||
@ -1610,7 +1602,7 @@ static int getInet4AddrFromIf (JNIEnv *env, jobject nif, struct in_addr *iaddr)
|
||||
{
|
||||
jobject addr;
|
||||
|
||||
int ret = getInetAddrFromIf (env, IPv4, nif, &addr);
|
||||
int ret = getInetAddrFromIf(env, java_net_InetAddress_IPv4, nif, &addr);
|
||||
if (ret == -1) {
|
||||
return -1;
|
||||
}
|
||||
@ -2285,9 +2277,9 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_socketLocalAddress
|
||||
len = sizeof(struct sockaddr_in);
|
||||
|
||||
/* family==-1 when socket is not connected */
|
||||
if ((family == IPv6) || (family == -1 && fd == -1)) {
|
||||
if ((family == java_net_InetAddress_IPv6) || (family == -1 && fd == -1)) {
|
||||
fd = fd1; /* must be IPv6 only */
|
||||
len = sizeof (struct SOCKADDR_IN6);
|
||||
len = sizeof(struct sockaddr_in6);
|
||||
}
|
||||
|
||||
if (fd == -1) {
|
||||
|
@ -22,23 +22,13 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "java_net_SocketOptions.h"
|
||||
#include "java_net_TwoStacksPlainSocketImpl.h"
|
||||
#include "java_net_InetAddress.h"
|
||||
#include "java_io_FileDescriptor.h"
|
||||
#include "java_lang_Integer.h"
|
||||
|
||||
#include "net_util.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include "java_net_TwoStacksPlainSocketImpl.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
#include "java_net_InetAddress.h"
|
||||
|
||||
/************************************************************************
|
||||
* TwoStacksPlainSocketImpl
|
||||
@ -413,7 +403,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketBind(JNIEnv *env, jobject this,
|
||||
|
||||
family = getInetAddress_family(env, iaObj);
|
||||
|
||||
if (family == IPv6 && !ipv6_supported) {
|
||||
if (family == java_net_InetAddress_IPv6 && !ipv6_supported) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Protocol family not supported");
|
||||
return;
|
||||
@ -655,18 +645,18 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
||||
return;
|
||||
}
|
||||
if (fd2 == fd) { /* v4 */
|
||||
len = sizeof (struct sockaddr_in);
|
||||
len = sizeof(struct sockaddr_in);
|
||||
} else {
|
||||
len = sizeof (struct SOCKADDR_IN6);
|
||||
len = sizeof(struct sockaddr_in6);
|
||||
}
|
||||
fd = fd2;
|
||||
} else {
|
||||
int ret;
|
||||
if (fd1 != -1) {
|
||||
fd = fd1;
|
||||
len = sizeof (struct SOCKADDR_IN6);
|
||||
len = sizeof(struct sockaddr_in6);
|
||||
} else {
|
||||
len = sizeof (struct sockaddr_in);
|
||||
len = sizeof(struct sockaddr_in);
|
||||
}
|
||||
if (timeout) {
|
||||
ret = NET_Timeout(fd, timeout);
|
||||
@ -728,7 +718,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
||||
}
|
||||
|
||||
setInetAddress_addr(env, socketAddressObj, ntohl(him.sa4.sin_addr.s_addr));
|
||||
setInetAddress_family(env, socketAddressObj, IPv4);
|
||||
setInetAddress_family(env, socketAddressObj, java_net_InetAddress_IPv4);
|
||||
(*env)->SetObjectField(env, socket, psi_addressID, socketAddressObj);
|
||||
} else {
|
||||
/* AF_INET6 -> Inet6Address */
|
||||
@ -754,7 +744,7 @@ Java_java_net_TwoStacksPlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
||||
return;
|
||||
}
|
||||
setInet6Address_ipaddress(env, socketAddressObj, (char *)&him.sa6.sin6_addr);
|
||||
setInetAddress_family(env, socketAddressObj, IPv6);
|
||||
setInetAddress_family(env, socketAddressObj, java_net_InetAddress_IPv6);
|
||||
setInet6Address_scopeid(env, socketAddressObj, him.sa6.sin6_scope_id);
|
||||
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#ifndef ICMP_H
|
||||
#define ICMP_H
|
||||
|
||||
/*
|
||||
* Structure of an internet header, naked of options.
|
||||
*
|
||||
* We declare ip_len and ip_off to be short, rather than ushort_t
|
||||
* pragmatically since otherwise unsigned comparisons can result
|
||||
* against negative integers quite easily, and fail in subtle ways.
|
||||
*/
|
||||
struct ip {
|
||||
unsigned char ip_hl:4, /* header length */
|
||||
ip_v:4; /* version */
|
||||
unsigned char ip_tos; /* type of service */
|
||||
short ip_len; /* total length */
|
||||
unsigned short ip_id; /* identification */
|
||||
short ip_off; /* fragment offset field */
|
||||
#define IP_DF 0x4000 /* don't fragment flag */
|
||||
#define IP_MF 0x2000 /* more fragments flag */
|
||||
unsigned char ip_ttl; /* time to live */
|
||||
unsigned char ip_p; /* protocol */
|
||||
unsigned short ip_sum; /* checksum */
|
||||
struct in_addr ip_src, ip_dst; /* source and dest address */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure of an icmp header.
|
||||
*/
|
||||
struct icmp {
|
||||
unsigned char icmp_type; /* type of message, see below */
|
||||
unsigned char icmp_code; /* type sub code */
|
||||
unsigned short icmp_cksum; /* ones complement cksum of struct */
|
||||
union {
|
||||
unsigned char ih_pptr; /* ICMP_PARAMPROB */
|
||||
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
|
||||
struct ih_idseq {
|
||||
unsigned short icd_id;
|
||||
unsigned short icd_seq;
|
||||
} ih_idseq;
|
||||
int ih_void;
|
||||
|
||||
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
|
||||
struct ih_pmtu {
|
||||
unsigned short ipm_void;
|
||||
unsigned short ipm_nextmtu;
|
||||
} ih_pmtu;
|
||||
|
||||
struct ih_rtradv {
|
||||
unsigned char irt_num_addrs;
|
||||
unsigned char irt_wpa;
|
||||
unsigned short irt_lifetime;
|
||||
} ih_rtradv;
|
||||
} icmp_hun;
|
||||
#define icmp_pptr icmp_hun.ih_pptr
|
||||
#define icmp_gwaddr icmp_hun.ih_gwaddr
|
||||
#define icmp_id icmp_hun.ih_idseq.icd_id
|
||||
#define icmp_seq icmp_hun.ih_idseq.icd_seq
|
||||
#define icmp_void icmp_hun.ih_void
|
||||
#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
|
||||
#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
|
||||
union {
|
||||
struct id_ts {
|
||||
unsigned int its_otime;
|
||||
unsigned int its_rtime;
|
||||
unsigned int its_ttime;
|
||||
} id_ts;
|
||||
struct id_ip {
|
||||
struct ip idi_ip;
|
||||
/* options and then 64 bits of data */
|
||||
} id_ip;
|
||||
unsigned int id_mask;
|
||||
char id_data[1];
|
||||
} icmp_dun;
|
||||
#define icmp_otime icmp_dun.id_ts.its_otime
|
||||
#define icmp_rtime icmp_dun.id_ts.its_rtime
|
||||
#define icmp_ttime icmp_dun.id_ts.its_ttime
|
||||
#define icmp_ip icmp_dun.id_ip.idi_ip
|
||||
#define icmp_mask icmp_dun.id_mask
|
||||
#define icmp_data icmp_dun.id_data
|
||||
};
|
||||
|
||||
#define ICMP_ECHOREPLY 0 /* echo reply */
|
||||
#define ICMP_ECHO 8 /* echo service */
|
||||
|
||||
/*
|
||||
* ICMPv6 structures & constants
|
||||
*/
|
||||
|
||||
typedef struct icmp6_hdr {
|
||||
u_char icmp6_type; /* type field */
|
||||
u_char icmp6_code; /* code field */
|
||||
u_short icmp6_cksum; /* checksum field */
|
||||
union {
|
||||
u_int icmp6_un_data32[1]; /* type-specific field */
|
||||
u_short icmp6_un_data16[2]; /* type-specific field */
|
||||
u_char icmp6_un_data8[4]; /* type-specific field */
|
||||
} icmp6_dataun;
|
||||
} icmp6_t;
|
||||
|
||||
#define icmp6_data32 icmp6_dataun.icmp6_un_data32
|
||||
#define icmp6_data16 icmp6_dataun.icmp6_un_data16
|
||||
#define icmp6_data8 icmp6_dataun.icmp6_un_data8
|
||||
#define icmp6_pptr icmp6_data32[0] /* parameter prob */
|
||||
#define icmp6_mtu icmp6_data32[0] /* packet too big */
|
||||
#define icmp6_id icmp6_data16[0] /* echo request/reply */
|
||||
#define icmp6_seq icmp6_data16[1] /* echo request/reply */
|
||||
#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
|
||||
|
||||
struct ip6_pseudo_hdr /* for calculate the ICMPv6 checksum */
|
||||
{
|
||||
struct in6_addr ip6_src;
|
||||
struct in6_addr ip6_dst;
|
||||
u_int ip6_plen;
|
||||
u_int ip6_nxt;
|
||||
};
|
||||
|
||||
#define ICMP6_ECHO_REQUEST 128
|
||||
#define ICMP6_ECHO_REPLY 129
|
||||
#define IPPROTO_ICMPV6 58
|
||||
#define IPV6_UNICAST_HOPS 4 /* Set/get IP unicast hop limit */
|
||||
|
||||
|
||||
#endif
|
@ -22,12 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
#include "net_util.h"
|
||||
#include "jni.h"
|
||||
|
||||
#include "java_net_InetAddress.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
|
||||
// Taken from mstcpip.h in Windows SDK 8.0 or newer.
|
||||
#define SIO_LOOPBACK_FAST_PATH _WSAIOW(IOC_VENDOR,16)
|
||||
@ -593,7 +591,7 @@ NET_Timeout2(int fd, int fd1, long timeout, int *fdret) {
|
||||
|
||||
|
||||
void dumpAddr (char *str, void *addr) {
|
||||
struct SOCKADDR_IN6 *a = (struct SOCKADDR_IN6 *)addr;
|
||||
struct sockaddr_in6 *a = (struct sockaddr_in6 *)addr;
|
||||
int family = a->sin6_family;
|
||||
printf ("%s\n", str);
|
||||
if (family == AF_INET) {
|
||||
@ -812,7 +810,7 @@ NET_BindV6(struct ipv6bind *b, jboolean exclBind) {
|
||||
* 0 if error
|
||||
* > 0 interface index to use
|
||||
*/
|
||||
jint getDefaultIPv6Interface(JNIEnv *env, struct SOCKADDR_IN6 *target_addr)
|
||||
jint getDefaultIPv6Interface(JNIEnv *env, struct sockaddr_in6 *target_addr)
|
||||
{
|
||||
int ret;
|
||||
DWORD b;
|
||||
@ -866,9 +864,9 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
||||
int *len, jboolean v4MappedAddress) {
|
||||
jint family, iafam;
|
||||
iafam = getInetAddress_family(env, iaObj);
|
||||
family = (iafam == IPv4)? AF_INET : AF_INET6;
|
||||
family = (iafam == java_net_InetAddress_IPv4)? AF_INET : AF_INET6;
|
||||
if (ipv6_available() && !(family == AF_INET && v4MappedAddress == JNI_FALSE)) {
|
||||
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
|
||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
||||
jbyte caddr[16];
|
||||
jint address, scopeid = 0;
|
||||
jint cached_scope_id = 0;
|
||||
@ -894,7 +892,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
||||
cached_scope_id = (jint)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID);
|
||||
}
|
||||
|
||||
memset((char *)him6, 0, sizeof(struct SOCKADDR_IN6));
|
||||
memset((char *)him6, 0, sizeof(struct sockaddr_in6));
|
||||
him6->sin6_port = (u_short) htons((u_short)port);
|
||||
memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) );
|
||||
him6->sin6_family = AF_INET6;
|
||||
@ -904,7 +902,7 @@ NET_InetAddressToSockaddr(JNIEnv *env, jobject iaObj, int port, struct sockaddr
|
||||
(*env)->SetIntField(env, iaObj, ia6_cachedscopeidID, cached_scope_id);
|
||||
}
|
||||
him6->sin6_scope_id = scopeid != 0 ? scopeid : cached_scope_id;
|
||||
*len = sizeof(struct SOCKADDR_IN6) ;
|
||||
*len = sizeof(struct sockaddr_in6) ;
|
||||
} else {
|
||||
struct sockaddr_in *him4 = (struct sockaddr_in *)him;
|
||||
jint address;
|
||||
@ -964,12 +962,12 @@ NET_IsEqual(jbyte* caddr1, jbyte* caddr2) {
|
||||
}
|
||||
|
||||
int getScopeID(struct sockaddr *him) {
|
||||
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
|
||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
||||
return him6->sin6_scope_id;
|
||||
}
|
||||
|
||||
int cmpScopeID(unsigned int scope, struct sockaddr *him) {
|
||||
struct SOCKADDR_IN6 *him6 = (struct SOCKADDR_IN6 *)him;
|
||||
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)him;
|
||||
return him6->sin6_scope_id == scope;
|
||||
}
|
||||
|
||||
|
@ -22,195 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <WS2tcpip.h>
|
||||
|
||||
/* typedefs that were defined correctly for the first time
|
||||
* in Nov. 2001 SDK, which we need to include here.
|
||||
* Specifically, in6_addr and sockaddr_in6 (which is defined but
|
||||
* not correctly). When moving to a later SDK remove following
|
||||
* code between START and END
|
||||
*/
|
||||
|
||||
/* --- START --- */
|
||||
|
||||
/* WIN64 already uses newer SDK */
|
||||
#ifdef _WIN64
|
||||
|
||||
#define SOCKADDR_IN6 sockaddr_in6
|
||||
|
||||
#else
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define WS2TCPIP_INLINE __inline
|
||||
#else
|
||||
#define WS2TCPIP_INLINE extern inline /* GNU style */
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1310
|
||||
|
||||
#define SOCKADDR_IN6 sockaddr_in6
|
||||
|
||||
#else
|
||||
|
||||
/*SO_REUSEPORT is not supported on Windows, define it to 0*/
|
||||
#define SO_REUSEPORT 0
|
||||
|
||||
/* Retain this code a little longer to support building in
|
||||
* old environments. _MSC_VER is defined as:
|
||||
* 1200 for MSVC++ 6.0
|
||||
* 1310 for Vc7
|
||||
*/
|
||||
|
||||
#define IPPROTO_IPV6 41
|
||||
#define IPV6_MULTICAST_IF 9
|
||||
|
||||
struct in6_addr {
|
||||
union {
|
||||
u_char Byte[16];
|
||||
u_short Word[8];
|
||||
} u;
|
||||
};
|
||||
|
||||
/*
|
||||
** Defines to match RFC 2553.
|
||||
*/
|
||||
#define _S6_un u
|
||||
#define _S6_u8 Byte
|
||||
#define s6_addr _S6_un._S6_u8
|
||||
|
||||
/*
|
||||
** Defines for our implementation.
|
||||
*/
|
||||
#define s6_bytes u.Byte
|
||||
#define s6_words u.Word
|
||||
|
||||
/* IPv6 socket address structure, RFC 2553 */
|
||||
|
||||
struct SOCKADDR_IN6 {
|
||||
short sin6_family; /* AF_INET6 */
|
||||
u_short sin6_port; /* Transport level port number */
|
||||
u_long sin6_flowinfo; /* IPv6 flow information */
|
||||
struct in6_addr sin6_addr; /* IPv6 address */
|
||||
u_long sin6_scope_id; /* set of interfaces for a scope */
|
||||
};
|
||||
|
||||
|
||||
/* Error codes from getaddrinfo() */
|
||||
|
||||
#define EAI_AGAIN WSATRY_AGAIN
|
||||
#define EAI_BADFLAGS WSAEINVAL
|
||||
#define EAI_FAIL WSANO_RECOVERY
|
||||
#define EAI_FAMILY WSAEAFNOSUPPORT
|
||||
#define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
|
||||
//#define EAI_NODATA WSANO_DATA
|
||||
#define EAI_NONAME WSAHOST_NOT_FOUND
|
||||
#define EAI_SERVICE WSATYPE_NOT_FOUND
|
||||
#define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
|
||||
|
||||
#define EAI_NODATA EAI_NONAME
|
||||
|
||||
/* Structure used in getaddrinfo() call */
|
||||
|
||||
typedef struct addrinfo {
|
||||
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
|
||||
int ai_family; /* PF_xxx */
|
||||
int ai_socktype; /* SOCK_xxx */
|
||||
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
||||
size_t ai_addrlen; /* Length of ai_addr */
|
||||
char *ai_canonname; /* Canonical name for nodename */
|
||||
struct sockaddr *ai_addr; /* Binary address */
|
||||
struct addrinfo *ai_next; /* Next structure in linked list */
|
||||
} ADDRINFO, FAR * LPADDRINFO;
|
||||
|
||||
/* Flags used in "hints" argument to getaddrinfo() */
|
||||
|
||||
#define AI_PASSIVE 0x1 /* Socket address will be used in bind() call */
|
||||
#define AI_CANONNAME 0x2 /* Return canonical name in first ai_canonname */
|
||||
#define AI_NUMERICHOST 0x4 /* Nodename must be a numeric address string */
|
||||
|
||||
/* IPv6 Multicasting definitions */
|
||||
|
||||
/* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP */
|
||||
|
||||
typedef struct ipv6_mreq {
|
||||
struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast address */
|
||||
unsigned int ipv6mr_interface; /* Interface index */
|
||||
} IPV6_MREQ;
|
||||
|
||||
#define IPV6_ADD_MEMBERSHIP 12 /* Add an IP group membership */
|
||||
#define IPV6_DROP_MEMBERSHIP 13 /* Drop an IP group membership */
|
||||
#define IPV6_MULTICAST_LOOP 11 /* Set/get IP multicast loopback */
|
||||
|
||||
WS2TCPIP_INLINE int
|
||||
IN6_IS_ADDR_MULTICAST(const struct in6_addr *a)
|
||||
{
|
||||
return (a->s6_bytes[0] == 0xff);
|
||||
}
|
||||
|
||||
WS2TCPIP_INLINE int
|
||||
IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *a)
|
||||
{
|
||||
return (a->s6_bytes[0] == 0xfe
|
||||
&& a->s6_bytes[1] == 0x80);
|
||||
}
|
||||
|
||||
#define NI_MAXHOST 1025 /* Max size of a fully-qualified domain name */
|
||||
#define NI_MAXSERV 32 /* Max size of a service name */
|
||||
|
||||
#define INET_ADDRSTRLEN 16 /* Max size of numeric form of IPv4 address */
|
||||
#define INET6_ADDRSTRLEN 46 /* Max size of numeric form of IPv6 address */
|
||||
|
||||
/* Flags for getnameinfo() */
|
||||
|
||||
#define NI_NOFQDN 0x01 /* Only return nodename portion for local hosts */
|
||||
#define NI_NUMERICHOST 0x02 /* Return numeric form of the host's address */
|
||||
#define NI_NAMEREQD 0x04 /* Error if the host's name not in DNS */
|
||||
#define NI_NUMERICSERV 0x08 /* Return numeric form of the service (port #) */
|
||||
#define NI_DGRAM 0x10 /* Service is a datagram service */
|
||||
|
||||
|
||||
#define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
(((a)->s6_words[0] == 0) && ((a)->s6_words[1] == 0) && \
|
||||
((a)->s6_words[2] == 0) && ((a)->s6_words[3] == 0) && \
|
||||
((a)->s6_words[4] == 0) && ((a)->s6_words[5] == 0xffff))
|
||||
|
||||
|
||||
/* --- END --- */
|
||||
#endif /* end 'else older build environment' */
|
||||
|
||||
#endif
|
||||
|
||||
#if !INCL_WINSOCK_API_TYPEDEFS
|
||||
|
||||
typedef
|
||||
int
|
||||
(WSAAPI * LPFN_GETADDRINFO)(
|
||||
IN const char FAR * nodename,
|
||||
IN const char FAR * servname,
|
||||
IN const struct addrinfo FAR * hints,
|
||||
OUT struct addrinfo FAR * FAR * res
|
||||
);
|
||||
|
||||
typedef
|
||||
void
|
||||
(WSAAPI * LPFN_FREEADDRINFO)(
|
||||
IN struct addrinfo FAR * ai
|
||||
);
|
||||
|
||||
typedef
|
||||
int
|
||||
(WSAAPI * LPFN_GETNAMEINFO)(
|
||||
IN const struct sockaddr FAR * sa,
|
||||
IN int salen,
|
||||
OUT char FAR * host,
|
||||
IN DWORD hostlen,
|
||||
OUT char FAR * serv,
|
||||
IN DWORD servlen,
|
||||
IN int flags
|
||||
);
|
||||
#endif
|
||||
#include <iphlpapi.h>
|
||||
#include <icmpapi.h>
|
||||
|
||||
/* used to disable connection reset messages on Windows XP */
|
||||
#ifndef SIO_UDP_CONNRESET
|
||||
@ -229,13 +44,9 @@ int
|
||||
#define IPV6_V6ONLY 27 /* Treat wildcard bind as AF_INET6-only. */
|
||||
#endif
|
||||
|
||||
#include "java_io_FileDescriptor.h"
|
||||
#include "java_net_SocketOptions.h"
|
||||
|
||||
#define MAX_BUFFER_LEN 2048
|
||||
#define MAX_HEAP_BUFFER_LEN 65536
|
||||
|
||||
|
||||
/* true if SO_RCVTIMEO is supported by underlying provider */
|
||||
extern jboolean isRcvTimeoutSupported;
|
||||
|
||||
@ -249,7 +60,7 @@ int NET_GetDefaultTOS(void);
|
||||
typedef union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sa4;
|
||||
struct SOCKADDR_IN6 sa6;
|
||||
struct sockaddr_in6 sa6;
|
||||
} SOCKETADDRESS;
|
||||
|
||||
/*
|
||||
@ -264,7 +75,7 @@ struct ipv6bind {
|
||||
|
||||
#define SOCKETADDRESS_COPY(DST,SRC) { \
|
||||
if ((SRC)->sa_family == AF_INET6) { \
|
||||
memcpy ((DST), (SRC), sizeof (struct SOCKADDR_IN6)); \
|
||||
memcpy ((DST), (SRC), sizeof (struct sockaddr_in6)); \
|
||||
} else { \
|
||||
memcpy ((DST), (SRC), sizeof (struct sockaddr_in)); \
|
||||
} \
|
||||
|
Loading…
x
Reference in New Issue
Block a user