OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
inetvpn_address.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_BGP_L3VPN_INETVPN_ADDRESS_H_
6 #define SRC_BGP_L3VPN_INETVPN_ADDRESS_H_
7 
8 #include <boost/system/error_code.hpp>
9 
10 #include <string>
11 
12 #include "bgp/bgp_attr.h"
13 #include "base/address.h"
14 #include "net/rd.h"
15 
16 class BgpServer;
17 
19 public:
20  InetVpnPrefix();
21  explicit InetVpnPrefix(const BgpProtoPrefix &prefix);
23  : rd_(rd), addr_(ip), prefixlen_(prefixlen) {
24  }
25 
26  static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix,
27  InetVpnPrefix *prefix,
28  const BgpAttr *attr, uint32_t *label);
29  static int FromProtoPrefix(BgpServer *server,
30  const BgpProtoPrefix &proto_prefix,
31  const BgpAttr *attr,
32  const Address::Family family,
33  InetVpnPrefix *prefix,
34  BgpAttrPtr *new_attr, uint32_t *label,
35  uint32_t *l3_label);
36  static InetVpnPrefix FromString(const std::string &str,
37  boost::system::error_code *errorp = NULL);
38 
39  std::string ToString() const;
40  bool IsMoreSpecific(const InetVpnPrefix &rhs) const;
41  bool operator==(const InetVpnPrefix &rhs) const;
42 
43  const RouteDistinguisher &route_distinguisher() const { return rd_; }
44  Ip4Address addr() const { return addr_; }
45  int prefixlen() const { return prefixlen_; }
46  void BuildProtoPrefix(uint32_t label, BgpProtoPrefix *proto_prefix,
47  const BgpAttr *attr = NULL) const;
48 
49 private:
53 };
54 
55 #endif // SRC_BGP_L3VPN_INETVPN_ADDRESS_H_
Family
Definition: address.h:24
Ip4Address addr() const
const RouteDistinguisher & route_distinguisher() const
std::string ToString() const
static InetVpnPrefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
bool IsMoreSpecific(const InetVpnPrefix &rhs) const
InetVpnPrefix(const RouteDistinguisher &rd, Ip4Address ip, int prefixlen)
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
Definition: bgp_attr.h:991
Ip4Address addr_
bool operator==(const InetVpnPrefix &rhs) const
static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix, InetVpnPrefix *prefix, const BgpAttr *attr, uint32_t *label)
boost::asio::ip::address_v4 Ip4Address
Definition: address.h:14
RouteDistinguisher rd_
int prefixlen() const
void BuildProtoPrefix(uint32_t label, BgpProtoPrefix *proto_prefix, const BgpAttr *attr=NULL) const