summaryrefslogtreecommitdiff
path: root/mesh/net.h
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2020-08-06 18:38:34 -0700
committerBrian Gix <brian.gix@intel.com>2020-08-10 14:48:55 -0700
commitc77bb848a9fb4e37e90109b0a97e68a3335a2734 (patch)
treed708aace739c89825e644c7f6f470ba6e068a208 /mesh/net.h
parent1836a4e09efa68e2c5d911e0b49de9563eea3cd3 (diff)
downloadbluez-c77bb848a9fb4e37e90109b0a97e68a3335a2734.tar.gz
mesh: Refactor heartbeat pub/sub
Move heartbeat publication/subscription timers and housekeeping to net.c since this is where the trigger events and control messages are handled. Configuration server (cfgmod-server.c) stays responsible for parsing the set pub/sub message parameters and assemblying the pub/sub status messages. Also, make sure that the correct message status is reported.
Diffstat (limited to 'mesh/net.h')
-rw-r--r--mesh/net.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/mesh/net.h b/mesh/net.h
index 3d374280f..91e07ef78 100644
--- a/mesh/net.h
+++ b/mesh/net.h
@@ -129,25 +129,27 @@ struct mesh_net_prov_caps {
uint16_t input_action;
} __packed;
-struct mesh_net_heartbeat {
- struct l_timeout *pub_timer;
- struct l_timeout *sub_timer;
- struct timeval sub_time;
- bool sub_enabled;
- uint32_t pub_period;
- uint32_t sub_period;
- uint32_t sub_start;
- uint16_t pub_dst;
- uint16_t pub_count;
- uint16_t pub_features;
+struct mesh_net_heartbeat_sub {
+ struct l_timeout *timer;
+ uint32_t start;
+ uint32_t period;
uint16_t features;
- uint16_t pub_net_idx;
- uint16_t sub_src;
- uint16_t sub_dst;
- uint16_t sub_count;
- uint8_t pub_ttl;
- uint8_t sub_min_hops;
- uint8_t sub_max_hops;
+ uint16_t src;
+ uint16_t dst;
+ uint16_t count;
+ bool enabled;
+ uint8_t min_hops;
+ uint8_t max_hops;
+};
+
+struct mesh_net_heartbeat_pub {
+ struct l_timeout *timer;
+ uint32_t period;
+ uint16_t dst;
+ uint16_t count;
+ uint16_t features;
+ uint16_t net_idx;
+ uint8_t ttl;
};
struct mesh_key_set {
@@ -328,9 +330,13 @@ void mesh_net_send_seg(struct mesh_net *net, uint32_t key_id,
uint32_t iv_index, uint8_t ttl, uint32_t seq,
uint16_t src, uint16_t dst, uint32_t hdr,
const void *seg, uint16_t seg_len);
-struct mesh_net_heartbeat *mesh_net_heartbeat_get(struct mesh_net *net);
-void mesh_net_heartbeat_init(struct mesh_net *net);
-void mesh_net_heartbeat_send(struct mesh_net *net);
+struct mesh_net_heartbeat_sub *mesh_net_get_heartbeat_sub(struct mesh_net *net);
+int mesh_net_set_heartbeat_sub(struct mesh_net *net, uint16_t src, uint16_t dst,
+ uint8_t period_log);
+struct mesh_net_heartbeat_pub *mesh_net_get_heartbeat_pub(struct mesh_net *net);
+int mesh_net_set_heartbeat_pub(struct mesh_net *net, uint16_t dst,
+ uint16_t features, uint16_t idx, uint8_t ttl,
+ uint8_t count_log, uint8_t period_log);
bool mesh_net_key_list_get(struct mesh_net *net, uint8_t *buf, uint16_t *count);
uint16_t mesh_net_get_primary_idx(struct mesh_net *net);
uint32_t mesh_net_friend_timeout(struct mesh_net *net, uint16_t addr);