|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.net.ntp.NtpV3Impl
public class NtpV3Impl
Implementation of NtpV3Packet with methods converting Java objects to/from the Network Time Protocol (NTP) data message header format described in RFC-1305.
Field Summary |
---|
Fields inherited from interface org.apache.commons.net.ntp.NtpV3Packet |
---|
LI_ALARM_CONDITION, LI_LAST_MINUTE_HAS_59_SECONDS, LI_LAST_MINUTE_HAS_61_SECONDS, LI_NO_WARNING, MODE_BROADCAST, MODE_CLIENT, MODE_CONTROL_MESSAGE, MODE_PRIVATE, MODE_RESERVED, MODE_SERVER, MODE_SYMMETRIC_ACTIVE, MODE_SYMMETRIC_PASSIVE, NTP_MAXCLOCK, NTP_MAXPOLL, NTP_MINCLOCK, NTP_MINPOLL, NTP_PORT, TYPE_DAYTIME, TYPE_ICMP, TYPE_NTP, TYPE_TIME, VERSION_3, VERSION_4 |
Constructor Summary | |
---|---|
NtpV3Impl()
Creates a new instance of NtpV3Impl |
Method Summary | |
---|---|
DatagramPacket |
getDatagramPacket()
Returns the datagram packet with the NTP details already filled in. |
int |
getLeapIndicator()
Returns leap indicator as defined in RFC-1305 which is a two-bit code: 0=no warning 1=last minute has 61 seconds 2=last minute has 59 seconds 3=alarm condition (clock not synchronized) |
int |
getMode()
Returns mode as defined in RFC-1305 which is a 3-bit integer whose value is indicated by the MODE_xxx parameters. |
String |
getModeName()
Return human-readable name of message mode type as described in RFC 1305. |
TimeStamp |
getOriginateTimeStamp()
Returns the originate time as defined in RFC-1305. |
int |
getPoll()
Returns poll interval as defined in RFC-1305, which is an eight-bit signed integer indicating the maximum interval between successive messages, in seconds to the nearest power of two (e.g. |
int |
getPrecision()
Returns precision as defined in RFC-1305 encoded as an 8-bit signed integer (seconds to nearest power of two). |
TimeStamp |
getReceiveTimeStamp()
Returns receive timestamp as defined in RFC-1305. |
int |
getReferenceId()
Returns the reference id as defined in RFC-1305, which is a 32-bit integer whose value is dependent on several criteria. |
String |
getReferenceIdString()
Returns the reference id string. |
TimeStamp |
getReferenceTimeStamp()
Returns the reference time as defined in RFC-1305. |
int |
getRootDelay()
Return root delay as defined in RFC-1305, which is the total roundtrip delay to the primary reference source, in seconds. |
double |
getRootDelayInMillisDouble()
Return root delay as defined in RFC-1305 in milliseconds, which is the total roundtrip delay to the primary reference source, in seconds. |
int |
getRootDispersion()
Returns root dispersion as defined in RFC-1305. |
long |
getRootDispersionInMillis()
Returns root dispersion (as defined in RFC-1305) in milliseconds. |
double |
getRootDispersionInMillisDouble()
Returns root dispersion (as defined in RFC-1305) in milliseconds as double precision value. |
int |
getStratum()
Returns Stratum as defined in RFC-1305, which indicates the stratum level of the local clock, with values defined as follows: 0=unspecified, 1=primary ref clock, and all others a secondary reference (via NTP). |
TimeStamp |
getTransmitTimeStamp()
Returns the transmit timestamp as defined in RFC-1305. |
String |
getType()
Return type of time packet. |
int |
getVersion()
Returns NTP version number as defined in RFC-1305. |
void |
setDatagramPacket(DatagramPacket srcDp)
Set the contents of this object from source datagram packet. |
void |
setLeapIndicator(int li)
Set leap indicator as defined in RFC-1305. |
void |
setMode(int mode)
Set mode as defined in RFC-1305. |
void |
setOriginateTimeStamp(TimeStamp ts)
Set originate timestamp given NTP TimeStamp object. |
void |
setPoll(int poll)
Set poll interval as defined in RFC-1305. |
void |
setPrecision(int precision)
Set precision as defined in RFC-1305. |
void |
setReceiveTimeStamp(TimeStamp ts)
Set receive timestamp given NTP TimeStamp object. |
void |
setReferenceId(int refId)
Set reference clock identifier field with 32-bit unsigned integer value. |
void |
setReferenceTime(TimeStamp ts)
Set Reference time with NTP timestamp. |
void |
setStratum(int stratum)
Set stratum level as defined in RFC-1305. |
void |
setTransmitTime(TimeStamp ts)
Set transmit time with NTP timestamp. |
void |
setVersion(int version)
Set NTP version as defined in RFC-1305. |
String |
toString()
Returns details of NTP packet as a string. |
protected static int |
ui(byte b)
Convert byte to unsigned integer. |
protected static long |
ul(byte b)
Convert byte to unsigned long. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NtpV3Impl()
Method Detail |
---|
public int getMode()
getMode
in interface NtpV3Packet
public String getModeName()
getModeName
in interface NtpV3Packet
public void setMode(int mode)
setMode
in interface NtpV3Packet
mode
- public int getLeapIndicator()
getLeapIndicator
in interface NtpV3Packet
public void setLeapIndicator(int li)
setLeapIndicator
in interface NtpV3Packet
li
- leap indicator.public int getPoll()
getPoll
in interface NtpV3Packet
public void setPoll(int poll)
setPoll
in interface NtpV3Packet
poll
- poll interval.public int getPrecision()
getPrecision
in interface NtpV3Packet
public void setPrecision(int precision)
precision
- public int getVersion()
getVersion
in interface NtpV3Packet
public void setVersion(int version)
setVersion
in interface NtpV3Packet
version
- NTP version.public int getStratum()
getStratum
in interface NtpV3Packet
public void setStratum(int stratum)
setStratum
in interface NtpV3Packet
stratum
- stratum level.public int getRootDelay()
getRootDelay
in interface NtpV3Packet
public double getRootDelayInMillisDouble()
getRootDelayInMillisDouble
in interface NtpV3Packet
public int getRootDispersion()
getRootDispersion
in interface NtpV3Packet
public long getRootDispersionInMillis()
getRootDispersionInMillis
in interface NtpV3Packet
public double getRootDispersionInMillisDouble()
getRootDispersionInMillisDouble
in interface NtpV3Packet
public void setReferenceId(int refId)
setReferenceId
in interface NtpV3Packet
refId
- reference clock identifier.public int getReferenceId()
getReferenceId
in interface NtpV3Packet
public String getReferenceIdString()
getReferenceIdString
in interface NtpV3Packet
public TimeStamp getTransmitTimeStamp()
getTransmitTimeStamp
in interface NtpV3Packet
public void setTransmitTime(TimeStamp ts)
ts
is null then zero time is used.
setTransmitTime
in interface NtpV3Packet
ts
- NTP timestamppublic void setOriginateTimeStamp(TimeStamp ts)
ts
is null then zero time is used.
setOriginateTimeStamp
in interface NtpV3Packet
ts
- NTP timestamppublic TimeStamp getOriginateTimeStamp()
getOriginateTimeStamp
in interface NtpV3Packet
public TimeStamp getReferenceTimeStamp()
getReferenceTimeStamp
in interface NtpV3Packet
TimeStamp
object.
Never returns null.public void setReferenceTime(TimeStamp ts)
ts
is null
then zero time is used.
setReferenceTime
in interface NtpV3Packet
ts
- NTP timestamppublic TimeStamp getReceiveTimeStamp()
getReceiveTimeStamp
in interface NtpV3Packet
public void setReceiveTimeStamp(TimeStamp ts)
ts
is null then zero time is used.
setReceiveTimeStamp
in interface NtpV3Packet
ts
- timestamppublic String getType()
getType
in interface NtpV3Packet
public DatagramPacket getDatagramPacket()
getDatagramPacket
in interface NtpV3Packet
public void setDatagramPacket(DatagramPacket srcDp)
setDatagramPacket
in interface NtpV3Packet
srcDp
- source DatagramPacket to copy contents from.protected static final int ui(byte b)
b
-
protected static final long ul(byte b)
b
-
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |