Bluetooth: Mesh: Expose header parsing outside net
Provides utility function for parsing network headers outside of the network layer. The primary intended use-case is friendship. Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
This commit is contained in:
parent
bb7c2e82b1
commit
ec5e43ba5f
2 changed files with 13 additions and 0 deletions
|
@ -1218,6 +1218,17 @@ done:
|
||||||
net_buf_unref(buf);
|
net_buf_unref(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bt_mesh_net_header_parse(struct net_buf_simple *buf,
|
||||||
|
struct bt_mesh_net_rx *rx)
|
||||||
|
{
|
||||||
|
rx->old_iv = (IVI(buf->data) != (bt_mesh.iv_index & 0x01));
|
||||||
|
rx->ctl = CTL(buf->data);
|
||||||
|
rx->ctx.recv_ttl = TTL(buf->data);
|
||||||
|
rx->seq = SEQ(buf->data);
|
||||||
|
rx->ctx.addr = SRC(buf->data);
|
||||||
|
rx->ctx.recv_dst = DST(buf->data);
|
||||||
|
}
|
||||||
|
|
||||||
int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
|
int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
|
||||||
struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
|
struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -344,6 +344,8 @@ u32_t bt_mesh_next_seq(void);
|
||||||
void bt_mesh_net_start(void);
|
void bt_mesh_net_start(void);
|
||||||
|
|
||||||
void bt_mesh_net_init(void);
|
void bt_mesh_net_init(void);
|
||||||
|
void bt_mesh_net_header_parse(struct net_buf_simple *buf,
|
||||||
|
struct bt_mesh_net_rx *rx);
|
||||||
|
|
||||||
/* Friendship Credential Management */
|
/* Friendship Credential Management */
|
||||||
struct friend_cred {
|
struct friend_cred {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue