Package org.apache.commons.net.ntp
Interface NtpV3Packet
- All Known Implementing Classes:
NtpV3Impl
public interface NtpV3Packet
Interface for a NtpV3Packet with get/set methods corresponding to the fields in the NTP Data Message Header described in RFC 1305.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
3static final int
2static final int
1static final int
0static final int
Mode option 5.static final int
Mode option 3.static final int
Mode option 6.static final int
Mode option 7.static final int
Mode option 0.static final int
Mode option 4.static final int
Mode option 1.static final int
Mode option 2.static final int
10static final int
14static final int
1static final int
4static final int
Standard NTP UDP portstatic final String
"DAYTIME"static final String
"ICMP"static final String
"NTP"static final String
"TIME"static final int
3static final int
4 -
Method Summary
Modifier and TypeMethodDescriptionGets a datagram packet with the NTP parts already filled in.int
Gets the leap indicator as defined in RFC-1305.int
getMode()
Gets the mode as defined in RFC-1305.Gets the mode as human readable string; for example, 3=Client.Gets theoriginate
time as defined in RFC-1305.int
getPoll()
Gets the poll interval as defined in RFC-1305.int
Gets the precision as defined in RFC-1305.Gets thereceive
time as defined in RFC-1305.int
Gets the reference id (32-bit code) as defined in RFC-1305.Gets the reference ID string.Gets the reference time as defined in RFC-1305.int
Gets the root delay as defined in RFC-1305.double
Gets root delay in milliseconds.int
Gets the root dispersion as defined in RFC-1305.long
Gets the the root dispersion in milliseconds.double
Gets the root dispersion in milliseconds.int
Gets the stratum as defined in RFC-1305.Gets thetransmit
timestamp as defined in RFC-1305.getType()
Gets the type of time packet.int
Gets version as defined in RFC-1305.void
Sets the contents of this object from the datagram packetvoid
setLeapIndicator
(int li) Sets leap indicator.void
setMode
(int mode) Sets mode as defined in RFC-1305void
Sets originate timestamp given NTP TimeStamp object.void
setPoll
(int poll) Sets poll interval as defined in RFC-1305.void
setPrecision
(int precision) Sets precision as defined in RFC-1305void
Sets receive timestamp given NTP TimeStamp object.void
setReferenceId
(int refId) Sets reference clock identifier field.void
Sets the reference timestamp given NTP TimeStamp object.void
setRootDelay
(int delay) Sets root delay as defined in RFC-1305void
setRootDispersion
(int dispersion) Sets the dispersion value.void
setStratum
(int stratum) Sets stratum as defined in RFC-1305void
Sets thetransmit
timestamp given NTP TimeStamp object.void
setVersion
(int version) Sets version as defined in RFC-1305
-
Field Details
-
NTP_PORT
Standard NTP UDP port- See Also:
-
LI_NO_WARNING
0- See Also:
-
LI_LAST_MINUTE_HAS_61_SECONDS
1- See Also:
-
LI_LAST_MINUTE_HAS_59_SECONDS
2- See Also:
-
LI_ALARM_CONDITION
3- See Also:
-
MODE_RESERVED
Mode option 0.- See Also:
-
MODE_SYMMETRIC_ACTIVE
Mode option 1.- See Also:
-
MODE_SYMMETRIC_PASSIVE
Mode option 2.- See Also:
-
MODE_CLIENT
Mode option 3.- See Also:
-
MODE_SERVER
Mode option 4.- See Also:
-
MODE_BROADCAST
Mode option 5.- See Also:
-
MODE_CONTROL_MESSAGE
Mode option 6.- See Also:
-
MODE_PRIVATE
Mode option 7.- See Also:
-
NTP_MINPOLL
4- See Also:
-
NTP_MAXPOLL
14- See Also:
-
NTP_MINCLOCK
1- See Also:
-
NTP_MAXCLOCK
10- See Also:
-
VERSION_3
3- See Also:
-
VERSION_4
4- See Also:
-
TYPE_NTP
"NTP"- See Also:
-
TYPE_ICMP
"ICMP"- See Also:
-
TYPE_TIME
"TIME"- See Also:
-
TYPE_DAYTIME
"DAYTIME"- See Also:
-
-
Method Details
-
getDatagramPacket
Gets a datagram packet with the NTP parts already filled in.- Returns:
- a datagram packet with the NTP parts already filled in.
-
getLeapIndicator
int getLeapIndicator()Gets the leap indicator as defined in RFC-1305.- Returns:
- the leap indicator as defined in RFC-1305.
-
getMode
int getMode()Gets the mode as defined in RFC-1305.- Returns:
- the mode as defined in RFC-1305.
-
getModeName
Gets the mode as human readable string; for example, 3=Client.- Returns:
- the mode as human readable string; for example, 3=Client.
-
getOriginateTimeStamp
Gets theoriginate
time as defined in RFC-1305.- Returns:
- the
originate
time as defined in RFC-1305.
-
getPoll
int getPoll()Gets the poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.- Returns:
- the poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.
-
getPrecision
int getPrecision()Gets the precision as defined in RFC-1305.- Returns:
- the precision as defined in RFC-1305.
-
getReceiveTimeStamp
Gets thereceive
time as defined in RFC-1305.- Returns:
- the
receive
time as defined in RFC-1305.
-
getReferenceId
int getReferenceId()Gets the reference id (32-bit code) as defined in RFC-1305.- Returns:
- the reference id (32-bit code) as defined in RFC-1305.
-
getReferenceIdString
Gets the reference ID string.- Returns:
- the reference ID string.
-
getReferenceTimeStamp
Gets the reference time as defined in RFC-1305.- Returns:
- the reference time as defined in RFC-1305.
-
getRootDelay
int getRootDelay()Gets the root delay as defined in RFC-1305.- Returns:
- the root delay as defined in RFC-1305.
-
getRootDelayInMillisDouble
double getRootDelayInMillisDouble()Gets root delay in milliseconds.- Returns:
- root delay in milliseconds.
-
getRootDispersion
int getRootDispersion()Gets the root dispersion as defined in RFC-1305.- Returns:
- the root dispersion as defined in RFC-1305.
-
getRootDispersionInMillis
long getRootDispersionInMillis()Gets the the root dispersion in milliseconds.- Returns:
- the root dispersion in milliseconds.
-
getRootDispersionInMillisDouble
double getRootDispersionInMillisDouble()Gets the root dispersion in milliseconds.- Returns:
- the root dispersion in milliseconds.
-
getStratum
int getStratum()Gets the stratum as defined in RFC-1305.- Returns:
- the stratum as defined in RFC-1305.
-
getTransmitTimeStamp
Gets thetransmit
timestamp as defined in RFC-1305.- Returns:
- the
transmit
timestamp as defined in RFC-1305.
-
getType
Gets the type of time packet. The values (e.g. NTP, TIME, ICMP, ...) correspond to the protocol used to obtain the timing information.- Returns:
- packet type string identifier
-
getVersion
int getVersion()Gets version as defined in RFC-1305.- Returns:
- version as defined in RFC-1305.
-
setDatagramPacket
Sets the contents of this object from the datagram packet- Parameters:
dp
- the packet
-
setLeapIndicator
Sets leap indicator.- Parameters:
li
- leap indicator code
-
setMode
Sets mode as defined in RFC-1305- Parameters:
mode
- the mode to set
-
setOriginateTimeStamp
Sets originate timestamp given NTP TimeStamp object.- Parameters:
ts
- timestamp
-
setPoll
Sets poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.- Parameters:
poll
- the interval to set
-
setPrecision
Sets precision as defined in RFC-1305- Parameters:
precision
- Precision- Since:
- 3.4
-
setReceiveTimeStamp
Sets receive timestamp given NTP TimeStamp object.- Parameters:
ts
- timestamp
-
setReferenceId
Sets reference clock identifier field.- Parameters:
refId
- the clock id field to set
-
setReferenceTime
Sets the reference timestamp given NTP TimeStamp object.- Parameters:
ts
- timestamp
-
setRootDelay
Sets root delay as defined in RFC-1305- Parameters:
delay
- the delay to set- Since:
- 3.4
-
setRootDispersion
Sets the dispersion value.- Parameters:
dispersion
- the value.- Since:
- 3.4
-
setStratum
Sets stratum as defined in RFC-1305- Parameters:
stratum
- the stratum to set
-
setTransmitTime
Sets thetransmit
timestamp given NTP TimeStamp object.- Parameters:
ts
- timestamp
-
setVersion
Sets version as defined in RFC-1305- Parameters:
version
- the version to set
-