"Fossies" - the Fresh Open Source Software Archive

Member "chrony-3.5/candm.h" (10 May 2019, 17507 Bytes) of package /linux/misc/chrony-3.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "candm.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 3.3_vs_3.4.

    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 N_REQUEST_TYPES 64
  105 
  106 /* Structure used to exchange timespecs independent of time_t size */
  107 typedef struct {
  108   uint32_t tv_sec_high;
  109   uint32_t tv_sec_low;
  110   uint32_t tv_nsec;
  111 } Timespec;
  112 
  113 /* This is used in tv_sec_high for 32-bit timestamps */
  114 #define TV_NOHIGHSEC 0x7fffffff
  115 
  116 /* 32-bit floating-point format consisting of 7-bit signed exponent
  117    and 25-bit signed coefficient without hidden bit.
  118    The result is calculated as: 2^(exp - 25) * coef */
  119 typedef struct {
  120   int32_t f;
  121 } Float;
  122 
  123 /* The EOR (end of record) fields are used by the offsetof operator in
  124    pktlength.c, to get the number of bytes that ought to be
  125    transmitted for each packet type. */
  126 
  127 typedef struct {
  128   int32_t EOR;
  129 } REQ_Null;
  130 
  131 typedef struct {
  132   IPAddr mask;
  133   IPAddr address;
  134   int32_t EOR;
  135 } REQ_Online;
  136 
  137 typedef struct {
  138   IPAddr mask;
  139   IPAddr address;
  140   int32_t EOR;
  141 } REQ_Offline;
  142 
  143 typedef struct {
  144   IPAddr mask;
  145   IPAddr address;
  146   int32_t n_good_samples;
  147   int32_t n_total_samples;
  148   int32_t EOR;
  149 } REQ_Burst;
  150 
  151 typedef struct {
  152   IPAddr address;
  153   int32_t new_minpoll;
  154   int32_t EOR;
  155 } REQ_Modify_Minpoll;
  156 
  157 typedef struct {
  158   IPAddr address;
  159   int32_t new_maxpoll;
  160   int32_t EOR;
  161 } REQ_Modify_Maxpoll;
  162 
  163 typedef struct {
  164   int32_t pad;
  165   int32_t EOR;
  166 } REQ_Dump;
  167 
  168 typedef struct {
  169   IPAddr address;
  170   Float new_max_delay;
  171   int32_t EOR;
  172 } REQ_Modify_Maxdelay;
  173 
  174 typedef struct {
  175   IPAddr address;
  176   Float new_max_delay_ratio;
  177   int32_t EOR;
  178 } REQ_Modify_Maxdelayratio;
  179 
  180 typedef struct {
  181   IPAddr address;
  182   Float new_max_delay_dev_ratio;
  183   int32_t EOR;
  184 } REQ_Modify_Maxdelaydevratio;
  185 
  186 typedef struct {
  187   IPAddr address;
  188   int32_t new_min_stratum;
  189   int32_t EOR;
  190 } REQ_Modify_Minstratum;
  191 
  192 typedef struct {
  193   IPAddr address;
  194   int32_t new_poll_target;
  195   int32_t EOR;
  196 } REQ_Modify_Polltarget;
  197 
  198 typedef struct {
  199   Float new_max_update_skew;
  200   int32_t EOR;
  201 } REQ_Modify_Maxupdateskew;
  202 
  203 typedef struct {
  204   int32_t limit;
  205   Float threshold;
  206   int32_t EOR;
  207 } REQ_Modify_Makestep;
  208 
  209 typedef struct {
  210   Timespec ts;
  211   int32_t EOR;
  212 } REQ_Logon;
  213 
  214 typedef struct {
  215   Timespec ts;
  216   int32_t EOR;
  217 } REQ_Settime;
  218 
  219 typedef struct {
  220   int32_t on_off;
  221   int32_t stratum;
  222   Float distance;
  223   int32_t orphan;
  224   int32_t EOR;
  225 } REQ_Local;
  226 
  227 typedef struct {
  228   int32_t option;
  229   int32_t EOR;
  230 } REQ_Manual;
  231 
  232 typedef struct {
  233   int32_t index;
  234   int32_t EOR;
  235 } REQ_Source_Data;
  236 
  237 typedef struct {
  238   IPAddr ip;
  239   int32_t subnet_bits;
  240   int32_t EOR;
  241 } REQ_Allow_Deny;
  242 
  243 typedef struct {
  244   IPAddr ip;
  245   int32_t EOR;
  246 } REQ_Ac_Check;
  247 
  248 /* Flags used in NTP source requests */
  249 #define REQ_ADDSRC_ONLINE 0x1
  250 #define REQ_ADDSRC_AUTOOFFLINE 0x2
  251 #define REQ_ADDSRC_IBURST 0x4
  252 #define REQ_ADDSRC_PREFER 0x8
  253 #define REQ_ADDSRC_NOSELECT 0x10
  254 #define REQ_ADDSRC_TRUST 0x20
  255 #define REQ_ADDSRC_REQUIRE 0x40
  256 #define REQ_ADDSRC_INTERLEAVED 0x80
  257 #define REQ_ADDSRC_BURST 0x100
  258 
  259 typedef struct {
  260   IPAddr ip_addr;
  261   uint32_t port;
  262   int32_t minpoll;
  263   int32_t maxpoll;
  264   int32_t presend_minpoll;
  265   uint32_t min_stratum;
  266   uint32_t poll_target;
  267   uint32_t version;
  268   uint32_t max_sources;
  269   int32_t min_samples;
  270   int32_t max_samples;
  271   uint32_t authkey;
  272   Float max_delay;
  273   Float max_delay_ratio;
  274   Float max_delay_dev_ratio;
  275   Float min_delay;
  276   Float asymmetry;
  277   Float offset;
  278   uint32_t flags;
  279   int32_t filter_length;
  280   uint32_t reserved[3];
  281   int32_t EOR;
  282 } REQ_NTP_Source;
  283 
  284 typedef struct {
  285   IPAddr ip_addr;
  286   int32_t EOR;
  287 } REQ_Del_Source;
  288 
  289 typedef struct {
  290   Float dfreq;
  291   int32_t EOR;
  292 } REQ_Dfreq;
  293 
  294 typedef struct {
  295   int32_t sec;
  296   int32_t usec;
  297   int32_t EOR;
  298 } REQ_Doffset;
  299 
  300 typedef struct {
  301   uint32_t index;
  302   int32_t EOR;
  303 } REQ_Sourcestats;
  304 
  305 /* This is based on the response size rather than the
  306    request size */
  307 #define MAX_CLIENT_ACCESSES 8
  308 
  309 typedef struct {
  310   uint32_t first_index;
  311   uint32_t n_clients;
  312   int32_t EOR;
  313 } REQ_ClientAccessesByIndex;
  314 
  315 typedef struct {
  316   int32_t index;
  317   int32_t EOR;
  318 } REQ_ManualDelete;
  319 
  320 typedef struct {
  321   Float distance;
  322   int32_t EOR;
  323 } REQ_ReselectDistance;
  324 
  325 #define REQ_SMOOTHTIME_RESET 0
  326 #define REQ_SMOOTHTIME_ACTIVATE 1
  327 
  328 typedef struct {
  329   int32_t option;
  330   int32_t EOR;
  331 } REQ_SmoothTime;
  332 
  333 typedef struct {
  334   IPAddr ip_addr;
  335   int32_t EOR;
  336 } REQ_NTPData;
  337 
  338 /* ================================================== */
  339 
  340 #define PKT_TYPE_CMD_REQUEST 1
  341 #define PKT_TYPE_CMD_REPLY 2
  342 
  343 /* This version number needs to be incremented whenever the packet
  344    size and/or the format of any of the existing messages is changed.
  345    Other changes, e.g. new command types, should be handled cleanly by
  346    client.c and cmdmon.c anyway, so the version can stay the same.
  347    
  348    Version 1 : original version with fixed size packets
  349 
  350    Version 2 : both command and reply packet sizes made capable of
  351    being variable length.
  352 
  353    Version 3 : NTP_Source message lengthened (auto_offline)
  354 
  355    Version 4 : IPv6 addressing added, 64-bit time values, sourcestats 
  356    and tracking reports extended, added flags to NTP source request,
  357    trimmed source report, replaced fixed-point format with floating-point
  358    and used also instead of integer microseconds, new commands: modify stratum,
  359    modify polltarget, modify maxdelaydevratio, reselect, reselectdistance
  360 
  361    Version 5 : auth data moved to the end of the packet to allow hashes with
  362    different sizes, extended sources, tracking and activity reports, dropped
  363    subnets accessed and client accesses
  364 
  365    Version 6 : added padding to requests to prevent amplification attack,
  366    changed maximum number of samples in manual list to 16, new commands: modify
  367    makestep, smoothing, smoothtime
  368 
  369    Support for authentication was removed later in version 6 of the protocol
  370    and commands that required authentication are allowed only locally over Unix
  371    domain socket.
  372 
  373    Version 6 (no authentication) : changed format of client accesses by index
  374    (using new request/reply types) and manual timestamp, added new fields and
  375    flags to NTP source request and report, made length of manual list constant,
  376    added new commands: ntpdata, refresh, serverstats, shutdown
  377  */
  378 
  379 #define PROTO_VERSION_NUMBER 6
  380 
  381 /* The oldest protocol versions that are compatible enough with the current
  382    version to report a version mismatch for the server and the client */
  383 #define PROTO_VERSION_MISMATCH_COMPAT_SERVER 5
  384 #define PROTO_VERSION_MISMATCH_COMPAT_CLIENT 4
  385 
  386 /* The first protocol version using padding in requests */
  387 #define PROTO_VERSION_PADDING 6
  388 
  389 /* The maximum length of padding in request packet, currently
  390    defined by MANUAL_LIST */
  391 #define MAX_PADDING_LENGTH 396
  392 
  393 /* ================================================== */
  394 
  395 typedef struct {
  396   uint8_t version; /* Protocol version */
  397   uint8_t pkt_type; /* What sort of packet this is */
  398   uint8_t res1;
  399   uint8_t res2;
  400   uint16_t command; /* Which command is being issued */
  401   uint16_t attempt; /* How many resends the client has done
  402                              (count up from zero for same sequence
  403                              number) */
  404   uint32_t sequence; /* Client's sequence number */
  405   uint32_t pad1;
  406   uint32_t pad2;
  407 
  408   union {
  409     REQ_Null null;
  410     REQ_Online online;
  411     REQ_Offline offline;
  412     REQ_Burst burst;
  413     REQ_Modify_Minpoll modify_minpoll;
  414     REQ_Modify_Maxpoll modify_maxpoll;
  415     REQ_Dump dump;
  416     REQ_Modify_Maxdelay modify_maxdelay;
  417     REQ_Modify_Maxdelayratio modify_maxdelayratio;
  418     REQ_Modify_Maxdelaydevratio modify_maxdelaydevratio;
  419     REQ_Modify_Minstratum modify_minstratum;
  420     REQ_Modify_Polltarget modify_polltarget;
  421     REQ_Modify_Maxupdateskew modify_maxupdateskew;
  422     REQ_Modify_Makestep modify_makestep;
  423     REQ_Logon logon;
  424     REQ_Settime settime;
  425     REQ_Local local;
  426     REQ_Manual manual;
  427     REQ_Source_Data source_data;
  428     REQ_Allow_Deny allow_deny;
  429     REQ_Ac_Check ac_check;
  430     REQ_NTP_Source ntp_source;
  431     REQ_Del_Source del_source;
  432     REQ_Dfreq dfreq;
  433     REQ_Doffset doffset;
  434     REQ_Sourcestats sourcestats;
  435     REQ_ClientAccessesByIndex client_accesses_by_index;
  436     REQ_ManualDelete manual_delete;
  437     REQ_ReselectDistance reselect_distance;
  438     REQ_SmoothTime smoothtime;
  439     REQ_NTPData ntp_data;
  440   } data; /* Command specific parameters */
  441 
  442   /* Padding used to prevent traffic amplification.  It only defines the
  443      maximum size of the packet, there is no hole after the data field. */
  444   uint8_t padding[MAX_PADDING_LENGTH];
  445 
  446 } CMD_Request;
  447 
  448 /* ================================================== */
  449 /* Authority codes for command types */
  450 
  451 #define PERMIT_OPEN 0
  452 #define PERMIT_LOCAL 1
  453 #define PERMIT_AUTH 2
  454 
  455 /* ================================================== */
  456 
  457 /* Reply codes */
  458 #define RPY_NULL 1
  459 #define RPY_N_SOURCES 2
  460 #define RPY_SOURCE_DATA 3
  461 #define RPY_MANUAL_TIMESTAMP 4
  462 #define RPY_TRACKING 5
  463 #define RPY_SOURCESTATS 6
  464 #define RPY_RTC 7
  465 #define RPY_SUBNETS_ACCESSED 8
  466 #define RPY_CLIENT_ACCESSES 9
  467 #define RPY_CLIENT_ACCESSES_BY_INDEX 10
  468 #define RPY_MANUAL_LIST 11
  469 #define RPY_ACTIVITY 12
  470 #define RPY_SMOOTHING 13
  471 #define RPY_SERVER_STATS 14
  472 #define RPY_CLIENT_ACCESSES_BY_INDEX2 15
  473 #define RPY_NTP_DATA 16
  474 #define RPY_MANUAL_TIMESTAMP2 17
  475 #define RPY_MANUAL_LIST2 18
  476 #define N_REPLY_TYPES 19
  477 
  478 /* Status codes */
  479 #define STT_SUCCESS 0
  480 #define STT_FAILED 1
  481 #define STT_UNAUTH 2
  482 #define STT_INVALID 3
  483 #define STT_NOSUCHSOURCE 4
  484 #define STT_INVALIDTS 5
  485 #define STT_NOTENABLED 6
  486 #define STT_BADSUBNET 7
  487 #define STT_ACCESSALLOWED 8
  488 #define STT_ACCESSDENIED 9
  489 /* Deprecated */
  490 #define STT_NOHOSTACCESS 10
  491 #define STT_SOURCEALREADYKNOWN 11
  492 #define STT_TOOMANYSOURCES 12
  493 #define STT_NORTC 13
  494 #define STT_BADRTCFILE 14
  495 #define STT_INACTIVE 15
  496 #define STT_BADSAMPLE 16
  497 #define STT_INVALIDAF 17
  498 #define STT_BADPKTVERSION 18
  499 #define STT_BADPKTLENGTH 19
  500 
  501 typedef struct {
  502   int32_t EOR;
  503 } RPY_Null;
  504 
  505 typedef struct {
  506   uint32_t n_sources;
  507   int32_t EOR;
  508 } RPY_N_Sources;
  509 
  510 #define RPY_SD_MD_CLIENT 0
  511 #define RPY_SD_MD_PEER   1
  512 #define RPY_SD_MD_REF    2
  513 
  514 #define RPY_SD_ST_SYNC 0
  515 #define RPY_SD_ST_UNREACH 1
  516 #define RPY_SD_ST_FALSETICKER 2
  517 #define RPY_SD_ST_JITTERY 3
  518 #define RPY_SD_ST_CANDIDATE 4
  519 #define RPY_SD_ST_OUTLIER 5
  520 
  521 #define RPY_SD_FLAG_NOSELECT 0x1
  522 #define RPY_SD_FLAG_PREFER 0x2
  523 #define RPY_SD_FLAG_TRUST 0x4
  524 #define RPY_SD_FLAG_REQUIRE 0x8
  525 
  526 typedef struct {
  527   IPAddr ip_addr;
  528   int16_t poll;
  529   uint16_t stratum;
  530   uint16_t state;
  531   uint16_t mode;
  532   uint16_t flags;
  533   uint16_t reachability;
  534   uint32_t  since_sample;
  535   Float orig_latest_meas;
  536   Float latest_meas;
  537   Float latest_meas_err;
  538   int32_t EOR;
  539 } RPY_Source_Data;
  540 
  541 typedef struct {
  542   uint32_t ref_id;
  543   IPAddr ip_addr;
  544   uint16_t stratum;
  545   uint16_t leap_status;
  546   Timespec ref_time;
  547   Float current_correction;
  548   Float last_offset;
  549   Float rms_offset;
  550   Float freq_ppm;
  551   Float resid_freq_ppm;
  552   Float skew_ppm;
  553   Float root_delay;
  554   Float root_dispersion;
  555   Float last_update_interval;
  556   int32_t EOR;
  557 } RPY_Tracking;
  558 
  559 typedef struct {
  560   uint32_t ref_id;
  561   IPAddr ip_addr;
  562   uint32_t n_samples;
  563   uint32_t n_runs;
  564   uint32_t span_seconds;
  565   Float sd;
  566   Float resid_freq_ppm;
  567   Float skew_ppm;
  568   Float est_offset;
  569   Float est_offset_err;
  570   int32_t EOR;
  571 } RPY_Sourcestats;
  572 
  573 typedef struct {
  574   Timespec ref_time;
  575   uint16_t n_samples;
  576   uint16_t n_runs;
  577   uint32_t span_seconds;
  578   Float rtc_seconds_fast;
  579   Float rtc_gain_rate_ppm;
  580   int32_t EOR;
  581 } RPY_Rtc;
  582 
  583 typedef struct {
  584   Float offset;
  585   Float dfreq_ppm;
  586   Float new_afreq_ppm;
  587   int32_t EOR;
  588 } RPY_ManualTimestamp;
  589 
  590 typedef struct {
  591   IPAddr ip;
  592   uint32_t ntp_hits;
  593   uint32_t cmd_hits;
  594   uint32_t ntp_drops;
  595   uint32_t cmd_drops;
  596   int8_t ntp_interval;
  597   int8_t cmd_interval;
  598   int8_t ntp_timeout_interval;
  599   int8_t pad;
  600   uint32_t last_ntp_hit_ago;
  601   uint32_t last_cmd_hit_ago;
  602 } RPY_ClientAccesses_Client;
  603 
  604 typedef struct {
  605   uint32_t n_indices;      /* how many indices there are in the server's table */
  606   uint32_t next_index;     /* the index 1 beyond those processed on this call */
  607   uint32_t n_clients;      /* the number of valid entries in the following array */
  608   RPY_ClientAccesses_Client clients[MAX_CLIENT_ACCESSES];
  609   int32_t EOR;
  610 } RPY_ClientAccessesByIndex;
  611 
  612 typedef struct {
  613   uint32_t ntp_hits;
  614   uint32_t cmd_hits;
  615   uint32_t ntp_drops;
  616   uint32_t cmd_drops;
  617   uint32_t log_drops;
  618   int32_t EOR;
  619 } RPY_ServerStats;
  620 
  621 #define MAX_MANUAL_LIST_SAMPLES 16
  622 
  623 typedef struct {
  624   Timespec when;
  625   Float slewed_offset;
  626   Float orig_offset;
  627   Float residual;
  628 } RPY_ManualListSample;
  629 
  630 typedef struct {
  631   uint32_t n_samples;
  632   RPY_ManualListSample samples[MAX_MANUAL_LIST_SAMPLES];
  633   int32_t EOR;
  634 } RPY_ManualList;
  635 
  636 typedef struct {
  637   int32_t online;
  638   int32_t offline;
  639   int32_t burst_online;
  640   int32_t burst_offline;
  641   int32_t unresolved;
  642   int32_t EOR;
  643 } RPY_Activity;
  644 
  645 #define RPY_SMT_FLAG_ACTIVE 0x1
  646 #define RPY_SMT_FLAG_LEAPONLY 0x2
  647 
  648 typedef struct {
  649   uint32_t flags;
  650   Float offset;
  651   Float freq_ppm;
  652   Float wander_ppm;
  653   Float last_update_ago;
  654   Float remaining_time;
  655   int32_t EOR;
  656 } RPY_Smoothing;
  657 
  658 #define RPY_NTP_FLAGS_TESTS 0x3ff
  659 #define RPY_NTP_FLAG_INTERLEAVED 0x4000
  660 #define RPY_NTP_FLAG_AUTHENTICATED 0x8000
  661 
  662 typedef struct {
  663   IPAddr remote_addr;
  664   IPAddr local_addr;
  665   uint16_t remote_port;
  666   uint8_t leap;
  667   uint8_t version;
  668   uint8_t mode;
  669   uint8_t stratum;
  670   int8_t poll;
  671   int8_t precision;
  672   Float root_delay;
  673   Float root_dispersion;
  674   uint32_t ref_id;
  675   Timespec ref_time;
  676   Float offset;
  677   Float peer_delay;
  678   Float peer_dispersion;
  679   Float response_time;
  680   Float jitter_asymmetry;
  681   uint16_t flags;
  682   uint8_t tx_tss_char;
  683   uint8_t rx_tss_char;
  684   uint32_t total_tx_count;
  685   uint32_t total_rx_count;
  686   uint32_t total_valid_count;
  687   uint32_t reserved[4];
  688   int32_t EOR;
  689 } RPY_NTPData;
  690 
  691 typedef struct {
  692   uint8_t version;
  693   uint8_t pkt_type;
  694   uint8_t res1;
  695   uint8_t res2;
  696   uint16_t command; /* Which command is being replied to */
  697   uint16_t reply; /* Which format of reply this is */
  698   uint16_t status; /* Status of command processing */
  699   uint16_t pad1; /* Padding for compatibility and 4 byte alignment */
  700   uint16_t pad2;
  701   uint16_t pad3;
  702   uint32_t sequence; /* Echo of client's sequence number */
  703   uint32_t pad4;
  704   uint32_t pad5;
  705 
  706   union {
  707     RPY_Null null;
  708     RPY_N_Sources n_sources;
  709     RPY_Source_Data source_data;
  710     RPY_ManualTimestamp manual_timestamp;
  711     RPY_Tracking tracking;
  712     RPY_Sourcestats sourcestats;
  713     RPY_Rtc rtc;
  714     RPY_ClientAccessesByIndex client_accesses_by_index;
  715     RPY_ServerStats server_stats;
  716     RPY_ManualList manual_list;
  717     RPY_Activity activity;
  718     RPY_Smoothing smoothing;
  719     RPY_NTPData ntp_data;
  720   } data; /* Reply specific parameters */
  721 
  722 } CMD_Reply;
  723 
  724 /* ================================================== */
  725 
  726 #endif /* GOT_CANDM_H */