WIP: S&F Progress

This commit is contained in:
Thomas Göttgens
2022-12-21 12:57:42 +01:00
parent 34c73da886
commit ae2ca1d89c
5 changed files with 255 additions and 198 deletions

View File

@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.6 */
/* Generated by nanopb-0.4.7 */
#include "storeforward.pb.h"
#if PB_PROTO_HEADER_VERSION != 40

View File

@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.6 */
/* Generated by nanopb-0.4.7 */
#ifndef PB_STOREFORWARD_PB_H_INCLUDED
#define PB_STOREFORWARD_PB_H_INCLUDED
@@ -10,88 +10,124 @@
#endif
/* Enum definitions */
typedef enum _StoreAndForward_RequestResponse {
StoreAndForward_RequestResponse_UNSET = 0,
StoreAndForward_RequestResponse_ROUTER_ERROR = 1,
StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2,
StoreAndForward_RequestResponse_ROUTER_PING = 3,
StoreAndForward_RequestResponse_ROUTER_PONG = 4,
StoreAndForward_RequestResponse_ROUTER_BUSY = 5,
StoreAndForward_RequestResponse_ROUTER_HISTORY = 6,
StoreAndForward_RequestResponse_CLIENT_ERROR = 101,
StoreAndForward_RequestResponse_CLIENT_HISTORY = 102,
StoreAndForward_RequestResponse_CLIENT_STATS = 103,
StoreAndForward_RequestResponse_CLIENT_PING = 104,
StoreAndForward_RequestResponse_CLIENT_PONG = 105,
StoreAndForward_RequestResponse_CLIENT_ABORT = 106
/* 001 - 063 = From Router
064 - 127 = From Client */
typedef enum _StoreAndForward_RequestResponse {
/* Unset/unused */
StoreAndForward_RequestResponse_UNSET = 0,
/* Router is an in error state. */
StoreAndForward_RequestResponse_ROUTER_ERROR = 1,
/* Router heartbeat */
StoreAndForward_RequestResponse_ROUTER_HEARTBEAT = 2,
/* Router has requested the client respond. This can work as a
"are you there" message. */
StoreAndForward_RequestResponse_ROUTER_PING = 3,
/* The response to a "Ping" */
StoreAndForward_RequestResponse_ROUTER_PONG = 4,
/* Router is currently busy. Please try again later. */
StoreAndForward_RequestResponse_ROUTER_BUSY = 5,
/* Router is responding to a request for history. */
StoreAndForward_RequestResponse_ROUTER_HISTORY = 6,
/* Client is an in error state. */
StoreAndForward_RequestResponse_CLIENT_ERROR = 64,
/* Client has requested a replay from the router. */
StoreAndForward_RequestResponse_CLIENT_HISTORY = 65,
/* Client has requested stats from the router. */
StoreAndForward_RequestResponse_CLIENT_STATS = 66,
/* Client has requested the router respond. This can work as a
"are you there" message. */
StoreAndForward_RequestResponse_CLIENT_PING = 67,
/* The response to a "Ping" */
StoreAndForward_RequestResponse_CLIENT_PONG = 68,
/* Client has requested that the router abort processing the client's request */
StoreAndForward_RequestResponse_CLIENT_ABORT = 106
} StoreAndForward_RequestResponse;
/* Struct definitions */
typedef struct _StoreAndForward_Heartbeat {
uint32_t period;
uint32_t secondary;
} StoreAndForward_Heartbeat;
typedef struct _StoreAndForward_History {
uint32_t history_messages;
uint32_t window;
uint32_t last_request;
} StoreAndForward_History;
typedef struct _StoreAndForward_Statistics {
/* TODO: REPLACE */
typedef struct _StoreAndForward_Statistics {
/* Number of messages we have ever seen */
uint32_t messages_total;
/* Number of messages we have currently saved our history. */
uint32_t messages_saved;
/* Maximum number of messages we will save */
uint32_t messages_max;
/* Router uptime in seconds */
uint32_t up_time;
/* Number of times any client sent a request to the S&F. */
uint32_t requests;
/* Number of times the history was requested. */
uint32_t requests_history;
/* Is the heartbeat enabled on the server? */
bool heartbeat;
/* Is the heartbeat enabled on the server? */
uint32_t return_max;
/* Is the heartbeat enabled on the server? */
uint32_t return_window;
} StoreAndForward_Statistics;
/* TODO: REPLACE */
typedef struct _StoreAndForward {
typedef struct _StoreAndForward_History {
/* Number of that will be sent to the client */
uint32_t history_messages;
/* The window of messages that was used to filter the history client requested */
uint32_t window;
/* The window of messages that was used to filter the history client requested */
uint32_t last_request;
} StoreAndForward_History;
/* TODO: REPLACE */
typedef struct _StoreAndForward_Heartbeat {
/* Number of that will be sent to the client */
uint32_t period;
/* If set, this is not the primary Store & Forward router on the mesh */
uint32_t secondary;
} StoreAndForward_Heartbeat;
/* TODO: REPLACE */
typedef struct _StoreAndForward {
/* TODO: REPLACE */
StoreAndForward_RequestResponse rr;
/* TODO: REPLACE */
bool has_stats;
StoreAndForward_Statistics stats;
/* TODO: REPLACE */
bool has_history;
StoreAndForward_History history;
/* TODO: REPLACE */
bool has_heartbeat;
StoreAndForward_Heartbeat heartbeat;
pb_size_t which_variant;
union {
/* TODO: REPLACE */
StoreAndForward_Statistics stats;
/* TODO: REPLACE */
StoreAndForward_History history;
/* TODO: REPLACE */
StoreAndForward_Heartbeat heartbeat;
/* Empty Payload */
bool empty;
} variant;
} StoreAndForward;
/* Helper constants for enums */
#define _StoreAndForward_RequestResponse_MIN StoreAndForward_RequestResponse_UNSET
#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_ABORT
#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_ABORT+1))
#ifdef __cplusplus
extern "C" {
#endif
/* Helper constants for enums */
#define _StoreAndForward_RequestResponse_MIN StoreAndForward_RequestResponse_UNSET
#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_ABORT
#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_ABORT+1))
#define StoreAndForward_rr_ENUMTYPE StoreAndForward_RequestResponse
/* Initializer values for message structs */
#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_default, false, StoreAndForward_History_init_default, false, StoreAndForward_Heartbeat_init_default}
#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, 0, {StoreAndForward_Statistics_init_default}}
#define StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define StoreAndForward_History_init_default {0, 0, 0}
#define StoreAndForward_Heartbeat_init_default {0, 0}
#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_zero, false, StoreAndForward_History_init_zero, false, StoreAndForward_Heartbeat_init_zero}
#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, 0, {StoreAndForward_Statistics_init_zero}}
#define StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
#define StoreAndForward_History_init_zero {0, 0, 0}
#define StoreAndForward_Heartbeat_init_zero {0, 0}
/* Field tags (for use in manual encoding/decoding) */
#define StoreAndForward_Heartbeat_period_tag 1
#define StoreAndForward_Heartbeat_secondary_tag 2
#define StoreAndForward_History_history_messages_tag 1
#define StoreAndForward_History_window_tag 2
#define StoreAndForward_History_last_request_tag 3
#define StoreAndForward_Statistics_messages_total_tag 1
#define StoreAndForward_Statistics_messages_saved_tag 2
#define StoreAndForward_Statistics_messages_max_tag 3
@@ -101,22 +137,29 @@ extern "C" {
#define StoreAndForward_Statistics_heartbeat_tag 7
#define StoreAndForward_Statistics_return_max_tag 8
#define StoreAndForward_Statistics_return_window_tag 9
#define StoreAndForward_History_history_messages_tag 1
#define StoreAndForward_History_window_tag 2
#define StoreAndForward_History_last_request_tag 3
#define StoreAndForward_Heartbeat_period_tag 1
#define StoreAndForward_Heartbeat_secondary_tag 2
#define StoreAndForward_rr_tag 1
#define StoreAndForward_stats_tag 2
#define StoreAndForward_history_tag 3
#define StoreAndForward_heartbeat_tag 4
#define StoreAndForward_empty_tag 5
/* Struct field encoding specification for nanopb */
#define StoreAndForward_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UENUM, rr, 1) \
X(a, STATIC, OPTIONAL, MESSAGE, stats, 2) \
X(a, STATIC, OPTIONAL, MESSAGE, history, 3) \
X(a, STATIC, OPTIONAL, MESSAGE, heartbeat, 4)
X(a, STATIC, ONEOF, MESSAGE, (variant,stats,variant.stats), 2) \
X(a, STATIC, ONEOF, MESSAGE, (variant,history,variant.history), 3) \
X(a, STATIC, ONEOF, MESSAGE, (variant,heartbeat,variant.heartbeat), 4) \
X(a, STATIC, ONEOF, BOOL, (variant,empty,variant.empty), 5)
#define StoreAndForward_CALLBACK NULL
#define StoreAndForward_DEFAULT NULL
#define StoreAndForward_stats_MSGTYPE StoreAndForward_Statistics
#define StoreAndForward_history_MSGTYPE StoreAndForward_History
#define StoreAndForward_heartbeat_MSGTYPE StoreAndForward_Heartbeat
#define StoreAndForward_variant_stats_MSGTYPE StoreAndForward_Statistics
#define StoreAndForward_variant_history_MSGTYPE StoreAndForward_History
#define StoreAndForward_variant_heartbeat_MSGTYPE StoreAndForward_Heartbeat
#define StoreAndForward_Statistics_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, messages_total, 1) \
@@ -159,7 +202,7 @@ extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg;
#define StoreAndForward_Heartbeat_size 12
#define StoreAndForward_History_size 18
#define StoreAndForward_Statistics_size 50
#define StoreAndForward_size 88
#define StoreAndForward_size 54
#ifdef __cplusplus
} /* extern "C" */