1 #ifdef USE_PRAGMA_IDENT_HDR 2 #pragma ident "@(#)hpi_windows.hpp 1.17 07/05/05 17:04:44 JVM" 3 #endif 4 /* 5 * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. 6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 * 8 * This code is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License version 2 only, as 10 * published by the Free Software Foundation. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23 * CA 95054 USA or visit www.sun.com if you need additional information or 24 * have any questions. 25 * 26 */ 27 28 // Win32 delegates these to the HPI. Solaris provides its own 29 // implementation without using the HPI (for Interrupitble I/O). 30 31 // HPI_FileInterface 32 33 HPIDECL(close, "close", _file, Close, int, "%d", 34 (int fd), 35 ("fd = %d", fd), 36 (fd)); 37 38 HPIDECL(read, "read", _file, Read, size_t, "%ld", 39 (int fd, void *buf, unsigned int nBytes), 40 ("fd = %d, buf = %p, nBytes = %u", fd, buf, nBytes), 41 (fd, buf, nBytes)); 42 43 HPIDECL(write, "write", _file, Write, size_t, "%ld", 44 (int fd, const void *buf, unsigned int nBytes), 45 ("fd = %d, buf = %p, nBytes = %u", fd, buf, nBytes), 46 (fd, buf, nBytes)); 47 48 49 // HPI_SocketInterface 50 51 HPIDECL(socket_close, "socket_close", _socket, Close, int, "%d", 52 (int fd), 53 ("fd = %d", fd), 54 (fd)); 55 56 HPIDECL(socket_available, "socket_available", _socket, Available, 57 int, "%d", 58 (int fd, jint *pbytes), 59 ("fd = %d, pbytes = %p", fd, pbytes), 60 (fd, pbytes)); 61 62 HPIDECL(socket, "socket", _socket, Socket, int, "%d", 63 (int domain, int type, int protocol), 64 ("domain = %d, type = %d, protocol = %d", domain, type, protocol), 65 (domain, type, protocol)); 66 67 HPIDECL(listen, "listen", _socket, Listen, int, "%d", 68 (int fd, int count), 69 ("fd = %d, count = %d", fd, count), 70 (fd, count)); 71 72 HPIDECL(connect, "connect", _socket, Connect, int, "%d", 73 (int fd, struct sockaddr *him, int len), 74 ("fd = %d, him = %p, len = %d", fd, him, len), 75 (fd, him, len)); 76 77 HPIDECL(accept, "accept", _socket, Accept, int, "%d", 78 (int fd, struct sockaddr *him, int *len), 79 ("fd = %d, him = %p, len = %p", fd, him, len), 80 (fd, him, len)); 81 82 HPIDECL(sendto, "sendto", _socket, SendTo, int, "%d", 83 (int fd, char *buf, int len, int flags, 84 struct sockaddr *to, int tolen), 85 ("fd = %d, buf = %p, len = %d, flags = %d, to = %p, tolen = %d", 86 fd, buf, len, flags, to, tolen), 87 (fd, buf, len, flags, to, tolen)); 88 89 HPIDECL(recvfrom, "recvfrom", _socket, RecvFrom, int, "%d", 90 (int fd, char *buf, int nbytes, int flags, 91 struct sockaddr *from, int *fromlen), 92 ("fd = %d, buf = %p, len = %d, flags = %d, frm = %p, frmlen = %d", 93 fd, buf, nbytes, flags, from, fromlen), 94 (fd, buf, nbytes, flags, from, fromlen)); 95 96 HPIDECL(recv, "recv", _socket, Recv, int, "%d", 97 (int fd, char *buf, int nBytes, int flags), 98 ("fd = %d, buf = %p, nBytes = %d, flags = %d", 99 fd, buf, nBytes, flags), 100 (fd, buf, nBytes, flags)); 101 102 HPIDECL(send, "send", _socket, Send, int, "%d", 103 (int fd, char *buf, int nBytes, int flags), 104 ("fd = %d, buf = %p, nBytes = %d, flags = %d", 105 fd, buf, nBytes, flags), 106 (fd, buf, nBytes, flags)); 107 108 HPIDECL(timeout, "timeout", _socket, Timeout, int, "%d", 109 (int fd, long timeout), 110 ("fd = %d, timeout = %ld", fd, timeout), 111 (fd, timeout)); 112 113 HPIDECL(get_host_by_name, "get_host_by_name", _socket, GetHostByName, 114 struct hostent *, "(struct hostent *)%p", 115 (char *name), 116 ("%s", name), 117 (name)); 118 119 HPIDECL(socket_shutdown, "socket_shutdown", _socket, SocketShutdown, 120 int, "%d", 121 (int fd, int howto), 122 ("fd = %d, howto = %d", fd, howto), 123 (fd, howto)); 124 125 HPIDECL(bind, "bind", _socket, Bind, 126 int, "%d", 127 (int fd, struct sockaddr *him, int len), 128 ("fd = %d, him = %p, len = %d", 129 fd, him, len), 130 (fd, him, len)); 131 132 HPIDECL(get_sock_name, "get_sock_name", _socket, GetSocketName, 133 int, "%d", 134 (int fd, struct sockaddr *him, int *len), 135 ("fd = %d, him = %p, len = %p", 136 fd, him, len), 137 (fd, him, len)); 138 139 HPIDECL(get_host_name, "get_host_name", _socket, GetHostName, int, "%d", 140 (char *hostname, int namelen), 141 ("hostname = %p, namelen = %d", 142 hostname, namelen), 143 (hostname, namelen)); 144 145 HPIDECL(get_host_by_addr, "get_host_by_addr", _socket, GetHostByAddr, 146 struct hostent *, "(struct hostent *)%p", 147 (const char* name, int len, int type), 148 ("name = %p, len = %d, type = %d", 149 name, len, type), 150 (name, len, type)); 151 152 HPIDECL(get_sock_opt, "get_sock_opt", _socket, SocketGetOption, int, "%d", 153 (int fd, int level, int optname, char *optval, int* optlen), 154 ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %p", 155 fd, level, optname, optval, optlen), 156 (fd, level, optname, optval, optlen)); 157 158 HPIDECL(set_sock_opt, "set_sock_opt", _socket, SocketSetOption, int, "%d", 159 (int fd, int level, int optname, const char *optval, int optlen), 160 ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %d", 161 fd, level, optname, optval, optlen), 162 (fd, level, optname, optval, optlen)); 163 164 HPIDECL(get_proto_by_name, "get_proto_by_name", _socket, GetProtoByName, 165 struct protoent *, "(struct protoent *)%p", 166 (char* name), 167 ("name = %p", 168 name), 169 (name)); 170