source: trunk/gcc/libjava/java/net/SocketOptions.java

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.0 KB
Line 
1/* SocketOptions.java -- Implements options for sockets (duh!)
2 Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38package java.net;
39
40/**
41 * Written using on-line Java Platform 1.2 API Specification.
42 * Status: Believed complete and correct.
43 */
44
45/**
46 * This interface is used by <code>SocketImpl</code> and
47 * <code>DatagramSocketImpl</code> to implement options
48 * on sockets.
49 *
50 * @since 1.2
51 *
52 * @author Aaron M. Renn (arenn@urbanophile.com)
53 * @author Warren Levy <warrenl@cygnus.com>
54 * @status should be completely JDK 1.4 compatible
55 */
56public interface SocketOptions
57{
58 /**
59 * Option id for the SO_KEEPALIVE value
60 * @since 1.3
61 */
62 static final int SO_KEEPALIVE = 0x8;
63
64 /**
65 * Option id for the SO_LINGER value
66 */
67 static final int SO_LINGER = 0x80; // 128
68
69 /**
70 * Option id for the SO_TIMEOUT value
71 */
72 static final int SO_TIMEOUT = 0x1006; // 4102
73
74 /**
75 * Retrieve the local address to which the socket is bound.
76 */
77 static final int SO_BINDADDR = 0x0F; // 15
78
79 /**
80 * Option id for the send buffer size
81 * @since 1.2
82 */
83 static final int SO_SNDBUF = 0x1001; // 4097
84
85 /**
86 * Option id for the receive buffer size
87 * @since 1.2
88 */
89 static final int SO_RCVBUF = 0x1002; // 4098
90
91 /**
92 * Sets the SO_REUSEADDR parameter on a socket
93 */
94 static final int SO_REUSEADDR = 0x04; // 4
95
96 /**
97 * Sets SO_BROADCAST for a socket
98 * @since 1.4
99 */
100 static final int SO_BROADCAST = 0x20; // 32
101
102 /**
103 * Sets SO_OOBINLINE for a socket
104 * @since 1.4
105 */
106 static final int SO_OOBINLINE = 0x1003; // 4099
107
108 /**
109 * Option id for the TCP_NODELAY value
110 */
111 static final int TCP_NODELAY = 0x01; // 1
112
113 /**
114 * Options id for the IP_MULTICAST_IF value
115 */
116 static final int IP_MULTICAST_IF = 0x10; // 16
117
118 /**
119 * same as above
120 * @since 1.4
121 */
122 static final int IP_MULTICAST_IF2 = 0x1F; // 31
123
124 /**
125 * This option enables or disables local loopback of multicast datagrams.
126 * @since 1.4
127 */
128 static final int IP_MULTICAST_LOOP = 0x12; // 18
129
130 /**
131 * This option sets the type-of-service or traffic class field in the
132 * IP header for a TCP or UDP socket.
133 * @since 1.4
134 */
135 static final int IP_TOS = 0x03; // 3
136
137 /**
138 * Sets the specified option on a socket to the passed in object. For
139 * options that take an integer argument, the passed in object is an
140 * <code>Integer</code>. For options that are set to on or off, the
141 * value passed will be a <code>Boolean</code>. The <code>option_id</code>
142 * parameter is one of the defined constants in this interface.
143 *
144 * @param option_id The identifier of the option
145 * @param val The value to set the option to
146 *
147 * @exception SocketException If an error occurs
148 */
149 void setOption(int option_id, Object val) throws SocketException;
150
151 /**
152 * Returns the current setting of the specified option. The
153 * <code>Object</code> returned will be an <code>Integer</code> for options
154 * that have integer values. For options that are set to on or off, a
155 * <code>Boolean</code> will be returned. The <code>option_id</code>
156 * is one of the defined constants in this interface.
157 *
158 * @param option_id The option identifier
159 *
160 * @return The current value of the option
161 *
162 * @exception SocketException If an error occurs
163 */
164 Object getOption(int option_id) throws SocketException;
165
166} // interface SocketOptions
167
Note: See TracBrowser for help on using the repository browser.