Line data Source code
1 : /* 2 : * Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #include "bgp/extended-community/multicast_flags.h" 6 : 7 : #include <algorithm> 8 : #include <stdio.h> 9 : 10 : 11 : using std::copy; 12 : #define IGMP_PROXY_FLAG 1 13 : 14 20072 : MulticastFlags::MulticastFlags() { 15 20072 : data_[0] = BgpExtendedCommunityType::Evpn; 16 20072 : data_[1] = BgpExtendedCommunityEvpnSubType::MulticastFlags; 17 20072 : put_value(&data_[2], 2, IGMP_PROXY_FLAG); 18 20072 : put_value(&data_[4], 4, 0); 19 20072 : } 20 : 21 0 : MulticastFlags::MulticastFlags(const bytes_type &data) { 22 0 : copy(data.begin(), data.end(), data_.begin()); 23 0 : } 24 : 25 0 : std::string MulticastFlags::ToString() { 26 0 : uint16_t flag = get_value(&data_[2], 2); 27 : char temp[50]; 28 0 : snprintf(temp, sizeof(temp), "evpn-mcast-flags:%u", flag); 29 0 : return std::string(temp); 30 : }