J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1998-2005 Sun Microsystems, Inc. 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. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any 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 | #ifdef _LP64 |
| 33 | typedef unsigned int UINT32; |
| 34 | typedef int INT32; |
| 35 | #else /* _LP64 */ |
| 36 | typedef unsigned long UINT32; |
| 37 | typedef long INT32; |
| 38 | #endif /* _LP64 */ |
| 39 | |
| 40 | #define DBG_POLLIN 1 |
| 41 | #define DBG_POLLOUT 2 |
| 42 | |
| 43 | #define DBG_EINPROGRESS -150 |
| 44 | #define DBG_ETIMEOUT -200 |
| 45 | |
| 46 | int dbgsysSocketClose(int fd); |
| 47 | INT32 dbgsysSocketAvailable(int fd, INT32 *pbytes); |
| 48 | int dbgsysConnect(int fd, struct sockaddr *him, int len); |
| 49 | int dbgsysFinishConnect(int fd, long timeout); |
| 50 | int dbgsysAccept(int fd, struct sockaddr *him, int *len); |
| 51 | int dbgsysSendTo(int fd, char *buf, int len, int flags, struct sockaddr *to, |
| 52 | int tolen); |
| 53 | int dbgsysRecvFrom(int fd, char *buf, int nbytes, int flags, |
| 54 | struct sockaddr *from, int *fromlen); |
| 55 | int dbgsysListen(int fd, INT32 count); |
| 56 | int dbgsysRecv(int fd, char *buf, int nBytes, int flags); |
| 57 | int dbgsysSend(int fd, char *buf, int nBytes, int flags); |
| 58 | int dbgsysTimeout(int fd, INT32 timeout); |
| 59 | struct hostent *dbgsysGetHostByName(char *hostname); |
| 60 | int dbgsysSocket(int domain, int type, int protocol); |
| 61 | int dbgsysBind(int fd, struct sockaddr *name, int namelen); |
| 62 | int dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value); |
| 63 | UINT32 dbgsysInetAddr(const char* cp); |
| 64 | UINT32 dbgsysHostToNetworkLong(UINT32 hostlong); |
| 65 | unsigned short dbgsysHostToNetworkShort(unsigned short hostshort); |
| 66 | UINT32 dbgsysNetworkToHostLong(UINT32 netlong); |
| 67 | unsigned short dbgsysNetworkToHostShort(unsigned short netshort); |
| 68 | int dbgsysGetSocketName(int fd, struct sockaddr *him, int *len); |
| 69 | int dbgsysConfigureBlocking(int fd, jboolean blocking); |
| 70 | int dbgsysPoll(int fd, jboolean rd, jboolean wr, long timeout); |
| 71 | int dbgsysGetLastIOError(char *buf, jint size); |
| 72 | long dbgsysCurrentTimeMillis(); |
| 73 | |
| 74 | /* |
| 75 | * TLS support |
| 76 | */ |
| 77 | int dbgsysTlsAlloc(); |
| 78 | void dbgsysTlsFree(int index); |
| 79 | void dbgsysTlsPut(int index, void *value); |
| 80 | void* dbgsysTlsGet(int index); |
| 81 | |
| 82 | #endif |