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

Public Member Functions

 __init__ (self, int stream_id, bool is_uni, bool is_s_initiated)
 
bool has_data (self)
 
int get_stream_id (self)
 
 add_data_to_stream (self, bytes data)
 
 generate_stream_frames (self, int max_size)
 
FrameStream send_next_frame (self)
 
 receive_frame (self, FrameStream frame)
 
bytes get_data_received (self)
 
bool is_finished (self)
 

Static Public Member Functions

bool is_uni_by_sid (int stream_id)
 
bool is_s_init_by_sid (int stream_id)
 

Protected Attributes

 _stream_id
 
 _is_uni
 
 _is_s_initiated
 
 _sender
 
 _receiver
 

Detailed Description

@brief Represents a QUIC stream that handles data transfer.

@details A Stream can be unidirectional or bidirectional, and handles
         both sending and receiving data through dedicated endpoints.

Definition at line 13 of file stream.py.

Constructor & Destructor Documentation

◆ __init__()

stream.Stream.__init__ (   self,
int  stream_id,
bool  is_uni,
bool  is_s_initiated 
)
@brief Initialize a Stream instance.

@param stream_id Unique identifier for the stream, generated already.
@param is_uni Specifies if the stream is unidirectional.
@param is_s_initiated Specifies if the stream was initiated by the server (receiver).

Definition at line 21 of file stream.py.

Member Function Documentation

◆ add_data_to_stream()

stream.Stream.add_data_to_stream (   self,
bytes  data 
)
@brief Add data to the stream by delegation to StreamSender.

@param data Data to be added to the send buffer.

Definition at line 53 of file stream.py.

References stream.Stream._sender.

◆ generate_stream_frames()

stream.Stream.generate_stream_frames (   self,
int  max_size 
)
@brief Stream frames generation by delegation to StreamSender.

@details Generate stream frames for sending based on the maximum frame size.

@param max_size The size of the payload_size which is determined by size of 
              payload-packet/num of streams on that packet.

Definition at line 61 of file stream.py.

References stream.Stream._sender, and stream.Stream.generate_stream_frames().

Referenced by stream.Stream.generate_stream_frames().

◆ get_data_received()

bytes stream.Stream.get_data_received (   self)
@brief Retrieve the data received on the stream.

@return The data received on the stream.

Definition at line 88 of file stream.py.

References stream.Stream._receiver.

◆ get_stream_id()

int stream.Stream.get_stream_id (   self)
@brief Getter for stream ID.

@return The stream ID.

Definition at line 45 of file stream.py.

References stream.Stream._stream_id.

◆ has_data()

bool stream.Stream.has_data (   self)
@brief Check if there is any data to send or receive.

@return True if there is data in the sender or receiver buffer, False otherwise.

Definition at line 37 of file stream.py.

References stream.Stream._receiver, stream.Stream._sender, and stream.Stream.has_data().

Referenced by stream.Stream.has_data().

◆ is_finished()

bool stream.Stream.is_finished (   self)
@brief Check if the stream has finished sending and receiving data.

@return True if the stream is in a terminal state, False otherwise.

Definition at line 96 of file stream.py.

References stream.Stream._is_s_initiated, stream.Stream._is_uni, stream.Stream._receiver, and stream.Stream._sender.

◆ is_s_init_by_sid()

bool stream.Stream.is_s_init_by_sid ( int  stream_id)
static
@brief Determine if a stream was initiated by a server based on its stream ID.

@param stream_id The stream ID.
@return True if the stream was initiated by a server, False otherwise.

Definition at line 120 of file stream.py.

◆ is_uni_by_sid()

bool stream.Stream.is_uni_by_sid ( int  stream_id)
static
@brief Determine if a stream is unidirectional based on stream ID.

@param stream_id The stream ID.
@return True if the stream is unidirectional, False otherwise.

Definition at line 110 of file stream.py.

◆ receive_frame()

stream.Stream.receive_frame (   self,
FrameStream  frame 
)
@brief Process a received frame by delegating it to the receiver.

@param frame The received frame.

Definition at line 80 of file stream.py.

References stream.Stream._receiver.

◆ send_next_frame()

FrameStream stream.Stream.send_next_frame (   self)
@brief Retrieve the next frame to be sent from the sender's list.

@return The next frame to be sent.

Definition at line 72 of file stream.py.

References stream.Stream._sender, and stream.Stream.send_next_frame().

Referenced by stream.Stream.send_next_frame().

Member Data Documentation

◆ _is_s_initiated

stream.Stream._is_s_initiated
protected

Definition at line 31 of file stream.py.

Referenced by stream.Stream.is_finished().

◆ _is_uni

stream.Stream._is_uni
protected

Definition at line 30 of file stream.py.

Referenced by stream.Stream.is_finished().

◆ _receiver

stream.Stream._receiver
protected

◆ _sender

◆ _stream_id


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