libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
rfc7273refclk.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_NETWORK
13#include <cstdint>
14#include <promeki/eui64.h>
15#include <promeki/macaddress.h>
16#include <promeki/namespace.h>
17#include <promeki/result.h>
18#include <promeki/string.h>
19
20PROMEKI_NAMESPACE_BEGIN
21
69class Rfc7273RefClk {
70 public:
72 enum class Kind {
73 None,
74 Ptp,
75 LocalMac,
76 };
77
79 static constexpr const char *DefaultPtpProfile = "IEEE1588-2008";
80
82 Rfc7273RefClk() = default;
83
98 static Rfc7273RefClk ptp(const String &profile, const EUI64 &gmid = EUI64(),
99 uint8_t domain = 0);
100
110 static Rfc7273RefClk ptpTraceable(const String &profile);
111
117 static Rfc7273RefClk localMac(const MacAddress &mac);
118
127 static Rfc7273RefClk local();
128
139 static Result<Rfc7273RefClk> fromSdpValue(const String &value);
140
142 Kind kind() const { return _kind; }
143
145 bool isValid() const { return _kind != Kind::None; }
146
148 bool isTraceable() const { return _traceable; }
149
151 const String &profile() const { return _profile; }
152
154 const EUI64 &grandmasterId() const { return _gmid; }
155
157 uint8_t domain() const { return _domain; }
158
160 const MacAddress &localMacAddress() const { return _mac; }
161
171 String toSdpValue() const;
172
174 bool operator==(const Rfc7273RefClk &other) const;
175
177 bool operator!=(const Rfc7273RefClk &other) const { return !(*this == other); }
178
179 private:
180 Kind _kind = Kind::None;
181 bool _traceable = false;
182 uint8_t _domain = 0;
183 String _profile;
184 EUI64 _gmid;
185 MacAddress _mac;
186};
187
188PROMEKI_NAMESPACE_END
189
190#endif // PROMEKI_ENABLE_NETWORK