cmdmon: rename status constants
Change the naming of reported selection status in the sources report to better match the internal status.
This commit is contained in:
parent
c74d6e458d
commit
83ea9fe284
5 changed files with 29 additions and 22 deletions
8
candm.h
8
candm.h
|
@ -553,12 +553,12 @@ typedef struct {
|
|||
#define RPY_SD_MD_PEER 1
|
||||
#define RPY_SD_MD_REF 2
|
||||
|
||||
#define RPY_SD_ST_SYNC 0
|
||||
#define RPY_SD_ST_UNREACH 1
|
||||
#define RPY_SD_ST_SELECTED 0
|
||||
#define RPY_SD_ST_NONSELECTABLE 1
|
||||
#define RPY_SD_ST_FALSETICKER 2
|
||||
#define RPY_SD_ST_JITTERY 3
|
||||
#define RPY_SD_ST_CANDIDATE 4
|
||||
#define RPY_SD_ST_OUTLIER 5
|
||||
#define RPY_SD_ST_UNSELECTED 4
|
||||
#define RPY_SD_ST_SELECTABLE 5
|
||||
|
||||
typedef struct {
|
||||
IPAddr ip_addr;
|
||||
|
|
8
client.c
8
client.c
|
@ -2189,10 +2189,10 @@ process_cmd_sources(char *line)
|
|||
}
|
||||
|
||||
switch (ntohs(reply.data.source_data.state)) {
|
||||
case RPY_SD_ST_SYNC:
|
||||
case RPY_SD_ST_SELECTED:
|
||||
state_ch = '*';
|
||||
break;
|
||||
case RPY_SD_ST_UNREACH:
|
||||
case RPY_SD_ST_NONSELECTABLE:
|
||||
state_ch = '?';
|
||||
break;
|
||||
case RPY_SD_ST_FALSETICKER:
|
||||
|
@ -2201,10 +2201,10 @@ process_cmd_sources(char *line)
|
|||
case RPY_SD_ST_JITTERY:
|
||||
state_ch = '~';
|
||||
break;
|
||||
case RPY_SD_ST_CANDIDATE:
|
||||
case RPY_SD_ST_UNSELECTED:
|
||||
state_ch = '+';
|
||||
break;
|
||||
case RPY_SD_ST_OUTLIER:
|
||||
case RPY_SD_ST_SELECTABLE:
|
||||
state_ch = '-';
|
||||
break;
|
||||
default:
|
||||
|
|
18
cmdmon.c
18
cmdmon.c
|
@ -578,11 +578,8 @@ handle_source_data(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
tx_message->data.source_data.stratum = htons(report.stratum);
|
||||
tx_message->data.source_data.poll = htons(report.poll);
|
||||
switch (report.state) {
|
||||
case RPT_SYNC:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_SYNC);
|
||||
break;
|
||||
case RPT_UNREACH:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_UNREACH);
|
||||
case RPT_NONSELECTABLE:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_NONSELECTABLE);
|
||||
break;
|
||||
case RPT_FALSETICKER:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_FALSETICKER);
|
||||
|
@ -590,11 +587,14 @@ handle_source_data(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
case RPT_JITTERY:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_JITTERY);
|
||||
break;
|
||||
case RPT_CANDIDATE:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_CANDIDATE);
|
||||
case RPT_SELECTABLE:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_SELECTABLE);
|
||||
break;
|
||||
case RPT_OUTLIER:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_OUTLIER);
|
||||
case RPT_UNSELECTED:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_UNSELECTED);
|
||||
break;
|
||||
case RPT_SELECTED:
|
||||
tx_message->data.source_data.state = htons(RPY_SD_ST_SELECTED);
|
||||
break;
|
||||
}
|
||||
switch (report.mode) {
|
||||
|
|
|
@ -36,7 +36,14 @@ typedef struct {
|
|||
int stratum;
|
||||
int poll;
|
||||
enum {RPT_NTP_CLIENT, RPT_NTP_PEER, RPT_LOCAL_REFERENCE} mode;
|
||||
enum {RPT_SYNC, RPT_UNREACH, RPT_FALSETICKER, RPT_JITTERY, RPT_CANDIDATE, RPT_OUTLIER} state;
|
||||
enum {
|
||||
RPT_NONSELECTABLE,
|
||||
RPT_FALSETICKER,
|
||||
RPT_JITTERY,
|
||||
RPT_SELECTABLE,
|
||||
RPT_UNSELECTED,
|
||||
RPT_SELECTED,
|
||||
} state;
|
||||
|
||||
int reachability;
|
||||
unsigned long latest_meas_ago; /* seconds */
|
||||
|
|
|
@ -1504,16 +1504,16 @@ SRC_ReportSource(int index, RPT_SourceReport *report, struct timespec *now)
|
|||
case SRC_WAITS_UPDATE:
|
||||
case SRC_DISTANT:
|
||||
case SRC_OUTLIER:
|
||||
report->state = RPT_OUTLIER;
|
||||
report->state = RPT_SELECTABLE;
|
||||
break;
|
||||
case SRC_UNSELECTED:
|
||||
report->state = RPT_CANDIDATE;
|
||||
report->state = RPT_UNSELECTED;
|
||||
break;
|
||||
case SRC_SELECTED:
|
||||
report->state = RPT_SYNC;
|
||||
report->state = RPT_SELECTED;
|
||||
break;
|
||||
default:
|
||||
report->state = RPT_UNREACH;
|
||||
report->state = RPT_NONSELECTABLE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue