Register generic ICMPv6 handlers for RPL
This commit is contained in:
parent
1d3da44991
commit
017697f91d
3 changed files with 20 additions and 21 deletions
|
@ -92,6 +92,12 @@ extern rpl_of_t RPL_OF;
|
|||
static uip_mcast6_route_t *mcast_group;
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Initialise RPL ICMPv6 message handlers */
|
||||
UIP_ICMP6_HANDLER(dis_handler, ICMP6_RPL, RPL_CODE_DIS, dis_input);
|
||||
UIP_ICMP6_HANDLER(dio_handler, ICMP6_RPL, RPL_CODE_DIO, dio_input);
|
||||
UIP_ICMP6_HANDLER(dao_handler, ICMP6_RPL, RPL_CODE_DAO, dao_input);
|
||||
UIP_ICMP6_HANDLER(dao_ack_handler, ICMP6_RPL, RPL_CODE_DAO_ACK, dao_ack_input);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
get_global_addr(uip_ipaddr_t *addr)
|
||||
{
|
||||
|
@ -168,6 +174,7 @@ dis_input(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
uip_len = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -407,6 +414,8 @@ dio_input(void)
|
|||
#endif
|
||||
|
||||
rpl_process_dio(&from, &dio);
|
||||
|
||||
uip_len = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -785,6 +794,7 @@ fwd_dao:
|
|||
dao_ack_output(instance, &dao_sender_addr, sequence);
|
||||
}
|
||||
}
|
||||
uip_len = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -914,6 +924,7 @@ dao_ack_input(void)
|
|||
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
||||
PRINTF("\n");
|
||||
#endif /* DEBUG */
|
||||
uip_len = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -936,27 +947,12 @@ dao_ack_output(rpl_instance_t *instance, uip_ipaddr_t *dest, uint8_t sequence)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_rpl_input(void)
|
||||
rpl_icmp6_register_handlers()
|
||||
{
|
||||
PRINTF("Received an RPL control message\n");
|
||||
switch(UIP_ICMP_BUF->icode) {
|
||||
case RPL_CODE_DIO:
|
||||
dio_input();
|
||||
break;
|
||||
case RPL_CODE_DIS:
|
||||
dis_input();
|
||||
break;
|
||||
case RPL_CODE_DAO:
|
||||
dao_input();
|
||||
break;
|
||||
case RPL_CODE_DAO_ACK:
|
||||
dao_ack_input();
|
||||
break;
|
||||
default:
|
||||
PRINTF("RPL: received an unknown ICMP6 code (%u)\n", UIP_ICMP_BUF->icode);
|
||||
break;
|
||||
}
|
||||
|
||||
uip_len = 0;
|
||||
uip_icmp6_register_input_handler(&dis_handler);
|
||||
uip_icmp6_register_input_handler(&dio_handler);
|
||||
uip_icmp6_register_input_handler(&dao_handler);
|
||||
uip_icmp6_register_input_handler(&dao_ack_handler);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
|
|
@ -289,6 +289,7 @@ void dio_output(rpl_instance_t *, uip_ipaddr_t *uc_addr);
|
|||
void dao_output(rpl_parent_t *, uint8_t lifetime);
|
||||
void dao_output_target(rpl_parent_t *, uip_ipaddr_t *, uint8_t lifetime);
|
||||
void dao_ack_output(rpl_instance_t *, uip_ipaddr_t *, uint8_t);
|
||||
void rpl_icmp6_register_handlers(void);
|
||||
|
||||
/* RPL logic functions. */
|
||||
void rpl_join_dag(uip_ipaddr_t *from, rpl_dio_t *dio);
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "net/ip/uip.h"
|
||||
#include "net/ip/tcpip.h"
|
||||
#include "net/ipv6/uip-ds6.h"
|
||||
#include "net/ipv6/uip-icmp6.h"
|
||||
#include "net/rpl/rpl-private.h"
|
||||
#include "net/ipv6/multicast/uip-mcast6.h"
|
||||
|
||||
|
@ -300,6 +301,7 @@ rpl_init(void)
|
|||
|
||||
rpl_dag_init();
|
||||
rpl_reset_periodic_timer();
|
||||
rpl_icmp6_register_handlers();
|
||||
|
||||
/* add rpl multicast address */
|
||||
uip_create_linklocal_rplnodes_mcast(&rplmaddr);
|
||||
|
|
Loading…
Reference in a new issue