OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tunnel_encap.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_TUNNEL_ENCAP_TUNNEL_ENCAP_H_
6 #define SRC_BGP_TUNNEL_ENCAP_TUNNEL_ENCAP_H_
7 
9 
10 #include <boost/array.hpp>
11 #include <boost/system/error_code.hpp>
12 
13 #include <string>
14 
15 #include "base/parse_object.h"
16 
17 class TunnelEncap {
18 public:
19  static const int kSize = 8;
20  typedef boost::array<uint8_t, kSize> bytes_type;
21 
22  explicit TunnelEncap(TunnelEncapType::Encap encap);
23  explicit TunnelEncap(std::string encap);
24  explicit TunnelEncap(const bytes_type &data);
25 
27 
28  const bytes_type &GetExtCommunity() const {
29  return data_;
30  }
31 
32  const uint64_t GetExtCommunityValue() const {
33  return get_value(data_.begin(), 8);
34  }
35  std::string ToString();
36  std::string ToXmppString();
37 
38 private:
40 };
41 
42 #endif // SRC_BGP_TUNNEL_ENCAP_TUNNEL_ENCAP_H_
const uint64_t GetExtCommunityValue() const
Definition: tunnel_encap.h:32
std::string ToString()
Definition: tunnel_encap.cc:51
TunnelEncap(TunnelEncapType::Encap encap)
Definition: tunnel_encap.cc:27
static uint64_t get_value(const uint8_t *data, int size)
Definition: parse_object.h:39
std::string ToXmppString()
Definition: tunnel_encap.cc:57
bytes_type data_
Definition: tunnel_encap.h:39
TunnelEncapType::Encap tunnel_encap() const
Definition: tunnel_encap.cc:40
static const int kSize
Definition: tunnel_encap.h:19
const bytes_type & GetExtCommunity() const
Definition: tunnel_encap.h:28
boost::array< uint8_t, kSize > bytes_type
Definition: tunnel_encap.h:20