sntp-opts.def revision 1.1.1.4.6.2 1 /* -*- Mode: Text -*- */
2
3 autogen definitions options;
4
5 #include autogen-version.def
6 #include copyright.def
7
8 prog-name = "sntp";
9 prog-title = "standard Simple Network Time Protocol client program";
10 argument = '[ hostname-or-IP ...]';
11
12 #include homerc.def
13
14 long-opts;
15
16 config-header = "config.h";
17
18 environrc;
19
20 #include version.def
21
22 flag = {
23 name = ipv4;
24 value = 4;
25 flags-cant = ipv6;
26 descrip = "Force IPv4 DNS name resolution";
27 doc = <<- _EndOfDoc_
28 Force DNS resolution of the following host names on the command line
29 to the IPv4 namespace.
30 _EndOfDoc_;
31 };
32
33 flag = {
34 name = ipv6;
35 value = 6;
36 flags-cant = ipv4;
37 descrip = "Force IPv6 DNS name resolution";
38 doc = <<- _EndOfDoc_
39 Force DNS resolution of the following host names on the command line
40 to the IPv6 namespace.
41 _EndOfDoc_;
42 };
43
44 flag = {
45 name = authentication;
46 value = a;
47 descrip = "Enable authentication with the key @var{auth-keynumber}";
48 arg-type = number;
49 arg-name = "auth-keynumber";
50 doc = <<- _EndOfDoc_
51 Enable authentication using the key specified in this option's
52 argument. The argument of this option is the @option{keyid}, a
53 number specified in the @option{keyfile} as this key's identifier.
54 See the @option{keyfile} option (@option{-k}) for more details.
55 _EndOfDoc_;
56 };
57
58 flag = {
59 name = broadcast;
60 value = b;
61 descrip = "Listen to the address specified for broadcast time sync";
62 arg-type = string;
63 arg-name = "broadcast-address";
64 max = NOLIMIT;
65 stack-arg;
66 doc = <<- _EndOfDoc_
67 If specified @code{sntp} will listen to the specified address
68 for NTP broadcasts. The default maximum wait time
69 can (and probably should) be modified with @option{-t}.
70 _EndOfDoc_;
71 };
72
73 flag = {
74 name = concurrent;
75 value = c;
76 descrip = "Concurrently query all IPs returned for host-name";
77 arg-type = string;
78 arg-name = "host-name";
79 max = NOLIMIT;
80 stack-arg;
81 doc = <<- _EndOfDoc_
82 Requests from an NTP "client" to a "server" should never be sent
83 more rapidly than one every 2 seconds. By default, any IPs returned
84 as part of a DNS lookup are assumed to be for a single instance of
85 @code{ntpd}, and therefore @code{sntp} will send queries to these IPs
86 one after another, with a 2-second gap in between each query.
87
88 The @option{-c} or @option{--concurrent} flag says that any IPs
89 returned for the DNS lookup of the supplied host-name are on
90 different machines, so we can send concurrent queries.
91 _EndOfDoc_;
92 };
93
94 #include debug-opt.def
95
96 flag = {
97 name = gap;
98 value = g;
99 descrip = "The gap (in milliseconds) between time requests";
100 arg-type = number;
101 arg-name = "milliseconds";
102 arg-default = 50;
103 doc = <<- _EndOfDoc_
104 Since we're only going to use the first valid response we get and
105 there is benefit to specifying a good number of servers to query,
106 separate the queries we send out by the specified number of
107 milliseconds.
108 _EndOfDoc_;
109 };
110
111 flag = {
112 name = kod;
113 value = K;
114 arg-type = file;
115 arg-name = "file-name";
116 arg-default = "/var/db/ntp-kod";
117 descrip = "KoD history filename";
118 doc = <<- _EndOfDoc_
119 Specifies the filename to be used for the persistent history of KoD
120 responses received from servers. If the file does not exist, a
121 warning message will be displayed. The file will not be created.
122 _EndOfDoc_;
123 };
124
125 flag = {
126 name = keyfile;
127 value = k;
128 descrip = "Look in this file for the key specified with @option{-a}";
129 arg-type = file;
130 arg-name = "file-name";
131 doc = <<- _EndOfDoc_
132 This option specifies the keyfile.
133 @code{sntp} will search for the key specified with @option{-a}
134 @file{keyno} in this file. See @command{ntp.keys(5)} for more
135 information.
136 _EndOfDoc_;
137 };
138
139 flag = {
140 name = logfile;
141 value = l;
142 arg-type = file;
143 arg-name = "file-name";
144 descrip = "Log to specified logfile";
145 doc = <<- _EndOfDoc_
146 This option causes the client to write log messages to the specified
147 @file{logfile}.
148 _EndOfDoc_;
149 };
150
151 flag = {
152 name = steplimit;
153 value = M;
154 arg-type = number;
155 arg-range = "0->";
156 descrip = "Adjustments less than @var{steplimit} msec will be slewed";
157 doc = <<- _EndOfDoc_
158 If the time adjustment is less than @file{steplimit} milliseconds,
159 slew the amount using @command{adjtime(2)}. Otherwise, step the
160 correction using @command{settimeofday(2)}.
161 _EndOfDoc_;
162 };
163
164 flag = {
165 name = ntpversion;
166 value = o;
167 descrip = "Send @var{int} as our NTP protocol version";
168 arg-type = number;
169 arg-default = 4;
170 arg-range = "0->7";
171 doc = <<- _EndOfDoc_
172 When sending requests to a remote server, tell them we are running
173 NTP protocol version @file{ntpversion} .
174 _EndOfDoc_;
175 };
176
177 flag = {
178 name = usereservedport;
179 value = r;
180 descrip = "Use the NTP Reserved Port (port 123)";
181 doc = <<- _EndOfDoc_
182 Use port 123, which is reserved for NTP, for our network
183 communications.
184 _EndOfDoc_;
185 };
186
187 flag = {
188 name = step;
189 value = S;
190 descrip = "OK to 'step' the time with @command{settimeofday(2)}";
191 doc = <<- _EndOfDoc_
192 _EndOfDoc_;
193 };
194
195 flag = {
196 name = slew;
197 value = s;
198 descrip = "OK to 'slew' the time with @command{adjtime(2)}";
199 doc = <<- _EndOfDoc_
200 _EndOfDoc_;
201 };
202
203
204 flag = {
205 name = timeout;
206 value = t;
207 descrip = "The number of seconds to wait for responses";
208 arg-type = number;
209 arg-name = "seconds";
210 arg-default = 5;
211 doc = <<- _EndOfDoc_
212 When waiting for a reply, @code{sntp} will wait the number
213 of seconds specified before giving up. The default should be
214 more than enough for a unicast response. If @code{sntp} is
215 only waiting for a broadcast response a longer timeout is
216 likely needed.
217 _EndOfDoc_;
218 };
219
220 flag = {
221 name = "wait";
222 descrip = "Wait for pending replies (if not setting the time)";
223 disable = no;
224 enabled;
225 settable;
226 doc = <<- _EndOfDoc_
227 If we are not setting the time, wait for all pending responses.
228 _EndOfDoc_;
229 };
230
231 /* explain: Additional information whenever the usage routine is invoked */
232 explain = <<- _END_EXPLAIN
233 _END_EXPLAIN;
234
235 doc-section = {
236 ds-type = 'DESCRIPTION';
237 ds-format = 'mdoc';
238 ds-text = <<- _END_PROG_MDOC_DESCRIP
239 .Nm
240 can be used as an SNTP client to query a NTP or SNTP server and either display
241 the time or set the local system's time (given suitable privilege). It can be
242 run as an interactive command or from a
243 .Ic cron
244 job.
245
246 NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
247 are defined and described by RFC 5905.
248
249 .Pp
250 The default is to write the estimated correct local date and time (i.e. not
251 UTC) to the standard output in a format like:
252
253 .Ic "'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 [host] IP sN'"
254
255 where the
256 .Ic "'(+0800)'"
257 means that to get to UTC from the reported local time one must
258 add 8 hours and 0 minutes,
259 the
260 .Ic "'+4.567'"
261 indicates the local clock is 4.567 seconds behind the correct time
262 (so 4.567 seconds must be added to the local clock to get it to be correct).
263 Note that the number of decimals printed for this value will change
264 based on the reported precision of the server.
265 .Ic "'+/- 0.089'"
266 is the reported
267 .Em synchronization distance
268 (in seconds), which represents the maximum error due to all causes.
269 If the server does not report valid data needed to calculate the
270 synchronization distance, this will be reported as
271 .Ic "'+/- ?'" .
272 If the
273 .Em host
274 is different from the
275 .Em IP ,
276 both will be displayed.
277 Otherwise, only the
278 .Em IP
279 is displayed.
280 Finally, the
281 .Em stratum
282 of the host is reported.
283 _END_PROG_MDOC_DESCRIP;
284 };
285
286 doc-section = {
287 ds-type = 'USAGE';
288 ds-format = 'mdoc';
289 ds-text = <<- _END_MDOC_USAGE
290 .Bl -tag -width indent
291 .It Li "sntp ntpserver.somewhere"
292 is the simplest use of this program
293 and can be run as an unprivileged command
294 to check the current time and error in the local clock.
295 .It Li "sntp -a ntpserver.somewhere"
296 With suitable privilege,
297 run as a command
298 or from a
299 .Xr cron 8
300 job,
301 .Ic "sntp -a"
302 will reset the local clock from a synchronized specified server,
303 like the (deprecated)
304 .Xr ntpdate 1ntpdatemdoc ,
305 or
306 .Xr rdate 8
307 commands.
308 .El
309 _END_MDOC_USAGE;
310 };
311
312 doc-section = {
313 ds-type = 'AUTHORS';
314 ds-format = 'mdoc';
315 ds-text = <<- _END_MDOC_AUTHORS
316 .An "Johannes Maximilian Kuehn"
317 .An "Harlan Stenn"
318 .An "Dave Hart"
319 _END_MDOC_AUTHORS;
320 };
321