diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2020-02-13 16:50:43 +0100 |
---|---|---|
committer | Jordan Augé <jordan.auge+fdio@cisco.com> | 2020-02-13 16:57:03 +0100 |
commit | 1fb7b1be452111b9e26a100bc5dfdce266c30330 (patch) | |
tree | ee67c224ff4ca6f20919032ff1933b07f0b43707 /hicn-light/src/hicn/core | |
parent | f9243a2bf823086404be1c41c7bcc1b27cfab7de (diff) |
[HICN-518] new API in hicn-light to allow a producer to force MAP-Me messages to be resent
Change-Id: I2e17250c5e4f78341966507a4bf04d09b84bb9d0
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/core')
-rw-r--r-- | hicn-light/src/hicn/core/mapme.c | 23 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/mapme.h | 12 |
2 files changed, 26 insertions, 9 deletions
diff --git a/hicn-light/src/hicn/core/mapme.c b/hicn-light/src/hicn/core/mapme.c index 93a01bb0d..a22d01ae7 100644 --- a/hicn-light/src/hicn/core/mapme.c +++ b/hicn-light/src/hicn/core/mapme.c @@ -482,14 +482,6 @@ static bool mapme_hasLocalNextHops(const MapMe *mapme, void mapme_send_updates(const MapMe * mapme, FibEntry * fibEntry, const NumberSet * nexthops) { - /* Detect change */ - NumberSet * previous_nexthops = fibEntry_GetPreviousNextHops(fibEntry); - if (numberSet_Equals(nexthops, previous_nexthops)) { - INFO(mapme, "[MAP-Me] No change in nexthops"); - return; - } - fibEntry_SetPreviousNextHops(fibEntry, nexthops); - if (!TFIB(fibEntry)) /* Create TFIB associated to FIB entry */ mapme_CreateTFIB(fibEntry); TFIB(fibEntry)->seq++; @@ -507,6 +499,21 @@ mapme_send_updates(const MapMe * mapme, FibEntry * fibEntry, const NumberSet * n free(name_str); } + +void +mapme_maybe_send_updates(const MapMe * mapme, FibEntry * fibEntry, const NumberSet * nexthops) +{ + /* Detect change */ + NumberSet * previous_nexthops = fibEntry_GetPreviousNextHops(fibEntry); + if (numberSet_Equals(nexthops, previous_nexthops)) { + INFO(mapme, "[MAP-Me] No change in nexthops"); + return; + } + fibEntry_SetPreviousNextHops(fibEntry, nexthops); + + mapme_send_updates(mapme, fibEntry, nexthops); +} + void mapme_reconsiderFibEntry(const MapMe *mapme, FibEntry * fibEntry) { diff --git a/hicn-light/src/hicn/core/mapme.h b/hicn-light/src/hicn/core/mapme.h index 503b22568..72f8d536a 100644 --- a/hicn-light/src/hicn/core/mapme.h +++ b/hicn-light/src/hicn/core/mapme.h @@ -70,7 +70,7 @@ void mapme_Process(const MapMe *mapme, const uint8_t *msgBuffer, /** * @function mapme_send_updates - * @abstract Trigger the update for specified FIB entry and nexthops + * @abstract Trigger (if needed) the update for specified FIB entry and nexthops * @param [in] mapme - Pointer to the MAP-Me data structure. * @param [in] fibEntry - The FIB entry to consider * @param [in] nexthops - NumberSet holding the next hops on which to send the @@ -79,6 +79,16 @@ void mapme_Process(const MapMe *mapme, const uint8_t *msgBuffer, void mapme_send_updates(const MapMe * mapme, FibEntry * fibEntry, const NumberSet * nexthops); /** + * @function mapme_send_updates + * @abstract Trigger the update for specified FIB entry and nexthops, only if needed + * @param [in] mapme - Pointer to the MAP-Me data structure. + * @param [in] fibEntry - The FIB entry to consider + * @param [in] nexthops - NumberSet holding the next hops on which to send the + * update. + */ +void mapme_maybe_send_updates(const MapMe * mapme, FibEntry * fibEntry, const NumberSet * nexthops); + +/** * @function mapme_reconsiderFibEntry * @abstract Process a fib entry for changes that might trigger new updates * @param [in] mapme - Pointer to the MAP-Me data structure. |