1 /* 2 * Copyright (c) 1998, 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 23 * questions. 24 */ 25 #ifndef _JAVASOFT_WIN32_SOCKET_MD_H 26 27 #include <jni.h> 28 #include <sys/types.h> 29 #include "sys.h" 30 #include "socket_md.h" 31 32 #define DBG_POLLIN 1 33 #define DBG_POLLOUT 2 34 35 #define DBG_EINPROGRESS -150 36 #define DBG_ETIMEOUT -200 37 #ifdef WIN32 38 typedef int socklen_t; 39 #endif 40 41 int dbgsysSocketClose(int fd); 42 int dbgsysConnect(int fd, struct sockaddr *him, socklen_t len); 43 int dbgsysFinishConnect(int fd, int timeout); 44 int dbgsysAccept(int fd, struct sockaddr *him, socklen_t *len); 45 int dbgsysSendTo(int fd, char *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen); 46 int dbgsysRecvFrom(int fd, char *buf, size_t nBytes, int flags, struct sockaddr *from, socklen_t *fromlen); 47 int dbgsysListen(int fd, int backlog); 48 int dbgsysRecv(int fd, char *buf, size_t nBytes, int flags); 49 int dbgsysSend(int fd, char *buf, size_t nBytes, int flags); 50 struct hostent *dbgsysGetHostByName(char *hostname); 51 int dbgsysSocket(int domain, int type, int protocol); 52 int dbgsysBind(int fd, struct sockaddr *name, socklen_t namelen); 53 int dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value); 54 uint32_t dbgsysInetAddr(const char* cp); 55 uint32_t dbgsysHostToNetworkLong(uint32_t hostlong); 56 unsigned short dbgsysHostToNetworkShort(unsigned short hostshort); 57 uint32_t dbgsysNetworkToHostLong(uint32_t netlong); 58 unsigned short dbgsysNetworkToHostShort(unsigned short netshort); 59 int dbgsysGetSocketName(int fd, struct sockaddr *him, socklen_t *len); 60 int dbgsysConfigureBlocking(int fd, jboolean blocking); 61 int dbgsysPoll(int fd, jboolean rd, jboolean wr, long timeout); 62 int dbgsysGetLastIOError(char *buf, jint size); 63 long dbgsysCurrentTimeMillis(); 64 65 /* 66 * TLS support 67 */ 68 int dbgsysTlsAlloc(); 69 void dbgsysTlsFree(int index); 70 void dbgsysTlsPut(int index, void *value); 71 void* dbgsysTlsGet(int index); 72 73 #endif 74