OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rtarget_prefix.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_RTARGET_RTARGET_PREFIX_H_
6 #define SRC_BGP_RTARGET_RTARGET_PREFIX_H_
7 
8 #include <boost/system/error_code.hpp>
9 
10 #include <string>
11 
12 #include "bgp/bgp_attr.h"
13 #include "bgp/bgp_common.h"
15 
17 public:
18  static const std::string kDefaultPrefixString;
19 
20  RTargetPrefix();
21  explicit RTargetPrefix(const BgpProtoPrefix &prefix);
23  : as_(as), rtarget_(rtarget) {
24  }
25 
26  static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix,
27  RTargetPrefix *prefix);
28  static int FromProtoPrefix(BgpServer *server,
29  const BgpProtoPrefix &proto_prefix,
30  const BgpAttr *attr,
31  const Address::Family family,
32  RTargetPrefix *prefix,
33  BgpAttrPtr *new_attr, uint32_t *label,
34  uint32_t *l3_label);
35  static RTargetPrefix FromString(const std::string &str,
36  boost::system::error_code *errorp = NULL);
37 
38  std::string ToString() const;
39  RouteTarget rtarget() const { return rtarget_; }
40  as_t as() const { return as_; }
41  void BuildProtoPrefix(BgpProtoPrefix *prefix) const;
42  int CompareTo(const RTargetPrefix &rhs) const;
43  bool operator==(const RTargetPrefix &rhs) const {
44  return (CompareTo(rhs) == 0);
45  }
46 
47 private:
50 };
51 
52 #endif // SRC_BGP_RTARGET_RTARGET_PREFIX_H_
int CompareTo(const RTargetPrefix &rhs) const
as_t as() const
RouteTarget rtarget() const
Family
Definition: address.h:24
static RTargetPrefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix, RTargetPrefix *prefix)
uint32_t as_t
Definition: bgp_common.h:21
bool operator==(const RTargetPrefix &rhs) const
RouteTarget rtarget_
RTargetPrefix(as_t as, RouteTarget rtarget)
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
Definition: bgp_attr.h:991
static const std::string kDefaultPrefixString
void BuildProtoPrefix(BgpProtoPrefix *prefix) const
std::string ToString() const