79 #if (BYTE_ORDER == LITTLE_ENDIAN)
90 uint8_t leapIndicator : 2,
110 uint64_t referenceTimestamp,
120 #pragma pack(push, 1)
130 #pragma pack(push, 1)
131 struct ntp_v4_auth_md5
140 #pragma pack(push, 1)
141 struct ntp_v4_auth_sha1
150 ntp_header* getNtpHeader()
const
152 return (ntp_header*)m_Data;
203 GOES = (
'G') | (
'O' << 8) | (
'E' << 16) | (
'S' << 24),
205 GPS = (
'G') | (
'P' << 8) | (
'S' << 16),
207 GAL = (
'G') | (
'A' << 8) | (
'L' << 16),
209 PPS = (
'P') | (
'P' << 8) | (
'S' << 16),
211 IRIG = (
'I') | (
'R' << 8) | (
'I' << 16) | (
'G' << 24),
213 WWVB = (
'W') | (
'W' << 8) | (
'V' << 16) | (
'B' << 24),
215 DCF = (
'D') | (
'C' << 8) | (
'F' << 16),
217 HBG = (
'H') | (
'B' << 8) | (
'G' << 16),
219 MSF = (
'M') | (
'S' << 8) | (
'F' << 16),
221 JJY = (
'J') | (
'J' << 8) | (
'Y' << 16),
223 LORC = (
'L') | (
'O' << 8) | (
'R' << 16) | (
'C' << 24),
225 TDF = (
'T') | (
'D' << 8) | (
'F' << 16),
227 CHU = (
'C') | (
'H' << 8) | (
'U' << 16),
229 WWV = (
'W') | (
'W' << 8) | (
'V' << 16),
231 WWVH = (
'W') | (
'W' << 8) | (
'V' << 16) | (
'H' << 24),
233 NIST = (
'N') | (
'I' << 8) | (
'S' << 16) | (
'T' << 24),
235 ACTS = (
'A') | (
'C' << 8) | (
'T' << 16) | (
'S' << 24),
237 USNO = (
'U') | (
'S' << 8) | (
'N' << 16) | (
'O' << 24),
239 PTB = (
'P') | (
'T' << 8) | (
'B' << 16),
241 MRS = (
'M') | (
'R' << 8) | (
'S' << 16),
243 XFAC = (
'X') | (
'F' << 8) | (
'A' << 16) | (
'C' << 24),
245 STEP = (
'S') | (
'T' << 8) | (
'E' << 16) | (
'P' << 24),
247 GOOG = (
'G') | (
'O' << 8) | (
'O' << 16) | (
'G' << 24),
250 DCFa = (
'D') | (
'C' << 8) | (
'F' << 16) | (
'a' << 24),
253 DCFp = (
'D') | (
'C' << 8) | (
'F' << 16) | (
'p' << 24),
256 GPSs = (
'G') | (
'P' << 8) | (
'S' << 16) | (
's' << 24),
259 GPSi = (
'G') | (
'P' << 8) | (
'S' << 16) | (
'i' << 24),
262 GLNs = (
'G') | (
'L' << 8) | (
'N' << 16) | (
's' << 24),
265 GLNi = (
'G') | (
'L' << 8) | (
'N' << 16) | (
'i' << 24),
267 LCL = (
'L') | (
'C' << 8) | (
'L' << 16),
269 LOCL = (
'L') | (
'O' << 8) | (
'C' << 16) | (
'L' << 24),
274 DCN = (
'D') | (
'C' << 8) | (
'N' << 16),
276 TSP = (
'T') | (
'S' << 8) | (
'P' << 16),
278 DTS = (
'D') | (
'T' << 8) | (
'S' << 16),
280 ATOM = (
'A') | (
'T' << 8) | (
'O' << 16) | (
'M' << 24),
282 VLF = (
'V') | (
'L' << 8) | (
'F' << 16)
291 ACST = (
'A') | (
'C' << 8) | (
'S' << 16) | (
'T' << 24),
293 AUTH = (
'A') | (
'U' << 8) | (
'T' << 16) | (
'H' << 24),
295 AUTO = (
'A') | (
'U' << 8) | (
'T' << 16) | (
'O' << 24),
297 BCST = (
'B') | (
'C' << 8) | (
'S' << 16) | (
'T' << 24),
299 CRYP = (
'C') | (
'R' << 8) | (
'Y' << 16) | (
'P' << 24),
301 DENY = (
'D') | (
'E' << 8) | (
'N' << 16) | (
'Y' << 24),
303 DROP = (
'D') | (
'R' << 8) | (
'O' << 16) | (
'P' << 24),
305 RSTR = (
'R') | (
'S' << 8) | (
'T' << 16) | (
'R' << 24),
307 INIT = (
'I') | (
'N' << 8) | (
'I' << 16) | (
'T' << 24),
309 MCST = (
'M') | (
'C' << 8) | (
'S' << 16) | (
'T' << 24),
311 NKEY = (
'N') | (
'K' << 8) | (
'E' << 16) | (
'Y' << 24),
313 RATE = (
'R') | (
'A' << 8) | (
'T' << 16) | (
'E' << 24),
316 RMOT = (
'R') | (
'M' << 8) | (
'O' << 16) | (
'T' << 24),
318 STEP = (
'S') | (
'T' << 8) | (
'E' << 16) | (
'P' << 24),
329 :
Layer(data, dataLen, prevLayer, packet,
NTP)
Definition: IpAddress.h:32
The NTP packet consists of an integral number of 32-bit (4 octet) words in network byte order....
Definition: NtpLayer.h:74
double getTransmitTimestampInSecs() const
LeapIndicator
Definition: NtpLayer.h:160
@ Last61Secs
Last minute of the day has 61 seconds.
Definition: NtpLayer.h:164
@ Last59Secs
Last minute of the day has 59 seconds.
Definition: NtpLayer.h:166
@ NoWarning
Normal, no leap second.
Definition: NtpLayer.h:162
@ Unknown
Unknown (clock unsynchronized)
Definition: NtpLayer.h:168
void setTransmitTimestampInSecs(double val)
uint8_t getStratum() const
std::string getReceiveTimestampAsString()
void setRootDispersion(uint32_t val)
void setVersion(uint8_t val)
std::string getReferenceTimestampAsString()
void setReceiveTimestampInSecs(double val)
void setRootDelayInSecs(double val)
void setStratum(uint8_t val)
static std::string convertToIsoFormat(const uint64_t timestampInNTPformat)
uint64_t getOriginTimestamp() const
uint64_t getReferenceTimestamp() const
size_t getHeaderLen() const
Definition: NtpLayer.h:678
uint64_t getReceiveTimestamp() const
uint32_t getKeyID() const
static bool isDataValid(const uint8_t *data, size_t dataSize)
void setReferenceIdentifier(IPv4Address val)
static uint32_t convertToShortFormat(const double val)
void setRootDispersionInSecs(double val)
double getReferenceTimestampInSecs() const
std::string getOriginTimestampAsString()
static double convertFromTimestampFormat(const uint64_t val)
double getReceiveTimestampInSecs() const
void setReferenceTimestampInSecs(double val)
int8_t getPollInterval() const
double getPollIntervalInSecs() const
double getOriginTimestampInSecs() const
ClockSource
Definition: NtpLayer.h:199
@ HBG
LF Radio HBG Prangins, HB 75 kHz.
@ DCF
LF Radio DCF77 Mainflingen, DE 77.5 kHz.
@ ACTS
NIST telephone modem.
@ MRS
Multi Reference Sources.
@ IRIG
Inter-Range Instrumentation Group.
@ PPS
Generic pulse-per-second.
@ GOES
Geosynchronous Orbit Environment Satellite.
@ USNO
USNO telephone modem.
@ XFAC
Inter Face Association Changed.
@ WWV
HF Radio WWV Ft. Collins, CO.
@ MSF
LF Radio MSF Anthorn, UK 60 kHz.
@ JJY
LF Radio JJY Fukushima, JP 40 kHz, Saga, JP 60 kHz.
@ ATOM
Atomic clock (calibrated)
@ GPS
Global Position System.
@ LORC
MF Radio LORAN C station, 100 kHz.
@ WWVH
HF Radio WWVH Kauai, HI.
@ GAL
Galileo Positioning System.
@ DTS
Digital Time Service.
@ NIST
NIST telephone modem.
@ LCL
Meinberg Undisciplined local clock (Ref: https://www.meinbergglobal.com/english/info/ntp-refid....
@ CHU
HF Radio CHU Ottawa, Ontario.
@ LOCL
Meinberg Undisciplined local clock (Ref: https://www.meinbergglobal.com/english/info/ntp-refid....
@ DCN
DCN routing protocol.
@ PTB
European telephone modem.
@ TDF
MF Radio Allouis, FR 162 kHz.
@ GOOG
Google Refid used by Google NTP servers as time4.google.com.
@ WWVB
LF Radio WWVB Ft. Collins, CO 60 kHz.
@ VLF
VLF radio (OMEGA, etc.)
void parseNextLayer()
Parses the next layer. NTP is the always last so does nothing for this layer.
Definition: NtpLayer.h:672
NtpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: NtpLayer.h:328
std::string getReferenceIdentifierString() const
void setTransmitTimestamp(uint64_t val)
void setRootDelay(uint32_t val)
static uint64_t convertToTimestampFormat(const double val)
std::string getModeString() const
void setOriginTimestamp(uint64_t val)
KissODeath
Definition: NtpLayer.h:289
@ NKEY
No key found. Either the key was never installed or is not trusted.
@ RSTR
Access denied due to local policy.
@ DENY
Access denied by remote server.
@ CRYP
Cryptographic authentication or identification failed.
@ BCST
The association belongs to a broadcast server.
@ STEP
A step change in system time has occurred, but the association has not yet resynchronized.
@ RATE
Rate exceeded. The server has temporarily denied access because the client exceeded the rate threshol...
@ MCST
The association belongs to a manycast server.
@ ACST
The association belongs to a anycast server.
@ DROP
Lost peer in symmetric mode.
@ AUTO
Autokey sequence failed.
@ AUTH
Server authentication failed.
@ INIT
The association has not yet synchronized for the first time.
std::string getDigest() const
void setReceiveTimestamp(uint64_t val)
static bool isNTPPort(uint16_t port)
Definition: NtpLayer.h:664
void setPollInterval(int8_t val)
LeapIndicator getLeapIndicator() const
int8_t getPrecision() const
uint32_t getReferenceIdentifier() const
void setReferenceIdentifier(KissODeath val)
double getRootDispersionInSecs() const
void setReferenceIdentifier(ClockSource val)
void computeCalculateFields()
Does nothing for this layer.
Definition: NtpLayer.h:684
uint64_t getTransmitTimestamp() const
Mode
Definition: NtpLayer.h:175
@ SymActive
Symmetrically active.
Definition: NtpLayer.h:179
@ Client
Client mode.
Definition: NtpLayer.h:183
@ Control
NTP control messages.
Definition: NtpLayer.h:189
@ Broadcast
Broadcasting mode.
Definition: NtpLayer.h:187
@ SymPassive
Symmetrically passive.
Definition: NtpLayer.h:181
@ PrivateUse
Reserved for private use.
Definition: NtpLayer.h:191
@ Server
Server mode.
Definition: NtpLayer.h:185
@ Reserved
Reserved variable.
Definition: NtpLayer.h:177
OsiModelLayer getOsiModelLayer() const
Definition: NtpLayer.h:690
double getPrecisionInSecs() const
double getRootDelayInSecs() const
void setOriginTimestampInSecs(double val)
void setReferenceTimestamp(uint64_t val)
void setLeapIndicator(LeapIndicator val)
uint8_t getVersion() const
std::string getTransmitTimestampAsString()
static std::string convertToIsoFormat(const double timestamp)
uint32_t getRootDispersion() const
std::string toString() const
void setPrecision(int8_t val)
static double convertFromShortFormat(const uint32_t val)
uint32_t getRootDelay() const
The main namespace for the PcapPlusPlus lib.
const ProtocolType NTP
Definition: ProtocolType.h:263
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelApplicationLayer
Definition: ProtocolType.h:368