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