quamj.qps.util.ntp
Class NtpHeader

java.lang.Object
  |
  +--quamj.qps.util.ntp.NtpHeader

public class NtpHeader
extends java.lang.Object

This class encapsulates the header of a NtpDatagram. See rfc2030 for more details.


Field Summary
static NtpHeader defaultHeader
          The default header for a client datagram.
static byte[] defaultHeaderData
          The default header data for a client datagram.
 
Constructor Summary
NtpHeader(byte[] data)
          Construct a NtpHeader from a 16 byte array.
 
Method Summary
 byte[] getData()
          Gets the 16 byte array constituting the header.
 int getLeapYearIndicator()
           
 int getMode()
           
 int getPollInterval()
           
 double getPrecision()
          Get precision in milliseconds.
 java.lang.Object getReferenceIdentifier()
          Gets the reference identifier as an object.
 double getRootDelay()
          Get root delay in milliseconds.
 double getRootDispersion()
          Get root dispersion in milliseconds.
 int getStratum()
           
 int getVersionNumber()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultHeaderData

public static final byte[] defaultHeaderData
The default header data for a client datagram. Version=3, Mode=client.


defaultHeader

public static final NtpHeader defaultHeader
The default header for a client datagram. This is a wrapper around 'defaultHeaderData'

Constructor Detail

NtpHeader

public NtpHeader(byte[] data)
Construct a NtpHeader from a 16 byte array.

Method Detail

getData

public byte[] getData()
Gets the 16 byte array constituting the header.


getLeapYearIndicator

public int getLeapYearIndicator()

getVersionNumber

public int getVersionNumber()

getMode

public int getMode()

getStratum

public int getStratum()

getPollInterval

public int getPollInterval()

getPrecision

public double getPrecision()
Get precision in milliseconds.


getRootDelay

public double getRootDelay()
Get root delay in milliseconds.


getRootDispersion

public double getRootDispersion()
Get root dispersion in milliseconds.


getReferenceIdentifier

public java.lang.Object getReferenceIdentifier()
Gets the reference identifier as an object. It can be either a String, a InetAddress or a 4 byte array. Use 'instanceof' to find out what the true class is.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object