• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 only, as
8  * published by the Free Software Foundation.  Oracle designates this
9  * particular file as subject to the "Classpath" exception as provided
10  * by Oracle in the LICENSE file that accompanied this code.
11  *
12  * This code is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15  * version 2 for more details (a copy is included in the LICENSE file that
16  * accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License version
19  * 2 along with this work; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23  * or visit www.oracle.com if you need additional information or have any
24  * questions.
25  */
26 package java.net;
27 
28 import java.io.IOException;
29 import java.io.FileDescriptor;
30 
31 /*
32  * On Unix systems we simply delegate to native methods.
33  *
34  * @author Chris Hegarty
35  */
36 
37 class PlainSocketImpl extends AbstractPlainSocketImpl
38 {
39     /**
40      * Constructs an empty instance.
41      */
PlainSocketImpl()42     PlainSocketImpl() {
43         this(new FileDescriptor());
44     }
45 
46     /**
47      * Constructs an instance with the given file descriptor.
48      */
PlainSocketImpl(FileDescriptor fd)49     PlainSocketImpl(FileDescriptor fd) {
50         this.fd = fd;
51     }
52 
socketCreate(boolean isServer)53     native void socketCreate(boolean isServer) throws IOException;
54 
socketConnect(InetAddress address, int port, int timeout)55     native void socketConnect(InetAddress address, int port, int timeout)
56         throws IOException;
57 
socketBind(InetAddress address, int port)58     native void socketBind(InetAddress address, int port)
59         throws IOException;
60 
socketListen(int count)61     native void socketListen(int count) throws IOException;
62 
socketAccept(SocketImpl s)63     native void socketAccept(SocketImpl s) throws IOException;
64 
socketAvailable()65     native int socketAvailable() throws IOException;
66 
socketClose0()67     native void socketClose0() throws IOException;
68 
socketShutdown(int howto)69     native void socketShutdown(int howto) throws IOException;
70 
socketSetOption(int cmd, boolean on, Object value)71     native void socketSetOption(int cmd, boolean on, Object value)
72         throws SocketException;
73 
socketGetOption(int opt, Object iaContainerObj)74     native int socketGetOption(int opt, Object iaContainerObj) throws SocketException;
75 
socketSendUrgentData(int data)76     native void socketSendUrgentData(int data) throws IOException;
77 
78 }
79