Bases: object
An abstract base class for other kinds of cells.
Return just the payload bytes of a cell.
For fixed-length cells, pad with null bytes to the appropriate length according to Link Protocol version. Primarily useful for encrypting or decrypting cells.
Returns: | str cell payload bytes |
---|
Return the (start, end) indices of this cell’s payload as a 2-tuple.
Returns: | tuple, int (start, end) payload indices. |
---|
Return True iff the str data contains enough bytes to build a cell.
The command byte is checked to determine the general type of cell to look for. For fixed-length cells, this is enough to know how much data is required. For variable-length cells, additionally check the length bytes.
Parameters: |
|
---|---|
Returns: | bool that’s True iff data is long enough to build the type of cell indicated by the command byte. |
Return an instance of a cell constructed from the str data.
If encrypted is True and the type if cell is RELAY or RELAY_EARLY, don’t try to parse the payload and just return a EncryptedCell. Otherwise, instantiate and return the appropriate cell type.
Note
data str is not modified.
Parameters: |
|
---|---|
Returns: | instantiated cell type as dictated by the command byte, parsed and extracted from data. |