1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-30 13:34:27 +01:00

Add Utils::route6_entries

This commit is contained in:
Matias Fontanini
2016-03-06 19:18:33 -08:00
parent c082dfad67
commit 4dcef0f15d
8 changed files with 161 additions and 17 deletions

View File

@@ -108,6 +108,7 @@ private:
void skip_line(std::istream& input);
bool from_hex(const std::string& str, uint32_t& result);
bool from_hex(const std::string& str, std::string& result);
template<bool, typename T = void>
struct enable_if {

View File

@@ -55,6 +55,13 @@ public:
*/
typedef const uint8_t* const_iterator;
/**
* \brief Constructs an IPv6 address from a prefix length
*
* \param prefix_length The length of the prefix
*/
static IPv6Address from_prefix_length(uint32_t prefix_length);
/**
* \brief Default constructor.
* Initializes this IPv6 address to "::"

View File

@@ -36,6 +36,7 @@
#include <vector>
#include <stdint.h>
#include "ip_address.h"
#include "ipv6_address.h"
#include "internals.h"
// Fix for Windows interface define on combaseapi.h
@@ -89,6 +90,36 @@ struct RouteEntry {
int metric;
};
/**
* Struct that represents an entry the IPv6 routing table
*/
struct Route6Entry {
/**
* This interface's name.
*/
std::string interface;
/**
* This route entry's destination.
*/
IPv6Address destination;
/**
* This route entry's subnet mask.
*/
IPv6Address mask;
/**
* This route entry's next hop.
*/
IPv6Address next_hop;
/**
* This route entry's metric.
*/
int metric;
};
/**
* \brief Resolves a domain name and returns its corresponding ip address.
*
@@ -176,6 +207,13 @@ void route_entries(ForwardIterator output);
*/
TINS_API std::vector<RouteEntry> route_entries();
/**
* \brief Retrieves entries in the routing table.
*
* \return a vector which contains all of the route entries.
*/
TINS_API std::vector<Route6Entry> route6_entries();
/** \brief Returns the 32 bit crc of the given buffer.
*
* \param data The input buffer.