OpenSDN source code
rtarget_route.h
Go to the documentation of this file.
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"
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  const RTargetPrefix &GetPrefix() const {
29  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  virtual bool IsLess(const DBEntry &genrhs) const {
42  const RTargetRoute &rhs = static_cast<const RTargetRoute &>(genrhs);
43  int cmp = CompareTo(rhs);
44  return (cmp < 0);
45  }
46 
47 private:
50 };
51 
52 #endif // SRC_BGP_RTARGET_RTARGET_ROUTE_H_
boost::asio::ip::address IpAddress
Definition: address.h:14
std::unique_ptr< DBRequestKey > KeyPtr
Definition: db_entry.h:25
RTargetRoute(const RTargetPrefix &prefix)
virtual void BuildProtoPrefix(BgpProtoPrefix *prefix, const BgpAttr *attr=NULL, uint32_t label=0, uint32_t l3_label=0) const
virtual std::string ToString() const
virtual KeyPtr GetDBRequestKey() const
RTargetPrefix prefix_
Definition: rtarget_route.h:48
virtual void SetKey(const DBRequestKey *reqkey)
virtual bool IsLess(const DBEntry &genrhs) const
Definition: rtarget_route.h:41
virtual void BuildBgpProtoNextHop(std::vector< uint8_t > &nh, IpAddress nexthop) const
DISALLOW_COPY_AND_ASSIGN(RTargetRoute)
const RTargetPrefix & GetPrefix() const
Definition: rtarget_route.h:28
virtual int CompareTo(const Route &rhs) const
Definition: route.h:15