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: 165675 $ $Date: 2005-05-02 15:09:55 -0500 (Mon, 02 May 2005) $
Author:
Naz Irizarry, MITRE Corp, Jason Mathews, MITRE Corp

Field Summary
static int LI_ALARM_CONDITION
           
static int LI_LAST_MINUTE_HAS_59_SECONDS
           
static int LI_LAST_MINUTE_HAS_61_SECONDS
           
static int LI_NO_WARNING
           
static int MODE_BROADCAST
           
static int MODE_CLIENT
           
static int MODE_CONTROL_MESSAGE
           
static int MODE_PRIVATE
           
static int MODE_RESERVED
           
static int MODE_SERVER
           
static int MODE_SYMMETRIC_ACTIVE
           
static int MODE_SYMMETRIC_PASSIVE
           
static int NTP_MAXCLOCK
           
static int NTP_MAXPOLL
           
static int NTP_MINCLOCK
           
static int NTP_MINPOLL
           
static int NTP_PORT
          Standard NTP UDP port
static String TYPE_DAYTIME
           
static String TYPE_ICMP
           
static String TYPE_NTP
           
static String TYPE_TIME
           
static int VERSION_3
           
static int VERSION_4
           
 
Method Summary
 DatagramPacket getDatagramPacket()
           
 int getLeapIndicator()
           
 int getMode()
           
 String getModeName()
           
 TimeStamp getOriginateTimeStamp()
           
 int getPoll()
           
 int getPrecision()
           
 TimeStamp getReceiveTimeStamp()
           
 int getReferenceId()
           
 String getReferenceIdString()
           
 TimeStamp getReferenceTimeStamp()
           
 int getRootDelay()
           
 double getRootDelayInMillisDouble()
           
 int getRootDispersion()
           
 long getRootDispersionInMillis()
           
 double getRootDispersionInMillisDouble()
           
 int getStratum()
           
 TimeStamp getTransmitTimeStamp()
           
 String getType()
          Return type of time packet.
 int getVersion()
           
 void setDatagramPacket(DatagramPacket dp)
          Set the contents of this object from the datagram packet
 void setLeapIndicator(int li)
          Set leap indicator.
 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 setReceiveTimeStamp(TimeStamp ts)
          Set receive timestamp given NTP TimeStamp object.
 void setReferenceId(int refId)
          Set reference clock identifier field.
 void setReferenceTime(TimeStamp ts)
          Set the reference timestamp given NTP TimeStamp object.
 void setStratum(int stratum)
          Set stratum as defined in RFC-1305
 void setTransmitTime(TimeStamp ts)
          Set the transmit timestamp given NTP TimeStamp object.
 void setVersion(int mode)
          Set version as defined in RFC-1305
 

Field Detail

NTP_PORT

public static final int NTP_PORT
Standard NTP UDP port

See Also:
Constant Field Values

LI_NO_WARNING

public static final int LI_NO_WARNING
See Also:
Constant Field Values

LI_LAST_MINUTE_HAS_61_SECONDS

public static final int LI_LAST_MINUTE_HAS_61_SECONDS
See Also:
Constant Field Values

LI_LAST_MINUTE_HAS_59_SECONDS

public static final int LI_LAST_MINUTE_HAS_59_SECONDS
See Also:
Constant Field Values

LI_ALARM_CONDITION

public static final int LI_ALARM_CONDITION
See Also:
Constant Field Values

MODE_RESERVED

public static final int MODE_RESERVED
See Also:
Constant Field Values

MODE_SYMMETRIC_ACTIVE

public static final int MODE_SYMMETRIC_ACTIVE
See Also:
Constant Field Values

MODE_SYMMETRIC_PASSIVE

public static final int MODE_SYMMETRIC_PASSIVE
See Also:
Constant Field Values

MODE_CLIENT

public static final int MODE_CLIENT
See Also:
Constant Field Values

MODE_SERVER

public static final int MODE_SERVER
See Also:
Constant Field Values

MODE_BROADCAST

public static final int MODE_BROADCAST
See Also:
Constant Field Values

MODE_CONTROL_MESSAGE

public static final int MODE_CONTROL_MESSAGE
See Also:
Constant Field Values

MODE_PRIVATE

public static final int MODE_PRIVATE
See Also:
Constant Field Values

NTP_MINPOLL

public static final int NTP_MINPOLL
See Also:
Constant Field Values

NTP_MAXPOLL

public static final int NTP_MAXPOLL
See Also:
Constant Field Values

NTP_MINCLOCK

public static final int NTP_MINCLOCK
See Also:
Constant Field Values

NTP_MAXCLOCK

public static final int NTP_MAXCLOCK
See Also:
Constant Field Values

VERSION_3

public static final int VERSION_3
See Also:
Constant Field Values

VERSION_4

public static final int VERSION_4
See Also:
Constant Field Values

TYPE_NTP

public static final String TYPE_NTP
See Also:
Constant Field Values

TYPE_ICMP

public static final String TYPE_ICMP
See Also:
Constant Field Values

TYPE_TIME

public static final String TYPE_TIME
See Also:
Constant Field Values

TYPE_DAYTIME

public static final String TYPE_DAYTIME
See Also:
Constant Field Values
Method Detail

getDatagramPacket

public DatagramPacket getDatagramPacket()
Returns:
a datagram packet with the NTP parts already filled in

setDatagramPacket

public void setDatagramPacket(DatagramPacket dp)
Set the contents of this object from the datagram packet


getLeapIndicator

public int getLeapIndicator()
Returns:
leap indicator as defined in RFC-1305

setLeapIndicator

public void setLeapIndicator(int li)
Set leap indicator.

Parameters:
li - - leap indicator code

getMode

public int getMode()
Returns:
mode as defined in RFC-1305

getModeName

public String getModeName()
Returns:
mode as human readable string; e.g. 3=Client

setMode

public void setMode(int mode)
Set mode as defined in RFC-1305


getPoll

public int getPoll()
Returns:
poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.

setPoll

public void setPoll(int poll)
Set poll interval as defined in RFC-1305. Field range between NTP_MINPOLL and NTP_MAXPOLL.


getPrecision

public int getPrecision()
Returns:
precision as defined in RFC-1305

getRootDelay

public int getRootDelay()
Returns:
root delay as defined in RFC-1305

getRootDelayInMillisDouble

public double getRootDelayInMillisDouble()
Returns:
root delay in milliseconds

getRootDispersion

public int getRootDispersion()
Returns:
root dispersion as defined in RFC-1305

getRootDispersionInMillis

public long getRootDispersionInMillis()
Returns:
root dispersion in milliseconds

getRootDispersionInMillisDouble

public double getRootDispersionInMillisDouble()
Returns:
root dispersion in milliseconds

getVersion

public int getVersion()
Returns:
version as defined in RFC-1305

setVersion

public void setVersion(int mode)
Set version as defined in RFC-1305


getStratum

public int getStratum()
Returns:
stratum as defined in RFC-1305

setStratum

public void setStratum(int stratum)
Set stratum as defined in RFC-1305


getReferenceIdString

public String getReferenceIdString()
Returns:
the reference id string

getReferenceId

public int getReferenceId()
Returns:
the reference id (32-bit code) as defined in RFC-1305

setReferenceId

public void setReferenceId(int refId)
Set reference clock identifier field.

Parameters:
refId -

getTransmitTimeStamp

public TimeStamp getTransmitTimeStamp()
Returns:
the transmit timestamp as defined in RFC-1305

getReferenceTimeStamp

public TimeStamp getReferenceTimeStamp()
Returns:
the reference time as defined in RFC-1305

getOriginateTimeStamp

public TimeStamp getOriginateTimeStamp()
Returns:
the originate time as defined in RFC-1305

getReceiveTimeStamp

public TimeStamp getReceiveTimeStamp()
Returns:
the receive time as defined in RFC-1305

setTransmitTime

public void setTransmitTime(TimeStamp ts)
Set the transmit timestamp given NTP TimeStamp object.

Parameters:
ts - - timestamp

setReferenceTime

public void setReferenceTime(TimeStamp ts)
Set the reference timestamp given NTP TimeStamp object.

Parameters:
ts - - timestamp

setOriginateTimeStamp

public void setOriginateTimeStamp(TimeStamp ts)
Set originate timestamp given NTP TimeStamp object.

Parameters:
ts - - timestamp

setReceiveTimeStamp

public void setReceiveTimeStamp(TimeStamp ts)
Set receive timestamp given NTP TimeStamp object.

Parameters:
ts - - timestamp

getType

public String 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


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.