From 4afd09124c041a2df30093f785ed60297ad3b588 Mon Sep 17 00:00:00 2001 From: Roman Penyaev Date: Thu, 6 Jun 2024 14:23:42 +0200 Subject: [PATCH] Introduuce new ZInfoNTPSource message in `proto/info/ntpsource.proto` This will be published from EVE. Signed-off-by: Roman Penyaev --- proto/info/ntpsources.proto | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 proto/info/ntpsources.proto diff --git a/proto/info/ntpsources.proto b/proto/info/ntpsources.proto new file mode 100644 index 00000000..3e8845aa --- /dev/null +++ b/proto/info/ntpsources.proto @@ -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; +}