API Documentation
Loading...
Searching...
No Matches
NtpPacket.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QtGlobal>
4
5#include <NDEVR/NtpTimestamp.h>
6namespace NDEVR
7{
8 /**
9 * NtpPacket flags (first byte of the packet).
10 */
12 /** Mode. */
13 unsigned char mode : 3;
14
15 /** Version number of the protocol (3 or 4). */
16 unsigned char versionNumber : 3;
17
18 /** Warns of an impending leap second to be inserted/deleted in the last minute
19 * of the current day. */
20 unsigned char leapIndicator : 2;
21 };
22 static_assert(sizeof(NtpPacketFlags) == 1);
23
24#pragma pack(push, 1)
25 /**
26 * Mandatory part of an NTP packet
27 */
28 struct NtpPacket
29 {
30 /** Flags. */
32
33 /** Stratum of the clock. */
34 quint8 stratum;
35
36 /** Maximum interval between successive messages, in log2 seconds. Note that the value is signed. */
37 qint8 poll;
38
39 /** Precision of the clock, in log2 seconds. Note that the value is signed. */
40 qint8 precision;
41
42 /** Round trip time to the primary reference source, in NTP short format. */
43 qint32 rootDelay;
44
45 /** Nominal error relative to the primary reference source. */
47
48 /** Reference identifier (either a 4 character string or an IP address). */
49 qint8 referenceID[4];
50
51 /** The time at which the clock was last set or corrected. */
53
54 /** The time at which the request departed the client for the server. */
56
57 /** The time at which the request arrived at the server. */
59
60 /** The time at which the reply departed the server for client. */
62 };
63 static_assert(sizeof(NtpPacket) == 48);
64
65 /**
66 * Optional part of an NTP packet.
67 */
69 /** Key identifier. */
70 quint32 keyId;
71
72 /** Message Digest. */
73 quint8 messageDigest[16];
74 };
75 static_assert(sizeof(NtpAuthenticationInfo) == 20);
76
77 /**
78 * Full NTP packet.
79 */
84 static_assert(sizeof(NtpFullPacket) == 68);
85
86#pragma pack(pop)
87}
Definition ACIColor.h:37
Definition NtpPacket.h:68
quint8 messageDigest[16]
Definition NtpPacket.h:73
quint32 keyId
Definition NtpPacket.h:70
Definition NtpPacket.h:80
NtpPacket basic
Definition NtpPacket.h:81
NtpAuthenticationInfo auth
Definition NtpPacket.h:82
Definition NtpPacket.h:11
unsigned char leapIndicator
Definition NtpPacket.h:20
unsigned char versionNumber
Definition NtpPacket.h:16
unsigned char mode
Definition NtpPacket.h:13
Definition NtpPacket.h:29
qint32 rootDispersion
Definition NtpPacket.h:46
qint8 poll
Definition NtpPacket.h:37
qint32 rootDelay
Definition NtpPacket.h:43
qint8 precision
Definition NtpPacket.h:40
NtpTimestamp receiveTimestamp
Definition NtpPacket.h:58
NtpTimestamp transmitTimestamp
Definition NtpPacket.h:61
NtpPacketFlags flags
Definition NtpPacket.h:31
NtpTimestamp referenceTimestamp
Definition NtpPacket.h:52
NtpTimestamp originateTimestamp
Definition NtpPacket.h:55
quint8 stratum
Definition NtpPacket.h:34
qint8 referenceID[4]
Definition NtpPacket.h:49
Definition NtpTimestamp.h:13