Base for socket that uses network interface directly.
More...
#include <sock.h>
|
void | close () |
|
bool | init () |
|
bool | send (const void *msg, size_t len) |
|
bool | send (Buf &buf, size_t len) |
|
bool | sendBuf (Buf &buf, size_t len) |
|
ssize_t | rcv (void *buf, size_t bufSize, bool block=false) |
|
ssize_t | rcv (Buf &buf, bool block=false) |
|
ssize_t | rcvBuf (Buf &buf, bool block=false) |
|
int | getFd () const |
|
int | fileno () const |
|
bool | poll (uint64_t timeout_ms=0) const |
|
bool | tpoll (uint64_t &timeout_ms) const |
|
Base for socket that uses network interface directly.
provide functions to set network interface for UDP and Raw sockets.
◆ setAll()
bool SockBaseIf::setAll |
( |
const IfInfo & |
ifObj, |
|
|
const ConfigFile & |
cfg, |
|
|
const std::string & |
section = "" |
|
) |
| |
|
inline |
Set all socket parameters using a network interface object and a configuration file
- Parameters
-
[in] | ifObj | initialized network interface object |
[in] | cfg | reference to configuration file object |
[in] | section | in configuration file |
- Returns
- true if network interface exists and update all parameters.
- Note
- parameters can not be changed after initializing. User can close the socket, change any of the parameters value and initialize a new socket.
-
calling without section will fetch value from "global" section
◆ setAllInit()
bool SockBaseIf::setAllInit |
( |
const IfInfo & |
ifObj, |
|
|
const ConfigFile & |
cfg, |
|
|
const std::string & |
section = "" |
|
) |
| |
|
inline |
Set all socket parameters using a network interface object and a configuration file and initialize
- Parameters
-
[in] | ifObj | initialized network interface object |
[in] | cfg | reference to configuration file object |
[in] | section | in configuration file |
- Returns
- true if network interface exists and update all parameters.
- Note
- parameters can not be changed after initializing. User can close the socket, change any of the parameters value and initialize a new socket.
-
calling without section will fetch value from "global" section
◆ setIf()
bool SockBaseIf::setIf |
( |
const IfInfo & |
ifObj | ) |
|
Set network interface using a network interface object
- Parameters
-
[in] | ifObj | initialized network interface object |
- Returns
- true if network interface exists and updated.
- Note
- network interface can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
◆ setIfUsingIndex()
bool SockBaseIf::setIfUsingIndex |
( |
int |
ifIndex | ) |
|
Set network interface using its index
- Parameters
-
[in] | ifIndex | interface index |
- Returns
- true if network interface exists and updated.
- Note
- network interface can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
◆ setIfUsingName()
bool SockBaseIf::setIfUsingName |
( |
const std::string & |
ifName | ) |
|
< Set network interface using its name
- Parameters
-
- Returns
- true if network interface exists and updated.
- Note
- network interface can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
The documentation for this class was generated from the following file: