Line data Source code
1 : /* 2 : * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef SRC_BGP_EXTENDED_COMMUNITY_ROUTER_MAC_H_ 6 : #define SRC_BGP_EXTENDED_COMMUNITY_ROUTER_MAC_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 : #include "net/mac_address.h" 16 : 17 : class RouterMac { 18 : public: 19 : static const int kSize = 8; 20 : typedef boost::array<uint8_t, kSize> bytes_type; 21 : 22 : explicit RouterMac(const MacAddress &mac_addr); 23 : explicit RouterMac(const bytes_type &data); 24 : 25 : MacAddress mac_address() const; 26 : 27 6 : const bytes_type &GetExtCommunity() const { return data_; } 28 : 29 15 : const uint64_t GetExtCommunityValue() const { 30 15 : return get_value(data_.begin(), 8); 31 : } 32 : std::string ToString(); 33 : 34 : private: 35 : bytes_type data_; 36 : }; 37 : 38 : #endif // SRC_BGP_EXTENDED_COMMUNITY_ROUTER_MAC_H_