01: /*
02: * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25: package java.net;
26:
27: import java.io.IOException;
28: import java.io.FileDescriptor;
29:
30: /*
31: * On Unix systems we simply delegate to native methods.
32: *
33: * @version 1.2, 06/11/07
34: * @author Chris Hegarty
35: */
36:
37: class PlainSocketImpl extends AbstractPlainSocketImpl {
38: static {
39: initProto();
40: }
41:
42: /**
43: * Constructs an empty instance.
44: */
45: PlainSocketImpl() {
46: }
47:
48: /**
49: * Constructs an instance with the given file descriptor.
50: */
51: PlainSocketImpl(FileDescriptor fd) {
52: this .fd = fd;
53: }
54:
55: native void socketCreate(boolean isServer) throws IOException;
56:
57: native void socketConnect(InetAddress address, int port, int timeout)
58: throws IOException;
59:
60: native void socketBind(InetAddress address, int port)
61: throws IOException;
62:
63: native void socketListen(int count) throws IOException;
64:
65: native void socketAccept(SocketImpl s) throws IOException;
66:
67: native int socketAvailable() throws IOException;
68:
69: native void socketClose0(boolean useDeferredClose)
70: throws IOException;
71:
72: native void socketShutdown(int howto) throws IOException;
73:
74: static native void initProto();
75:
76: native void socketSetOption(int cmd, boolean on, Object value)
77: throws SocketException;
78:
79: native int socketGetOption(int opt, Object iaContainerObj)
80: throws SocketException;
81:
82: native int socketGetOption1(int opt, Object iaContainerObj,
83: FileDescriptor fd) throws SocketException;
84:
85: native void socketSendUrgentData(int data) throws IOException;
86:
87: }
|