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