Class TelnetThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--TelnetThread

public class TelnetThread
extends java.lang.Thread

This class handles network elements by acting as a Telnet client to the network element using RFC 854. One object is instantiated for each client session and monitored in the thread. The constructor autostarts the thread.

Version:
1.0
Author:
Paul Regenhardt

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TelnetThread(TelnetDeamon o, java.net.Socket s)
          Instantiates the object, assigns the user, establishes the connection, and starts the thread.
 
Method Summary
 void areYouThere()
          Telnet connectivity test
 void authenticate(boolean flag)
          sets the authentication flag.
 void cleanup()
          Final process cleanup
 java.lang.String getString()
          Gets a string of input from the telnet client terminated by the termination character
 void interupt()
          Telnet Interuption service
 boolean isAuthenticated()
          responds true if the user has been authenticated
 void run()
          This is the main thread loop to process data
 void sendCR()
          Shortcut method to send a carriage return to the telnet client
 void sendCRLF()
          Shortcut method to send a carriage-control and linefeed to the telnet client
 void sendLF()
          Shortcut methode to send a line feed to the telnet client
 void setPrompt(java.lang.String p)
          set's the prompt that the telnet client will see when waiting for input
 void setTimeout(int min)
          Sets the timeout (in minutes) for the telnet client.
 void setupLink()
          Some telnet clients expect this to be asked, not demanded by the RFC.
 void transmit(java.lang.String s)
          This method transmits one line at a time to the output destination.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TelnetThread

public TelnetThread(TelnetDeamon o,
                    java.net.Socket s)
Instantiates the object, assigns the user, establishes the connection, and starts the thread.
Parameters:
o - The user object
s - The socket
Method Detail

sendCRLF

public void sendCRLF()
Shortcut method to send a carriage-control and linefeed to the telnet client

sendCR

public void sendCR()
Shortcut method to send a carriage return to the telnet client

sendLF

public void sendLF()
Shortcut methode to send a line feed to the telnet client

setTimeout

public void setTimeout(int min)
Sets the timeout (in minutes) for the telnet client. If the client has not entered any new data within the timeout period then the connection is closed.
Parameters:
min -  

areYouThere

public void areYouThere()
Telnet connectivity test

authenticate

public void authenticate(boolean flag)
sets the authentication flag.
Parameters:
flag -  

isAuthenticated

public boolean isAuthenticated()
responds true if the user has been authenticated

interupt

public void interupt()
Telnet Interuption service

transmit

public void transmit(java.lang.String s)
This method transmits one line at a time to the output destination. It appends a CR/LF and waits for the data to be transmitted via a sleep before allowing the next line.
Parameters:
s - The string to output

cleanup

public void cleanup()
Final process cleanup

setPrompt

public void setPrompt(java.lang.String p)
set's the prompt that the telnet client will see when waiting for input
Parameters:
p -  

getString

public java.lang.String getString()
Gets a string of input from the telnet client terminated by the termination character

setupLink

public void setupLink()
Some telnet clients expect this to be asked, not demanded by the RFC.

run

public void run()
This is the main thread loop to process data
Overrides:
run in class java.lang.Thread