001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020
021package org.apache.directory.server.ntp.messages;
022
023
024/**
025 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
026 */
027public class NtpMessageModifier
028{
029    private LeapIndicatorType leapIndicator;
030    private int versionNumber;
031    private ModeType mode;
032    private StratumType stratumType;
033    private byte pollInterval;
034    private byte precision;
035    private int rootDelay;
036    private int rootDispersion;
037
038    private ReferenceIdentifier referenceIdentifier;
039
040    private NtpTimeStamp referenceTimestamp;
041    private NtpTimeStamp originateTimestamp;
042    private NtpTimeStamp receiveTimestamp;
043    private NtpTimeStamp transmitTimestamp;
044
045
046    /**
047     * Returns the built {@link NtpMessage}.
048     *
049     * @return The {@link NtpMessage}.
050     */
051    public NtpMessage getNtpMessage()
052    {
053        return new NtpMessage( leapIndicator, versionNumber, mode, stratumType, pollInterval, precision, rootDelay,
054            rootDispersion, referenceIdentifier, referenceTimestamp, originateTimestamp, receiveTimestamp,
055            transmitTimestamp );
056    }
057
058
059    /**
060     * @param leapIndicator The Leap Indicator to set.
061     */
062    public void setLeapIndicator( LeapIndicatorType leapIndicator )
063    {
064        this.leapIndicator = leapIndicator;
065    }
066
067
068    /**
069     * @param mode The Mode to set.
070     */
071    public void setMode( ModeType mode )
072    {
073        this.mode = mode;
074    }
075
076
077    /**
078     * @param originateTimestamp The Originate Timestamp to set.
079     */
080    public void setOriginateTimestamp( NtpTimeStamp originateTimestamp )
081    {
082        this.originateTimestamp = originateTimestamp;
083    }
084
085
086    /**
087     * @param pollInterval The Poll Interval to set.
088     */
089    public void setPollInterval( byte pollInterval )
090    {
091        this.pollInterval = pollInterval;
092    }
093
094
095    /**
096     * @param precision The Precision to set.
097     */
098    public void setPrecision( byte precision )
099    {
100        this.precision = precision;
101    }
102
103
104    /**
105     * @param receiveTimestamp The Receive Timestamp to set.
106     */
107    public void setReceiveTimestamp( NtpTimeStamp receiveTimestamp )
108    {
109        this.receiveTimestamp = receiveTimestamp;
110    }
111
112
113    /**
114     * @param referenceIdentifier The Reference Identifier to set.
115     */
116    public void setReferenceIdentifier( ReferenceIdentifier referenceIdentifier )
117    {
118        this.referenceIdentifier = referenceIdentifier;
119    }
120
121
122    /**
123     * @param referenceTimestamp The Reference Timestamp to set.
124     */
125    public void setReferenceTimestamp( NtpTimeStamp referenceTimestamp )
126    {
127        this.referenceTimestamp = referenceTimestamp;
128    }
129
130
131    /**
132     * @param rootDelay The Root Delay to set.
133     */
134    public void setRootDelay( int rootDelay )
135    {
136        this.rootDelay = rootDelay;
137    }
138
139
140    /**
141     * @param rootDispersion The Root Dispersion to set.
142     */
143    public void setRootDispersion( int rootDispersion )
144    {
145        this.rootDispersion = rootDispersion;
146    }
147
148
149    /**
150     * @param stratumType The Stratum to set.
151     */
152    public void setStratum( StratumType stratumType )
153    {
154        this.stratumType = stratumType;
155    }
156
157
158    /**
159     * @param transmitTimestamp The Transmit Timestamp to set.
160     */
161    public void setTransmitTimestamp( NtpTimeStamp transmitTimestamp )
162    {
163        this.transmitTimestamp = transmitTimestamp;
164    }
165
166
167    /**
168     * @param versionNumber The Version Number to set.
169     */
170    public void setVersionNumber( int versionNumber )
171    {
172        this.versionNumber = versionNumber;
173    }
174}