|
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 |
|
105 HPIDECL(timeout, "timeout", _socket, Timeout, int, "%d", |
|
106 (int fd, long timeout), |
|
107 ("fd = %d, timeout = %ld", fd, timeout), |
|
108 (fd, timeout)); |
|
109 |
|
110 HPIDECL(get_host_by_name, "get_host_by_name", _socket, GetHostByName, |
|
111 struct hostent *, "(struct hostent *)%p", |
|
112 (char *name), |
|
113 ("%s", name), |
|
114 (name)); |
|
115 |
|
116 HPIDECL(socket_shutdown, "socket_shutdown", _socket, SocketShutdown, |
|
117 int, "%d", |
|
118 (int fd, int howto), |
|
119 ("fd = %d, howto = %d", fd, howto), |
|
120 (fd, howto)); |
|
121 |
|
122 HPIDECL(bind, "bind", _socket, Bind, |
|
123 int, "%d", |
|
124 (int fd, struct sockaddr *him, int len), |
|
125 ("fd = %d, him = %p, len = %d", |
|
126 fd, him, len), |
|
127 (fd, him, len)); |
|
128 |
|
129 HPIDECL(get_sock_name, "get_sock_name", _socket, GetSocketName, |
|
130 int, "%d", |
|
131 (int fd, struct sockaddr *him, int *len), |
|
132 ("fd = %d, him = %p, len = %p", |
|
133 fd, him, len), |
|
134 (fd, him, len)); |
|
135 |
|
136 HPIDECL(get_host_name, "get_host_name", _socket, GetHostName, int, "%d", |
|
137 (char *hostname, int namelen), |
|
138 ("hostname = %p, namelen = %d", |
|
139 hostname, namelen), |
|
140 (hostname, namelen)); |
|
141 |
|
142 HPIDECL(get_host_by_addr, "get_host_by_addr", _socket, GetHostByAddr, |
|
143 struct hostent *, "(struct hostent *)%p", |
|
144 (const char* name, int len, int type), |
|
145 ("name = %p, len = %d, type = %d", |
|
146 name, len, type), |
|
147 (name, len, type)); |
|
148 |
|
149 HPIDECL(get_sock_opt, "get_sock_opt", _socket, SocketGetOption, int, "%d", |
|
150 (int fd, int level, int optname, char *optval, int* optlen), |
|
151 ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %p", |
|
152 fd, level, optname, optval, optlen), |
|
153 (fd, level, optname, optval, optlen)); |
|
154 |
|
155 HPIDECL(set_sock_opt, "set_sock_opt", _socket, SocketSetOption, int, "%d", |
|
156 (int fd, int level, int optname, const char *optval, int optlen), |
|
157 ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %d", |
|
158 fd, level, optname, optval, optlen), |
|
159 (fd, level, optname, optval, optlen)); |
|
160 |
|
161 HPIDECL(get_proto_by_name, "get_proto_by_name", _socket, GetProtoByName, |
|
162 struct protoent *, "(struct protoent *)%p", |
|
163 (char* name), |
|
164 ("name = %p", |
|
165 name), |
|
166 (name)); |