Merge pull request #769 from tsakoda/impl-starting-EB-RFC8180

implementation section 6.3 in RFC 8180
This commit is contained in:
Simon Duquennoy 2019-02-19 08:56:54 +01:00 committed by GitHub
commit e6b1f21254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 1 deletions

View File

@ -136,5 +136,13 @@ tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new)
rpl_parent_get_ipaddr(new)));
}
}
/*---------------------------------------------------------------------------*/
/* Check RPL has joined DODAG.
* To use, set #define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined */
int
tsch_rpl_check_dodag_joined(void)
{
return NETSTACK_ROUTING.node_has_joined();
}
#endif /* UIP_CONF_IPV6_RPL */
/** @} */

View File

@ -79,6 +79,12 @@ void tsch_rpl_callback_new_dio_interval(clock_time_t dio_interval);
* \param new The new RPL parent
*/
void tsch_rpl_callback_parent_switch(rpl_parent_t *old, rpl_parent_t *new);
/**
* \brief Check RPL has joined DODAG.
* To use, set TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined
* \return 1 if joined, 0 otherwise
*/
int tsch_rpl_check_dodag_joined(void);
#endif /* __TSCH_RPL_H__ */
/** @} */

View File

@ -861,7 +861,12 @@ PROCESS_THREAD(tsch_send_eb_process, ev, data)
while(1) {
unsigned long delay;
if(tsch_is_associated && tsch_current_eb_period > 0) {
if(tsch_is_associated && tsch_current_eb_period > 0
#ifdef TSCH_RPL_CHECK_DODAG_JOINED
/* Implementation section 6.3 of RFC 8180 */
&& TSCH_RPL_CHECK_DODAG_JOINED()
#endif /* TSCH_RPL_CHECK_DODAG_JOINED */
) {
/* Enqueue EB only if there isn't already one in queue */
if(tsch_queue_packet_count(&tsch_eb_address) == 0) {
uint8_t hdr_len = 0;

View File

@ -88,6 +88,10 @@ frequency hopping for enhanced reliability.
#define TSCH_CALLBACK_KA_SENT tsch_rpl_callback_ka_sent
#endif /* TSCH_CALLBACK_KA_SENT */
#ifndef TSCH_RPL_CHECK_DODAG_JOINED
#define TSCH_RPL_CHECK_DODAG_JOINED tsch_rpl_check_dodag_joined
#endif /* TSCH_RPL_CHECK_DODAG_JOINED */
#endif /* UIP_CONF_IPV6_RPL */
#if BUILD_WITH_ORCHESTRA
@ -117,6 +121,11 @@ void TSCH_CALLBACK_LEAVING_NETWORK();
void TSCH_CALLBACK_KA_SENT();
#endif
/* Called by TSCH before sending a EB */
#ifdef TSCH_RPL_CHECK_DODAG_JOINED
int TSCH_RPL_CHECK_DODAG_JOINED();
#endif
/* Called by TSCH form interrupt after receiving a frame, enabled upper-layer to decide
* whether to ACK or NACK */
#ifdef TSCH_CALLBACK_DO_NACK