libbgp  0.6
A C++ BGP Library.
Functions | Variables
prefix4.cc File Reference

IPv4 Route/Prefix related utilities. More...

#include "prefix4.h"
#include "value-op.h"
#include <arpa/inet.h>
Include dependency graph for prefix4.cc:

Go to the source code of this file.

Functions

uint32_t libbgp::cidr_to_mask (uint8_t cidr)
 Convert netmask in CIDR notation to network bytes integer. More...
 

Variables

const uint32_t libbgp::CIDR_MASK_MAP [33]
 

Detailed Description

IPv4 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 prefix4.cc.

Function Documentation

◆ cidr_to_mask()

uint32_t libbgp::cidr_to_mask ( uint8_t  cidr)

Convert netmask in CIDR notation to network bytes integer.

Parameters
cidrThe netmask in CIDR notation.
Returns
uint32_t The netmask in network byte order.
Exceptions
bad_route_lengthNetmask invalid.

Definition at line 33 of file prefix4.cc.

References libbgp::cidr_to_mask().

Referenced by libbgp::cidr_to_mask().

Variable Documentation

◆ CIDR_MASK_MAP

const uint32_t libbgp::CIDR_MASK_MAP[33]
Initial value:
= {
0x00000000, 0x00000080, 0x000000c0, 0x000000e0, 0x000000f0, 0x000000f8,
0x000000fc, 0x000000fe, 0x000000ff, 0x000080ff, 0x0000c0ff, 0x0000e0ff,
0x0000f0ff, 0x0000f8ff, 0x0000fcff, 0x0000feff, 0x0000ffff, 0x0080ffff,
0x00c0ffff, 0x00e0ffff, 0x00f0ffff, 0x00f8ffff, 0x00fcffff, 0x00feffff,
0x00ffffff, 0x80ffffff, 0xc0ffffff, 0xe0ffffff, 0xf0ffffff, 0xf8ffffff,
0xfcffffff, 0xfeffffff, 0xffffffff
}

Definition at line 17 of file prefix4.cc.