OpenSDN source code
es_import.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3
* Copyright Contributors to the OpenSDN project
4
*/
5
6
#include "
bgp/extended-community/es_import.h
"
7
8
#include <algorithm>
9
#include <string>
10
11
#include "
net/mac_address.h
"
12
13
using
std::copy;
14
using
std::string;
15
16
EsImport::EsImport
(
const
bytes_type
&data) {
17
copy(data.begin(), data.end(),
data_
.begin());
18
}
19
20
MacAddress
EsImport::mac_address
()
const
{
21
if
(
data_
[0] !=
BgpExtendedCommunityType::Evpn
||
22
data_
[1] !=
BgpExtendedCommunityEvpnSubType::EsImport
)
23
return
MacAddress
();
24
uint8_t mac_bytes[6];
25
copy(
data_
.begin() + 2,
data_
.end(), mac_bytes);
26
return
MacAddress
(mac_bytes);
27
}
28
29
string
EsImport::ToString
()
const
{
30
string
temp(
"esimport:"
);
31
return
temp +
mac_address
().
ToString
();
32
}
EsImport::mac_address
MacAddress mac_address() const
Definition:
es_import.cc:20
EsImport::ToString
std::string ToString() const
Definition:
es_import.cc:29
EsImport::EsImport
EsImport(const bytes_type &data)
Definition:
es_import.cc:16
EsImport::bytes_type
boost::array< uint8_t, kSize > bytes_type
Definition:
es_import.h:21
EsImport::data_
bytes_type data_
Definition:
es_import.h:29
MacAddress
Definition:
mac_address.h:15
MacAddress::ToString
std::string ToString() const
Definition:
mac_address.cc:54
es_import.h
mac_address.h
BgpExtendedCommunityEvpnSubType::EsImport
@ EsImport
Definition:
extended-community/types.h:44
BgpExtendedCommunityType::Evpn
@ Evpn
Definition:
extended-community/types.h:15
contrail
controller
src
bgp
extended-community
es_import.cc
Generated by
1.9.1