01: /*
02: * Copyright (c) xsocket.org, 2006 - 2008. All rights reserved.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt
19: * The latest copy of this software may be found on http://www.xsocket.org/
20: */
21: package org.xsocket.connection.spi;
22:
23: import java.io.Closeable;
24: import java.io.IOException;
25: import java.net.InetAddress;
26: import java.util.Map;
27:
28: import org.xsocket.connection.IServer;
29:
30: /**
31: * Acceptor specification <br><br>
32: *
33: *
34: * @author grro@xsocket.org
35: */
36: public interface IAcceptor extends Closeable {
37:
38: public static final String ACCEPTOR_CLASSNAME_KEY = "org.xsocket.stream.spi.AcceptorClassname";
39:
40: public static final String SO_RCVBUF = IServer.SO_RCVBUF;
41: public static final String SO_REUSEADDR = IServer.SO_REUSEADDR;
42:
43: /**
44: * returns the value of the option
45: *
46: * @param name the name of the option
47: * @return the value of the option
48: * @throws IOException In an I/O error occurs
49: */
50: public Object getOption(String name) throws IOException;
51:
52: /**
53: * Returns an unmodifiable map of the options supported by this end point.
54: *
55: * The key in the returned map is the name of a option, and its value
56: * is the type of the option value. The returned map will never contain null keys or values.
57: *
58: * @return An unmodifiable map of the options supported by this channel
59: */
60: @SuppressWarnings("unchecked")
61: public Map<String, Class> getOptions();
62:
63: /**
64: * executes the acceptor by listening incoming connections. This method blocks
65: *
66: * @throws IOException If some other I/O error occurs
67: */
68: public void listen() throws IOException;
69:
70: /**
71: * return the number of open connections
72: *
73: */
74: public int getNumberOfOpenConnections();
75:
76: /**
77: * returns the local port
78: *
79: * @return the local port
80: */
81: public int getLocalPort();
82:
83: /**<
84: * returns the local address
85: *
86: * @return the local address
87: */
88: public InetAddress getLocalAddress();
89: }
|