Skip to content

Commit

Permalink
Introduuce new ZInfoNTPSource message in proto/info/ntpsource.proto
Browse files Browse the repository at this point in the history
This will be published from EVE.

Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
  • Loading branch information
rouming committed Jun 6, 2024
1 parent 77df971 commit 4afd091
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions proto/info/ntpsources.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright(c) 2024 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";

import "google/protobuf/timestamp.proto";

package org.lfedge.eve.info;
option go_package = "github.com/lf-edge/eve-api/go/info";

option java_package = "org.lfedge.eve.info";

// Enum for describing the NTP peer state
enum NTPPeerStateType {
NTP_PEER_STATE_SYNC = 0;
NTP_PEER_STATE_UNREACH = 1;
NTP_PEER_STATE_FALSETICKER = 2;
NTP_PEER_STATE_JITTERY = 3;
NTP_PEER_STATE_CANDIDATE = 4;
NTP_PEER_STATE_OUTLIER = 5;
}

// Flags from RFC 5905 + defined by chrony
enum NTPPeerFlagBitmap {
NTP_PEER_PKT_FLAG_UNKNOWN = 0x0000;
NTP_PEER_PKT_FLAG_DUP = 0x0001;
NTP_PEER_PKT_FLAG_BOGUS = 0x0002;
NTP_PEER_PKT_FLAG_INVALID = 0x0004;
NTP_PEER_PKT_FLAG_AUTH = 0x0008;
NTP_PEER_PKT_FLAG_STRATUM = 0x0010;
NTP_PEER_PKT_FLAG_HEADER = 0x0020;
NTP_PEER_TST_FLAG_MAX_DELAY = 0x0040;
NTP_PEER_TST_FLAG_DELAY_RATIO = 0x0080;
NTP_PEER_TST_FLAG_DELAY_DEV_RATION = 0x0100;
NTP_PEER_TST_FLAG_SYNC_LOOP = 0x0200;
}

// As described in http://doc.ntp.org/current-stable/ntpq.html
message NTPPeer {
bool authenticated = 1;
bool reachable = 2; // (reachability == 0xff), i.e. 8 attempts
uint32 reachability = 3;
NTPPeerStateType state = 4;
string hostname = 5;
string src_addr = 6;
uint32 src_port = 7;
string dst_addr = 8;
uint32 dst_port = 9;
uint32 leap = 10;
uint32 stratum = 11;
uint32 precision = 12;
string ref_id = 13;
google.protobuf.Timestamp ref_time = 14;
sint32 poll = 15;
uint32 flags = 16; // bitmap from NTPPeerFlagBitmap
double offset = 17;
double delay = 18;
double dispersion = 19;
double jitter = 20;
double root_delay = 21;
double root_disp = 22;
}

message ZInfoNTPSources {
repeated NTPPeer ntp_peers = 1;
}

0 comments on commit 4afd091

Please sign in to comment.