15 #include <unordered_map> 35 hash = this->prefix | (this->length << 4);
38 this->prefix = prefix;
39 this->length = length;
40 hash = this->prefix | (this->length << 4);
44 return prefix == other.prefix && length == other.length;
69 BgpRib4Entry (
Prefix4 r, uint32_t src,
const std::vector<std::shared_ptr<BgpPathAttrib>> attribs);
78 uint32_t getNexthop()
const;
81 typedef std::unordered_multimap<BgpRib4EntryKey, BgpRib4Entry, BgpRib4EntryHash> rib4_t;
93 const std::vector<BgpRib4Entry> insert(
BgpLogHandler *logger,
const std::vector<Prefix4> &routes, uint32_t nexthop, int32_t weight = 0);
99 std::pair<const BgpRib4Entry*, bool> insert(uint32_t src_router_id,
const Prefix4 &route,
const std::vector<std::shared_ptr<BgpPathAttrib>> &attrib, int32_t weight, uint32_t ibgp_asn);
104 std::pair<std::vector<BgpRib4Entry>, std::vector<Prefix4>> insert(uint32_t src_router_id,
const std::vector<Prefix4> &routes,
const std::vector<std::shared_ptr<BgpPathAttrib>> &attrib, int32_t weight, uint32_t ibgp_asn);
107 std::pair<bool, const BgpRib4Entry*> withdraw(uint32_t src_router_id,
const Prefix4 &route);
110 std::pair<std::vector<Prefix4>, std::vector<BgpRib4Entry>> discard(uint32_t src_router_id);
116 const BgpRib4Entry* lookup(uint32_t src_router_id, uint32_t dest)
const;
119 const rib4_t &
get()
const;
121 rib4_t::iterator find_best (
const Prefix4 &prefix);
122 rib4_t::iterator find_entry (
const Prefix4 &prefix, uint32_t src);
123 std::pair<const BgpRib4Entry*, bool> insertPriv(uint32_t src_router_id,
const Prefix4 &route,
const std::vector<std::shared_ptr<BgpPathAttrib>> &attrib, int32_t weight, uint32_t ibgp_asn);
125 std::recursive_mutex mutex;
uint32_t getPrefix() const
Get prefix.
The BgpRib4 (IPv4 BGP Routing Information Base) class.
Hasher for the Rib4 entry key.
Prefix4 route
The prefix of this entry.
Key for the Rib4 entry map.
The base of BGP RIB entry.
uint8_t getLength() const
Get netmask.
IPv4 Route/Prefix related utilities.
IPv4 Route/Prefix related utilities.