PcapPlusPlus  24.09
pcpp::NtpLayer Class Reference

The NTP packet consists of an integral number of 32-bit (4 octet) words in network byte order. The packet format consists of three components: the header itself, one or more optional extension fields (for v4), and an optional message authentication code (MAC). Currently the extension fields are not supported. The NTP header is: More...

#include <NtpLayer.h>

Inheritance diagram for pcpp::NtpLayer:
pcpp::Layer pcpp::IDataContainer

Public Types

enum  LeapIndicator { NoWarning = 0 , Last61Secs , Last59Secs , Unknown }
 
enum  Mode {
  Reserved = 0 , SymActive , SymPassive , Client ,
  Server , Broadcast , Control , PrivateUse
}
 
enum class  ClockSource : uint32_t {
  GOES = ('G') | ('O' << 8) | ('E' << 16) | ('S' << 24) , GPS = ('G') | ('P' << 8) | ('S' << 16) , GAL = ('G') | ('A' << 8) | ('L' << 16) , PPS = ('P') | ('P' << 8) | ('S' << 16) ,
  IRIG = ('I') | ('R' << 8) | ('I' << 16) | ('G' << 24) , WWVB = ('W') | ('W' << 8) | ('V' << 16) | ('B' << 24) , DCF = ('D') | ('C' << 8) | ('F' << 16) , HBG = ('H') | ('B' << 8) | ('G' << 16) ,
  MSF = ('M') | ('S' << 8) | ('F' << 16) , JJY = ('J') | ('J' << 8) | ('Y' << 16) , LORC = ('L') | ('O' << 8) | ('R' << 16) | ('C' << 24) , TDF = ('T') | ('D' << 8) | ('F' << 16) ,
  CHU = ('C') | ('H' << 8) | ('U' << 16) , WWV = ('W') | ('W' << 8) | ('V' << 16) , WWVH = ('W') | ('W' << 8) | ('V' << 16) | ('H' << 24) , NIST = ('N') | ('I' << 8) | ('S' << 16) | ('T' << 24) ,
  ACTS = ('A') | ('C' << 8) | ('T' << 16) | ('S' << 24) , USNO = ('U') | ('S' << 8) | ('N' << 16) | ('O' << 24) , PTB = ('P') | ('T' << 8) | ('B' << 16) , MRS = ('M') | ('R' << 8) | ('S' << 16) ,
  XFAC = ('X') | ('F' << 8) | ('A' << 16) | ('C' << 24) , STEP = ('S') | ('T' << 8) | ('E' << 16) | ('P' << 24) , GOOG = ('G') | ('O' << 8) | ('O' << 16) | ('G' << 24) , DCFa = ('D') | ('C' << 8) | ('F' << 16) | ('a' << 24) ,
  DCFp = ('D') | ('C' << 8) | ('F' << 16) | ('p' << 24) , GPSs = ('G') | ('P' << 8) | ('S' << 16) | ('s' << 24) , GPSi = ('G') | ('P' << 8) | ('S' << 16) | ('i' << 24) , GLNs = ('G') | ('L' << 8) | ('N' << 16) | ('s' << 24) ,
  GLNi = ('G') | ('L' << 8) | ('N' << 16) | ('i' << 24) , LCL = ('L') | ('C' << 8) | ('L' << 16) , LOCL = ('L') | ('O' << 8) | ('C' << 16) | ('L' << 24) , DCN = ('D') | ('C' << 8) | ('N' << 16) ,
  TSP = ('T') | ('S' << 8) | ('P' << 16) , DTS = ('D') | ('T' << 8) | ('S' << 16) , ATOM = ('A') | ('T' << 8) | ('O' << 16) | ('M' << 24) , VLF = ('V') | ('L' << 8) | ('F' << 16)
}
 
enum class  KissODeath : uint32_t {
  ACST = ('A') | ('C' << 8) | ('S' << 16) | ('T' << 24) , AUTH = ('A') | ('U' << 8) | ('T' << 16) | ('H' << 24) , AUTO = ('A') | ('U' << 8) | ('T' << 16) | ('O' << 24) , BCST = ('B') | ('C' << 8) | ('S' << 16) | ('T' << 24) ,
  CRYP = ('C') | ('R' << 8) | ('Y' << 16) | ('P' << 24) , DENY = ('D') | ('E' << 8) | ('N' << 16) | ('Y' << 24) , DROP = ('D') | ('R' << 8) | ('O' << 16) | ('P' << 24) , RSTR = ('R') | ('S' << 8) | ('T' << 16) | ('R' << 24) ,
  INIT = ('I') | ('N' << 8) | ('I' << 16) | ('T' << 24) , MCST = ('M') | ('C' << 8) | ('S' << 16) | ('T' << 24) , NKEY = ('N') | ('K' << 8) | ('E' << 16) | ('Y' << 24) , RATE = ('R') | ('A' << 8) | ('T' << 16) | ('E' << 24) ,
  RMOT = ('R') | ('M' << 8) | ('O' << 16) | ('T' << 24) , STEP = ('S') | ('T' << 8) | ('E' << 16) | ('P' << 24)
}
 

Public Member Functions

 NtpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 NtpLayer ()
 
LeapIndicator getLeapIndicator () const
 
void setLeapIndicator (LeapIndicator val)
 
uint8_t getVersion () const
 
void setVersion (uint8_t val)
 
Mode getMode () const
 
std::string getModeString () const
 
void setMode (Mode val)
 
uint8_t getStratum () const
 
void setStratum (uint8_t val)
 
int8_t getPollInterval () const
 
void setPollInterval (int8_t val)
 
double getPollIntervalInSecs () const
 
int8_t getPrecision () const
 
void setPrecision (int8_t val)
 
double getPrecisionInSecs () const
 
uint32_t getRootDelay () const
 
void setRootDelay (uint32_t val)
 
double getRootDelayInSecs () const
 
void setRootDelayInSecs (double val)
 
uint32_t getRootDispersion () const
 
void setRootDispersion (uint32_t val)
 
double getRootDispersionInSecs () const
 
void setRootDispersionInSecs (double val)
 
uint32_t getReferenceIdentifier () const
 
void setReferenceIdentifier (IPv4Address val)
 
void setReferenceIdentifier (ClockSource val)
 
void setReferenceIdentifier (KissODeath val)
 
std::string getReferenceIdentifierString () const
 
uint64_t getReferenceTimestamp () const
 
void setReferenceTimestamp (uint64_t val)
 
double getReferenceTimestampInSecs () const
 
void setReferenceTimestampInSecs (double val)
 
std::string getReferenceTimestampAsString ()
 
uint64_t getOriginTimestamp () const
 
void setOriginTimestamp (uint64_t val)
 
double getOriginTimestampInSecs () const
 
void setOriginTimestampInSecs (double val)
 
std::string getOriginTimestampAsString ()
 
uint64_t getReceiveTimestamp () const
 
void setReceiveTimestamp (uint64_t val)
 
double getReceiveTimestampInSecs () const
 
void setReceiveTimestampInSecs (double val)
 
std::string getReceiveTimestampAsString ()
 
uint64_t getTransmitTimestamp () const
 
void setTransmitTimestamp (uint64_t val)
 
double getTransmitTimestampInSecs () const
 
void setTransmitTimestampInSecs (double val)
 
std::string getTransmitTimestampAsString ()
 
uint32_t getKeyID () const
 
std::string getDigest () const
 
void parseNextLayer ()
 Parses the next layer. NTP is the always last so does nothing for this layer.
 
size_t getHeaderLen () const
 
void computeCalculateFields ()
 Does nothing for this layer.
 
OsiModelLayer getOsiModelLayer () const
 
std::string toString () const
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer () const
 
LayergetPrevLayer () const
 
ProtocolType getProtocol () const
 
bool isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) const
 
uint8_t * getData () const
 
size_t getDataLen () const
 
uint8_t * getLayerPayload () const
 
size_t getLayerPayloadSize () const
 
bool isAllocatedToPacket () const
 
void copyData (uint8_t *toArr) const
 
uint8_t * getDataPtr (size_t offset=0) const
 

Static Public Member Functions

static double convertFromShortFormat (const uint32_t val)
 
static double convertFromTimestampFormat (const uint64_t val)
 
static uint32_t convertToShortFormat (const double val)
 
static uint64_t convertToTimestampFormat (const double val)
 
static std::string convertToIsoFormat (const double timestamp)
 
static std::string convertToIsoFormat (const uint64_t timestampInNTPformat)
 
static bool isDataValid (const uint8_t *data, size_t dataSize)
 
static bool isNTPPort (uint16_t port)
 

Detailed Description

The NTP packet consists of an integral number of 32-bit (4 octet) words in network byte order. The packet format consists of three components: the header itself, one or more optional extension fields (for v4), and an optional message authentication code (MAC). Currently the extension fields are not supported. The NTP header is:

Represents a NTP (Network Time Protocol) layer

  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |LI | VN  |Mode |    Stratum     |     Poll      |  Precision   |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                         Root Delay                            |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                         Root Dispersion                       |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                          Reference ID                         |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 +                     Reference Timestamp (64)                  +
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 +                      Origin Timestamp (64)                    +
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 +                      Receive Timestamp (64)                   +
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 +                      Transmit Timestamp (64)                  +
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 .                                                               .
 .                Extension Field 1 (variable, only v4)          .
 .                                                               .
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 .                                                               .
 .                Extension Field 1 (variable, only v4)          .
 .                                                               .
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                          Key Identifier                       |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 |                   dgst (128 for v4, 64 for v3)                |
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Member Enumeration Documentation

◆ ClockSource

enum pcpp::NtpLayer::ClockSource : uint32_t
strong

32-bit code identifying the particular server or reference clock. The interpretation depends on the value in the stratum field.

Enumerator
GOES 

Geosynchronous Orbit Environment Satellite.

GPS 

Global Position System.

GAL 

Galileo Positioning System.

PPS 

Generic pulse-per-second.

IRIG 

Inter-Range Instrumentation Group.

WWVB 

LF Radio WWVB Ft. Collins, CO 60 kHz.

DCF 

LF Radio DCF77 Mainflingen, DE 77.5 kHz.

HBG 

LF Radio HBG Prangins, HB 75 kHz.

MSF 

LF Radio MSF Anthorn, UK 60 kHz.

JJY 

LF Radio JJY Fukushima, JP 40 kHz, Saga, JP 60 kHz.

LORC 

MF Radio LORAN C station, 100 kHz.

TDF 

MF Radio Allouis, FR 162 kHz.

CHU 

HF Radio CHU Ottawa, Ontario.

WWV 

HF Radio WWV Ft. Collins, CO.

WWVH 

HF Radio WWVH Kauai, HI.

NIST 

NIST telephone modem.

ACTS 

NIST telephone modem.

USNO 

USNO telephone modem.

PTB 

European telephone modem.

MRS 

Multi Reference Sources.

XFAC 

Inter Face Association Changed.

STEP 

Step time change.

GOOG 

Google Refid used by Google NTP servers as time4.google.com.

DCFa 

Meinberg DCF77 with amplitude modulation (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

DCFp 

Meinberg DCF77 with phase modulation)/pseudo random phase modulation (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

GPSs 

Meinberg GPS (with shared memory access) (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

GPSi 

Meinberg GPS (with interrupt based access) (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

GLNs 

Meinberg GPS/GLONASS (with shared memory access) (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

GLNi 

Meinberg GPS/GLONASS (with interrupt based access) (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

LCL 

Meinberg Undisciplined local clock (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

LOCL 

Meinberg Undisciplined local clock (Ref: https://www.meinbergglobal.com/english/info/ntp-refid.htm)

DCN 

DCN routing protocol.

TSP 

TSP time protocol.

DTS 

Digital Time Service.

ATOM 

Atomic clock (calibrated)

VLF 

VLF radio (OMEGA, etc.)

◆ KissODeath

enum pcpp::NtpLayer::KissODeath : uint32_t
strong

32-bit Kiss of Death (KoD) codes

Enumerator
ACST 

The association belongs to a anycast server.

AUTH 

Server authentication failed.

AUTO 

Autokey sequence failed.

BCST 

The association belongs to a broadcast server.

CRYP 

Cryptographic authentication or identification failed.

DENY 

Access denied by remote server.

DROP 

Lost peer in symmetric mode.

RSTR 

Access denied due to local policy.

INIT 

The association has not yet synchronized for the first time.

MCST 

The association belongs to a manycast server.

NKEY 

No key found. Either the key was never installed or is not trusted.

RATE 

Rate exceeded. The server has temporarily denied access because the client exceeded the rate threshold.

RMOT 

Somebody is tinkering with the association from a remote host running ntpdc. Not to worry unless some rascal has stolen your keys

STEP 

A step change in system time has occurred, but the association has not yet resynchronized.

◆ LeapIndicator

Warning of an impending leap second to be inserted or deleted in the last minute of the current month

Enumerator
NoWarning 

Normal, no leap second.

Last61Secs 

Last minute of the day has 61 seconds.

Last59Secs 

Last minute of the day has 59 seconds.

Unknown 

Unknown (clock unsynchronized)

◆ Mode

Representing the NTP association modes

Enumerator
Reserved 

Reserved variable.

SymActive 

Symmetrically active.

SymPassive 

Symmetrically passive.

Client 

Client mode.

Server 

Server mode.

Broadcast 

Broadcasting mode.

Control 

NTP control messages.

PrivateUse 

Reserved for private use.

Constructor & Destructor Documentation

◆ NtpLayer() [1/2]

pcpp::NtpLayer::NtpLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)
inline

A constructor that creates the layer from an existing packet raw data

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored in

◆ NtpLayer() [2/2]

pcpp::NtpLayer::NtpLayer ( )

Empty c'tor

Member Function Documentation

◆ convertFromShortFormat()

static double pcpp::NtpLayer::convertFromShortFormat ( const uint32_t  val)
static

Convert NTP short format to seconds from the Unix Epoch

Parameters
[in]valValue in NTP short format
Returns
Value in seconds from Unix Epoch (1 Jan 1970)

◆ convertFromTimestampFormat()

static double pcpp::NtpLayer::convertFromTimestampFormat ( const uint64_t  val)
static

Convert NTP timestamp format to seconds from the Unix Epoch

Parameters
[in]valValue in NTP timestamp format
Returns
Value in seconds from Unix Epoch (1 Jan 1970)

◆ convertToIsoFormat() [1/2]

static std::string pcpp::NtpLayer::convertToIsoFormat ( const double  timestamp)
static

A static method to convert timestamp value to ISO8601 date time format

Parameters
[in]timestampValue in seconds from the Unix Epoch
Returns
std::string ISO8601 formatted string

◆ convertToIsoFormat() [2/2]

static std::string pcpp::NtpLayer::convertToIsoFormat ( const uint64_t  timestampInNTPformat)
static

A static method to convert timestamp value to ISO8601 date time format

Parameters
[in]timestampInNTPformatValue in NTP timestamp format
Returns
std::string ISO8601 formatted string

◆ convertToShortFormat()

static uint32_t pcpp::NtpLayer::convertToShortFormat ( const double  val)
static

Convert seconds from the Unix Epoch to NTP short format

Parameters
[in]valValue in seconds from Unix Epoch (1 Jan 1970)
Returns
Value in NTP short format

◆ convertToTimestampFormat()

static uint64_t pcpp::NtpLayer::convertToTimestampFormat ( const double  val)
static

Convert seconds from the Unix Epoch to NTP timestamp format

Parameters
[in]valValue in seconds from Unix Epoch (1 Jan 1970)
Returns
Value in NTP timestamp format

◆ getDigest()

std::string pcpp::NtpLayer::getDigest ( ) const
Returns
Get the digest value as hexadecimal string, empty string on unsupported version

◆ getHeaderLen()

size_t pcpp::NtpLayer::getHeaderLen ( ) const
inlinevirtual
Returns
Get the size of the layer (Including the extension and authentication fields if exists)

Implements pcpp::Layer.

◆ getKeyID()

uint32_t pcpp::NtpLayer::getKeyID ( ) const
Returns
Returns the key identifier if exists, returns 0 on unsupported NTP version or key identifier not found

◆ getLeapIndicator()

LeapIndicator pcpp::NtpLayer::getLeapIndicator ( ) const
Returns
The leap indicator

◆ getMode()

Mode pcpp::NtpLayer::getMode ( ) const
Returns
The mode value

◆ getModeString()

std::string pcpp::NtpLayer::getModeString ( ) const
Returns
The mode as string

◆ getOriginTimestamp()

uint64_t pcpp::NtpLayer::getOriginTimestamp ( ) const
Returns
The value of origin timestamp in NTP timestamp format

◆ getOriginTimestampAsString()

std::string pcpp::NtpLayer::getOriginTimestampAsString ( )
Returns
the origin timestamp value as readable string in ISO8601 format

◆ getOriginTimestampInSecs()

double pcpp::NtpLayer::getOriginTimestampInSecs ( ) const
Returns
The value of origin timestamp in seconds from Unix Epoch (1 Jan 1970)

◆ getOsiModelLayer()

OsiModelLayer pcpp::NtpLayer::getOsiModelLayer ( ) const
inlinevirtual
Returns
The OSI layer level of NTP (Application Layer).

Implements pcpp::Layer.

◆ getPollInterval()

int8_t pcpp::NtpLayer::getPollInterval ( ) const
Returns
The value of poll interval in log2 seconds

◆ getPollIntervalInSecs()

double pcpp::NtpLayer::getPollIntervalInSecs ( ) const
Returns
The value of poll interval in seconds

◆ getPrecision()

int8_t pcpp::NtpLayer::getPrecision ( ) const
Returns
The value of precision in log2 seconds

◆ getPrecisionInSecs()

double pcpp::NtpLayer::getPrecisionInSecs ( ) const
Returns
The value of precision in seconds

◆ getReceiveTimestamp()

uint64_t pcpp::NtpLayer::getReceiveTimestamp ( ) const
Returns
The value of receive timestamp in NTP timestamp format

◆ getReceiveTimestampAsString()

std::string pcpp::NtpLayer::getReceiveTimestampAsString ( )
Returns
The receive timestamp value as readable string in ISO8601 format

◆ getReceiveTimestampInSecs()

double pcpp::NtpLayer::getReceiveTimestampInSecs ( ) const
Returns
The value of receive timestampin seconds from Unix Epoch (1 Jan 1970)

◆ getReferenceIdentifier()

uint32_t pcpp::NtpLayer::getReferenceIdentifier ( ) const
Returns
The value of reference identifier

◆ getReferenceIdentifierString()

std::string pcpp::NtpLayer::getReferenceIdentifierString ( ) const
Returns
The value of reference identifier as a string. String representation of NTP clock source if stratum is 1, IPv4 address or MD5 hash of first four octets of IPv6

◆ getReferenceTimestamp()

uint64_t pcpp::NtpLayer::getReferenceTimestamp ( ) const
Returns
The value of reference timestamp in NTP timestamp format

◆ getReferenceTimestampAsString()

std::string pcpp::NtpLayer::getReferenceTimestampAsString ( )
Returns
The reference timestamp value as readable string in ISO8601 format

◆ getReferenceTimestampInSecs()

double pcpp::NtpLayer::getReferenceTimestampInSecs ( ) const
Returns
The value of reference timestamp in seconds from Unix Epoch (1 Jan 1970)

◆ getRootDelay()

uint32_t pcpp::NtpLayer::getRootDelay ( ) const
Returns
The value of root delay in NTP short format

◆ getRootDelayInSecs()

double pcpp::NtpLayer::getRootDelayInSecs ( ) const
Returns
The value of root delay in seconds

◆ getRootDispersion()

uint32_t pcpp::NtpLayer::getRootDispersion ( ) const
Returns
The value of root dispersion in NTP short format

◆ getRootDispersionInSecs()

double pcpp::NtpLayer::getRootDispersionInSecs ( ) const
Returns
The value of root dispersion in seconds

◆ getStratum()

uint8_t pcpp::NtpLayer::getStratum ( ) const
Returns
The value of stratum

◆ getTransmitTimestamp()

uint64_t pcpp::NtpLayer::getTransmitTimestamp ( ) const
Returns
The value of transmit timestamp in NTP timestamp format

◆ getTransmitTimestampAsString()

std::string pcpp::NtpLayer::getTransmitTimestampAsString ( )
Returns
The transmit timestamp value as readable string in ISO8601 format

◆ getTransmitTimestampInSecs()

double pcpp::NtpLayer::getTransmitTimestampInSecs ( ) const
Returns
The value of transmit timestamp in seconds from Unix Epoch (1 Jan 1970)

◆ getVersion()

uint8_t pcpp::NtpLayer::getVersion ( ) const
Returns
The version of NTP

◆ isDataValid()

static bool pcpp::NtpLayer::isDataValid ( const uint8_t *  data,
size_t  dataSize 
)
static

A static method that takes a byte array and detects whether it is a NTP message

Parameters
[in]dataA byte array
[in]dataSizeThe byte array size (in bytes)
Returns
True if the data is identified as NTP message

◆ isNTPPort()

static bool pcpp::NtpLayer::isNTPPort ( uint16_t  port)
inlinestatic

A static method that checks whether the port is considered as NTP

Parameters
[in]portThe port number to be checked

◆ setLeapIndicator()

void pcpp::NtpLayer::setLeapIndicator ( LeapIndicator  val)

Set the leap indicator

◆ setMode()

void pcpp::NtpLayer::setMode ( Mode  val)

Set the mode

◆ setOriginTimestamp()

void pcpp::NtpLayer::setOriginTimestamp ( uint64_t  val)

Set the value of origin timestamp

Parameters
[in]valValue in NTP timestamp format

◆ setOriginTimestampInSecs()

void pcpp::NtpLayer::setOriginTimestampInSecs ( double  val)

Set the value of origin timestamp

Parameters
[in]valValue in seconds from Unix Epoch (1 Jan 1970)

◆ setPollInterval()

void pcpp::NtpLayer::setPollInterval ( int8_t  val)

Set the value of poll interval

Parameters
[in]valPoll interval in log2 seconds

◆ setPrecision()

void pcpp::NtpLayer::setPrecision ( int8_t  val)

Set the value of precision

Parameters
[in]valPrecision in log2 seconds

◆ setReceiveTimestamp()

void pcpp::NtpLayer::setReceiveTimestamp ( uint64_t  val)

Set the value of receive timestamp

Parameters
[in]valValue in NTP timestamp format

◆ setReceiveTimestampInSecs()

void pcpp::NtpLayer::setReceiveTimestampInSecs ( double  val)

Set the value of receive timestamp

Parameters
[in]valValue in seconds from Unix Epoch (1 Jan 1970)

◆ setReferenceIdentifier() [1/3]

void pcpp::NtpLayer::setReferenceIdentifier ( ClockSource  val)

Set the value of reference identifier

Parameters
[in]valValue of the reference identifier as ClockSource

◆ setReferenceIdentifier() [2/3]

void pcpp::NtpLayer::setReferenceIdentifier ( IPv4Address  val)

Set the value of reference identifier

Parameters
[in]valValue of the reference identifier as IPv4 address

◆ setReferenceIdentifier() [3/3]

void pcpp::NtpLayer::setReferenceIdentifier ( KissODeath  val)

Set the value of reference identifier

Parameters
[in]valValue of the reference identifier as Kiss-O-Death code

◆ setReferenceTimestamp()

void pcpp::NtpLayer::setReferenceTimestamp ( uint64_t  val)

Set the value of reference timestamp

Parameters
[in]valTimestamp in NTP timestamp format

◆ setReferenceTimestampInSecs()

void pcpp::NtpLayer::setReferenceTimestampInSecs ( double  val)

Set the value of reference timestamp

Parameters
[in]valValue in seconds from Unix Epoch (1 Jan 1970)

◆ setRootDelay()

void pcpp::NtpLayer::setRootDelay ( uint32_t  val)

Set the value of root delay

Parameters
[in]valRoot delay in NTP short format

◆ setRootDelayInSecs()

void pcpp::NtpLayer::setRootDelayInSecs ( double  val)

Set the value of root delay

Parameters
[in]valRoot delay in seconds

◆ setRootDispersion()

void pcpp::NtpLayer::setRootDispersion ( uint32_t  val)

Set the value of root delay

Parameters
[in]valRoot dispersion in NTP short format

◆ setRootDispersionInSecs()

void pcpp::NtpLayer::setRootDispersionInSecs ( double  val)

Set the value of root dispersion

Parameters
[in]valRoot dispersion in seconds

◆ setStratum()

void pcpp::NtpLayer::setStratum ( uint8_t  val)

Set the value of stratum

◆ setTransmitTimestamp()

void pcpp::NtpLayer::setTransmitTimestamp ( uint64_t  val)

Set the value of transmit timestamp

Parameters
[in]valValue in NTP timestamp format

◆ setTransmitTimestampInSecs()

void pcpp::NtpLayer::setTransmitTimestampInSecs ( double  val)

Set the value of transmit timestamp

Parameters
[in]valValue in seconds from Unix Epoch (1 Jan 1970)

◆ setVersion()

void pcpp::NtpLayer::setVersion ( uint8_t  val)

Set the version of NTP

◆ toString()

std::string pcpp::NtpLayer::toString ( ) const
virtual
Returns
Returns the protocol info as readable string

Implements pcpp::Layer.