Line data Source code
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 : 8 : #include "net/tunnel_encap_type.h" 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 : 26 : TunnelEncapType::Encap tunnel_encap() const; 27 : 28 32251 : const bytes_type &GetExtCommunity() const { 29 32251 : return data_; 30 : } 31 : 32 33898 : const uint64_t GetExtCommunityValue() const { 33 33898 : return get_value(data_.begin(), 8); 34 : } 35 : std::string ToString(); 36 : std::string ToXmppString(); 37 : 38 : private: 39 : bytes_type data_; 40 : }; 41 : 42 : #endif // SRC_BGP_TUNNEL_ENCAP_TUNNEL_ENCAP_H_