-
Notifications
You must be signed in to change notification settings - Fork 14
/
DestAdvertInfo.h
75 lines (61 loc) · 1.63 KB
/
DestAdvertInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Dynamic Link Exchange Protocol (DLEP)
*
* Copyright (C) 2015, 2016 Massachusetts Institute of Technology
*
* Contributor: Adjacent Link LLC, Bridgewater, NJ
*/
/// @file
/// DestAdvertInfo class declaration.
#ifndef DEST_ADVERT_INFO_H
#define DEST_ADVERT_INFO_H
#include <cstdint>
#include <string>
#include <sstream>
#include "DlepCommon.h"
namespace LLDLEP
{
namespace internal
{
// holds info going in/out of the advertisement msg
struct DestAdvertInfo
{
std::uint32_t reportInterval;
std::int64_t uptime;
std::uint32_t sequenceNumber;
LLDLEP::DlepMac rfId;
LLDLEP::DlepMacAddrs destinations;
DestAdvertInfo() :
reportInterval {},
uptime {},
sequenceNumber {}
{ }
DestAdvertInfo(std::uint32_t interval,
time_t uptm,
std::uint32_t seq,
const LLDLEP::DlepMac & id,
const LLDLEP::DlepMacAddrs & dests) :
reportInterval {interval},
uptime {uptm},
sequenceNumber {seq},
rfId(id),
destinations(dests)
{ }
std::string to_string() const
{
std::stringstream ss;
ss << "report interval=" << reportInterval;
ss << " uptime=" << uptime;
ss << " seqnum=" << sequenceNumber;
ss << " rfid=" << rfId.to_string();
ss << " dests:";
for (auto dest : destinations)
{
ss << dest.to_string() << ", ";
}
return ss.str();
}
};
} // namespace internal
} // namespace LLDLEP
#endif