1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 18:12:46 +01:00

net/rpl: Major style fixes using uncrustify

This commit is contained in:
Teufelchen1 2024-01-24 11:47:28 +01:00
parent 8f6d5b2cb4
commit 1407d4b638

View File

@ -190,6 +190,7 @@ void gnrc_rpl_send(gnrc_pktsnip_t *pkt, kernel_pid_t iface, ipv6_addr_t *src, ip
(void)dodag_id; (void)dodag_id;
gnrc_pktsnip_t *hdr; gnrc_pktsnip_t *hdr;
if (iface == KERNEL_PID_UNDEF) { if (iface == KERNEL_PID_UNDEF) {
netif = _find_interface_with_rpl_mcast(); netif = _find_interface_with_rpl_mcast();
@ -246,6 +247,7 @@ static gnrc_pktsnip_t *_dio_dodag_conf_build(gnrc_pktsnip_t *pkt, gnrc_rpl_dodag
{ {
gnrc_rpl_opt_dodag_conf_t *dodag_conf; gnrc_rpl_opt_dodag_conf_t *dodag_conf;
gnrc_pktsnip_t *opt_snip; gnrc_pktsnip_t *opt_snip;
if ((opt_snip = gnrc_pktbuf_add(pkt, NULL, sizeof(gnrc_rpl_opt_dodag_conf_t), if ((opt_snip = gnrc_pktbuf_add(pkt, NULL, sizeof(gnrc_rpl_opt_dodag_conf_t),
GNRC_NETTYPE_UNDEF)) == NULL) { GNRC_NETTYPE_UNDEF)) == NULL) {
DEBUG("RPL: BUILD DODAG CONF - no space left in packet buffer\n"); DEBUG("RPL: BUILD DODAG CONF - no space left in packet buffer\n");
@ -268,7 +270,8 @@ static gnrc_pktsnip_t *_dio_dodag_conf_build(gnrc_pktsnip_t *pkt, gnrc_rpl_dodag
return opt_snip; return opt_snip;
} }
static gnrc_pktsnip_t *_dis_solicited_opt_build(gnrc_pktsnip_t *pkt, gnrc_rpl_internal_opt_dis_solicited_t *opt) static gnrc_pktsnip_t *_dis_solicited_opt_build(gnrc_pktsnip_t *pkt,
gnrc_rpl_internal_opt_dis_solicited_t *opt)
{ {
gnrc_pktsnip_t *opt_snip; gnrc_pktsnip_t *opt_snip;
size_t snip_size = sizeof(gnrc_rpl_opt_dis_solicited_t); size_t snip_size = sizeof(gnrc_rpl_opt_dis_solicited_t);
@ -281,6 +284,7 @@ static gnrc_pktsnip_t *_dis_solicited_opt_build(gnrc_pktsnip_t *pkt, gnrc_rpl_in
} }
gnrc_rpl_opt_dis_solicited_t *solicited_information; gnrc_rpl_opt_dis_solicited_t *solicited_information;
solicited_information = opt_snip->data; solicited_information = opt_snip->data;
solicited_information->type = GNRC_RPL_OPT_SOLICITED_INFO; solicited_information->type = GNRC_RPL_OPT_SOLICITED_INFO;
@ -460,7 +464,8 @@ void gnrc_rpl_send_DIS(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination,
for (size_t i = 0; i < num_opts; ++i) { for (size_t i = 0; i < num_opts; ++i) {
if (options[i]->type == GNRC_RPL_OPT_SOLICITED_INFO) { if (options[i]->type == GNRC_RPL_OPT_SOLICITED_INFO) {
if ((pkt = _dis_solicited_opt_build(pkt, if ((pkt = _dis_solicited_opt_build(pkt,
(gnrc_rpl_internal_opt_dis_solicited_t*)options[i])) == NULL) { (gnrc_rpl_internal_opt_dis_solicited_t *)options
[i])) == NULL) {
return; return;
} }
} }
@ -507,13 +512,15 @@ static inline uint32_t _sec_to_ms(uint32_t sec)
} }
/** @todo allow target prefixes in target options to be of variable length */ /** @todo allow target prefixes in target options to be of variable length */
static bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt_t *opt, uint16_t len, static bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt_t *opt,
uint16_t len,
ipv6_addr_t *src, uint32_t *included_opts) ipv6_addr_t *src, uint32_t *included_opts)
{ {
uint16_t len_parsed = 0; uint16_t len_parsed = 0;
gnrc_rpl_opt_target_t *first_target = NULL; gnrc_rpl_opt_target_t *first_target = NULL;
gnrc_rpl_dodag_t *dodag = &inst->dodag; gnrc_rpl_dodag_t *dodag = &inst->dodag;
eui64_t iid; eui64_t iid;
*included_opts = 0; *included_opts = 0;
if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_VALIDATION)) { if (!IS_ACTIVE(CONFIG_GNRC_RPL_WITHOUT_VALIDATION)) {
@ -663,9 +670,9 @@ static bool _parse_options(int msg_type, gnrc_rpl_instance_t *inst, gnrc_rpl_opt
transit->path_lifetime * dodag->lifetime_unit); transit->path_lifetime * dodag->lifetime_unit);
first_target = (gnrc_rpl_opt_target_t *)(((uint8_t *)(first_target)) + first_target = (gnrc_rpl_opt_target_t *)(((uint8_t *)(first_target)) +
sizeof(gnrc_rpl_opt_t) + first_target->length); sizeof(gnrc_rpl_opt_t) +
} first_target->length);
while (first_target->type == GNRC_RPL_OPT_TARGET); }while (first_target->type == GNRC_RPL_OPT_TARGET);
first_target = NULL; first_target = NULL;
break; break;
@ -928,10 +935,12 @@ void gnrc_rpl_recv_DIO(gnrc_rpl_dio_t *dio, kernel_pid_t iface, ipv6_addr_t *src
} }
} }
static gnrc_pktsnip_t *_dao_target_build(gnrc_pktsnip_t *pkt, ipv6_addr_t *addr, uint8_t prefix_length) static gnrc_pktsnip_t *_dao_target_build(gnrc_pktsnip_t *pkt, ipv6_addr_t *addr,
uint8_t prefix_length)
{ {
gnrc_rpl_opt_target_t *target; gnrc_rpl_opt_target_t *target;
gnrc_pktsnip_t *opt_snip; gnrc_pktsnip_t *opt_snip;
if ((opt_snip = gnrc_pktbuf_add(pkt, NULL, sizeof(gnrc_rpl_opt_target_t), if ((opt_snip = gnrc_pktbuf_add(pkt, NULL, sizeof(gnrc_rpl_opt_target_t),
GNRC_NETTYPE_UNDEF)) == NULL) { GNRC_NETTYPE_UNDEF)) == NULL) {
DEBUG("RPL: Send DAO - no space left in packet buffer\n"); DEBUG("RPL: Send DAO - no space left in packet buffer\n");
@ -951,6 +960,7 @@ static gnrc_pktsnip_t *_dao_transit_build(gnrc_pktsnip_t *pkt, uint8_t lifetime,
{ {
gnrc_rpl_opt_transit_t *transit; gnrc_rpl_opt_transit_t *transit;
gnrc_pktsnip_t *opt_snip; gnrc_pktsnip_t *opt_snip;
if ((opt_snip = gnrc_pktbuf_add(pkt, NULL, sizeof(gnrc_rpl_opt_transit_t), if ((opt_snip = gnrc_pktbuf_add(pkt, NULL, sizeof(gnrc_rpl_opt_transit_t),
GNRC_NETTYPE_UNDEF)) == NULL) { GNRC_NETTYPE_UNDEF)) == NULL) {
DEBUG("RPL: Send DAO - no space left in packet buffer\n"); DEBUG("RPL: Send DAO - no space left in packet buffer\n");
@ -1183,7 +1193,9 @@ void gnrc_rpl_recv_DAO(gnrc_rpl_dao_t *dao, kernel_pid_t iface, ipv6_addr_t *src
if ((dao->k_d_flags & GNRC_RPL_DAO_D_BIT)) { if ((dao->k_d_flags & GNRC_RPL_DAO_D_BIT)) {
if (memcmp(&dodag->dodag_id, (ipv6_addr_t *)(dao + 1), sizeof(ipv6_addr_t)) != 0) { if (memcmp(&dodag->dodag_id, (ipv6_addr_t *)(dao + 1), sizeof(ipv6_addr_t)) != 0) {
DEBUG("RPL: DAO with unknown DODAG id (%s)\n", ipv6_addr_to_str(addr_str, DEBUG("RPL: DAO with unknown DODAG id (%s)\n", ipv6_addr_to_str(addr_str,
(ipv6_addr_t *)(dao + 1), sizeof(addr_str))); (ipv6_addr_t *)(dao +
1),
sizeof(addr_str)));
return; return;
} }
opts = (gnrc_rpl_opt_t *)(((uint8_t *)opts) + sizeof(ipv6_addr_t)); opts = (gnrc_rpl_opt_t *)(((uint8_t *)opts) + sizeof(ipv6_addr_t));
@ -1247,7 +1259,9 @@ void gnrc_rpl_recv_DAO_ACK(gnrc_rpl_dao_ack_t *dao_ack, kernel_pid_t iface, ipv6
if ((dao_ack->d_reserved & GNRC_RPL_DAO_ACK_D_BIT)) { if ((dao_ack->d_reserved & GNRC_RPL_DAO_ACK_D_BIT)) {
if (memcmp(&dodag->dodag_id, (ipv6_addr_t *)(dao_ack + 1), sizeof(ipv6_addr_t)) != 0) { if (memcmp(&dodag->dodag_id, (ipv6_addr_t *)(dao_ack + 1), sizeof(ipv6_addr_t)) != 0) {
DEBUG("RPL: DAO-ACK with unknown DODAG id (%s)\n", ipv6_addr_to_str(addr_str, DEBUG("RPL: DAO-ACK with unknown DODAG id (%s)\n", ipv6_addr_to_str(addr_str,
(ipv6_addr_t *)(dao_ack + 1), sizeof(addr_str))); (ipv6_addr_t *)(
dao_ack + 1),
sizeof(addr_str)));
return; return;
} }
} }