1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added another overload of Utils::resolv_hwaddr.

This commit is contained in:
Matias Fontanini
2013-04-23 15:19:48 -03:00
parent ec05a49cce
commit 7e85058ef1
2 changed files with 19 additions and 0 deletions

View File

@@ -129,6 +129,21 @@ namespace Tins {
*/
HWAddress<6> resolve_hwaddr(const NetworkInterface &iface,
IPv4Address ip, PacketSender &sender);
/**
* \brief Resolves the hardware address for a given ip.
*
* If the address can't be resolved, a std::runtime_error
* exception is thrown.
*
* This method sends and receives the packet through
* PacketSender::default_interface.
*
* \param ip The ip to resolve, in integer format.
* \param sender The sender to use to send and receive the ARP requests.
* \return HWAddress<6> containing the resolved hardware address.
*/
HWAddress<6> resolve_hwaddr(IPv4Address ip, PacketSender &sender);
/** \brief List all network interfaces.
*

View File

@@ -117,6 +117,10 @@ HWAddress<6> resolve_hwaddr(const NetworkInterface &iface, IPv4Address ip, Packe
throw std::runtime_error("Could not resolve hardware address");
}
HWAddress<6> resolve_hwaddr(IPv4Address ip, PacketSender &sender) {
return resolve_hwaddr(sender.default_interface(), ip, sender);
}
bool gateway_from_ip(IPv4Address ip, IPv4Address &gw_addr) {
typedef std::vector<RouteEntry> entries_type;
entries_type entries;