com.mindbright.net.telnet
Class TelnetNVT
java.lang.Object
com.mindbright.net.telnet.TelnetNVT
- All Implemented Interfaces:
- java.lang.Runnable
public class TelnetNVT
- extends java.lang.Object
- implements java.lang.Runnable
Implements the client side of the telnet protocol (rfc854). This
class handles most of the protocol basics. It is meant to be used
together with an TelnetEventHandler
which gets the
actual data received from the other end.
Most of the contants and methods in this class should be fairly
obvious to people having deep enough knowledge of rfc854.
- See Also:
TelnetEventHandler
Constructor Summary |
TelnetNVT(TelnetEventHandler eventHandler,
java.io.InputStream in,
java.io.OutputStream out)
Create a new instance of the telnet protocol. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CODE_LF
public static final int CODE_LF
- See Also:
- Constant Field Values
CODE_CR
public static final int CODE_CR
- See Also:
- Constant Field Values
CODE_EOR
public static final int CODE_EOR
- See Also:
- Constant Field Values
CODE_SE
public static final int CODE_SE
- See Also:
- Constant Field Values
CODE_NOP
public static final int CODE_NOP
- See Also:
- Constant Field Values
CODE_DM
public static final int CODE_DM
- See Also:
- Constant Field Values
CODE_BREAK
public static final int CODE_BREAK
- See Also:
- Constant Field Values
CODE_IP
public static final int CODE_IP
- See Also:
- Constant Field Values
CODE_ABORT
public static final int CODE_ABORT
- See Also:
- Constant Field Values
CODE_AYT
public static final int CODE_AYT
- See Also:
- Constant Field Values
CODE_EC
public static final int CODE_EC
- See Also:
- Constant Field Values
CODE_EL
public static final int CODE_EL
- See Also:
- Constant Field Values
CODE_GA
public static final int CODE_GA
- See Also:
- Constant Field Values
CODE_SB
public static final int CODE_SB
- See Also:
- Constant Field Values
CODE_WILL
public static final int CODE_WILL
- See Also:
- Constant Field Values
CODE_WONT
public static final int CODE_WONT
- See Also:
- Constant Field Values
CODE_DO
public static final int CODE_DO
- See Also:
- Constant Field Values
CODE_DONT
public static final int CODE_DONT
- See Also:
- Constant Field Values
CODE_IAC
public static final int CODE_IAC
- See Also:
- Constant Field Values
OPT_BINARY
public static final int OPT_BINARY
- See Also:
- Constant Field Values
OPT_ECHO
public static final int OPT_ECHO
- See Also:
- Constant Field Values
OPT_SGA
public static final int OPT_SGA
- See Also:
- Constant Field Values
OPT_STATUS
public static final int OPT_STATUS
- See Also:
- Constant Field Values
OPT_TTYPE
public static final int OPT_TTYPE
- See Also:
- Constant Field Values
OPT_EOR
public static final int OPT_EOR
- See Also:
- Constant Field Values
OPT_NAWS
public static final int OPT_NAWS
- See Also:
- Constant Field Values
OPT_SPEED
public static final int OPT_SPEED
- See Also:
- Constant Field Values
OPT_REMFCTL
public static final int OPT_REMFCTL
- See Also:
- Constant Field Values
OPT_XDISP
public static final int OPT_XDISP
- See Also:
- Constant Field Values
OPT_NEWENV
public static final int OPT_NEWENV
- See Also:
- Constant Field Values
SB_CMD_IS
public static final int SB_CMD_IS
- See Also:
- Constant Field Values
SB_CMD_SEND
public static final int SB_CMD_SEND
- See Also:
- Constant Field Values
SB_CMD_REPLY
public static final int SB_CMD_REPLY
- See Also:
- Constant Field Values
SB_CMD_NAME
public static final int SB_CMD_NAME
- See Also:
- Constant Field Values
TelnetNVT
public TelnetNVT(TelnetEventHandler eventHandler,
java.io.InputStream in,
java.io.OutputStream out)
- Create a new instance of the telnet protocol. This will use the
given streams to comminucate with the telnet server and pass
received data to the given event handler.
- Parameters:
eventHandler
- event handler which will get the data
receivedin
- stream from which data from the telnet server is readout
- stream over which to send data to the telnet server
start
public void start()
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
getThread
public java.lang.Thread getThread()
sendData
public void sendData(byte[] data)
throws java.io.IOException
- Throws:
java.io.IOException
sendData
public void sendData(byte[] data,
int off,
int sz)
throws java.io.IOException
- Throws:
java.io.IOException
sendData
public void sendData(int b)
throws java.io.IOException
- Throws:
java.io.IOException
sendBreak
public void sendBreak()
throws java.io.IOException
- Throws:
java.io.IOException
doOption
public void doOption(int option)
throws java.io.IOException
- Throws:
java.io.IOException
dontOption
public void dontOption(int option)
throws java.io.IOException
- Throws:
java.io.IOException
willOption
public void willOption(int option)
throws java.io.IOException
- Throws:
java.io.IOException
wontOption
public void wontOption(int option)
throws java.io.IOException
- Throws:
java.io.IOException
sendOptionSubNegotiation
public void sendOptionSubNegotiation(int option,
byte[] params)
throws java.io.IOException
- Throws:
java.io.IOException
optionNegotiation
protected void optionNegotiation(int option,
int request)
throws java.io.IOException
- Throws:
java.io.IOException
interpretAsCommand
protected int interpretAsCommand(int cmd)