01: package com.coldcore.coloradoftp.connection;
02:
03: import com.coldcore.coloradoftp.command.Reply;
04: import com.coldcore.coloradoftp.session.Session;
05:
06: /**
07: * Control connection.
08: *
09: * When user connects to a server a control connection is created and assigned to him/her.
10: * One user may have only one control connection which lives until user disconnects.
11: * Control connection accepts user commands, executes them and sends replies.
12: *
13: * Control connection acts as a main point for all users' operations, every user is
14: * identified by a control connection. As a result, control connection has references
15: * to all user-related objects and vice versa.
16: *
17: * Note that a user may also have a single data connection. Which can be created and destroyed
18: * as many times as required while the control connection lives on.
19: * Control connection has a reference to a data connection initiator which is activated
20: * when there is a need to establish a new data connection.
21: *
22: * Control connection may be poisoned at any time. When poisoned, a connection will commit
23: * suicide as soon as all the data is written out to the user and the data connection finishes.
24: * This feature is required to drop connections when server is full: when message is written
25: * out to a user the connection will be dropped right away. Or when a user sends QUIT command,
26: * the control connection will wait until the data connection dies and then it will kill itself.
27: * So poisoned status must be set when user submits QUIT command.
28: *
29: * Some FTP commands put control connection into the INTERRUPT state which is then
30: * cleared when the connection sends a reply. Such reply must refer to a command which
31: * is allowed to clear the state or does not have a reference to a command.
32: * Usually INTERRUPT state is trigerred by data transfer commands and cleared right
33: * after data transfer ends.
34: *
35: *
36: * ColoradoFTP - The Open Source FTP Server (http://cftp.coldcore.com)
37: */
38: public interface ControlConnection extends Connection {
39:
40: /** Reply to user
41: * @param reply Reply
42: */
43: public void reply(Reply reply);
44:
45: /** Get user session
46: * @return Session
47: */
48: public Session getSession();
49:
50: /** Get data connection of this control connection
51: * @return Data connection or NULL if does not have one
52: */
53: public DataConnection getDataConnection();
54:
55: /** Set data connection of this control connection
56: * @param dataConnection Data connection
57: */
58: public void setDataConnection(DataConnection dataConnection);
59:
60: /** Get data connection initiator
61: * @return Initiator
62: */
63: public DataConnectionInitiator getDataConnectionInitiator();
64:
65: /** Get text length that awaits in the outgoing to user buffer
66: * @return Test length
67: */
68: public int getOutgoingBufferSize();
69:
70: /** Get text length that awaits in the incoming from user buffer
71: * @return Test length
72: */
73: public int getIncomingBufferSize();
74: }
|