//TODO implement Netlink singleton per pid
public:
/**
- * Create network interface object for the ifname in the container (network namespace)
+ * Create network interface object for the @b ifname in the container (network namespace)
*/
NetworkInterface(const std::string& ifname, pid_t pid = 0) :
mIfname(ifname),
NetStatus status() const;
/**
- * Create network interface in container identified by @mContainerPid
+ * Create network interface in container identified by @ref mContainerPid.
*
- * Equivalent to: ip link add @mIfname type @type [...]
- * Create pair of virtual ethernet interfaces
- * ip link add @mIfname type veth peer name @peerif
- * Create bridge interface
- * ip link add @mIfname type bridge
- * Create psedo-ethernet interface on existing one
- * ip link add @mIfname type macvlan link @peerif [mode @a mode]
+ * Equivalent to: ip link add @ref mIfname type @b type [...]
+ *
+ * Create pair of virtual ethernet interfaces:
+ * - ip link add @ref mIfname type veth peer name @b peerif
+ *
+ * Create bridge interface:
+ * - ip link add @ref mIfname type bridge
+ *
+ * Create pseudo-ethernet interface on existing one:
+ * - ip link add @ref mIfname type macvlan link @b peerif [mode @b mode]
*/
void create(InterfaceType type, const std::string& peerif = "", MacVLanMode mode = MacVLanMode::PRIVATE);
/**
- * Delete interface
- * Equivalent to: ip link delete @mIfname
+ * Delete interface.
+ * Equivalent to: ip link delete @ref mIfname
*/
void destroy();
/**
- * Move interface to container
- * Equivalent to: ip link set dev @mIfname netns @pid
+ * Move interface to container.
+ * Equivalent to: ip link set dev @ref mIfname netns @b pid
*/
void moveToContainer(pid_t pid);
/**
- * Rename interface name
- * Equivalent to: ip link set dev @oldif name @mIfname
+ * Rename interface name.
+ * Equivalent to: ip link set dev @b oldif name @ref mIfname
*/
void renameFrom(const std::string& oldif);
/**
- * Add interface to the bridge
- * Equivalent to: ip link set @mIfname master @bridge
+ * Add interface to the bridge.
+ * Equivalent to: ip link set @ref mIfname master @b bridge
*/
void addToBridge(const std::string& bridge);
/**
- * Remove insterface from the bridge
- * Equivalent to: ip link set @mIfname nomaster
+ * Remove insterface from the bridge.
+ * Equivalent to: ip link set @ref mIfname nomaster
*/
void delFromBridge();
/**
* Set or get interface attributes in one netlink call.
- * Supported attributes: see @AttrNames
+ * Supported attributes: see @ref AttrName
*/
void setAttrs(const Attrs& attrs);
Attrs getAttrs() const;
/**
- * Add inet address to the interface
- * Equivalent to: ip addr add @addr dev @mIfname
+ * Add inet address to the interface.
+ * Equivalent to: ip addr add @b addr dev @ref mIfname
*/
void addInetAddr(const InetAddr& addr);
/**
- * Remove inet address from the interface
- * Equivalent to: ip addr del @addr dev @mIfname
+ * Remove inet address from the interface.
+ * Equivalent to: ip addr del @b addr dev @ref mIfname
*/
void delInetAddr(const InetAddr& addr);
/**
- * Retrieve all inet addresses for the interface
+ * Retrieve all inet addresses for the interface.
* Equivalent to: ip addr show, ip -6 addr show
*/
std::vector<InetAddr> getInetAddressList() const;
/**
- * Add route to specified routing table
- * Equivalent to: ip route add @route.dst.addr/@route.dst.prefix dev @mIfname (if route.src.prefix=0)
+ * Add route to specified routing table.
+ * Equivalent to: ip route add @b route.dst.addr/@b route.dst.prefix dev @ref mIfname (if route.src.prefix=0)
*/
void addRoute(const Route& route, const RoutingTable rt = RoutingTable::MAIN);
/**
- * Remove route from specified routing table
- * Equivalent to: ip route del @route.dst.addr dev @mIfname
+ * Remove route from specified routing table.
+ * Equivalent to: ip route del @b route.dst.addr dev @ref mIfname
*/
void delRoute(const Route& route, const RoutingTable rt = RoutingTable::MAIN);
/**
- * Retrieve routing table for the interface
- * Equivalent to: ip route show dev @mIfname table @rt
+ * Retrieve routing table for the interface.
+ * Equivalent to: ip route show dev @ref mIfname table @b rt
*/
std::vector<Route> getRoutes(const RoutingTable rt = RoutingTable::MAIN) const;
/**
- * Set interface up
- * Equivalent to: ip link set @mIfname up
+ * Set interface up.
+ * Equivalent to: ip link set @ref mIfname up
*/
void up();
/**
- * Set interface down
- * Equivalent to: ip link set @mInface down
+ * Set interface down.
+ * Equivalent to: ip link set @ref mIfname down
*/
void down();
/**
- * Set MAC address attribute
- * Equivalent to: ip link set @mIfname address @macaddr
- * @macaddr in format AA:BB:CC:DD:FF:GG
+ * Set MAC address attribute.
+ * Equivalent to: ip link set @ref mIfname address @b macaddr (@b macaddr in format AA:BB:CC:DD:FF:GG)
*
* Note: two lower bits of first byte (leftmost) specifies MAC address class:
- * b1: 0=unicast, 1=broadcast
- * b2: 0=global, 1=local
- * in most cases should be b2=0, b1=1
- * (see: https://en.wikipedia.org/wiki/MAC_address)
+ * - b1: 0=unicast, 1=broadcast
+ * - b2: 0=global, 1=local
+ *
+ * In most cases should be b2=0, b1=1, (see: https://en.wikipedia.org/wiki/MAC_address)
*/
void setMACAddress(const std::string& macaddr);
/**
- * Set MTU attribute
- * Equivalent to: ip link set @mIfname mtu @mtu
+ * Set MTU attribute.
+ * Equivalent to: ip link set @ref mIfname mtu @b mtu
*/
void setMTU(int mtu);
/**
- * Set TxQ attribute
- * Equivalent to: ip link set @mIfname txqueue @txlen
+ * Set TxQ attribute.
+ * Equivalent to: ip link set @ref mIfname txqueue @b txlen
*/
void setTxLength(int txlen);
/**
- * Get list of network interafece names
+ * Get list of network interafece names.
* Equivalent to: ip link show
*/
static std::vector<std::string> getInterfaces(pid_t initpid);
/**
- * Get list of routes (specified routing table)
- * Equivalent to: ip route show table @rt
+ * Get list of routes (specified routing table).
+ * Equivalent to: ip route show table @b rt
*/
static std::vector<Route> getRoutes(pid_t initpid, const RoutingTable rt = RoutingTable::MAIN);