blob: 113bcb0183e9177f9ef65b49f04528b4f8271816 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2007 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * 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 */
25package java.net;
26
27import java.io.IOException;
28import java.io.FileDescriptor;
29
30/*
31 * On Unix systems we simply delegate to native methods.
32 *
33 * @author Chris Hegarty
34 */
35
36class PlainSocketImpl extends AbstractPlainSocketImpl
37{
38 static {
39 initProto();
40 }
41
42 /**
43 * Constructs an empty instance.
44 */
45 PlainSocketImpl() { }
46
47 /**
48 * Constructs an instance with the given file descriptor.
49 */
50 PlainSocketImpl(FileDescriptor fd) {
51 this.fd = fd;
52 }
53
54 native void socketCreate(boolean isServer) throws IOException;
55
56 native void socketConnect(InetAddress address, int port, int timeout)
57 throws IOException;
58
59 native void socketBind(InetAddress address, int port)
60 throws IOException;
61
62 native void socketListen(int count) throws IOException;
63
64 native void socketAccept(SocketImpl s) throws IOException;
65
66 native int socketAvailable() throws IOException;
67
68 native void socketClose0(boolean useDeferredClose) throws IOException;
69
70 native void socketShutdown(int howto) throws IOException;
71
72 static native void initProto();
73
74 native void socketSetOption(int cmd, boolean on, Object value)
75 throws SocketException;
76
77 native int socketGetOption(int opt, Object iaContainerObj) throws SocketException;
78
79 native int socketGetOption1(int opt, Object iaContainerObj, FileDescriptor fd)
80 throws SocketException;
81
82 native void socketSendUrgentData(int data) throws IOException;
83
84}