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
38typedef int socklen_t;
39#endif
40
41int dbgsysSocketClose(int fd);
42int dbgsysConnect(int fd, struct sockaddr *him, socklen_t len);
43int dbgsysFinishConnect(int fd, int timeout);
44int dbgsysAccept(int fd, struct sockaddr *him, socklen_t *len);
45int dbgsysSendTo(int fd, char *buf, size_t len, int flags, struct sockaddr *to, socklen_t tolen);
46int dbgsysRecvFrom(int fd, char *buf, size_t nBytes, int flags, struct sockaddr *from, socklen_t *fromlen);
47int dbgsysListen(int fd, int backlog);
48int dbgsysRecv(int fd, char *buf, size_t nBytes, int flags);
49int dbgsysSend(int fd, char *buf, size_t nBytes, int flags);
50struct hostent *dbgsysGetHostByName(char *hostname);
51int dbgsysSocket(int domain, int type, int protocol);
52int dbgsysBind(int fd, struct sockaddr *name, socklen_t namelen);
53int dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value);
54uint32_t dbgsysInetAddr(const char* cp);
55uint32_t dbgsysHostToNetworkLong(uint32_t hostlong);
56unsigned short dbgsysHostToNetworkShort(unsigned short hostshort);
57uint32_t dbgsysNetworkToHostLong(uint32_t netlong);
58unsigned short dbgsysNetworkToHostShort(unsigned short netshort);
59int dbgsysGetSocketName(int fd, struct sockaddr *him, socklen_t *len);
60int dbgsysConfigureBlocking(int fd, jboolean blocking);
61int dbgsysPoll(int fd, jboolean rd, jboolean wr, long timeout);
62int dbgsysGetLastIOError(char *buf, jint size);
63long dbgsysCurrentTimeMillis();
64
65/*
66 * TLS support
67 */
68int dbgsysTlsAlloc();
69void dbgsysTlsFree(int index);
70void dbgsysTlsPut(int index, void *value);
71void* dbgsysTlsGet(int index);
72
73#endif
74