5#include <linux/if_packet.h>
38 void init(
int domain,
int type,
int protocol);
46 explicit RawSocket(std::string iface,
bool isWrite =
false);
72 int writeData(
const unsigned char *data,
size_t dataLen);
80 int readData(
unsigned char *data,
size_t dataLen);
int _sockFd
Socket descriptor.
RawSocket(std::string iface, bool isWrite=false)
bool _writeMode
Mode indicator. True = Write, False = Read.
RawSocket & operator=(RawSocket)=delete
Copy assignment operator.
RawSocketStats _stats
Internal structure for statistics.
RawSocketStats getStats(bool resetInternalStats=false)
RawSocket(RawSocket &&)=delete
Move constructor.
void init(int domain, int type, int protocol)
const std::string & getInterfaceName() const
RawSocket & operator=(RawSocket &&)=delete
Move assignment operator.
std::string _iFace
Currently used ethernet interface.
int readData(unsigned char *data, size_t dataLen)
int writeData(const unsigned char *data, size_t dataLen)
sockaddr_ll _addr
Socket structure.
RawSocket(const RawSocket &)=delete
Copy constructor.
size_t receivedBytes
Number of bytes read from socket.
size_t sentBytes
Number of bytes written to socket.
double processingTime
Total execution time in nanoseconds.