Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef SRC_BGP_L3VPN_INETVPN_ROUTE_H_ 6 : #define SRC_BGP_L3VPN_INETVPN_ROUTE_H_ 7 : 8 : #include <set> 9 : #include <string> 10 : #include <vector> 11 : 12 : #include "base/util.h" 13 : #include "base/address.h" 14 : #include "bgp/bgp_attr.h" 15 : #include "bgp/bgp_attr_base.h" 16 : #include "bgp/bgp_route.h" 17 : #include "bgp/l3vpn/inetvpn_address.h" 18 : #include "net/bgp_af.h" 19 : 20 : class InetVpnRoute : public BgpRoute { 21 : public: 22 : explicit InetVpnRoute(const InetVpnPrefix &prefix); 23 : virtual int CompareTo(const Route &rhs) const; 24 : 25 : virtual std::string ToString() const; 26 : 27 2459514 : const InetVpnPrefix &GetPrefix() const { 28 2459514 : return prefix_; 29 : } 30 1 : virtual RouteDistinguisher GetRouteDistinguisher() const { 31 1 : return prefix_.route_distinguisher(); 32 : } 33 : 34 : virtual KeyPtr GetDBRequestKey() const; 35 : virtual void SetKey(const DBRequestKey *reqkey); 36 : virtual void BuildProtoPrefix(BgpProtoPrefix *prefix, 37 : const BgpAttr *attr = NULL, 38 : uint32_t label = 0, 39 : uint32_t l3_label = 0) const; 40 : virtual void BuildBgpProtoNextHop(std::vector<uint8_t> &nh, 41 : IpAddress nexthop) const; 42 : 43 2031722 : virtual bool IsLess(const DBEntry &genrhs) const { 44 2031722 : const InetVpnRoute &rhs = static_cast<const InetVpnRoute &>(genrhs); 45 2031722 : int cmp = CompareTo(rhs); 46 2031313 : return (cmp < 0); 47 : } 48 : 49 : virtual bool IsMoreSpecific(const std::string &match) const; 50 : virtual bool IsLessSpecific(const std::string &match) const; 51 : 52 : private: 53 : InetVpnPrefix prefix_; 54 : DISALLOW_COPY_AND_ASSIGN(InetVpnRoute); 55 : }; 56 : 57 : #endif // SRC_BGP_L3VPN_INETVPN_ROUTE_H_