FileDocCategorySizeDatePackage
TerminalTypeOptionHandler.javaAPI DocApache Commons NET 1.4.1 API4141Sat Dec 03 10:05:48 GMT 2005org.apache.commons.net.telnet

TerminalTypeOptionHandler

public class TerminalTypeOptionHandler extends TelnetOptionHandler
Implements the telnet terminal type option RFC 1091.

author
Bruno D'Avanzo

Fields Summary
private String
termType
Terminal type
protected static final int
TERMINAL_TYPE
Terminal type option
protected static final int
TERMINAL_TYPE_SEND
Send (for subnegotiation)
protected static final int
TERMINAL_TYPE_IS
Is (for subnegotiation)
Constructors Summary
public TerminalTypeOptionHandler(String termtype, boolean initlocal, boolean initremote, boolean acceptlocal, boolean acceptremote)
Constructor for the TerminalTypeOptionHandler. Allows defining desired initial setting for local/remote activation of this option and behaviour in case a local/remote activation request for this option is received.

param
termtype - terminal type that will be negotiated.
param
initlocal - if set to true, a WILL is sent upon connection.
param
initremote - if set to true, a DO is sent upon connection.
param
acceptlocal - if set to true, any DO request is accepted.
param
acceptremote - if set to true, any WILL request is accepted.


                                                                                                 
      
                                 
                                 
                                 
                                 
    
        super(TelnetOption.TERMINAL_TYPE, initlocal, initremote,
                                      acceptlocal, acceptremote);
        termType = termtype;
    
public TerminalTypeOptionHandler(String termtype)
Constructor for the TerminalTypeOptionHandler. Initial and accept behaviour flags are set to false

param
termtype - terminal type that will be negotiated.

        super(TelnetOption.TERMINAL_TYPE, false, false, false, false);
        termType = termtype;
    
Methods Summary
public int[]answerSubnegotiation(int[] suboptionData, int suboptionLength)
Implements the abstract method of TelnetOptionHandler.

param
suboptionData - the sequence received, whithout IAC SB & IAC SE
param
suboptionLength - the length of data in suboption_data

return
terminal type information

        if ((suboptionData != null) && (suboptionLength > 1)
            && (termType != null))
        {
            if ((suboptionData[0] == TERMINAL_TYPE)
                && (suboptionData[1] == TERMINAL_TYPE_SEND))
            {
                int response[] = new int[termType.length() + 2];

                response[0] = TERMINAL_TYPE;
                response[1] = TERMINAL_TYPE_IS;

                for (int ii = 0; ii < termType.length(); ii++)
                {
                    response[ii + 2] = (int) termType.charAt(ii);
                }

                return response;
            }
        }
        return null;
    
public int[]startSubnegotiationLocal()
Implements the abstract method of TelnetOptionHandler.

return
always null (no response to subnegotiation)

        return null;
    
public int[]startSubnegotiationRemote()
Implements the abstract method of TelnetOptionHandler.

return
always null (no response to subnegotiation)

        return null;