92 virtual BgpFilterOP apply(
const Prefix &prefix,
const std::vector<std::shared_ptr<BgpPathAttrib>> &attribs) = 0;
101 template <
typename T>
118 BgpFilterOP apply(
const Prefix &prefix, __attribute__((unused))
const std::vector<std::shared_ptr<BgpPathAttrib>> &attribs) {
119 if (prefix.afi != this->prefix.afi)
return NOP;
120 const T &prefix_t =
dynamic_cast<const T &
>(prefix);
121 switch (match_type) {
122 case M_EQ:
return prefix_t == this->prefix ? op :
NOP;
123 case M_NE:
return prefix_t != this->prefix ? op :
NOP;
124 case M_GT:
return prefix_t != this->prefix && prefix_t.
includes(this->prefix) ? op :
NOP;
125 case M_LT:
return prefix_t != this->prefix && this->prefix.
includes(prefix_t) ? op :
NOP;
126 case M_GE:
return prefix_t.includes(this->prefix) ? op :
NOP;
184 NO_EXPORT = 0xFFFFFF01,
185 NO_ADVERTISE = 0xFFFFFF02,
186 NO_EXPORT_SUBCONFED = 0xFFFFFF03
223 template <
typename T>
225 const T &rule_typed =
dynamic_cast<const T&
> (rule);
226 rules.push_back(std::shared_ptr<BgpFilterRule>(
new T(rule_typed)));
229 %
template(appendAsPathRule) append<BgpFilterRuleAsPath>;
230 %
template(appendCommunityRule) append<BgpFilterRuleCommunity>;
231 %
template(appendRoute4Rule) append<BgpFilterRuleRoute4>;
232 %
template(appendRoute6Rule) append<BgpFilterRuleRoute6>;
237 std::vector<std::shared_ptr<BgpFilterRule>> rules;
243 #endif // BGP_FILTER_H_
IPv6 Route/Prefix related utilities.
BgpFilterOP
The filter operation.
The AS_PATH filtering rule.
BgpFilterRuleRouteMatchType
Matching type of IP prefix rule.
virtual BgpFilterOP apply(const Prefix &prefix, const std::vector< std::shared_ptr< BgpPathAttrib >> &attribs)=0
Apply the rule on a route.
The IPv4 route filtering rule.
virtual ~BgpFilterRuleRoute()
Destroy the BgpFilterRuleRoute object.
virtual bool includes(const Prefix &other) const =0
Test if another prefix is inside this prefix.
The base of BgpFilterRule.
BgpFilterRuleCommunityMatchType
Matching type of COMMUNITY rule.
BgpFilterRuleRoute()
Construct a new BgpFilterRuleRoute object.
IPv4 Route/Prefix related utilities.
IPv4 Route/Prefix related utilities.
BgpFilterRuleType
Type of filter rule.
uint32_t asn
The ASN of this entry.
IPv6 Route/Prefix related utilities.
Route/Prefix related utilities.
BgpFilterRuleAsPathMatchType
Matching type of AS_PATH rule.
The prefix filtering rule.
T prefix
The route prefix.
The BGP filtering rules set.
void append(const BgpFilterRule &rule)
Append a rule to the rule set.
BgpWellKnownCommunity
BGP well-known communities.
The IPv6 route filtering rule.