cmdmon: define new types for CLIENT_ACCESSES_BY_INDEX command
There was an incompatible change in the client access report. To avoid bumping the protocol version drop support for the original request/reply types and define new CLIENT_ACCESSES_BY_INDEX2 types as a newer version of the command.
This commit is contained in:
parent
6e4dd9302d
commit
705e32acdc
4 changed files with 14 additions and 9 deletions
6
candm.h
6
candm.h
|
@ -92,7 +92,8 @@
|
|||
#define REQ_SMOOTHTIME 52
|
||||
#define REQ_REFRESH 53
|
||||
#define REQ_SERVER_STATS 54
|
||||
#define N_REQUEST_TYPES 55
|
||||
#define REQ_CLIENT_ACCESSES_BY_INDEX2 55
|
||||
#define N_REQUEST_TYPES 56
|
||||
|
||||
/* Special utoken value used to log on with first exchange being the
|
||||
password. (This time value has long since gone by) */
|
||||
|
@ -435,7 +436,8 @@ typedef struct {
|
|||
#define RPY_ACTIVITY 12
|
||||
#define RPY_SMOOTHING 13
|
||||
#define RPY_SERVER_STATS 14
|
||||
#define N_REPLY_TYPES 15
|
||||
#define RPY_CLIENT_ACCESSES_BY_INDEX2 15
|
||||
#define N_REPLY_TYPES 16
|
||||
|
||||
/* Status codes */
|
||||
#define STT_SUCCESS 0
|
||||
|
|
4
client.c
4
client.c
|
@ -2098,11 +2098,11 @@ process_cmd_clients(char *line)
|
|||
"===============================================================================\n");
|
||||
|
||||
while (1) {
|
||||
request.command = htons(REQ_CLIENT_ACCESSES_BY_INDEX);
|
||||
request.command = htons(REQ_CLIENT_ACCESSES_BY_INDEX2);
|
||||
request.data.client_accesses_by_index.first_index = htonl(next_index);
|
||||
request.data.client_accesses_by_index.n_clients = htonl(MAX_CLIENT_ACCESSES);
|
||||
|
||||
if (!request_reply(&request, &reply, RPY_CLIENT_ACCESSES_BY_INDEX, 0))
|
||||
if (!request_reply(&request, &reply, RPY_CLIENT_ACCESSES_BY_INDEX2, 0))
|
||||
return 0;
|
||||
|
||||
n_clients = ntohl(reply.data.client_accesses_by_index.n_clients);
|
||||
|
|
5
cmdmon.c
5
cmdmon.c
|
@ -131,6 +131,7 @@ static const char permissions[] = {
|
|||
PERMIT_AUTH, /* SMOOTHTIME */
|
||||
PERMIT_AUTH, /* REFRESH */
|
||||
PERMIT_AUTH, /* SERVER_STATS */
|
||||
PERMIT_AUTH, /* CLIENT_ACCESSES_BY_INDEX2 */
|
||||
};
|
||||
|
||||
/* ================================================== */
|
||||
|
@ -1047,7 +1048,7 @@ handle_client_accesses_by_index(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
return;
|
||||
}
|
||||
|
||||
tx_message->reply = htons(RPY_CLIENT_ACCESSES_BY_INDEX);
|
||||
tx_message->reply = htons(RPY_CLIENT_ACCESSES_BY_INDEX2);
|
||||
tx_message->data.client_accesses_by_index.n_indices = htonl(n_indices);
|
||||
|
||||
memset(tx_message->data.client_accesses_by_index.clients, 0,
|
||||
|
@ -1520,7 +1521,7 @@ read_from_cmd_socket(void *anything)
|
|||
handle_cyclelogs(&rx_message, &tx_message);
|
||||
break;
|
||||
|
||||
case REQ_CLIENT_ACCESSES_BY_INDEX:
|
||||
case REQ_CLIENT_ACCESSES_BY_INDEX2:
|
||||
handle_client_accesses_by_index(&rx_message, &tx_message);
|
||||
break;
|
||||
|
||||
|
|
|
@ -94,8 +94,7 @@ static const struct request_length request_lengths[] = {
|
|||
REQ_LENGTH_ENTRY(null, null), /* CYCLELOGS */
|
||||
{ 0, 0 }, /* SUBNETS_ACCESSED - not supported */
|
||||
{ 0, 0 }, /* CLIENT_ACCESSES - not supported */
|
||||
REQ_LENGTH_ENTRY(client_accesses_by_index,
|
||||
client_accesses_by_index), /* CLIENT_ACCESSES_BY_INDEX */
|
||||
{ 0, 0 }, /* CLIENT_ACCESSES_BY_INDEX - not supported */
|
||||
REQ_LENGTH_ENTRY(null, manual_list), /* MANUAL_LIST */
|
||||
REQ_LENGTH_ENTRY(manual_delete, null), /* MANUAL_DELETE */
|
||||
REQ_LENGTH_ENTRY(null, null), /* MAKESTEP */
|
||||
|
@ -110,6 +109,8 @@ static const struct request_length request_lengths[] = {
|
|||
REQ_LENGTH_ENTRY(smoothtime, null), /* SMOOTHTIME */
|
||||
REQ_LENGTH_ENTRY(null, null), /* REFRESH */
|
||||
REQ_LENGTH_ENTRY(null, server_stats), /* SERVER_STATS */
|
||||
REQ_LENGTH_ENTRY(client_accesses_by_index,
|
||||
client_accesses_by_index), /* CLIENT_ACCESSES_BY_INDEX2 */
|
||||
};
|
||||
|
||||
static const uint16_t reply_lengths[] = {
|
||||
|
@ -123,11 +124,12 @@ static const uint16_t reply_lengths[] = {
|
|||
RPY_LENGTH_ENTRY(rtc), /* RTC */
|
||||
0, /* SUBNETS_ACCESSED - not supported */
|
||||
0, /* CLIENT_ACCESSES - not supported */
|
||||
RPY_LENGTH_ENTRY(client_accesses_by_index), /* CLIENT_ACCESSES_BY_INDEX */
|
||||
0, /* CLIENT_ACCESSES_BY_INDEX - not supported */
|
||||
0, /* MANUAL_LIST - variable length */
|
||||
RPY_LENGTH_ENTRY(activity), /* ACTIVITY */
|
||||
RPY_LENGTH_ENTRY(smoothing), /* SMOOTHING */
|
||||
RPY_LENGTH_ENTRY(server_stats), /* SERVER_STATS */
|
||||
RPY_LENGTH_ENTRY(client_accesses_by_index), /* CLIENT_ACCESSES_BY_INDEX2 */
|
||||
};
|
||||
|
||||
/* ================================================== */
|
||||
|
|
Loading…
Reference in a new issue