16 #include <unordered_map> 37 uint64_t prefix_pre = 0;
38 memcpy(&prefix_pre, this->prefix, 8);
43 return memcmp(other.prefix, prefix, 16) == 0 &&
44 length == other.length;
69 const uint8_t nexthop_linklocal[16],
70 const std::vector<std::shared_ptr<BgpPathAttrib>> attribs);
82 uint8_t nexthop_global[16];
89 uint8_t nexthop_linklocal[16];
92 typedef std::unordered_multimap<BgpRib6EntryKey, BgpRib6Entry, BgpRib6EntryHash> rib6_t;
104 const Prefix6 &route,
const uint8_t nexthop_global[16],
105 const uint8_t nexthop_linklocal[16], int32_t weight = 0);
107 const std::vector<BgpRib6Entry> insert(
BgpLogHandler *logger,
108 const std::vector<Prefix6> &routes,
const uint8_t nexthop_global[16],
109 const uint8_t nexthop_linklocal[16], int32_t weight = 0);
115 std::pair<const BgpRib6Entry*, bool> insert(uint32_t src_router_id,
117 const uint8_t nexthop_global[16],
const uint8_t nexthop_linklocal[16],
118 const std::vector<std::shared_ptr<BgpPathAttrib>> &attrib, int32_t weight,
124 std::pair<std::vector<BgpRib6Entry>, std::vector<Prefix6>> insert(
125 uint32_t src_router_id,
const std::vector<Prefix6> &routes,
126 const uint8_t nexthop_global[16],
const uint8_t nexthop_linklocal[16],
127 const std::vector<std::shared_ptr<BgpPathAttrib>> &attrib, int32_t weight,
131 std::pair<bool, const BgpRib6Entry*> withdraw(uint32_t src_router_id,
const Prefix6 &route);
134 std::pair<std::vector<Prefix6>, std::vector<BgpRib6Entry>> discard(uint32_t src_router_id);
137 const BgpRib6Entry* lookup(
const uint8_t dest[16])
const;
140 const BgpRib6Entry* lookup(uint32_t src_router_id,
const uint8_t dest[16])
const;
143 const rib6_t &
get()
const;
145 rib6_t::iterator find_best (
const Prefix6 &prefix);
146 rib6_t::iterator find_entry (
const Prefix6 &prefix, uint32_t src);
148 std::pair<const BgpRib6Entry*, bool> insertPriv(uint32_t src_router_id,
150 const uint8_t nexthop_global[16],
const uint8_t nexthop_linklocal[16],
151 const std::vector<std::shared_ptr<BgpPathAttrib>> &attrib,
152 int32_t weight, uint32_t ibgp_asn);
155 std::recursive_mutex mutex;
IPv6 Route/Prefix related utilities.
Hasher for the Rib6 entry key.
Key for the Rib6 entry map.
The base of BGP RIB entry.
uint8_t getLength() const
Get netmask.
The BgpRib6 (IPv6 BGP Routing Information Base) class.
IPv6 Route/Prefix related utilities.
void getPrefix(uint8_t prefix[16]) const
Get prefix.
Prefix6 route
The prefix of this entry.