QUIC Protocol Implementation 1.0
A Python implementation of the QUIC (Quick UDP Internet Connections) protocol.
Loading...
Searching...
No Matches
frame.FrameStream Class Reference
Inheritance diagram for frame.FrameStream:
Collaboration diagram for frame.FrameStream:

Public Member Functions

bytes encode (self)
 
 decode (cls, bytes frame)
 

Static Public Member Functions

int end_of_attrs (bytes frame)
 
 length_from_attrs (bytes frame, int end_of_attrs)
 

Public Attributes

 data
 

Static Public Attributes

int offset
 
int length
 
bool fin
 
bytes data
 
- Static Public Attributes inherited from frame.StreamFrameABC
int stream_id
 

Protected Member Functions

 _decode (cls, bytes frame)
 

Detailed Description

@brief Concrete implementation of a QUIC stream frame.

@details Contains data for a single frame within a stream,
         with methods to encode and decode the frame.

Definition at line 46 of file frame.py.

Member Function Documentation

◆ _decode()

frame.FrameStream._decode (   cls,
bytes  frame 
)
protected
@brief Decodes a frame encoded in bytes into a FrameStream instance.

@details The decoding process includes:
        - Extracting the offset, length, fin flag, stream ID, and stream data from the frame.
        - Creating a new FrameStream instance with the extracted values.

@param frame The encoded frame as bytes.
@return A new FrameStream instance with the decoded values.

Definition at line 100 of file frame.py.

◆ decode()

frame.FrameStream.decode (   cls,
bytes  frame 
)
@brief Decodes a frame encoded in bytes into a FrameStream instance.

@details Delegates to _decode for the actual decoding.

@param frame The encoded frame as bytes.
@return A new FrameStream instance with the decoded values.

Reimplemented from frame.StreamFrameABC.

Definition at line 88 of file frame.py.

◆ encode()

bytes frame.FrameStream.encode (   self)
@brief Encodes the frame into bytes.

@details The encoding process includes:
        - Converting the stream ID to bytes.
        - Setting the type field based on the presence of offset, length, and fin attributes.
        - Appending the offset, length, and data to the values list if they are present.
        - Combining all parts into a single bytes object.

@return The encoded frame as bytes.

Reimplemented from frame.StreamFrameABC.

Definition at line 59 of file frame.py.

References frame.FrameStream.fin, frame.FrameStream.length, test_frame.TestFrameStream.length, frame.FrameStream.offset, test_frame.TestFrameStream.offset, frame.StreamFrameABC.stream_id, test_frame.TestFrameStream.stream_id, test_stream.TestStreamSender.stream_id, and test_stream.TestStreamReceiver.stream_id.

◆ end_of_attrs()

int frame.FrameStream.end_of_attrs ( bytes  frame)
static
@brief Determines the end position of the attributes in the frame.

@details The process includes:
        - Calculating the initial end position based on the frame type field length and stream ID length.
        - Checking if the offset bit is set in the type field and adjusting the end position accordingly.
        - Checking if the length bit is set in the type field and adjusting the end position accordingly.

@param frame The encoded frame as bytes.
@return The end position of the attributes in the frame.

Definition at line 134 of file frame.py.

◆ length_from_attrs()

frame.FrameStream.length_from_attrs ( bytes  frame,
int  end_of_attrs 
)
static
@brief Determines the length of the data in the frame.

@details The process includes:
        - Checking if the end of attributes is less than or equal to the sum of the frame type 
          field length and stream ID length.
        - If the end of attributes is less than or equal to the sum of the frame type field 
          length and stream ID length plus the offset length.
        - Otherwise, the length is extracted from the frame after the offset length.

@param frame The encoded frame as bytes.
@param end_of_attrs The end position of the attributes in the frame.
@return The length of the data in the frame.

Definition at line 155 of file frame.py.

Member Data Documentation

◆ data [1/2]

bytes frame.FrameStream.data
static

Definition at line 57 of file frame.py.

◆ data [2/2]

frame.FrameStream.data

Definition at line 81 of file frame.py.

◆ fin

bool frame.FrameStream.fin
static

Definition at line 56 of file frame.py.

Referenced by frame.FrameStream.encode().

◆ length

◆ offset


The documentation for this class was generated from the following file: