OpenSDN source code
inetvpn_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_L3VPN_INETVPN_ROUTE_H_
7 #define SRC_BGP_L3VPN_INETVPN_ROUTE_H_
8 
9 #include <set>
10 #include <string>
11 #include <vector>
12 
13 #include "base/util.h"
14 #include "base/address.h"
15 #include "bgp/bgp_attr.h"
16 #include "bgp/bgp_attr_base.h"
17 #include "bgp/bgp_route.h"
19 #include "net/bgp_af.h"
20 
21 class InetVpnRoute : public BgpRoute {
22 public:
23  explicit InetVpnRoute(const InetVpnPrefix &prefix);
24  virtual int CompareTo(const Route &rhs) const;
25 
26  virtual std::string ToString() const;
27 
28  const InetVpnPrefix &GetPrefix() const {
29  return prefix_;
30  }
33  }
34 
35  virtual KeyPtr GetDBRequestKey() const;
36  virtual void SetKey(const DBRequestKey *reqkey);
37  virtual void BuildProtoPrefix(BgpProtoPrefix *prefix,
38  const BgpAttr *attr = NULL,
39  uint32_t label = 0,
40  uint32_t l3_label = 0) const;
41  virtual void BuildBgpProtoNextHop(std::vector<uint8_t> &nh,
42  IpAddress nexthop) const;
43 
44  virtual bool IsLess(const DBEntry &genrhs) const {
45  const InetVpnRoute &rhs = static_cast<const InetVpnRoute &>(genrhs);
46  int cmp = CompareTo(rhs);
47  return (cmp < 0);
48  }
49 
50  virtual bool IsMoreSpecific(const std::string &match) const;
51  virtual bool IsLessSpecific(const std::string &match) const;
52 
53 private:
56 };
57 
58 #endif // SRC_BGP_L3VPN_INETVPN_ROUTE_H_
boost::asio::ip::address IpAddress
Definition: address.h:14
std::unique_ptr< DBRequestKey > KeyPtr
Definition: db_entry.h:25
const RouteDistinguisher & route_distinguisher() const
virtual void BuildBgpProtoNextHop(std::vector< uint8_t > &nh, IpAddress nexthop) const
InetVpnPrefix prefix_
Definition: inetvpn_route.h:54
virtual std::string ToString() const
const InetVpnPrefix & GetPrefix() const
Definition: inetvpn_route.h:28
virtual KeyPtr GetDBRequestKey() const
virtual bool IsMoreSpecific(const std::string &match) const
virtual void BuildProtoPrefix(BgpProtoPrefix *prefix, const BgpAttr *attr=NULL, uint32_t label=0, uint32_t l3_label=0) const
virtual bool IsLessSpecific(const std::string &match) const
virtual bool IsLess(const DBEntry &genrhs) const
Definition: inetvpn_route.h:44
InetVpnRoute(const InetVpnPrefix &prefix)
virtual RouteDistinguisher GetRouteDistinguisher() const
Definition: inetvpn_route.h:31
DISALLOW_COPY_AND_ASSIGN(InetVpnRoute)
virtual int CompareTo(const Route &rhs) const
virtual void SetKey(const DBRequestKey *reqkey)
Definition: route.h:15