01: package com.coldcore.coloradoftp.connection;
02:
03: import java.io.IOException;
04:
05: /**
06: * Accepts incoming control connections.
07: *
08: * When connection is accepted on a predefined port, this class configures it,
09: * writes a welcome/reject message into it and adds it to a connection pool which will
10: * serve it till the connection dies.
11: *
12: * Server should not just drop a connection leaving user with no response message. If a
13: * connection must be dropped, it should be poisoned instead, this way the connection
14: * writes out the message to its user and then dies.
15: *
16: * This class must be aware of core's POISONED status. When core is poisoned it is the
17: * responsibility of a connector to not to allow any more incoming connections, so server
18: * can shut down normally.
19: *
20: *
21: * ColoradoFTP - The Open Source FTP Server (http://cftp.coldcore.com)
22: */
23: public interface ControlConnector {
24:
25: /** Bing to the port and start listening for incoming connections */
26: public void bind() throws IOException;
27:
28: /** Unbind from the port and stop listening for incoming connections */
29: public void unbind() throws IOException;
30:
31: /** Test if connector is bound to the port.
32: * @return TRUE if it is bound, FALSE otherwise
33: */
34: public boolean isBound();
35:
36: /** Set binding port
37: * @param port Port number
38: */
39: public void setPort(int port);
40:
41: /** Get binding port
42: * @return Port number
43: */
44: public int getPort();
45: }
|