diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-07-26 23:20:30 +0200 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2019-07-29 17:13:35 +0200 |
commit | 0a1c6b5565e20167d1f1f33a5a8b597f420b18b0 (patch) | |
tree | 98c5da8f231fbd3dc2ce6502040e29c8333d9ffc /hicn-light/src/hicn/strategies/rndSegment.c | |
parent | 05ca0aa8f612ee48fb66d4dbebe596b7f1e03181 (diff) |
[HICN-252] Add per-application policy framework to hicn-light forwarder
Change-Id: I0531cd7a7de179581295ae34766c81cd9cf3e172
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Co-authored-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/strategies/rndSegment.c')
-rw-r--r-- | hicn-light/src/hicn/strategies/rndSegment.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/hicn-light/src/hicn/strategies/rndSegment.c b/hicn-light/src/hicn/strategies/rndSegment.c index d7a5c6aec..93e39ee74 100644 --- a/hicn-light/src/hicn/strategies/rndSegment.c +++ b/hicn-light/src/hicn/strategies/rndSegment.c @@ -33,9 +33,15 @@ static void _strategyRndSegment_ReceiveObject(StrategyImpl *strategy, static void _strategyRndSegment_OnTimeout(StrategyImpl *strategy, const NumberSet *egressId); static NumberSet *_strategyRndSegment_LookupNexthop( - StrategyImpl *strategy, const Message *interestMessage); + StrategyImpl *strategy, +#ifdef WITH_POLICY + NumberSet * nexthops, +#endif /* WITH_POLICY */ + const Message *interestMessage); +#ifndef WITH_POLICY static NumberSet *_strategyRndSegment_ReturnNexthops(StrategyImpl *strategy); static unsigned _strategyRndSegment_CountNexthops(StrategyImpl *strategy); +#endif /* ! WITH_POLICY */ static void _strategyRndSegment_AddNexthop(StrategyImpl *strategy, unsigned connectionId); static void _strategyRndSegment_RemoveNexthop(StrategyImpl *strategy, @@ -48,8 +54,10 @@ static StrategyImpl _template = { .receiveObject = &_strategyRndSegment_ReceiveObject, .onTimeout = &_strategyRndSegment_OnTimeout, .lookupNexthop = &_strategyRndSegment_LookupNexthop, +#ifndef WITH_POLICY .returnNexthops = &_strategyRndSegment_ReturnNexthops, .countNexthops = &_strategyRndSegment_CountNexthops, +#endif /* ! WITH_POLICY */ .addNexthop = &_strategyRndSegment_AddNexthop, .removeNexthop = &_strategyRndSegment_RemoveNexthop, .destroy = &_strategyRndSegment_ImplDestroy, @@ -111,7 +119,11 @@ static void _strategyRndSegment_OnTimeout(StrategyImpl *strategy, const NumberSet *egressId) {} static NumberSet *_strategyRndSegment_LookupNexthop( - StrategyImpl *strategy, const Message *interestMessage) { + StrategyImpl *strategy, +#ifdef WITH_POLICY + NumberSet * nexthops, +#endif /* WITH_POLICY */ + const Message *interestMessage) { StrategyRndSegment *srnd = (StrategyRndSegment *)strategy->context; unsigned in_connection = message_GetIngressConnectionId(interestMessage); @@ -161,6 +173,7 @@ static NumberSet *_strategyRndSegment_LookupNexthop( return out; } +#ifndef WITH_POLICY static NumberSet *_strategyRndSegment_ReturnNexthops(StrategyImpl *strategy) { StrategyRndSegment *srnd = (StrategyRndSegment *)strategy->context; return srnd->nexthops; @@ -170,22 +183,27 @@ unsigned _strategyRndSegment_CountNexthops(StrategyImpl *strategy) { StrategyRndSegment *srnd = (StrategyRndSegment *)strategy->context; return (unsigned)numberSet_Length(srnd->nexthops); } +#endif /* ! WITH_POLICY */ static void _strategyRndSegment_AddNexthop(StrategyImpl *strategy, unsigned connectionId) { +#ifndef WITH_POLICY StrategyRndSegment *srnd = (StrategyRndSegment *)strategy->context; if (!numberSet_Contains(srnd->nexthops, connectionId)) { numberSet_Add(srnd->nexthops, connectionId); } +#endif /* ! WITH_POLICY */ } static void _strategyRndSegment_RemoveNexthop(StrategyImpl *strategy, unsigned connectionId) { +#ifndef WITH_POLICY StrategyRndSegment *srnd = (StrategyRndSegment *)strategy->context; if (numberSet_Contains(srnd->nexthops, connectionId)) { numberSet_Remove(srnd->nexthops, connectionId); } +#endif /* ! WITH_POLICY */ } static void _strategyRndSegment_ImplDestroy(StrategyImpl **strategyPtr) { |