Package beepy :: Package transports :: Module tcp :: Class BeepProtocol
[show private | hide private]
[frames | no frames]

Class BeepProtocol

BaseProtocol --+        
               |        
        Protocol --+    
                   |    
        LineReceiver --+
                       |
                      BeepProtocol

Known Subclasses:
BeepClientProtocol, BeepServerProtocol, SASLClientProtocol, SASLServerProtocol, TLSProtocol

Method Summary
  __init__(self)
  close(self)
  connectionLost(self, reason)
  connectionMade(self)
Called when a connection is made.
  createTransportChannel(self, channelnum)
Performs transport specific channel creation
  deleteTransportChannel(self, channelnum)
Performs transport specific channel deletion
  doSEQFrame(self)
  findFrame(self)
Search for a frame in the databuffer.
  flushDatabuf(self, channelnum)
  processQueuedData(self)
This method examines the local data queues to see if there is pending data that didn't fit within a window for a given channel.
  processSEQFrame(self, theframe)
Perform window size management for inbound SEQ frames.
  rawDataReceived(self, data)
Override this for when raw data is received.
  sendFrame(self, theframe)
sendFrame is used to push frames over the transport.
  sendMessage(self, msg, channelnum)
sendMessage is used to send a Message as one or more Frames over the transport.
  sendMsgComplete(self, channelnum, msg)
Send the final frame in a sequence of fragments.
  sendMsgFragment(self, channelnum, msg)
Send a message fragment by setting the continuation indicator for the frame.
  sendSEQFrame(self, channelnum)
This is the simplest tuning.
    Inherited from LineReceiver
  clearLineBuffer(self)
Clear buffered data.
  dataReceived(self, data)
Protocol.dataReceived.
  lineLengthExceeded(self, line)
Called when the maximum line length has been reached.
  lineReceived(self, line)
Override this for when each line is received.
  sendLine(self, line)
Sends a line to the other end of the connection.
  setLineMode(self, extra)
Sets the line-mode of this receiver.
  setRawMode(self)
Sets the raw mode of this receiver.
    Inherited from Protocol
  connectionFailed(self)
(Deprecated)

Class Variable Summary
    Inherited from LineReceiver
str delimiter: The line-ending delimiter to use.
int line_mode = 1                                                                     
int MAX_LENGTH: The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped).
    Inherited from Protocol
tuple __implements__ = (<class 'twisted.internet.interfaces.IP...

Method Details

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)

createTransportChannel(self, channelnum)

Performs transport specific channel creation

deleteTransportChannel(self, channelnum)

Performs transport specific channel deletion

findFrame(self)

Search for a frame in the databuffer. Return a frame object for the first frame found.

processQueuedData(self)

This method examines the local data queues to see if there is pending data that didn't fit within a window for a given channel. If data is available and there is available space at the remote peer then more data is sent, up to the amount of available space. If no space is available yet (because we haven't received another SEQ frame yet) then we don't send the data for that channel.

processSEQFrame(self, theframe)

Perform window size management for inbound SEQ frames.

rawDataReceived(self, data)

Override this for when raw data is received.
Overrides:
twisted.protocols.basic.LineReceiver.rawDataReceived (inherited documentation)

sendFrame(self, theframe)

sendFrame is used to push frames over the transport.

With the addition of SEQ frames, this becomes a little more complex. We need to check that the amount of data we're about to send isn't larger than the allocated window size. If it is, then we fragment the data and only send bytes up to the window size. We then have to wait for a SEQ frame from the remote peer saying that it has room for more data before sending the rest.

The sending of pending data happens asynchronously via the processQueuedData() method.

sendMessage(self, msg, channelnum)

sendMessage is used to send a Message as one or more Frames over the transport.

sendMsgComplete(self, channelnum, msg)

Send the final frame in a sequence of fragments. A sequence of fragments may only be one frame long, with that single frame containing the whole message.

sendMsgFragment(self, channelnum, msg)

Send a message fragment by setting the continuation indicator for the frame.

sendSEQFrame(self, channelnum)

This is the simplest tuning. We simply reset the window to max, allowing the remote peer to send more data on this channel.

Generated by Epydoc 2.0 on Thu Sep 30 14:39:24 2004 http://epydoc.sf.net