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