Netdevice Controller. More...
#include <senf/Socket/NetdeviceController.hh>
Classes | |
struct | SockFd |
Public Member Functions | |
NetdeviceController (std::string const &interface_name) | |
Construct a new controller for the given interface name. More... | |
NetdeviceController (int interface_index) | |
Construct a new controller for the given interface index. More... | |
void | reset (std::string const &interface_name) |
reset the ifindex_ from the given iface_name (i.e. after USB Ethernet unplug/plug More... | |
int | interfaceIndex () const |
return the interface index More... | |
MACAddress | hardwareAddress () const |
return hardware address More... | |
void | hardwareAddress (MACAddress const &newAddress) |
set hardware address More... | |
std::string | interfaceName () const |
return interface name More... | |
void | interfaceName (std::string const &newName) |
set interface name More... | |
int | mtu () const |
return the Maximum Transmission Unit More... | |
void | mtu (int new_mtu) |
set the Maximum Transmission Unit More... | |
int | txqueuelen () const |
return the Tx Queue Length More... | |
void | txqueuelen (int new_mtu) |
set the Tx Queue Length More... | |
bool | promisc () const |
return true if interface is in promiscuous mode More... | |
void | promisc (bool mode) |
enable/disable promiscuous mode of the interface More... | |
void | addVLAN (std::uint16_t vlanId) |
add a VLAN interface More... | |
void | delVLAN (std::uint16_t vlanId) |
delete a VLAN interface More... | |
void | timestamping (int txType, int rxFilter) |
configures hw timestamping for RX and/or TX More... | |
bool | isUp () const |
return true if interface is up More... | |
void | up () |
ifconfig up interface More... | |
void | down () |
ifconfig down interface More... | |
Static Public Member Functions | |
static SockFd::ptr | sockfd () |
static std::string | macToName (MACAddress const &mac) |
static MACAddress | readMACAddressFromFile (boost::filesystem::path const &path) |
Protected Member Functions | |
void | ifrName (ifreq &ifr) const |
Protected Attributes | |
SockFd::ptr | sockfd_ |
int | ifindex_ |
Netdevice Controller.
This controller provides an interface which can be used to configure network devices. Note, that some setting members are privileged operations.
Definition at line 44 of file NetdeviceController.hh.
|
explicit |
Construct a new controller for the given interface name.
Definition at line 42 of file NetdeviceController.cc.
|
explicit |
Construct a new controller for the given interface index.
Definition at line 48 of file NetdeviceController.cc.
void senf::NetdeviceController::addVLAN | ( | std::uint16_t | vlanId | ) |
add a VLAN interface
Note, that this is a privileged operation.
Definition at line 187 of file NetdeviceController.cc.
void senf::NetdeviceController::delVLAN | ( | std::uint16_t | vlanId | ) |
delete a VLAN interface
Note, that this is a privileged operation.
Definition at line 197 of file NetdeviceController.cc.
void senf::NetdeviceController::down | ( | ) |
ifconfig down interface
Definition at line 178 of file NetdeviceController.cc.
senf::MACAddress senf::NetdeviceController::hardwareAddress | ( | ) | const |
return hardware address
Definition at line 87 of file NetdeviceController.cc.
void senf::NetdeviceController::hardwareAddress | ( | MACAddress const & | newAddress | ) |
set hardware address
Changes the hardware address of the interface. Note, that setting the hardware address is a privileged operation. It is only allowed when the interface is not up. If the interface is up, this call will cause an SystemException to be thrown.
Definition at line 96 of file NetdeviceController.cc.
|
protected |
Definition at line 221 of file NetdeviceController.cc.
int senf::NetdeviceController::interfaceIndex | ( | ) | const |
return the interface index
Definition at line 215 of file NetdeviceController.cc.
std::string senf::NetdeviceController::interfaceName | ( | ) | const |
return interface name
Definition at line 63 of file NetdeviceController.cc.
void senf::NetdeviceController::interfaceName | ( | std::string const & | newName | ) |
set interface name
Changes the name of the interface. Note, that setting the name is a privileged operation. It is only allowed when the interface is not up. If the interface is up, this call will cause an SystemException to be thrown.
Definition at line 76 of file NetdeviceController.cc.
bool senf::NetdeviceController::isUp | ( | ) | const |
return true
if interface is up
Definition at line 160 of file NetdeviceController.cc.
|
static |
Definition at line 273 of file NetdeviceController.cc.
int senf::NetdeviceController::mtu | ( | ) | const |
return the Maximum Transmission Unit
Definition at line 104 of file NetdeviceController.cc.
void senf::NetdeviceController::mtu | ( | int | new_mtu | ) |
set the Maximum Transmission Unit
Set the MTU (Maximum Transfer Unit) of the device. Note, that this is a privileged operation. Setting the MTU to too small values may cause kernel crashes.
Definition at line 113 of file NetdeviceController.cc.
bool senf::NetdeviceController::promisc | ( | ) | const |
return true
if interface is in promiscuous mode
Definition at line 139 of file NetdeviceController.cc.
void senf::NetdeviceController::promisc | ( | bool | mode | ) |
enable/disable promiscuous mode of the interface
Note, that this is a privileged operation.
Definition at line 148 of file NetdeviceController.cc.
|
static |
Definition at line 262 of file NetdeviceController.cc.
void senf::NetdeviceController::reset | ( | std::string const & | interface_name | ) |
reset the ifindex_ from the given iface_name (i.e. after USB Ethernet unplug/plug
Definition at line 54 of file NetdeviceController.cc.
|
static |
Definition at line 249 of file NetdeviceController.cc.
void senf::NetdeviceController::timestamping | ( | int | txType, |
int | rxFilter | ||
) |
configures hw timestamping for RX and/or TX
Note, that this is a privileged operation.
Definition at line 206 of file NetdeviceController.cc.
int senf::NetdeviceController::txqueuelen | ( | ) | const |
return the Tx Queue Length
Definition at line 121 of file NetdeviceController.cc.
void senf::NetdeviceController::txqueuelen | ( | int | new_mtu | ) |
set the Tx Queue Length
Set the Tx Queue Length (in Packets) MTU of the device. Note, that this is a privileged operation.
Definition at line 130 of file NetdeviceController.cc.
void senf::NetdeviceController::up | ( | ) |
ifconfig up interface
Definition at line 169 of file NetdeviceController.cc.
|
protected |
Definition at line 121 of file NetdeviceController.hh.
|
protected |
Definition at line 120 of file NetdeviceController.hh.