QUIC Protocol Implementation 1.0
A Python implementation of the QUIC (Quick UDP Internet Connections) protocol.
|
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 |
![]() | |
int | stream_id |
Protected Member Functions | |
_decode (cls, bytes frame) | |
@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.
|
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.
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.
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.
|
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.
|
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.
|
static |
Definition at line 56 of file frame.py.
Referenced by frame.FrameStream.encode().
|
static |
Definition at line 55 of file frame.py.
Referenced by frame.FrameStream.encode(), test_frame.TestFrameStream.test_encode_decode(), test_frame.TestFrameStream.test_encode_decode_with_fin(), test_frame.TestFrameStream.test_init(), test_frame.TestFrameStream.test_length_from_attrs(), and test_frame.TestFrameStream.test_zero_offset().
|
static |
Definition at line 54 of file frame.py.
Referenced by frame.FrameStream.encode(), test_frame.TestFrameStream.test_encode_decode(), test_frame.TestFrameStream.test_encode_decode_with_fin(), test_frame.TestFrameStream.test_init(), and test_frame.TestFrameStream.test_zero_length().