Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / java / net / SocketOptions.java
blob659bf750c3b9b2fcd5fb53e6922f3fc014c5382d
1 /* SocketOptions.java -- Implements options for sockets (duh!)
2 Copyright (C) 1998, 1999, 2000, 2001,
3 2002, 2003 Free Software Foundation, Inc.
5 This file is part of GNU Classpath.
7 GNU Classpath is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU Classpath is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Classpath; see the file COPYING. If not, write to the
19 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301 USA.
22 Linking this library statically or dynamically with other modules is
23 making a combined work based on this library. Thus, the terms and
24 conditions of the GNU General Public License cover the whole
25 combination.
27 As a special exception, the copyright holders of this library give you
28 permission to link this library with independent modules to produce an
29 executable, regardless of the license terms of these independent
30 modules, and to copy and distribute the resulting executable under
31 terms of your choice, provided that you also meet, for each linked
32 independent module, the terms and conditions of the license of that
33 module. An independent module is a module which is not derived from
34 or based on this library. If you modify this library, you may extend
35 this exception to your version of the library, but you are not
36 obligated to do so. If you do not wish to do so, delete this
37 exception statement from your version. */
39 package java.net;
42 /**
43 * Written using on-line Java Platform 1.2 API Specification.
44 * Status: Believed complete and correct.
46 /**
47 * This interface is used by <code>SocketImpl</code> and
48 * <code>DatagramSocketImpl</code> to implement options
49 * on sockets.
51 * @since 1.2
53 * @author Aaron M. Renn (arenn@urbanophile.com)
54 * @author Warren Levy (warrenl@cygnus.com)
55 * @status should be completely JDK 1.4 compatible
57 public interface SocketOptions
59 /**
60 * Option id for the SO_KEEPALIVE value
61 * @since 1.3
63 int SO_KEEPALIVE = 0x8;
65 /**
66 * Option id for the SO_LINGER value
68 int SO_LINGER = 0x80; // 128
70 /**
71 * Option id for the SO_TIMEOUT value
73 int SO_TIMEOUT = 0x1006; // 4102
75 /**
76 * Retrieve the local address to which the socket is bound.
78 int SO_BINDADDR = 0x0F; // 15
80 /**
81 * Option id for the send buffer size
82 * @since 1.2
84 int SO_SNDBUF = 0x1001; // 4097
86 /**
87 * Option id for the receive buffer size
88 * @since 1.2
90 int SO_RCVBUF = 0x1002; // 4098
92 /**
93 * Sets the SO_REUSEADDR parameter on a socket
95 int SO_REUSEADDR = 0x04; // 4
97 /**
98 * Sets SO_BROADCAST for a socket
99 * @since 1.4
101 int SO_BROADCAST = 0x20; // 32
104 * Sets SO_OOBINLINE for a socket
105 * @since 1.4
107 int SO_OOBINLINE = 0x1003; // 4099
110 * Option id for the TCP_NODELAY value
112 int TCP_NODELAY = 0x01; // 1
115 * Options id for the IP_MULTICAST_IF value
117 int IP_MULTICAST_IF = 0x10; // 16
120 * same as above
121 * @since 1.4
123 int IP_MULTICAST_IF2 = 0x1F; // 31
126 * This option enables or disables local loopback of multicast datagrams.
127 * @since 1.4
129 int IP_MULTICAST_LOOP = 0x12; // 18
132 * This option sets the type-of-service or traffic class field in the
133 * IP header for a TCP or UDP socket.
134 * @since 1.4
136 int IP_TOS = 0x03; // 3
139 * Sets the specified option on a socket to the passed in object. For
140 * options that take an integer argument, the passed in object is an
141 * <code>Integer</code>. For options that are set to on or off, the
142 * value passed will be a <code>Boolean</code>. The <code>optionId</code>
143 * parameter is one of the defined constants in this interface.
145 * @param optionId The identifier of the option
146 * @param val The value to set the option to
148 * @exception SocketException If an error occurs
150 void setOption(int optionId, Object val) throws SocketException;
153 * Returns the current setting of the specified option. The
154 * <code>Object</code> returned will be an <code>Integer</code> for options
155 * that have integer values. For options that are set to on or off, a
156 * <code>Boolean</code> will be returned. The <code>optionId</code>
157 * parameter is one of the defined constants in this interface.
159 * @param optionId The option identifier
161 * @return The current value of the option
163 * @exception SocketException If an error occurs
165 Object getOption(int optionId) throws SocketException;
166 } // interface SocketOptions