]> git.ipfire.org Git - thirdparty/chrony.git/blob - candm.h
cmdmon: add reload sources command
[thirdparty/chrony.git] / candm.h
1 /*
2 chronyd/chronyc - Programs for keeping computer clocks accurate.
3
4 **********************************************************************
5 * Copyright (C) Richard P. Curnow 1997-2003
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 **********************************************************************
21
22 =======================================================================
23
24 Definitions for the network protocol used for command and monitoring
25 of the timeserver.
26
27 */
28
29 #ifndef GOT_CANDM_H
30 #define GOT_CANDM_H
31
32 #include "sysincl.h"
33 #include "addressing.h"
34
35 /* This is the default port to use for CANDM, if no alternative is
36 defined */
37 #define DEFAULT_CANDM_PORT 323
38
39 /* Request codes */
40 #define REQ_NULL 0
41 #define REQ_ONLINE 1
42 #define REQ_OFFLINE 2
43 #define REQ_BURST 3
44 #define REQ_MODIFY_MINPOLL 4
45 #define REQ_MODIFY_MAXPOLL 5
46 #define REQ_DUMP 6
47 #define REQ_MODIFY_MAXDELAY 7
48 #define REQ_MODIFY_MAXDELAYRATIO 8
49 #define REQ_MODIFY_MAXUPDATESKEW 9
50 #define REQ_LOGON 10
51 #define REQ_SETTIME 11
52 #define REQ_LOCAL 12
53 #define REQ_MANUAL 13
54 #define REQ_N_SOURCES 14
55 #define REQ_SOURCE_DATA 15
56 #define REQ_REKEY 16
57 #define REQ_ALLOW 17
58 #define REQ_ALLOWALL 18
59 #define REQ_DENY 19
60 #define REQ_DENYALL 20
61 #define REQ_CMDALLOW 21
62 #define REQ_CMDALLOWALL 22
63 #define REQ_CMDDENY 23
64 #define REQ_CMDDENYALL 24
65 #define REQ_ACCHECK 25
66 #define REQ_CMDACCHECK 26
67 #define REQ_ADD_SERVER 27
68 #define REQ_ADD_PEER 28
69 #define REQ_DEL_SOURCE 29
70 #define REQ_WRITERTC 30
71 #define REQ_DFREQ 31
72 #define REQ_DOFFSET 32
73 #define REQ_TRACKING 33
74 #define REQ_SOURCESTATS 34
75 #define REQ_RTCREPORT 35
76 #define REQ_TRIMRTC 36
77 #define REQ_CYCLELOGS 37
78 #define REQ_SUBNETS_ACCESSED 38
79 #define REQ_CLIENT_ACCESSES 39
80 #define REQ_CLIENT_ACCESSES_BY_INDEX 40
81 #define REQ_MANUAL_LIST 41
82 #define REQ_MANUAL_DELETE 42
83 #define REQ_MAKESTEP 43
84 #define REQ_ACTIVITY 44
85 #define REQ_MODIFY_MINSTRATUM 45
86 #define REQ_MODIFY_POLLTARGET 46
87 #define REQ_MODIFY_MAXDELAYDEVRATIO 47
88 #define REQ_RESELECT 48
89 #define REQ_RESELECTDISTANCE 49
90 #define REQ_MODIFY_MAKESTEP 50
91 #define REQ_SMOOTHING 51
92 #define REQ_SMOOTHTIME 52
93 #define REQ_REFRESH 53
94 #define REQ_SERVER_STATS 54
95 #define REQ_CLIENT_ACCESSES_BY_INDEX2 55
96 #define REQ_LOCAL2 56
97 #define REQ_NTP_DATA 57
98 #define REQ_ADD_SERVER2 58
99 #define REQ_ADD_PEER2 59
100 #define REQ_ADD_SERVER3 60
101 #define REQ_ADD_PEER3 61
102 #define REQ_SHUTDOWN 62
103 #define REQ_ONOFFLINE 63
104 #define REQ_ADD_SOURCE 64
105 #define REQ_NTP_SOURCE_NAME 65
106 #define REQ_RESET_SOURCES 66
107 #define REQ_AUTH_DATA 67
108 #define REQ_CLIENT_ACCESSES_BY_INDEX3 68
109 #define REQ_SELECT_DATA 69
110 #define REQ_RELOAD_SOURCES 70
111 #define N_REQUEST_TYPES 71
112
113 /* Structure used to exchange timespecs independent of time_t size */
114 typedef struct {
115 uint32_t tv_sec_high;
116 uint32_t tv_sec_low;
117 uint32_t tv_nsec;
118 } Timespec;
119
120 /* This is used in tv_sec_high for 32-bit timestamps */
121 #define TV_NOHIGHSEC 0x7fffffff
122
123 /* 32-bit floating-point format consisting of 7-bit signed exponent
124 and 25-bit signed coefficient without hidden bit.
125 The result is calculated as: 2^(exp - 25) * coef */
126 typedef struct {
127 int32_t f;
128 } Float;
129
130 /* The EOR (end of record) fields are used by the offsetof operator in
131 pktlength.c, to get the number of bytes that ought to be
132 transmitted for each packet type. */
133
134 typedef struct {
135 int32_t EOR;
136 } REQ_Null;
137
138 typedef struct {
139 IPAddr mask;
140 IPAddr address;
141 int32_t EOR;
142 } REQ_Online;
143
144 typedef struct {
145 IPAddr mask;
146 IPAddr address;
147 int32_t EOR;
148 } REQ_Offline;
149
150 typedef struct {
151 IPAddr mask;
152 IPAddr address;
153 int32_t n_good_samples;
154 int32_t n_total_samples;
155 int32_t EOR;
156 } REQ_Burst;
157
158 typedef struct {
159 IPAddr address;
160 int32_t new_minpoll;
161 int32_t EOR;
162 } REQ_Modify_Minpoll;
163
164 typedef struct {
165 IPAddr address;
166 int32_t new_maxpoll;
167 int32_t EOR;
168 } REQ_Modify_Maxpoll;
169
170 typedef struct {
171 int32_t pad;
172 int32_t EOR;
173 } REQ_Dump;
174
175 typedef struct {
176 IPAddr address;
177 Float new_max_delay;
178 int32_t EOR;
179 } REQ_Modify_Maxdelay;
180
181 typedef struct {
182 IPAddr address;
183 Float new_max_delay_ratio;
184 int32_t EOR;
185 } REQ_Modify_Maxdelayratio;
186
187 typedef struct {
188 IPAddr address;
189 Float new_max_delay_dev_ratio;
190 int32_t EOR;
191 } REQ_Modify_Maxdelaydevratio;
192
193 typedef struct {
194 IPAddr address;
195 int32_t new_min_stratum;
196 int32_t EOR;
197 } REQ_Modify_Minstratum;
198
199 typedef struct {
200 IPAddr address;
201 int32_t new_poll_target;
202 int32_t EOR;
203 } REQ_Modify_Polltarget;
204
205 typedef struct {
206 Float new_max_update_skew;
207 int32_t EOR;
208 } REQ_Modify_Maxupdateskew;
209
210 typedef struct {
211 int32_t limit;
212 Float threshold;
213 int32_t EOR;
214 } REQ_Modify_Makestep;
215
216 typedef struct {
217 Timespec ts;
218 int32_t EOR;
219 } REQ_Logon;
220
221 typedef struct {
222 Timespec ts;
223 int32_t EOR;
224 } REQ_Settime;
225
226 typedef struct {
227 int32_t on_off;
228 int32_t stratum;
229 Float distance;
230 int32_t orphan;
231 int32_t EOR;
232 } REQ_Local;
233
234 typedef struct {
235 int32_t option;
236 int32_t EOR;
237 } REQ_Manual;
238
239 typedef struct {
240 int32_t index;
241 int32_t EOR;
242 } REQ_Source_Data;
243
244 typedef struct {
245 IPAddr ip;
246 int32_t subnet_bits;
247 int32_t EOR;
248 } REQ_Allow_Deny;
249
250 typedef struct {
251 IPAddr ip;
252 int32_t EOR;
253 } REQ_Ac_Check;
254
255 /* Source types in NTP source requests */
256 #define REQ_ADDSRC_SERVER 1
257 #define REQ_ADDSRC_PEER 2
258 #define REQ_ADDSRC_POOL 3
259
260 /* Flags used in NTP source requests */
261 #define REQ_ADDSRC_ONLINE 0x1
262 #define REQ_ADDSRC_AUTOOFFLINE 0x2
263 #define REQ_ADDSRC_IBURST 0x4
264 #define REQ_ADDSRC_PREFER 0x8
265 #define REQ_ADDSRC_NOSELECT 0x10
266 #define REQ_ADDSRC_TRUST 0x20
267 #define REQ_ADDSRC_REQUIRE 0x40
268 #define REQ_ADDSRC_INTERLEAVED 0x80
269 #define REQ_ADDSRC_BURST 0x100
270 #define REQ_ADDSRC_NTS 0x200
271
272 typedef struct {
273 uint32_t type;
274 int8_t name[256];
275 uint32_t port;
276 int32_t minpoll;
277 int32_t maxpoll;
278 int32_t presend_minpoll;
279 uint32_t min_stratum;
280 uint32_t poll_target;
281 uint32_t version;
282 uint32_t max_sources;
283 int32_t min_samples;
284 int32_t max_samples;
285 uint32_t authkey;
286 uint32_t nts_port;
287 Float max_delay;
288 Float max_delay_ratio;
289 Float max_delay_dev_ratio;
290 Float min_delay;
291 Float asymmetry;
292 Float offset;
293 uint32_t flags;
294 int32_t filter_length;
295 uint32_t reserved[3];
296 int32_t EOR;
297 } REQ_NTP_Source;
298
299 typedef struct {
300 IPAddr ip_addr;
301 int32_t EOR;
302 } REQ_Del_Source;
303
304 typedef struct {
305 Float dfreq;
306 int32_t EOR;
307 } REQ_Dfreq;
308
309 typedef struct {
310 int32_t sec;
311 int32_t usec;
312 int32_t EOR;
313 } REQ_Doffset;
314
315 typedef struct {
316 uint32_t index;
317 int32_t EOR;
318 } REQ_Sourcestats;
319
320 /* This is based on the response size rather than the
321 request size */
322 #define MAX_CLIENT_ACCESSES 8
323
324 typedef struct {
325 uint32_t first_index;
326 uint32_t n_clients;
327 uint32_t min_hits;
328 uint32_t reset;
329 int32_t EOR;
330 } REQ_ClientAccessesByIndex;
331
332 typedef struct {
333 int32_t index;
334 int32_t EOR;
335 } REQ_ManualDelete;
336
337 typedef struct {
338 Float distance;
339 int32_t EOR;
340 } REQ_ReselectDistance;
341
342 #define REQ_SMOOTHTIME_RESET 0
343 #define REQ_SMOOTHTIME_ACTIVATE 1
344
345 typedef struct {
346 int32_t option;
347 int32_t EOR;
348 } REQ_SmoothTime;
349
350 typedef struct {
351 IPAddr ip_addr;
352 int32_t EOR;
353 } REQ_NTPData;
354
355 typedef struct {
356 IPAddr ip_addr;
357 int32_t EOR;
358 } REQ_NTPSourceName;
359
360 typedef struct {
361 IPAddr ip_addr;
362 int32_t EOR;
363 } REQ_AuthData;
364
365 typedef struct {
366 uint32_t index;
367 int32_t EOR;
368 } REQ_SelectData;
369
370 /* ================================================== */
371
372 #define PKT_TYPE_CMD_REQUEST 1
373 #define PKT_TYPE_CMD_REPLY 2
374
375 /* This version number needs to be incremented whenever the packet
376 size and/or the format of any of the existing messages is changed.
377 Other changes, e.g. new command types, should be handled cleanly by
378 client.c and cmdmon.c anyway, so the version can stay the same.
379
380 Version 1 : original version with fixed size packets
381
382 Version 2 : both command and reply packet sizes made capable of
383 being variable length.
384
385 Version 3 : NTP_Source message lengthened (auto_offline)
386
387 Version 4 : IPv6 addressing added, 64-bit time values, sourcestats
388 and tracking reports extended, added flags to NTP source request,
389 trimmed source report, replaced fixed-point format with floating-point
390 and used also instead of integer microseconds, new commands: modify stratum,
391 modify polltarget, modify maxdelaydevratio, reselect, reselectdistance
392
393 Version 5 : auth data moved to the end of the packet to allow hashes with
394 different sizes, extended sources, tracking and activity reports, dropped
395 subnets accessed and client accesses
396
397 Version 6 : added padding to requests to prevent amplification attack,
398 changed maximum number of samples in manual list to 16, new commands: modify
399 makestep, smoothing, smoothtime
400
401 Support for authentication was removed later in version 6 of the protocol
402 and commands that required authentication are allowed only locally over Unix
403 domain socket.
404
405 Version 6 (no authentication) : changed format of client accesses by index
406 (using new request/reply types) and manual timestamp, added new fields and
407 flags to NTP source request and report, made length of manual list constant,
408 added new commands: authdata, ntpdata, onoffline, refresh, reset,
409 selectdata, serverstats, shutdown, sourcename
410 */
411
412 #define PROTO_VERSION_NUMBER 6
413
414 /* The oldest protocol versions that are compatible enough with the current
415 version to report a version mismatch for the server and the client */
416 #define PROTO_VERSION_MISMATCH_COMPAT_SERVER 5
417 #define PROTO_VERSION_MISMATCH_COMPAT_CLIENT 4
418
419 /* The first protocol version using padding in requests */
420 #define PROTO_VERSION_PADDING 6
421
422 /* The maximum length of padding in request packet, currently
423 defined by CLIENT_ACCESSES_BY_INDEX3 */
424 #define MAX_PADDING_LENGTH 484
425
426 /* ================================================== */
427
428 typedef struct {
429 uint8_t version; /* Protocol version */
430 uint8_t pkt_type; /* What sort of packet this is */
431 uint8_t res1;
432 uint8_t res2;
433 uint16_t command; /* Which command is being issued */
434 uint16_t attempt; /* How many resends the client has done
435 (count up from zero for same sequence
436 number) */
437 uint32_t sequence; /* Client's sequence number */
438 uint32_t pad1;
439 uint32_t pad2;
440
441 union {
442 REQ_Null null;
443 REQ_Online online;
444 REQ_Offline offline;
445 REQ_Burst burst;
446 REQ_Modify_Minpoll modify_minpoll;
447 REQ_Modify_Maxpoll modify_maxpoll;
448 REQ_Dump dump;
449 REQ_Modify_Maxdelay modify_maxdelay;
450 REQ_Modify_Maxdelayratio modify_maxdelayratio;
451 REQ_Modify_Maxdelaydevratio modify_maxdelaydevratio;
452 REQ_Modify_Minstratum modify_minstratum;
453 REQ_Modify_Polltarget modify_polltarget;
454 REQ_Modify_Maxupdateskew modify_maxupdateskew;
455 REQ_Modify_Makestep modify_makestep;
456 REQ_Logon logon;
457 REQ_Settime settime;
458 REQ_Local local;
459 REQ_Manual manual;
460 REQ_Source_Data source_data;
461 REQ_Allow_Deny allow_deny;
462 REQ_Ac_Check ac_check;
463 REQ_NTP_Source ntp_source;
464 REQ_Del_Source del_source;
465 REQ_Dfreq dfreq;
466 REQ_Doffset doffset;
467 REQ_Sourcestats sourcestats;
468 REQ_ClientAccessesByIndex client_accesses_by_index;
469 REQ_ManualDelete manual_delete;
470 REQ_ReselectDistance reselect_distance;
471 REQ_SmoothTime smoothtime;
472 REQ_NTPData ntp_data;
473 REQ_NTPSourceName ntp_source_name;
474 REQ_AuthData auth_data;
475 REQ_SelectData select_data;
476 } data; /* Command specific parameters */
477
478 /* Padding used to prevent traffic amplification. It only defines the
479 maximum size of the packet, there is no hole after the data field. */
480 uint8_t padding[MAX_PADDING_LENGTH];
481
482 } CMD_Request;
483
484 /* ================================================== */
485 /* Authority codes for command types */
486
487 #define PERMIT_OPEN 0
488 #define PERMIT_LOCAL 1
489 #define PERMIT_AUTH 2
490
491 /* ================================================== */
492
493 /* Reply codes */
494 #define RPY_NULL 1
495 #define RPY_N_SOURCES 2
496 #define RPY_SOURCE_DATA 3
497 #define RPY_MANUAL_TIMESTAMP 4
498 #define RPY_TRACKING 5
499 #define RPY_SOURCESTATS 6
500 #define RPY_RTC 7
501 #define RPY_SUBNETS_ACCESSED 8
502 #define RPY_CLIENT_ACCESSES 9
503 #define RPY_CLIENT_ACCESSES_BY_INDEX 10
504 #define RPY_MANUAL_LIST 11
505 #define RPY_ACTIVITY 12
506 #define RPY_SMOOTHING 13
507 #define RPY_SERVER_STATS 14
508 #define RPY_CLIENT_ACCESSES_BY_INDEX2 15
509 #define RPY_NTP_DATA 16
510 #define RPY_MANUAL_TIMESTAMP2 17
511 #define RPY_MANUAL_LIST2 18
512 #define RPY_NTP_SOURCE_NAME 19
513 #define RPY_AUTH_DATA 20
514 #define RPY_CLIENT_ACCESSES_BY_INDEX3 21
515 #define RPY_SERVER_STATS2 22
516 #define RPY_SELECT_DATA 23
517 #define N_REPLY_TYPES 24
518
519 /* Status codes */
520 #define STT_SUCCESS 0
521 #define STT_FAILED 1
522 #define STT_UNAUTH 2
523 #define STT_INVALID 3
524 #define STT_NOSUCHSOURCE 4
525 #define STT_INVALIDTS 5
526 #define STT_NOTENABLED 6
527 #define STT_BADSUBNET 7
528 #define STT_ACCESSALLOWED 8
529 #define STT_ACCESSDENIED 9
530 /* Deprecated */
531 #define STT_NOHOSTACCESS 10
532 #define STT_SOURCEALREADYKNOWN 11
533 #define STT_TOOMANYSOURCES 12
534 #define STT_NORTC 13
535 #define STT_BADRTCFILE 14
536 #define STT_INACTIVE 15
537 #define STT_BADSAMPLE 16
538 #define STT_INVALIDAF 17
539 #define STT_BADPKTVERSION 18
540 #define STT_BADPKTLENGTH 19
541 #define STT_INVALIDNAME 21
542
543 typedef struct {
544 int32_t EOR;
545 } RPY_Null;
546
547 typedef struct {
548 uint32_t n_sources;
549 int32_t EOR;
550 } RPY_N_Sources;
551
552 #define RPY_SD_MD_CLIENT 0
553 #define RPY_SD_MD_PEER 1
554 #define RPY_SD_MD_REF 2
555
556 #define RPY_SD_ST_SYNC 0
557 #define RPY_SD_ST_UNREACH 1
558 #define RPY_SD_ST_FALSETICKER 2
559 #define RPY_SD_ST_JITTERY 3
560 #define RPY_SD_ST_CANDIDATE 4
561 #define RPY_SD_ST_OUTLIER 5
562
563 typedef struct {
564 IPAddr ip_addr;
565 int16_t poll;
566 uint16_t stratum;
567 uint16_t state;
568 uint16_t mode;
569 uint16_t flags;
570 uint16_t reachability;
571 uint32_t since_sample;
572 Float orig_latest_meas;
573 Float latest_meas;
574 Float latest_meas_err;
575 int32_t EOR;
576 } RPY_Source_Data;
577
578 typedef struct {
579 uint32_t ref_id;
580 IPAddr ip_addr;
581 uint16_t stratum;
582 uint16_t leap_status;
583 Timespec ref_time;
584 Float current_correction;
585 Float last_offset;
586 Float rms_offset;
587 Float freq_ppm;
588 Float resid_freq_ppm;
589 Float skew_ppm;
590 Float root_delay;
591 Float root_dispersion;
592 Float last_update_interval;
593 int32_t EOR;
594 } RPY_Tracking;
595
596 typedef struct {
597 uint32_t ref_id;
598 IPAddr ip_addr;
599 uint32_t n_samples;
600 uint32_t n_runs;
601 uint32_t span_seconds;
602 Float sd;
603 Float resid_freq_ppm;
604 Float skew_ppm;
605 Float est_offset;
606 Float est_offset_err;
607 int32_t EOR;
608 } RPY_Sourcestats;
609
610 typedef struct {
611 Timespec ref_time;
612 uint16_t n_samples;
613 uint16_t n_runs;
614 uint32_t span_seconds;
615 Float rtc_seconds_fast;
616 Float rtc_gain_rate_ppm;
617 int32_t EOR;
618 } RPY_Rtc;
619
620 typedef struct {
621 Float offset;
622 Float dfreq_ppm;
623 Float new_afreq_ppm;
624 int32_t EOR;
625 } RPY_ManualTimestamp;
626
627 typedef struct {
628 IPAddr ip;
629 uint32_t ntp_hits;
630 uint32_t nke_hits;
631 uint32_t cmd_hits;
632 uint32_t ntp_drops;
633 uint32_t nke_drops;
634 uint32_t cmd_drops;
635 int8_t ntp_interval;
636 int8_t nke_interval;
637 int8_t cmd_interval;
638 int8_t ntp_timeout_interval;
639 uint32_t last_ntp_hit_ago;
640 uint32_t last_nke_hit_ago;
641 uint32_t last_cmd_hit_ago;
642 } RPY_ClientAccesses_Client;
643
644 typedef struct {
645 uint32_t n_indices; /* how many indices there are in the server's table */
646 uint32_t next_index; /* the index 1 beyond those processed on this call */
647 uint32_t n_clients; /* the number of valid entries in the following array */
648 RPY_ClientAccesses_Client clients[MAX_CLIENT_ACCESSES];
649 int32_t EOR;
650 } RPY_ClientAccessesByIndex;
651
652 typedef struct {
653 uint32_t ntp_hits;
654 uint32_t nke_hits;
655 uint32_t cmd_hits;
656 uint32_t ntp_drops;
657 uint32_t nke_drops;
658 uint32_t cmd_drops;
659 uint32_t log_drops;
660 uint32_t ntp_auth_hits;
661 int32_t EOR;
662 } RPY_ServerStats;
663
664 #define MAX_MANUAL_LIST_SAMPLES 16
665
666 typedef struct {
667 Timespec when;
668 Float slewed_offset;
669 Float orig_offset;
670 Float residual;
671 } RPY_ManualListSample;
672
673 typedef struct {
674 uint32_t n_samples;
675 RPY_ManualListSample samples[MAX_MANUAL_LIST_SAMPLES];
676 int32_t EOR;
677 } RPY_ManualList;
678
679 typedef struct {
680 int32_t online;
681 int32_t offline;
682 int32_t burst_online;
683 int32_t burst_offline;
684 int32_t unresolved;
685 int32_t EOR;
686 } RPY_Activity;
687
688 #define RPY_SMT_FLAG_ACTIVE 0x1
689 #define RPY_SMT_FLAG_LEAPONLY 0x2
690
691 typedef struct {
692 uint32_t flags;
693 Float offset;
694 Float freq_ppm;
695 Float wander_ppm;
696 Float last_update_ago;
697 Float remaining_time;
698 int32_t EOR;
699 } RPY_Smoothing;
700
701 #define RPY_NTP_FLAGS_TESTS 0x3ff
702 #define RPY_NTP_FLAG_INTERLEAVED 0x4000
703 #define RPY_NTP_FLAG_AUTHENTICATED 0x8000
704
705 typedef struct {
706 IPAddr remote_addr;
707 IPAddr local_addr;
708 uint16_t remote_port;
709 uint8_t leap;
710 uint8_t version;
711 uint8_t mode;
712 uint8_t stratum;
713 int8_t poll;
714 int8_t precision;
715 Float root_delay;
716 Float root_dispersion;
717 uint32_t ref_id;
718 Timespec ref_time;
719 Float offset;
720 Float peer_delay;
721 Float peer_dispersion;
722 Float response_time;
723 Float jitter_asymmetry;
724 uint16_t flags;
725 uint8_t tx_tss_char;
726 uint8_t rx_tss_char;
727 uint32_t total_tx_count;
728 uint32_t total_rx_count;
729 uint32_t total_valid_count;
730 uint32_t reserved[4];
731 int32_t EOR;
732 } RPY_NTPData;
733
734 typedef struct {
735 int8_t name[256];
736 int32_t EOR;
737 } RPY_NTPSourceName;
738
739 #define RPY_AD_MD_NONE 0
740 #define RPY_AD_MD_SYMMETRIC 1
741 #define RPY_AD_MD_NTS 2
742
743 typedef struct {
744 uint16_t mode;
745 uint16_t key_type;
746 uint32_t key_id;
747 uint16_t key_length;
748 uint16_t ke_attempts;
749 uint32_t last_ke_ago;
750 uint16_t cookies;
751 uint16_t cookie_length;
752 uint16_t nak;
753 uint16_t pad;
754 int32_t EOR;
755 } RPY_AuthData;
756
757 #define RPY_SD_OPTION_NOSELECT 0x1
758 #define RPY_SD_OPTION_PREFER 0x2
759 #define RPY_SD_OPTION_TRUST 0x4
760 #define RPY_SD_OPTION_REQUIRE 0x8
761
762 typedef struct {
763 uint32_t ref_id;
764 IPAddr ip_addr;
765 uint8_t state_char;
766 uint8_t authentication;
767 uint8_t pad[2];
768 uint16_t conf_options;
769 uint16_t eff_options;
770 uint32_t last_sample_ago;
771 Float score;
772 Float lo_limit;
773 Float hi_limit;
774 int32_t EOR;
775 } RPY_SelectData;
776
777 typedef struct {
778 uint8_t version;
779 uint8_t pkt_type;
780 uint8_t res1;
781 uint8_t res2;
782 uint16_t command; /* Which command is being replied to */
783 uint16_t reply; /* Which format of reply this is */
784 uint16_t status; /* Status of command processing */
785 uint16_t pad1; /* Padding for compatibility and 4 byte alignment */
786 uint16_t pad2;
787 uint16_t pad3;
788 uint32_t sequence; /* Echo of client's sequence number */
789 uint32_t pad4;
790 uint32_t pad5;
791
792 union {
793 RPY_Null null;
794 RPY_N_Sources n_sources;
795 RPY_Source_Data source_data;
796 RPY_ManualTimestamp manual_timestamp;
797 RPY_Tracking tracking;
798 RPY_Sourcestats sourcestats;
799 RPY_Rtc rtc;
800 RPY_ClientAccessesByIndex client_accesses_by_index;
801 RPY_ServerStats server_stats;
802 RPY_ManualList manual_list;
803 RPY_Activity activity;
804 RPY_Smoothing smoothing;
805 RPY_NTPData ntp_data;
806 RPY_NTPSourceName ntp_source_name;
807 RPY_AuthData auth_data;
808 RPY_SelectData select_data;
809 } data; /* Reply specific parameters */
810
811 } CMD_Reply;
812
813 /* ================================================== */
814
815 #endif /* GOT_CANDM_H */