bluetooth: Controller: Refactor node_rx footer to avoid ptr arithmetic

The old footer was appended after PDU using pointer arithmetic. Now
the footer fields have been moved to the header struct, the
footer fields are now statically located in the data structure,
this is type safe and fields can be referred to by their actual
names rather than indirectly through reference to other members,
thus avoiding pointer arithmetic. Secondly, this change will pave
the way for adding other meta data in the future.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
This commit is contained in:
Asger Munk Nielsen 2019-05-01 12:27:13 +02:00 committed by Alberto Escolar
commit 58e9ac6811
7 changed files with 83 additions and 45 deletions

View file

@ -629,9 +629,7 @@ void ull_conn_setup(memq_link_t *link, struct node_rx_hdr *rx)
struct node_rx_ftr *ftr;
struct lll_conn *lll;
ftr = (void *)((u8_t *)((struct node_rx_pdu *)rx)->pdu +
(offsetof(struct pdu_adv, connect_ind) +
sizeof(struct pdu_adv_connect_ind)));
ftr = &(rx->rx_ftr);
lll = *((struct lll_conn **)((u8_t *)ftr->param +
sizeof(struct lll_hdr)));