< prev index next >

src/java.base/windows/native/libnet/net_util_md.h

Print this page
rev 14618 : 8158023: SocketExceptions contain too little information sometimes
   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   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


 278     if ((X)->him.sa_family == AF_INET) {        \
 279         (X)->him4.sin_port = (Y);               \
 280     } else {                                    \
 281         (X)->him6.sin6_port = (Y);              \
 282     }                                           \
 283 }
 284 
 285 #define GET_PORT(X) ((X)->him.sa_family==AF_INET ?(X)->him4.sin_port: (X)->him6.sin6_port)
 286 
 287 #define IS_LOOPBACK_ADDRESS(x) ( \
 288     ((x)->him.sa_family == AF_INET) ? \
 289         (ntohl((x)->him4.sin_addr.s_addr)==INADDR_LOOPBACK) : \
 290         (IN6ADDR_ISLOOPBACK (x)) \
 291 )
 292 
 293 JNIEXPORT int JNICALL NET_SocketClose(int fd);
 294 
 295 JNIEXPORT int JNICALL NET_Timeout(int fd, long timeout);
 296 
 297 int NET_Socket(int domain, int type, int protocol);
 298 
 299 void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
 300          const char *defaultDetail);
 301 
 302 void NET_ThrowSocketException(JNIEnv *env, char* msg);
 303 
 304 /*
 305  * differs from NET_Timeout() as follows:
 306  *
 307  * If timeout = -1, it blocks forever.
 308  *
 309  * returns 1 or 2 depending if only one or both sockets
 310  * fire at same time.
 311  *
 312  * *fdret is (one of) the active fds. If both sockets
 313  * fire at same time, *fd == fd always.
 314  */
 315 JNIEXPORT int JNICALL NET_Timeout2(int fd, int fd1, long timeout, int *fdret);
 316 
 317 JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind* b, jboolean exclBind);
 318 
 319 #define NET_WAIT_READ   0x01
 320 #define NET_WAIT_WRITE  0x02


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   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


 278     if ((X)->him.sa_family == AF_INET) {        \
 279         (X)->him4.sin_port = (Y);               \
 280     } else {                                    \
 281         (X)->him6.sin6_port = (Y);              \
 282     }                                           \
 283 }
 284 
 285 #define GET_PORT(X) ((X)->him.sa_family==AF_INET ?(X)->him4.sin_port: (X)->him6.sin6_port)
 286 
 287 #define IS_LOOPBACK_ADDRESS(x) ( \
 288     ((x)->him.sa_family == AF_INET) ? \
 289         (ntohl((x)->him4.sin_addr.s_addr)==INADDR_LOOPBACK) : \
 290         (IN6ADDR_ISLOOPBACK (x)) \
 291 )
 292 
 293 JNIEXPORT int JNICALL NET_SocketClose(int fd);
 294 
 295 JNIEXPORT int JNICALL NET_Timeout(int fd, long timeout);
 296 
 297 int NET_Socket(int domain, int type, int protocol);



 298 
 299 void NET_ThrowSocketException(JNIEnv *env, char* msg);
 300 
 301 /*
 302  * differs from NET_Timeout() as follows:
 303  *
 304  * If timeout = -1, it blocks forever.
 305  *
 306  * returns 1 or 2 depending if only one or both sockets
 307  * fire at same time.
 308  *
 309  * *fdret is (one of) the active fds. If both sockets
 310  * fire at same time, *fd == fd always.
 311  */
 312 JNIEXPORT int JNICALL NET_Timeout2(int fd, int fd1, long timeout, int *fdret);
 313 
 314 JNIEXPORT int JNICALL NET_BindV6(struct ipv6bind* b, jboolean exclBind);
 315 
 316 #define NET_WAIT_READ   0x01
 317 #define NET_WAIT_WRITE  0x02


< prev index next >