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