Package beepy :: Package core :: Module frame :: Class DataFrame
[show private | hide private]
[frames | no frames]

Class DataFrame

Frame --+
        |
       DataFrame


A DataFrame is the basic unit of data used by BEEP to transport information around.
Method Summary
  __init__(self, channelnum, msgno, seqno, size, dataFrameType, more, ansno, databuffer)
When a frame is created, various checks on the data are performed to ensure that it is a correctly formed frame.
  __repr__(self)
  __str__(self)
Returns a frame as a formatted bytestring ready for passing to the transport layer.
  isANS(self)
Check to see if this is an ANS frame
  isERR(self)
Check to see if this is an ERR frame
  isMSG(self)
Check to see if this is a MSG frame
  isNUL(self)
Check to see if this is a NUL frame
  isRPY(self)
Check to see if this is a RPY frame
  setPayload(self, payload)
Assigns a payload to a DataFrame.
  _bufferToFrame(self, data)
Convert a bytestring databuffer to a DataFrame object.
  _checkValues(self, channelnum, msgno, more, seqno, size, dataFrameType, ansno)
Performs sanity checking on values of DataFrames at create time.

Class Variable Summary
int ansno = -1                                                                    
int channelnum = -1                                                                    
str frameType = 'data'
int msgno = -1                                                                    
long seqno = -1L
long size = -1L
str TRAILER = 'END\r\n'

Method Details

__init__(self, channelnum=None, msgno=None, seqno=None, size=None, dataFrameType='MSG', more='.', ansno=None, databuffer=None)
(Constructor)

When a frame is created, various checks on the data are performed to ensure that it is a correctly formed frame. This is most useful for validating data received from the transport layer.
Parameters:
channelnum - The channel number this frame is/was sent on
           (type=integer)
msgno - The message number of the frame
           (type=integer)
seqno - The frame sequence number
           (type=integer)
size - The length of the frame payload in bytes
           (type=long)
dataFrameType - a string type from constants.dataFrameTypes
           (type=string)
more - The frame continuation indicator
           (type=character, . or *)
ansno - For a NUL frame, the ansno to which this is a reply
           (type=integer)
databuffer - A raw frame as a bytestring
           (type=bytestring)
Overrides:
beepy.core.frame.Frame.__init__

__str__(self)
(Informal representation operator)

Returns a frame as a formatted bytestring ready for passing to the transport layer. Pretty printed so it's human readable.

isANS(self)

Check to see if this is an ANS frame
Returns:
1 if true

isERR(self)

Check to see if this is an ERR frame
Returns:
1 if true

isMSG(self)

Check to see if this is a MSG frame
Returns:
1 if true

isNUL(self)

Check to see if this is a NUL frame
Returns:
1 if true

isRPY(self)

Check to see if this is a RPY frame
Returns:
1 if true

setPayload(self, payload)

Assigns a payload to a DataFrame. This is usually called after creating an empty frame with the header information set to populate the frame.
Parameters:
payload - a bytestring that is a frame payload
           (type=string)

_bufferToFrame(self, data)

Convert a bytestring databuffer to a DataFrame object. Mostly used to decode incoming datastreams from the transport layer into DataFrame objects.
Parameters:
data - a bytestring containing a single frame as a bytestring
           (type=string)

_checkValues(self, channelnum, msgno, more, seqno, size, dataFrameType, ansno=None)

Performs sanity checking on values of DataFrames at create time.

Class Variable Details

ansno

Type:
int
Value:
-1                                                                    

channelnum

Type:
int
Value:
-1                                                                    

frameType

Type:
str
Value:
'data'                                                                 

msgno

Type:
int
Value:
-1                                                                    

seqno

Type:
long
Value:
-1L                                                                    

size

Type:
long
Value:
-1L                                                                    

TRAILER

Type:
str
Value:
'''END\r
'''                                                                    

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