Kea 2.5.8
isc::perfdhcp::Receiver Class Reference

A receiving DHCP packets class. More...

#include <receiver.h>

Public Member Functions

 Receiver (BasePerfSocket &socket, bool single_threaded, uint8_t ip_version)
 Receiver constructor.
 
 ~Receiver ()
 Destructor.
 
dhcp::PktPtr getPkt ()
 Get DHCP packet.
 
void start ()
 Start a receiving thread in multi-thread mode.
 
void stop ()
 Stop a receiving thread in multi-thread mode.
 

Detailed Description

A receiving DHCP packets class.

Receiver can be used in two modes: single-thread and multi-thread.

In single-thread mode the class directly reads packets from socket and returns them to consumer using getPkt method.

In case of multi-thread mode the class starts a thread in the background. The thread reads the packets and pushes them to pkt_queue_. Then in main thread packets can be consumed from the queue using getPkt method.

Definition at line 34 of file receiver.h.

Constructor & Destructor Documentation

◆ Receiver()

isc::perfdhcp::Receiver::Receiver ( BasePerfSocket socket,
bool  single_threaded,
uint8_t  ip_version 
)
inline

Receiver constructor.

Parameters
socketA socket for receiving packets.
single_threadedA flag indicating running mode.
ip_versionAn IP version: 4 or 6

Definition at line 61 of file receiver.h.

◆ ~Receiver()

isc::perfdhcp::Receiver::~Receiver ( )

Destructor.

Definition at line 49 of file receiver.cc.

References stop().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPkt()

PktPtr isc::perfdhcp::Receiver::getPkt ( )

Get DHCP packet.

In single-thread mode it reads directly from the socket. In multi-thread mode it reads packets from the queue.

Definition at line 58 of file receiver.cc.

Referenced by isc::perfdhcp::TestControl::consumeReceivedPackets().

◆ start()

void isc::perfdhcp::Receiver::start ( )

Start a receiving thread in multi-thread mode.

In single-thread mode it does nothing.

Definition at line 24 of file receiver.cc.

References isc_throw.

Referenced by isc::perfdhcp::TestControl::start().

◆ stop()

void isc::perfdhcp::Receiver::stop ( )

Stop a receiving thread in multi-thread mode.

In single-thread mode it does nothing.

Definition at line 36 of file receiver.cc.

Referenced by ~Receiver(), and isc::perfdhcp::TestControl::stop().


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