Yarilo v0.9.9
WPA2 Decrypter & Packet Analyzer
Loading...
Searching...
No Matches
yarilo::PacketChannel Class Reference

Thread-friendly blocking channel for sending packets. More...

#include <channel.h>

Public Member Functions

 PacketChannel ()
 
void send (std::unique_ptr< Tins::Packet > pkt)
 
std::optional< std::unique_ptr< Tins::Packet > > receive ()
 
void close ()
 
bool is_closed ()
 
bool is_empty ()
 
size_t len ()
 
std::unique_lock< std::mutex > lock_send ()
 
void unlock_send ()
 

Detailed Description

Thread-friendly blocking channel for sending packets.

Constructor & Destructor Documentation

◆ PacketChannel()

yarilo::PacketChannel::PacketChannel ( )
inline

Constructor for the packet channel

Member Function Documentation

◆ close()

void yarilo::PacketChannel::close ( )
inline

Close the channel and notify all blocked subscribers

◆ is_closed()

bool yarilo::PacketChannel::is_closed ( )
inline

Get the channels closed state

Returns
True if the channel is closed

◆ is_empty()

bool yarilo::PacketChannel::is_empty ( )
inline

Get the channels queue emptiness state

Returns
True if the packet queue is empty

◆ len()

size_t yarilo::PacketChannel::len ( )
inline

Get the queue length

Returns
Number of packets waiting in the queue

◆ lock_send()

std::unique_lock< std::mutex > yarilo::PacketChannel::lock_send ( )
inline

Lock the queue for sending, useful for making sure that packets will not come in a critical section

Returns
Unique lock of the mutex

◆ receive()

std::optional< std::unique_ptr< Tins::Packet > > yarilo::PacketChannel::receive ( )
inline

Receive a packet from the channel, blocks until a packet arrives, or the channel is closed

Returns
Packet or nullopt in the case of a channel close

◆ send()

void yarilo::PacketChannel::send ( std::unique_ptr< Tins::Packet > pkt)
inline

Send a packet through the channel

Parameters
[in]pktPacket packet to send

◆ unlock_send()

void yarilo::PacketChannel::unlock_send ( )
inline

Unlock the queue for sending, useful for making sure that packets will not come in a critical section


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