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