Package DataCollector :: Module TelnetClient :: Class TelnetClientProtocol
[show private | hide private]
[frames | no frames]

Class TelnetClientProtocol

BaseProtocol --+        
               |        
        Protocol --+    
                   |    
              Telnet --+
                       |
                      TelnetClientProtocol


Method Summary
  applicationDataReceived(self, bytes)
Called with application-level data.
  cancelTimeout(self)
  connectionMade(self)
Called when a connection is made.
  curCommand(self)
  dataReceived(self, data)
Called whenever data is received.
  defaultTimeout(self)
  iac_DO(self, feature)
  iac_DONT(self, feature)
  iac_WILL(self, feature)
  iac_WONT(self, feature)
  loginTimeout(self, loginTries)
  processChunk(self, chunk)
  processLine(self, line)
I call a method that looks like 'telnet_*' where '*' is filled in by the current mode.
  startTimeout(self, timeout, timeoutfunc)
  telnet_ClearPromptData(self, data)
  telnet_Command(self, data)
process the data from a sent command if there are no more commands move to final state
  telnet_Enable(self, data)
change to enable mode on cisco
  telnet_FindPrompt(self, data)
Called after login to figure out the command prompt
  telnet_Login(self, data)
Called when login prompt is received
  telnet_Password(self, data)
Called when the password prompt is received
  telnet_SendCommand(self, data)
Get a command of the command stack and send it
  write(self, data)
save the last bit of data that we wrote
Inherited from Telnet: __init__, commandReceived, connectionLost, disableLocal, disableRemote, do, do_no_false, do_no_true, do_yes_false, do_yes_true, dont, dont_no_false, dont_no_true, dont_yes_false, dont_yes_true, enableLocal, enableRemote, getOptionState, negotiate, requestNegotiation, telnet_DO, telnet_DONT, telnet_WILL, telnet_WONT, unhandledCommand, unhandledSubnegotiation, will, will_no_false, will_no_true, will_yes_false, will_yes_true, wont, wont_no_false, wont_no_true, wont_yes_false, wont_yes_true

Instance Variable Summary
Inherited from Telnet: commandMap, negotiationMap, options, state, transport

Class Variable Summary
str buffer = ''
str bytes = ''
str command = ''
str commandPrompt = ''
int enabled = -1                                                                    
str lastwrite = ''
str mode = 'Login'
str p1 = ''
str p2 = ''
str result = ''
NoneType scCallLater = None                                                                  
int timeout = 0                                                                     
NoneType timeoutID = None                                                                  
Inherited from Telnet: doMap, dontMap, willMap, wontMap
Inherited from Protocol: __implemented__, __provides__

Method Details

applicationDataReceived(self, bytes)

Called with application-level data.
Overrides:
twisted.conch.telnet.Telnet.applicationDataReceived (inherited documentation)

connectionMade(self)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
Overrides:
twisted.internet.protocol.BaseProtocol.connectionMade (inherited documentation)

dataReceived(self, data)

Called whenever data is received.

Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.
Parameters:
data - a string of indeterminate length. Please keep in mind that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.
Overrides:
twisted.conch.telnet.Telnet.dataReceived (inherited documentation)

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(self, data)

process the data from a sent command if there are no more commands move to final state

telnet_Enable(self, data)

change to enable mode on cisco

telnet_FindPrompt(self, data)

Called after login to figure out the command prompt

telnet_Login(self, data)

Called when login prompt is received

telnet_Password(self, data)

Called when the password prompt is received

telnet_SendCommand(self, data)

Get a command of the command stack and send it

write(self, data)

save the last bit of data that we wrote

Class Variable Details

buffer

Type:
str
Value:
''                                                                     

bytes

Type:
str
Value:
''                                                                     

command

Type:
str
Value:
''                                                                     

commandPrompt

Type:
str
Value:
''                                                                     

enabled

Type:
int
Value:
-1                                                                    

lastwrite

Type:
str
Value:
''                                                                     

mode

Type:
str
Value:
'Login'                                                                

p1

Type:
str
Value:
''                                                                     

p2

Type:
str
Value:
''                                                                     

result

Type:
str
Value:
''                                                                     

scCallLater

Type:
NoneType
Value:
None                                                                  

timeout

Type:
int
Value:
0                                                                     

timeoutID

Type:
NoneType
Value:
None                                                                  

Generated by Epydoc 2.1 on Thu Aug 16 09:55:12 2007 http://epydoc.sf.net