Package org.apache.commons.net.ntp
Interface NtpV3Packet
-
- All Known Implementing Classes:
NtpV3Impl
public interface NtpV3PacketInterface for a NtpV3Packet with get/set methods corresponding to the fields in the NTP Data Message Header described in RFC 1305.
-
-
Field Summary
Fields Modifier and Type Field Description static intLI_ALARM_CONDITION3static intLI_LAST_MINUTE_HAS_59_SECONDS2static intLI_LAST_MINUTE_HAS_61_SECONDS1static intLI_NO_WARNING0static intMODE_BROADCASTMode option 5.static intMODE_CLIENTMode option 3.static intMODE_CONTROL_MESSAGEMode option 6.static intMODE_PRIVATEMode option 7.static intMODE_RESERVEDMode option 0.static intMODE_SERVERMode option 4.static intMODE_SYMMETRIC_ACTIVEMode option 1.static intMODE_SYMMETRIC_PASSIVEMode option 2.static intNTP_MAXCLOCK10static intNTP_MAXPOLL14static intNTP_MINCLOCK1static intNTP_MINPOLL4static intNTP_PORTStandard NTP UDP portstatic java.lang.StringTYPE_DAYTIME"DAYTIME"static java.lang.StringTYPE_ICMP"ICMP"static java.lang.StringTYPE_NTP"NTP"static java.lang.StringTYPE_TIME"TIME"static intVERSION_33static intVERSION_44
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.net.DatagramPacketgetDatagramPacket()Gets a datagram packet with the NTP parts already filled in.intgetLeapIndicator()Gets the leap indicator as defined in RFC-1305.intgetMode()Gets the mode as defined in RFC-1305.java.lang.StringgetModeName()Gets the mode as human readable string; for example, 3=Client.TimeStampgetOriginateTimeStamp()Gets theoriginatetime as defined in RFC-1305.intgetPoll()Gets the poll interval as defined in RFC-1305.intgetPrecision()Gets the precision as defined in RFC-1305.TimeStampgetReceiveTimeStamp()Gets thereceivetime as defined in RFC-1305.intgetReferenceId()Gets the reference id (32-bit code) as defined in RFC-1305.java.lang.StringgetReferenceIdString()Gets the reference ID string.TimeStampgetReferenceTimeStamp()Gets the reference time as defined in RFC-1305.intgetRootDelay()Gets the root delay as defined in RFC-1305.doublegetRootDelayInMillisDouble()Gets root delay in milliseconds.intgetRootDispersion()Gets the root dispersion as defined in RFC-1305.longgetRootDispersionInMillis()Gets the root dispersion in milliseconds.doublegetRootDispersionInMillisDouble()Gets the root dispersion in milliseconds.intgetStratum()Gets the stratum as defined in RFC-1305.TimeStampgetTransmitTimeStamp()Gets thetransmittimestamp as defined in RFC-1305.java.lang.StringgetType()Gets the type of time packet.intgetVersion()Gets version as defined in RFC-1305.voidsetDatagramPacket(java.net.DatagramPacket dp)Sets the contents of this object from the datagram packetvoidsetLeapIndicator(int li)Sets leap indicator.voidsetMode(int mode)Sets mode as defined in RFC-1305voidsetOriginateTimeStamp(TimeStamp ts)Sets originate timestamp given NTP TimeStamp object.voidsetPoll(int poll)Sets poll interval as defined in RFC-1305.voidsetPrecision(int precision)Sets precision as defined in RFC-1305voidsetReceiveTimeStamp(TimeStamp ts)Sets receive timestamp given NTP TimeStamp object.voidsetReferenceId(int refId)Sets reference clock identifier field.voidsetReferenceTime(TimeStamp ts)Sets the reference timestamp given NTP TimeStamp object.voidsetRootDelay(int delay)Sets root delay as defined in RFC-1305voidsetRootDispersion(int dispersion)Sets the dispersion value.voidsetStratum(int stratum)Sets stratum as defined in RFC-1305voidsetTransmitTime(TimeStamp ts)Sets thetransmittimestamp given NTP TimeStamp object.voidsetVersion(int version)Sets version as defined in RFC-1305
-
-
-
Field Detail
-
NTP_PORT
static final int NTP_PORT
Standard NTP UDP port- See Also:
- Constant Field Values
-
LI_NO_WARNING
static final int LI_NO_WARNING
0- See Also:
- Constant Field Values
-
LI_LAST_MINUTE_HAS_61_SECONDS
static final int LI_LAST_MINUTE_HAS_61_SECONDS
1- See Also:
- Constant Field Values
-
LI_LAST_MINUTE_HAS_59_SECONDS
static final int LI_LAST_MINUTE_HAS_59_SECONDS
2- See Also:
- Constant Field Values
-
LI_ALARM_CONDITION
static final int LI_ALARM_CONDITION
3- See Also:
- Constant Field Values
-
MODE_RESERVED
static final int MODE_RESERVED
Mode option 0.- See Also:
- Constant Field Values
-
MODE_SYMMETRIC_ACTIVE
static final int MODE_SYMMETRIC_ACTIVE
Mode option 1.- See Also:
- Constant Field Values
-
MODE_SYMMETRIC_PASSIVE
static final int MODE_SYMMETRIC_PASSIVE
Mode option 2.- See Also:
- Constant Field Values
-
MODE_CLIENT
static final int MODE_CLIENT
Mode option 3.- See Also:
- Constant Field Values
-
MODE_SERVER
static final int MODE_SERVER
Mode option 4.- See Also:
- Constant Field Values
-
MODE_BROADCAST
static final int MODE_BROADCAST
Mode option 5.- See Also:
- Constant Field Values
-
MODE_CONTROL_MESSAGE
static final int MODE_CONTROL_MESSAGE
Mode option 6.- See Also:
- Constant Field Values
-
MODE_PRIVATE
static final int MODE_PRIVATE
Mode option 7.- See Also:
- Constant Field Values
-
NTP_MINPOLL
static final int NTP_MINPOLL
4- See Also:
- Constant Field Values
-
NTP_MAXPOLL
static final int NTP_MAXPOLL
14- See Also:
- Constant Field Values
-
NTP_MINCLOCK
static final int NTP_MINCLOCK
1- See Also:
- Constant Field Values
-
NTP_MAXCLOCK
static final int NTP_MAXCLOCK
10- See Also:
- Constant Field Values
-
VERSION_3
static final int VERSION_3
3- See Also:
- Constant Field Values
-
VERSION_4
static final int VERSION_4
4- See Also:
- Constant Field Values
-
TYPE_NTP
static final java.lang.String TYPE_NTP
"NTP"- See Also:
- Constant Field Values
-
TYPE_ICMP
static final java.lang.String TYPE_ICMP
"ICMP"- See Also:
- Constant Field Values
-
TYPE_TIME
static final java.lang.String TYPE_TIME
"TIME"- See Also:
- Constant Field Values
-
TYPE_DAYTIME
static final java.lang.String TYPE_DAYTIME
"DAYTIME"- See Also:
- Constant Field Values
-
-
Method Detail
-
getDatagramPacket
java.net.DatagramPacket 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
java.lang.String getModeName()
Gets the mode as human readable string; for example, 3=Client.- Returns:
- the mode as human readable string; for example, 3=Client.
-
getOriginateTimeStamp
TimeStamp getOriginateTimeStamp()
Gets theoriginatetime as defined in RFC-1305.- Returns:
- the
originatetime 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
TimeStamp getReceiveTimeStamp()
Gets thereceivetime as defined in RFC-1305.- Returns:
- the
receivetime 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
java.lang.String getReferenceIdString()
Gets the reference ID string.- Returns:
- the reference ID string.
-
getReferenceTimeStamp
TimeStamp 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 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
TimeStamp getTransmitTimeStamp()
Gets thetransmittimestamp as defined in RFC-1305.- Returns:
- the
transmittimestamp as defined in RFC-1305.
-
getType
java.lang.String 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
void setDatagramPacket(java.net.DatagramPacket dp)
Sets the contents of this object from the datagram packet- Parameters:
dp- the packet
-
setLeapIndicator
void setLeapIndicator(int li)
Sets leap indicator.- Parameters:
li- leap indicator code
-
setMode
void setMode(int mode)
Sets mode as defined in RFC-1305- Parameters:
mode- the mode to set
-
setOriginateTimeStamp
void setOriginateTimeStamp(TimeStamp ts)
Sets originate timestamp given NTP TimeStamp object.- Parameters:
ts- timestamp
-
setPoll
void setPoll(int poll)
Sets poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.- Parameters:
poll- the interval to set
-
setPrecision
void setPrecision(int precision)
Sets precision as defined in RFC-1305- Parameters:
precision- Precision- Since:
- 3.4
-
setReceiveTimeStamp
void setReceiveTimeStamp(TimeStamp ts)
Sets receive timestamp given NTP TimeStamp object.- Parameters:
ts- timestamp
-
setReferenceId
void setReferenceId(int refId)
Sets reference clock identifier field.- Parameters:
refId- the clock id field to set
-
setReferenceTime
void setReferenceTime(TimeStamp ts)
Sets the reference timestamp given NTP TimeStamp object.- Parameters:
ts- timestamp
-
setRootDelay
void setRootDelay(int delay)
Sets root delay as defined in RFC-1305- Parameters:
delay- the delay to set- Since:
- 3.4
-
setRootDispersion
void setRootDispersion(int dispersion)
Sets the dispersion value.- Parameters:
dispersion- the value.- Since:
- 3.4
-
setStratum
void setStratum(int stratum)
Sets stratum as defined in RFC-1305- Parameters:
stratum- the stratum to set
-
setTransmitTime
void setTransmitTime(TimeStamp ts)
Sets thetransmittimestamp given NTP TimeStamp object.- Parameters:
ts- timestamp
-
setVersion
void setVersion(int version)
Sets version as defined in RFC-1305- Parameters:
version- the version to set
-
-