Table of Contents

Class: Telnet Twisted-0.17.4/twisted/protocols/telnet.py

I am a Protocol for handling Telnet connections. I have two sets of special methods, telnet_ and iac_.

telnet_ methods get called on every line sent to me. The method to call is decided by the current mode. The initial mode is 'User'; this means that telnet_User is the first telnet_ method to be called. All telnet_ methods should return a string which specifies the mode to go into next; thus dictating which telnet_ method to call next. For example, the default telnet_User method returns Password to go into Password mode, and the default telnet_Password method returns Command to go into Command mode.

The iac_* methods are less-used; they are called when an IAC telnet byte is received. You can define iac_DO, iac_DONT, iac_WILL, iac_WONT, and iac_IP methods to do what you want when one of these bytes is received.

Base Classes   
protocol.Protocol
Methods   
connectionMade
dataReceived
iacSBchunk
iac_DO
iac_DONT
iac_IP
iac_WILL
iac_WONT
loggedIn
loginPrompt
processChunk
processLine
telnet_Command
telnet_Password
telnet_User
welcomeMessage
  connectionMade 
connectionMade ( self )

I will write a welcomeMessage and loginPrompt to the client.

  dataReceived 
dataReceived ( self,  data )

  iacSBchunk 
iacSBchunk ( self,  chunk )

  iac_DO 
iac_DO ( self,  feature )

  iac_DONT 
iac_DONT ( self,  feature )

  iac_IP 
iac_IP ( self,  feature )

  iac_WILL 
iac_WILL ( self,  feature )

  iac_WONT 
iac_WONT ( self,  feature )

  loggedIn 
loggedIn ( self )

Called after the user succesfully logged in.

Override in subclasses.

  loginPrompt 
loginPrompt ( self )

Override me to return a 'login:'-type prompt.

  processChunk 
processChunk ( self,  chunk )

I take a chunk of data and delegate out to telnet_* methods by way of processLine. If the current mode is Done, I'll close the connection.

  processLine 
processLine ( self,  line )

I call a method that looks like 'telnet_ where ' is filled in by the current mode. telnet_* methods should return a string which will become the new mode.

  telnet_Command 
telnet_Command ( self,  cmd )

The default command processing mode. You probably want to override me.

  telnet_Password 
telnet_Password ( self,  paswd )

I accept a password as an argument, and check it with the checkUserAndPass method. If the login is successful, I call loggedIn().

  telnet_User 
telnet_User ( self,  user )

I take a username, set it to the self.username attribute, print out a password prompt, and switch to Password mode. If you want to do something else when the username is received (ie, create a new user if the user doesn't exist), override me.

  welcomeMessage 
welcomeMessage ( self )

Override me to return a string which will be sent to the client before login.


Table of Contents

This document was automatically generated on Sat Apr 20 01:31:04 2002 by HappyDoc version 2.0