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.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `LI_ALARM_CONDITION`
  3
  `static final int`
  `LI_LAST_MINUTE_HAS_59_SECONDS`
  2
  `static final int`
  `LI_LAST_MINUTE_HAS_61_SECONDS`
  1
  `static final int`
  `LI_NO_WARNING`
  0
  `static final int`
  `MODE_BROADCAST`
  Mode option 5.
  `static final int`
  `MODE_CLIENT`
  Mode option 3.
  `static final int`
  `MODE_CONTROL_MESSAGE`
  Mode option 6.
  `static final int`
  `MODE_PRIVATE`
  Mode option 7.
  `static final int`
  `MODE_RESERVED`
  Mode option 0.
  `static final int`
  `MODE_SERVER`
  Mode option 4.
  `static final int`
  `MODE_SYMMETRIC_ACTIVE`
  Mode option 1.
  `static final int`
  `MODE_SYMMETRIC_PASSIVE`
  Mode option 2.
  `static final int`
  `NTP_MAXCLOCK`
  10
  `static final int`
  `NTP_MAXPOLL`
  14
  `static final int`
  `NTP_MINCLOCK`
  1
  `static final int`
  `NTP_MINPOLL`
  4
  `static final int`
  `NTP_PORT`
  Standard NTP UDP port
  `static final String`
  `TYPE_DAYTIME`
  "DAYTIME"
  `static final String`
  `TYPE_ICMP`
  "ICMP"
  `static final String`
  `TYPE_NTP`
  "NTP"
  `static final String`
  `TYPE_TIME`
  "TIME"
  `static final int`
  `VERSION_3`
  3
  `static final int`
  `VERSION_4`
  4

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DatagramPacket`
  `getDatagramPacket()`
  Gets a datagram packet with the NTP parts already filled in.
  `int`
  `getLeapIndicator()`
  Gets the leap indicator as defined in RFC-1305.
  `int`
  `getMode()`
  Gets the mode as defined in RFC-1305.
  `String`
  `getModeName()`
  Gets the mode as human readable string; for example, 3=Client.
  `TimeStamp`
  `getOriginateTimeStamp()`
  Gets the `originate` time as defined in RFC-1305.
  `int`
  `getPoll()`
  Gets the poll interval as defined in RFC-1305.
  `int`
  `getPrecision()`
  Gets the precision as defined in RFC-1305.
  `TimeStamp`
  `getReceiveTimeStamp()`
  Gets the `receive` time as defined in RFC-1305.
  `int`
  `getReferenceId()`
  Gets the reference id (32-bit code) as defined in RFC-1305.
  `String`
  `getReferenceIdString()`
  Gets the reference ID string.
  `TimeStamp`
  `getReferenceTimeStamp()`
  Gets the reference time as defined in RFC-1305.
  `int`
  `getRootDelay()`
  Gets the root delay as defined in RFC-1305.
  `double`
  `getRootDelayInMillisDouble()`
  Gets root delay in milliseconds.
  `int`
  `getRootDispersion()`
  Gets the root dispersion as defined in RFC-1305.
  `long`
  `getRootDispersionInMillis()`
  Gets the the root dispersion in milliseconds.
  `double`
  `getRootDispersionInMillisDouble()`
  Gets the root dispersion in milliseconds.
  `int`
  `getStratum()`
  Gets the stratum as defined in RFC-1305.
  `TimeStamp`
  `getTransmitTimeStamp()`
  Gets the `transmit` timestamp as defined in RFC-1305.
  `String`
  `getType()`
  Gets the type of time packet.
  `int`
  `getVersion()`
  Gets version as defined in RFC-1305.
  `void`
  `setDatagramPacket(DatagramPacket dp)`
  Sets the contents of this object from the datagram packet
  `void`
  `setLeapIndicator(int li)`
  Sets leap indicator.
  `void`
  `setMode(int mode)`
  Sets mode as defined in RFC-1305
  `void`
  `setOriginateTimeStamp(TimeStamp ts)`
  Sets originate timestamp given NTP TimeStamp object.
  `void`
  `setPoll(int poll)`
  Sets poll interval as defined in RFC-1305.
  `void`
  `setPrecision(int precision)`
  Sets precision as defined in RFC-1305
  `void`
  `setReceiveTimeStamp(TimeStamp ts)`
  Sets receive timestamp given NTP TimeStamp object.
  `void`
  `setReferenceId(int refId)`
  Sets reference clock identifier field.
  `void`
  `setReferenceTime(TimeStamp ts)`
  Sets the reference timestamp given NTP TimeStamp object.
  `void`
  `setRootDelay(int delay)`
  Sets root delay as defined in RFC-1305
  `void`
  `setRootDispersion(int dispersion)`
  Sets the dispersion value.
  `void`
  `setStratum(int stratum)`
  Sets stratum as defined in RFC-1305
  `void`
  `setTransmitTime(TimeStamp ts)`
  Sets the `transmit` timestamp given NTP TimeStamp object.
  `void`
  `setVersion(int version)`
  Sets version as defined in RFC-1305

- ## Field Details

  - ### 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 String TYPE_NTP
    "NTP"
    See Also:
      - Constant Field Values

  - ### TYPE_ICMP

    static final String TYPE_ICMP
    "ICMP"
    See Also:
      - Constant Field Values

  - ### TYPE_TIME

    static final String TYPE_TIME
    "TIME"
    See Also:
      - Constant Field Values

  - ### TYPE_DAYTIME

    static final String TYPE_DAYTIME
    "DAYTIME"
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getDatagramPacket

    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

    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 the `originate` time as defined in RFC-1305.
    Returns:
      the `originate` time 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 the `receive` time as defined in RFC-1305.
    Returns:
      the `receive` time 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

    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 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 the `transmit` timestamp as defined in RFC-1305.
    Returns:
      the `transmit` timestamp as defined in RFC-1305.

  - ### getType

    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(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 the `transmit` timestamp 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