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