Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef SRC_BGP_EXTENDED_COMMUNITY_MAC_MOBILITY_H_ 6 : #define SRC_BGP_EXTENDED_COMMUNITY_MAC_MOBILITY_H_ 7 : 8 : #include <boost/array.hpp> 9 : #include <boost/system/error_code.hpp> 10 : 11 : #include <string> 12 : 13 : #include "base/parse_object.h" 14 : #include "bgp/extended-community/types.h" 15 : 16 : class MacMobility { 17 : public: 18 : static const int kSize = 8; 19 : typedef boost::array<uint8_t, kSize> bytes_type; 20 : 21 : explicit MacMobility(uint32_t seq, bool sticky=false); 22 : explicit MacMobility(const bytes_type &data); 23 : 24 : uint32_t sequence_number() const; 25 : bool sticky() const; 26 : 27 10 : const bytes_type &GetExtCommunity() const { 28 10 : return data_; 29 : } 30 : 31 543 : const uint64_t GetExtCommunityValue() const { 32 543 : return get_value(data_.begin(), 8); 33 : } 34 : 35 : std::string ToString(); 36 : 37 : private: 38 : bytes_type data_; 39 : }; 40 : 41 : #endif // SRC_BGP_EXTENDED_COMMUNITY_MAC_MOBILITY_H_