mirror of
https://github.com/mfontanini/libtins
synced 2026-01-25 19:51:34 +01:00
Added another overload of Utils::route_entries and fixed a bug in Utils::network_interfaces.
This commit is contained in:
@@ -168,13 +168,20 @@ namespace Tins {
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retrieves entries int the routing table.
|
||||
* \brief Retrieves entries in the routing table.
|
||||
*
|
||||
* \brief output ForwardIterator in which entries will be stored.
|
||||
*/
|
||||
template<class ForwardIterator>
|
||||
void route_entries(ForwardIterator output);
|
||||
|
||||
/**
|
||||
* \brief Retrieves entries in the routing table.
|
||||
*
|
||||
* \return a vector which contains all of the route entries.
|
||||
*/
|
||||
std::vector<RouteEntry> route_entries();
|
||||
|
||||
/** \brief Returns the 32 bit crc of the given buffer.
|
||||
*
|
||||
* \param data The input buffer.
|
||||
|
||||
@@ -62,12 +62,12 @@ struct InterfaceCollector {
|
||||
#ifdef WIN32
|
||||
bool operator() (PIP_ADAPTER_ADDRESSES addr) {
|
||||
ifaces.insert(addr->AdapterName);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
bool operator() (struct ifaddrs *addr) {
|
||||
ifaces.insert(addr->ifa_name);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@@ -121,6 +121,12 @@ HWAddress<6> resolve_hwaddr(IPv4Address ip, PacketSender &sender) {
|
||||
return resolve_hwaddr(sender.default_interface(), ip, sender);
|
||||
}
|
||||
|
||||
std::vector<RouteEntry> route_entries() {
|
||||
std::vector<RouteEntry> entries;
|
||||
route_entries(std::back_inserter(entries));
|
||||
return entries;
|
||||
}
|
||||
|
||||
bool gateway_from_ip(IPv4Address ip, IPv4Address &gw_addr) {
|
||||
typedef std::vector<RouteEntry> entries_type;
|
||||
entries_type entries;
|
||||
|
||||
Reference in New Issue
Block a user