tlslite.defragmenter module

Helper package for handling fragmentation of messages

class tlslite.defragmenter.Defragmenter

Bases: object

Class for demultiplexing TLS messages.

Since the messages can be interleaved and fragmented between each other we need to cache not complete ones and return in order of urgency.

Supports messages with given size (like Alerts) or with a length header in specific place (like Handshake messages).

Variables:
  • priorities – order in which messages from given types should be returned.
  • buffers – data buffers for message types
  • decoders – functions which check buffers if a message of given type is complete
__init__()

Set up empty defregmenter

addData(msgType, data)

Adds data to buffers

addDynamicSize(msgType, sizeOffset, sizeOfSize)

Add a message type which has a dynamic size set in a header

addStaticSize(msgType, size)

Add a message type which all messages are of same length

clearBuffers()

Remove all data from buffers

getMessage()

Extract the highest priority complete message from buffer