equal
deleted
inserted
replaced
27 import java.io.FileDescriptor; |
27 import java.io.FileDescriptor; |
28 import java.io.IOException; |
28 import java.io.IOException; |
29 import java.net.InetAddress; |
29 import java.net.InetAddress; |
30 import java.net.InetSocketAddress; |
30 import java.net.InetSocketAddress; |
31 import java.net.SocketAddress; |
31 import java.net.SocketAddress; |
|
32 import java.nio.channels.AlreadyBoundException; |
32 import java.util.Set; |
33 import java.util.Set; |
33 import java.util.HashSet; |
34 import java.util.HashSet; |
34 import java.security.AccessController; |
35 import java.security.AccessController; |
35 import sun.security.action.GetPropertyAction; |
36 import sun.security.action.GetPropertyAction; |
36 import com.sun.nio.sctp.SctpSocketOption; |
37 import com.sun.nio.sctp.SctpSocketOption; |
50 |
51 |
51 /* lksctp/linux requires Ipv4 addresses */ |
52 /* lksctp/linux requires Ipv4 addresses */ |
52 return false; |
53 return false; |
53 } |
54 } |
54 |
55 |
|
56 static boolean throwAlreadyBoundException() throws IOException { |
|
57 throw new AlreadyBoundException(); |
|
58 } |
|
59 |
|
60 static void listen(int fd, int backlog) throws IOException { |
|
61 listen0(fd, backlog); |
|
62 } |
|
63 |
|
64 static int connect(int fd, InetAddress remote, int remotePort) |
|
65 throws IOException { |
|
66 return connect0(fd, remote, remotePort); |
|
67 } |
|
68 |
|
69 static void close(int fd) throws IOException { |
|
70 close0(fd); |
|
71 } |
|
72 |
|
73 static void preClose(int fd) throws IOException { |
|
74 preClose0(fd); |
|
75 } |
|
76 |
55 /** |
77 /** |
56 * @param oneToone |
78 * @param oneToOne |
57 * if {@code true} returns a one-to-one sctp socket, otherwise |
79 * if {@code true} returns a one-to-one sctp socket, otherwise |
58 * returns a one-to-many sctp socket |
80 * returns a one-to-many sctp socket |
59 */ |
81 */ |
60 static FileDescriptor socket(boolean oneToOne) throws IOException { |
82 static FileDescriptor socket(boolean oneToOne) throws IOException { |
61 int nativefd = socket0(oneToOne); |
83 int nativefd = socket0(oneToOne); |
238 } |
260 } |
239 |
261 |
240 /* Native Methods */ |
262 /* Native Methods */ |
241 static native int socket0(boolean oneToOne) throws IOException; |
263 static native int socket0(boolean oneToOne) throws IOException; |
242 |
264 |
|
265 static native void listen0(int fd, int backlog) throws IOException; |
|
266 |
|
267 static native int connect0(int fd, InetAddress remote, int remotePort) |
|
268 throws IOException; |
|
269 |
|
270 static native void close0(int fd) throws IOException; |
|
271 |
|
272 static native void preClose0(int fd) throws IOException; |
|
273 |
243 static native void bindx(int fd, InetAddress[] addrs, int port, int length, |
274 static native void bindx(int fd, InetAddress[] addrs, int port, int length, |
244 boolean add, boolean preferIPv6) throws IOException; |
275 boolean add, boolean preferIPv6) throws IOException; |
245 |
276 |
246 static native int getIntOption0(int fd, int opt) throws IOException; |
277 static native int getIntOption0(int fd, int opt) throws IOException; |
247 |
278 |
269 |
300 |
270 static native void setInitMsgOption0(int fd, int arg1, int arg2) |
301 static native void setInitMsgOption0(int fd, int arg1, int arg2) |
271 throws IOException; |
302 throws IOException; |
272 |
303 |
273 static native void shutdown0(int fd, int assocId); |
304 static native void shutdown0(int fd, int assocId); |
|
305 |
|
306 static native void init(); |
|
307 |
|
308 static { |
|
309 init(); |
|
310 } |
274 } |
311 } |
275 |
312 |