|
libbgp
0.6
A C++ BGP Library.
|
IPv6 Route/Prefix related utilities. More...
#include <prefix6.h>


Public Member Functions | |
| Prefix6 () | |
| Construct a new Prefix6 object. | |
| Prefix6 (const uint8_t prefix[16], uint8_t length) | |
| Construct a new Prefix6 object. More... | |
| Prefix6 (const char *prefix, uint8_t length) | |
| Construct a new Prefix6 object. More... | |
| ssize_t | parse (const uint8_t *buffer, size_t buf_sz) |
| Parse a IPv6 NLRI prefix from buffer. More... | |
| ssize_t | write (uint8_t *buffer, size_t buf_sz) const |
| Write a IPv6 prefix to NLRI buffer. More... | |
| bool | includes (const uint8_t address[16]) const |
| Test if an address is inside this prefix. More... | |
| bool | includes (const char *address) const |
| Test if an address is inside this prefix. More... | |
| bool | includes (const Prefix &other) const |
| Test if another prefix is inside this prefix. More... | |
| bool | includes (const uint8_t prefix[16], uint8_t length) const |
| Test if another prefix is inside this prefix. More... | |
| bool | includes (const char *prefix, uint8_t length) const |
| Test if another prefix is inside this prefix. More... | |
| bool | operator== (const Prefix &other) const |
| Test if two routes are equals. More... | |
| bool | operator> (const Prefix &other) const |
| bool | operator< (const Prefix &other) const |
| bool | operator>= (const Prefix &other) const |
| bool | operator<= (const Prefix &other) const |
| bool | operator!= (const Prefix &other) const |
| bool | set (const uint8_t prefix[16], uint8_t length) |
| Set route. More... | |
| bool | setPrefix (const uint8_t prefix[16]) |
| Set prefix. More... | |
| bool | setLength (uint8_t length) |
| Set netmask. More... | |
| void | getPrefix (uint8_t prefix[16]) const |
| Get prefix. More... | |
| uint8_t | getLength () const |
| Get netmask. More... | |
| void | getMask (uint8_t mask[16]) const |
| Get netmask. More... | |
Static Public Member Functions | |
| static bool | Includes (const uint8_t prefix[16], uint8_t length, const uint8_t address[16]) |
| Test if an address is inside a prefix. More... | |
| static bool | Includes (const uint8_t prefix_a[16], uint8_t length_a, const uint8_t prefix_b[16], uint8_t length_b) |
| Test if a prefix is inside another prefix. More... | |
Additional Inherited Members | |
Public Attributes inherited from libbgp::Prefix | |
| Afi | afi |
| libbgp::Prefix6::Prefix6 | ( | const uint8_t | prefix[16], |
| uint8_t | length | ||
| ) |
Construct a new Prefix6 object.
| prefix | Prefix as bytes array. |
| length | Netmask of the prefix in CIDR notation. |
Definition at line 215 of file prefix6.cc.
| libbgp::Prefix6::Prefix6 | ( | const char * | prefix, |
| uint8_t | length | ||
| ) |
Construct a new Prefix6 object.
| prefix | Prefix as IPv6 string. |
| length | Netmask of the prefix in CIDR notation. |
Definition at line 227 of file prefix6.cc.
| uint8_t libbgp::Prefix6::getLength | ( | ) | const |
Get netmask.
Definition at line 459 of file prefix6.cc.
| void libbgp::Prefix6::getMask | ( | uint8_t | mask[16] | ) | const |
Get netmask.
| mask | Bytes array to store the netmask. |
| bad_route_length | Netmask invalid. |
Definition at line 469 of file prefix6.cc.
References libbgp::cidr_to_mask6().
| void libbgp::Prefix6::getPrefix | ( | uint8_t | prefix[16] | ) | const |
Get prefix.
| prefix | Bytes array to store the prefix. |
Definition at line 450 of file prefix6.cc.
|
static |
Test if an address is inside a prefix.
| prefix | The prefix. |
| length | The netmask of the prefix in CIDR notation. |
| address | The address to test against. |
Definition at line 279 of file prefix6.cc.
References libbgp::mask_ipv6().
Referenced by includes().
|
static |
Test if a prefix is inside another prefix.
| prefix_a | The prefix. |
| length_a | The netmask of the prefix in CIDR notation. |
| prefix_b | The orefix to test against. |
| length_b | The netmask of the prefix to test against in CIDR notation. |
Definition at line 298 of file prefix6.cc.
References libbgp::mask_ipv6().
| bool libbgp::Prefix6::includes | ( | const uint8_t | address[16] | ) | const |
Test if an address is inside this prefix.
| address | The address. |
Definition at line 315 of file prefix6.cc.
References Includes().
Referenced by includes().
| bool libbgp::Prefix6::includes | ( | const char * | address | ) | const |
Test if an address is inside this prefix.
| address | The address in IPv6 string format. |
Definition at line 326 of file prefix6.cc.
References includes().
|
virtual |
Test if another prefix is inside this prefix.
| other | The other prefix. |
Implements libbgp::Prefix.
Definition at line 339 of file prefix6.cc.
| bool libbgp::Prefix6::includes | ( | const uint8_t | prefix[16], |
| uint8_t | length | ||
| ) | const |
Test if another prefix is inside this prefix.
| prefix | The other prefix. |
| length | Netmask of the other prefix in CIDR notation. |
Definition at line 353 of file prefix6.cc.
References Includes().
| bool libbgp::Prefix6::includes | ( | const char * | prefix, |
| uint8_t | length | ||
| ) | const |
Test if another prefix is inside this prefix.
| prefix | The other prefix in IPv6 string notation. |
| length | Netmask of the other prefix in CIDR notation. |
Definition at line 365 of file prefix6.cc.
References Includes().
|
virtual |
Test if two routes are equals.
| other | The other route object. |
Implements libbgp::Prefix.
Definition at line 378 of file prefix6.cc.
|
virtual |
Parse a IPv6 NLRI prefix from buffer.
| buffer | Buffer to parse from. |
| buf_sz | Size of the buffer. |
| -1 | Failed to parse prefix. |
| >=0 | Bytes read. |
Implements libbgp::Prefix.
Definition at line 242 of file prefix6.cc.
| bool libbgp::Prefix6::set | ( | const uint8_t | prefix[16], |
| uint8_t | length | ||
| ) |
Set route.
| prefix | Prefix. |
| length | The netmask in CIDR notation. |
Definition at line 416 of file prefix6.cc.
References setLength(), and setPrefix().
| bool libbgp::Prefix6::setLength | ( | uint8_t | length | ) |
Set netmask.
| length | The netmask in CIDR notation. |
Definition at line 439 of file prefix6.cc.
Referenced by set().
| bool libbgp::Prefix6::setPrefix | ( | const uint8_t | prefix[16] | ) |
Set prefix.
| prefix | Prefix to set. |
Definition at line 427 of file prefix6.cc.
Referenced by set().
|
virtual |
Write a IPv6 prefix to NLRI buffer.
| buffer | Buffer to write to. |
| buf_sz | Size of the buffer (max write size). |
| -1 | Failed to write. |
| >=0 | Bytes written. |
Implements libbgp::Prefix.
Definition at line 262 of file prefix6.cc.
1.8.13