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