Kea  1.5.0
isc::perfdhcp::TestControl::TestControlSocket Struct Reference

Socket wrapper structure. More...

#include <test_control.h>

+ Inheritance diagram for isc::perfdhcp::TestControl::TestControlSocket:

Public Member Functions

 TestControlSocket (const int socket)
 Constructor of socket wrapper class. More...
 
 ~TestControlSocket ()
 Destructor of the socket wrapper class. More...
 
- Public Member Functions inherited from isc::dhcp::SocketInfo
 SocketInfo (const isc::asiolink::IOAddress &addr, const uint16_t port, const int sockfd, const int fallbackfd=-1)
 SocketInfo constructor. More...
 

Public Attributes

uint16_t ifindex_
 Interface index. More...
 
bool valid_
 Is socket valid. More...
 
- Public Attributes inherited from isc::dhcp::SocketInfo
isc::asiolink::IOAddress addr_
 
int fallbackfd_
 Fallback socket descriptor. More...
 
uint16_t family_
 socket port More...
 
uint16_t port_
 bound address More...
 
int sockfd_
 IPv4 or IPv6. More...
 

Detailed Description

Socket wrapper structure.

This is the wrapper that holds descriptor of the socket used to run DHCP test. The wrapped socket is closed in the destructor. This prevents resource leaks when when function that created the socket ends (normally or when exception occurs). This structure extends parent structure with new field ifindex_ that holds interface index where socket is bound to.

Definition at line 160 of file test_control.h.

Constructor & Destructor Documentation

◆ TestControlSocket()

isc::perfdhcp::TestControl::TestControlSocket::TestControlSocket ( const int  socket)

Constructor of socket wrapper class.

This constructor uses provided socket descriptor to find the name of the interface where socket has been bound to. If provided socket descriptor is invalid then valid_ field is set to false;

Parameters
socketsocket descriptor.

Definition at line 103 of file test_control.cc.

References valid_.

◆ ~TestControlSocket()

isc::perfdhcp::TestControl::TestControlSocket::~TestControlSocket ( )

Destructor of the socket wrapper class.

Destructor closes wrapped socket.

Definition at line 113 of file test_control.cc.

Member Data Documentation

◆ ifindex_

uint16_t isc::perfdhcp::TestControl::TestControlSocket::ifindex_

Interface index.

Definition at line 162 of file test_control.h.

Referenced by isc::perfdhcp::TestControl::setDefaults4(), and isc::perfdhcp::TestControl::setDefaults6().

◆ valid_

bool isc::perfdhcp::TestControl::TestControlSocket::valid_

Is socket valid.

It will not be valid if the provided socket descriptor does not point to valid socket.

Definition at line 165 of file test_control.h.

Referenced by isc::perfdhcp::TestControl::run(), and TestControlSocket().


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