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.
- Version:
- $Revision: 1652868 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intStandard NTP UDP portstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionintintgetMode()intgetPoll()intintintdoubleintlongdoubleintgetType()Return type of time packet.intvoidSet the contents of this object from the datagram packetvoidsetLeapIndicator(int li) Set leap indicator.voidsetMode(int mode) Set mode as defined in RFC-1305voidSet originate timestamp given NTP TimeStamp object.voidsetPoll(int poll) Set poll interval as defined in RFC-1305.voidsetPrecision(int precision) Set precision as defined in RFC-1305voidSet receive timestamp given NTP TimeStamp object.voidsetReferenceId(int refId) Set reference clock identifier field.voidSet the reference timestamp given NTP TimeStamp object.voidsetRootDelay(int delay) Set root delay as defined in RFC-1305voidsetRootDispersion(int dispersion) voidsetStratum(int stratum) Set stratum as defined in RFC-1305voidSet the transmit timestamp given NTP TimeStamp object.voidsetVersion(int version) Set version as defined in RFC-1305
-
Field Details
-
NTP_PORT
Standard NTP UDP port- See Also:
-
LI_NO_WARNING
- See Also:
-
LI_LAST_MINUTE_HAS_61_SECONDS
- See Also:
-
LI_LAST_MINUTE_HAS_59_SECONDS
- See Also:
-
LI_ALARM_CONDITION
- See Also:
-
MODE_RESERVED
- See Also:
-
MODE_SYMMETRIC_ACTIVE
- See Also:
-
MODE_SYMMETRIC_PASSIVE
- See Also:
-
MODE_CLIENT
- See Also:
-
MODE_SERVER
- See Also:
-
MODE_BROADCAST
- See Also:
-
MODE_CONTROL_MESSAGE
- See Also:
-
MODE_PRIVATE
- See Also:
-
NTP_MINPOLL
- See Also:
-
NTP_MAXPOLL
- See Also:
-
NTP_MINCLOCK
- See Also:
-
NTP_MAXCLOCK
- See Also:
-
VERSION_3
- See Also:
-
VERSION_4
- See Also:
-
TYPE_NTP
- See Also:
-
TYPE_ICMP
- See Also:
-
TYPE_TIME
- See Also:
-
TYPE_DAYTIME
- See Also:
-
-
Method Details
-
getDatagramPacket
- Returns:
- a datagram packet with the NTP parts already filled in
-
setDatagramPacket
Set the contents of this object from the datagram packet- Parameters:
dp- the packet
-
getLeapIndicator
int getLeapIndicator()- Returns:
- leap indicator as defined in RFC-1305
-
setLeapIndicator
Set leap indicator.- Parameters:
li- - leap indicator code
-
getMode
int getMode()- Returns:
- mode as defined in RFC-1305
-
getModeName
- Returns:
- mode as human readable string; e.g. 3=Client
-
setMode
Set mode as defined in RFC-1305- Parameters:
mode- the mode to set
-
getPoll
int getPoll()- Returns:
- poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.
-
setPoll
Set poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.- Parameters:
poll- the interval to set
-
getPrecision
int getPrecision()- Returns:
- precision as defined in RFC-1305
-
setPrecision
Set precision as defined in RFC-1305- Parameters:
precision- Precision- Since:
- 3.4
-
getRootDelay
int getRootDelay()- Returns:
- root delay as defined in RFC-1305
-
setRootDelay
Set root delay as defined in RFC-1305- Parameters:
delay- the delay to set- Since:
- 3.4
-
getRootDelayInMillisDouble
double getRootDelayInMillisDouble()- Returns:
- root delay in milliseconds
-
getRootDispersion
int getRootDispersion()- Returns:
- root dispersion as defined in RFC-1305
-
setRootDispersion
- Parameters:
dispersion- the value to set- Since:
- 3.4
-
getRootDispersionInMillis
long getRootDispersionInMillis()- Returns:
- root dispersion in milliseconds
-
getRootDispersionInMillisDouble
double getRootDispersionInMillisDouble()- Returns:
- root dispersion in milliseconds
-
getVersion
int getVersion()- Returns:
- version as defined in RFC-1305
-
setVersion
Set version as defined in RFC-1305- Parameters:
version- the version to set
-
getStratum
int getStratum()- Returns:
- stratum as defined in RFC-1305
-
setStratum
Set stratum as defined in RFC-1305- Parameters:
stratum- the stratum to set
-
getReferenceIdString
- Returns:
- the reference id string
-
getReferenceId
int getReferenceId()- Returns:
- the reference id (32-bit code) as defined in RFC-1305
-
setReferenceId
Set reference clock identifier field.- Parameters:
refId- the clock id field to set
-
getTransmitTimeStamp
- Returns:
- the transmit timestamp as defined in RFC-1305
-
getReferenceTimeStamp
- Returns:
- the reference time as defined in RFC-1305
-
getOriginateTimeStamp
- Returns:
- the originate time as defined in RFC-1305
-
getReceiveTimeStamp
- Returns:
- the receive time as defined in RFC-1305
-
setTransmitTime
Set the transmit timestamp given NTP TimeStamp object.- Parameters:
ts- - timestamp
-
setReferenceTime
Set the reference timestamp given NTP TimeStamp object.- Parameters:
ts- - timestamp
-
setOriginateTimeStamp
Set originate timestamp given NTP TimeStamp object.- Parameters:
ts- - timestamp
-
setReceiveTimeStamp
Set receive timestamp given NTP TimeStamp object.- Parameters:
ts- - timestamp
-
getType
Return 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
-