PcapPlusPlus
20.08
|
#include <LinuxNicInformationSocket.h>
Public Types | |
typedef int | LinuxSocket |
typedef unsigned long | IoctlType |
Public Member Functions | |
LinuxNicInformationSocket () | |
~LinuxNicInformationSocket () | |
bool | makeRequest (const char *nicName, const IoctlType ioctlType, ifreq *request) |
Makes request to socket. Firstly tries to open socket if it is not opened. Then makes an ioctl(2) request to handled socket with provided request structure. See: netdevice(7) for description of possible values of ioctlType and content of request. More... | |
Simple wrapper over Linux socket for making the information requests about NICs or making some changes in NICs setup. All possible requests are described in netdevice(7). The instance of this class handels underlying socket during its lifetime and takes an appropriate actions to close socket on destruction. The user must call LinuxNicInformationSocket::makeRequest method with known ioctl type and properly filled ifreq structure for this ioctl type. Filling of ifr_name may be omitted as it will be done automatically from provided NIC name.
typedef unsigned long pcpp::LinuxNicInformationSocket::IoctlType |
Simple type rename for convenience
typedef int pcpp::LinuxNicInformationSocket::LinuxSocket |
Simple type rename for convenience
pcpp::LinuxNicInformationSocket::LinuxNicInformationSocket | ( | ) |
Tries to open handled socket on construction. If fails prints the debug message
pcpp::LinuxNicInformationSocket::~LinuxNicInformationSocket | ( | ) |
Closes handled socket on destruction. If no socket was opened prints the debug message
bool pcpp::LinuxNicInformationSocket::makeRequest | ( | const char * | nicName, |
const IoctlType | ioctlType, | ||
ifreq * | request | ||
) |
Makes request to socket. Firstly tries to open socket if it is not opened. Then makes an ioctl(2) request to handled socket with provided request structure. See: netdevice(7) for description of possible values of ioctlType and content of request.
[in] | nicName | Name of internet controller as displayed by Linux |
[in] | ioctlType | Value of ioctl to make |
[in,out] | request | Pointer to ifreq structure that contains some information or will be used for obtaining the information (depends on ioctlType) |