libbgp  0.6
A C++ BGP Library.
Classes | Functions
prefix6.h File Reference

IPv6 Route/Prefix related utilities. More...

#include <stdint.h>
#include <unistd.h>
#include "prefix.h"
Include dependency graph for prefix6.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  libbgp::Prefix6
 IPv6 Route/Prefix related utilities. More...
 

Functions

bool libbgp::cidr_to_mask6 (uint8_t src, uint8_t dst[16])
 Convert IPv6 mask in CIDR notation to bytes array. More...
 
bool libbgp::mask_ipv6 (const uint8_t prefix[16], uint8_t mask, uint8_t masked_addr[16])
 Mask a IPv6 address with given netmask. More...
 
bool libbgp::v6addr_is_zero (const uint8_t prefix[16])
 Test if a IPv6 addresss is all zero. More...
 

Detailed Description

IPv6 Route/Prefix related utilities.

Author
Nato Morichika nat@n.nosp@m.at.m.nosp@m.oe
Version
0.1
Date
2019-07-21

Definition in file prefix6.h.

Function Documentation

◆ cidr_to_mask6()

bool libbgp::cidr_to_mask6 ( uint8_t  src,
uint8_t  dst[16] 
)

Convert IPv6 mask in CIDR notation to bytes array.

Parameters
srcIPv6 mask in CIDR notation.
dstBytes array to write to.
Returns
true Converted.
false Failed to convert.

Definition at line 158 of file prefix6.cc.

References libbgp::cidr_to_mask6().

Referenced by libbgp::cidr_to_mask6(), and libbgp::Prefix6::getMask().

◆ mask_ipv6()

bool libbgp::mask_ipv6 ( const uint8_t  prefix[16],
uint8_t  mask,
uint8_t  masked_addr[16] 
)

Mask a IPv6 address with given netmask.

Parameters
prefixPrefix to mask.
maskIPv6 mask in CIDR notation.
masked_addrBytes array to store masked address.
Returns
true Masked.
false Failed to mask.

Definition at line 173 of file prefix6.cc.

References libbgp::mask_ipv6().

Referenced by libbgp::Prefix6::Includes(), and libbgp::mask_ipv6().

◆ v6addr_is_zero()

bool libbgp::v6addr_is_zero ( const uint8_t  prefix[16])

Test if a IPv6 addresss is all zero.

Parameters
prefixThe prefix to test.
Returns
true Address is all zero;
false Address is not all zero.

Definition at line 195 of file prefix6.cc.

References libbgp::v6addr_is_zero().

Referenced by libbgp::BgpPathAttribMpReachNlriIpv6::length(), and libbgp::v6addr_is_zero().