1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_sixlowpan_frag_rb: add check function for empty interval pool

This commit is contained in:
Martine S. Lenders 2019-12-02 11:58:17 +01:00 committed by Martine Lenders
parent 80ff517eba
commit bd300a3cc0
No known key found for this signature in database
GPG Key ID: CCD317364F63286F
2 changed files with 33 additions and 0 deletions

View File

@ -251,6 +251,27 @@ static inline void gnrc_sixlowpan_frag_rb_remove(gnrc_sixlowpan_frag_rb_t *rbuf)
}
#endif
#if defined(TEST_SUITES) || defined(DOXYGEN)
/**
* @brief Check if pool of fragment intervals is empty
*
* @see @ref gnrc_sixlowpan_frag_rb_int_t
* @note Returns only non-true values if @ref TEST_SUITES is defined.
*
* @return true, if pool of fragment intervals is empty
* @return false, if pool of fragment intervals is not empty
*/
bool gnrc_sixlowpan_frag_rb_ints_empty(void);
#else /* defined(TEST_SUITES) || defined(DOXYGEN) */
/* always true without TEST_SUITES defined to optimize out when not testing,
* as checking the status of the fragment interval pool is unnecessary in
* production */
static inline bool gnrc_sixlowpan_frag_rb_ints_empty(void)
{
return true;
}
#endif /* defined(TEST_SUITES) || defined(DOXYGEN) */
#ifdef __cplusplus
}
#endif

View File

@ -423,6 +423,18 @@ static gnrc_sixlowpan_frag_rb_int_t *_rbuf_int_get_free(void)
return NULL;
}
#ifdef TEST_SUITES
bool gnrc_sixlowpan_frag_rb_ints_empty(void)
{
for (unsigned int i = 0; i < RBUF_INT_SIZE; i++) {
if (rbuf_int[i].end > 0) {
return false;
}
}
return true;
}
#endif /* TEST_SUITES */
static bool _rbuf_update_ints(gnrc_sixlowpan_frag_rb_base_t *entry,
uint16_t offset, size_t frag_size)
{