Socket implementation for Linux.
More...
#include <socket_linux.h>
|
void | bindToDevice (const std::string &device) |
| Binds this socket to a specific device (root privileges are required). More...
|
|
Socket implementation for Linux.
Definition at line 51 of file socket_linux.h.
Type representing the native socket handle type.
Definition at line 59 of file socket_linux.h.
rcdiscover::SocketLinux::SocketLinux |
( |
int |
domain, |
|
|
int |
type, |
|
|
int |
protocol, |
|
|
in_addr_t |
dst_ip, |
|
|
uint16_t |
port, |
|
|
std::string |
iface_name |
|
) |
| |
Constructor.
- Parameters
-
domain | domain of socket() |
type | type of socket() |
protocol | protocol of socket() |
dst_ip | destination IP address |
port | destination port |
iface_name | name of the interface |
Definition at line 162 of file socket_linux.cc.
rcdiscover::SocketLinux::SocketLinux |
( |
SocketLinux && |
other | ) |
|
rcdiscover::SocketLinux::~SocketLinux |
( |
| ) |
|
void rcdiscover::SocketLinux::bindImpl |
( |
const sockaddr_in & |
addr | ) |
|
|
protected |
Binds the socket to a specific sockaddr.
- Parameters
-
addr | sockaddr_in to which to bind the socket |
Definition at line 222 of file socket_linux.cc.
void rcdiscover::SocketLinux::bindToDevice |
( |
const std::string & |
device | ) |
|
|
private |
Binds this socket to a specific device (root privileges are required).
- Parameters
-
device | device name to bind the socket to |
- Exceptions
-
Definition at line 273 of file socket_linux.cc.
SocketLinux rcdiscover::SocketLinux::create |
( |
in_addr_t |
dst_ip, |
|
|
uint16_t |
port, |
|
|
std::string |
iface_name |
|
) |
| |
|
static |
Create a new socket.
- Parameters
-
dst_ip | destination IP address |
port | destination port |
iface_name | name of the interface |
- Returns
- the created socket
Definition at line 69 of file socket_linux.cc.
std::vector< SocketLinux > rcdiscover::SocketLinux::createAndBindForAllInterfaces |
( |
uint16_t |
port | ) |
|
|
static |
Creates sockets for all interfaces and binds them to the respective interface.
- Parameters
-
- Returns
- vector of sockets
Definition at line 76 of file socket_linux.cc.
void rcdiscover::SocketLinux::enableBroadcastImpl |
( |
| ) |
|
|
protected |
void rcdiscover::SocketLinux::enableNonBlockingImpl |
( |
| ) |
|
|
protected |
Enables non-blocking operation for this socket.
Definition at line 264 of file socket_linux.cc.
const in_addr_t & rcdiscover::SocketLinux::getBroadcastAddr |
( |
| ) |
|
|
static |
Returns the broadcast address.
- Returns
- broadcast address
Definition at line 58 of file socket_linux.cc.
const sockaddr_in & rcdiscover::SocketLinux::getDestSockAddr |
( |
| ) |
const |
Returns the sockaddr to which the socket is bound.
- Returns
- sockaddr to which the socket is bound.
Definition at line 64 of file socket_linux.cc.
const int & rcdiscover::SocketLinux::getHandleImpl |
( |
| ) |
const |
|
protected |
Returns the native socket handle.
- Returns
- native socket handle.
Definition at line 217 of file socket_linux.cc.
void rcdiscover::SocketLinux::sendImpl |
( |
const std::vector< uint8_t > & |
sendbuf | ) |
|
|
protected |
sockaddr_in rcdiscover::SocketLinux::dst_addr_ |
|
private |
int rcdiscover::SocketLinux::sock_ |
|
private |
The documentation for this class was generated from the following files: