| java.lang.Object kawa.Telnet
Telnet | public class Telnet implements Runnable(Code) | | Encapsulates the state of a telnet connection.
When run as an application, is a a minimal telnet client.
|
Field Summary | |
final public static int | DO Indicates the request that the other party perform, or
confirmation that you are expecting the other party to perform, the
indicated option. | final public static int | DONT | final public static int | ECHO | final static int | EOF | final static int | IAC The "Interpret As Command" prefix code. | final static int | IP | final static int | LINEMODE | final static int | NAWS | final static int | NOP | final static int | OPTION_NO The option is disabled, and no negotiating is in progress. | final static int | OPTION_WANTNO We sent out DONT/WONT and are waiting for confirming WONT/DONT. | final static int | OPTION_WANTNO_OPPOSITE Like WANTNO, but we changed our mind. | final static int | OPTION_WANTYES We sent out DO/WILL and are waiting for confirming WILL/DO. | final static int | OPTION_WANTYES_OPPOSITE Like WANTYES, but we changed our mind. | final static int | OPTION_YES The option is enabled, and no negotiating is in progress. | final static int | SB Indicates that what follows is subnegotiation of the indicated option. | final static int | SE | final public static int | SUPPRESS_GO_AHEAD | final static int | TM | final static int | TTYPE | final public static int | WILL Indicates the desire to begin performing, or confirmation that
you are now performing, the indicated option. | final public static int | WONT Indicates the refusal to perform,or continue performing, the
indicated option. | TelnetInputStream | in | boolean | isServer | final byte[] | optionsState Used to store the the current state of negotiation of telnet options.
For example, for option LINEMODE (34), (telnet_options_state[34] & 7)
is the state of the option on this side, and
((telnet_options_state[34] >> 3) & 7) is the state on the other side.
The 3 bits for each side can be any of OPTION_NO though OPTION_YES.
The option is only enabled if the value is OPTION_YES.
See RFC 1143. | TelnetOutputStream | out | final byte | preferredLineMode | java.io.InputStream | sin | java.io.OutputStream | sout | public byte[] | terminalType | public short | windowHeightwindowWidth |
Method Summary | |
boolean | change(int command, int option) Actually (try to) change the state for an option.
Return false is we don't know how or don't want to.
command is DO if we're enabling on this side;
DONT if we're disabling on this side;
WILL if we're enabling for the other side;
WONT if we're disabling for the other side.
You should not call this function directly.
Instead, call request to send a request to the other side
(but with DO/WILL and DONT/WONT switched). | public TelnetInputStream | getInputStream() | public TelnetOutputStream | getOutputStream() | void | handle(int command, int option) Handle a request from the other side.
Command is one of DO, DONT, WILL, WONT. | public static void | main(String[] args) | public void | request(int command, int option) Request (from this side) a new option state.
Command is one of DO, DONT, WILL, WONT. | public void | run() | public void | subCommand(byte[] buf, int off, int len) Handle a sub-command (SB-sequence) that we received. | static void | usage() |
DO | final public static int DO(Code) | | Indicates the request that the other party perform, or
confirmation that you are expecting the other party to perform, the
indicated option.
|
DONT | final public static int DONT(Code) | | |
ECHO | final public static int ECHO(Code) | | |
IAC | final static int IAC(Code) | | The "Interpret As Command" prefix code.
|
LINEMODE | final static int LINEMODE(Code) | | |
NAWS | final static int NAWS(Code) | | |
OPTION_NO | final static int OPTION_NO(Code) | | The option is disabled, and no negotiating is in progress.
|
OPTION_WANTNO | final static int OPTION_WANTNO(Code) | | We sent out DONT/WONT and are waiting for confirming WONT/DONT.
|
OPTION_WANTNO_OPPOSITE | final static int OPTION_WANTNO_OPPOSITE(Code) | | Like WANTNO, but we changed our mind.
|
OPTION_WANTYES | final static int OPTION_WANTYES(Code) | | We sent out DO/WILL and are waiting for confirming WILL/DO.
|
OPTION_WANTYES_OPPOSITE | final static int OPTION_WANTYES_OPPOSITE(Code) | | Like WANTYES, but we changed our mind.
|
OPTION_YES | final static int OPTION_YES(Code) | | The option is enabled, and no negotiating is in progress.
|
SB | final static int SB(Code) | | Indicates that what follows is subnegotiation of the indicated option.
|
SUPPRESS_GO_AHEAD | final public static int SUPPRESS_GO_AHEAD(Code) | | |
TTYPE | final static int TTYPE(Code) | | |
WILL | final public static int WILL(Code) | | Indicates the desire to begin performing, or confirmation that
you are now performing, the indicated option.
|
WONT | final public static int WONT(Code) | | Indicates the refusal to perform,or continue performing, the
indicated option.
|
isServer | boolean isServer(Code) | | |
optionsState | final byte[] optionsState(Code) | | Used to store the the current state of negotiation of telnet options.
For example, for option LINEMODE (34), (telnet_options_state[34] & 7)
is the state of the option on this side, and
((telnet_options_state[34] >> 3) & 7) is the state on the other side.
The 3 bits for each side can be any of OPTION_NO though OPTION_YES.
The option is only enabled if the value is OPTION_YES.
See RFC 1143.
|
preferredLineMode | final byte preferredLineMode(Code) | | |
terminalType | public byte[] terminalType(Code) | | |
windowHeightwindowWidth | public short windowHeightwindowWidth(Code) | | |
change | boolean change(int command, int option)(Code) | | Actually (try to) change the state for an option.
Return false is we don't know how or don't want to.
command is DO if we're enabling on this side;
DONT if we're disabling on this side;
WILL if we're enabling for the other side;
WONT if we're disabling for the other side.
You should not call this function directly.
Instead, call request to send a request to the other side
(but with DO/WILL and DONT/WONT switched). Then, when
confirmation comes back, it is handled by the handle method, which
calls change.
The optionsState array may not have been updated yet.
|
handle | void handle(int command, int option) throws java.io.IOException(Code) | | Handle a request from the other side.
Command is one of DO, DONT, WILL, WONT.
|
request | public void request(int command, int option) throws java.io.IOException(Code) | | Request (from this side) a new option state.
Command is one of DO, DONT, WILL, WONT.
|
subCommand | public void subCommand(byte[] buf, int off, int len)(Code) | | Handle a sub-command (SB-sequence) that we received.
|
usage | static void usage()(Code) | | |
|
|