aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/processor/fibEntry.c
diff options
context:
space:
mode:
authormichele papalini <micpapal@cisco.com>2019-08-22 17:54:24 +0200
committermichele papalini <micpapal@cisco.com>2019-08-22 17:54:24 +0200
commit707a14c46b1a5ba66e1abf7f7a9f0aed16f67501 (patch)
tree505b4330c0d9ceb975db45250e4d670ad42a82f3 /hicn-light/src/hicn/processor/fibEntry.c
parent7d14523ac8e0708e8877cce7f3a21a340740dd47 (diff)
HICN-266 fix strategy creation with policies
Change-Id: I285389e02742768ec65304cd088312492ddcb281 Signed-off-by: michele papalini <micpapal@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/processor/fibEntry.c')
-rw-r--r--hicn-light/src/hicn/processor/fibEntry.c48
1 files changed, 8 insertions, 40 deletions
diff --git a/hicn-light/src/hicn/processor/fibEntry.c b/hicn-light/src/hicn/processor/fibEntry.c
index 15d754168..9d82b086e 100644
--- a/hicn-light/src/hicn/processor/fibEntry.c
+++ b/hicn-light/src/hicn/processor/fibEntry.c
@@ -72,7 +72,6 @@ struct fib_entry {
#ifdef WITH_POLICY
FibEntry *fibEntry_Create(Name *name, strategy_type fwdStrategy, const Forwarder * forwarder) {
- ConnectionTable * table = forwarder_GetConnectionTable(forwarder);
#else
FibEntry *fibEntry_Create(Name *name, strategy_type fwdStrategy) {
#endif /* WITH_POLICY */
@@ -84,47 +83,31 @@ FibEntry *fibEntry_Create(Name *name, strategy_type fwdStrategy) {
if (fwdStrategy) {
switch (fwdStrategy) {
case SET_STRATEGY_LOADBALANCER:
-#ifdef WITH_POLICY
- fibEntry->fwdStrategy = strategyLoadBalancer_Create(table);
-#else
fibEntry->fwdStrategy = strategyLoadBalancer_Create();
-#endif /* WITH_POLICY */
+ break;
+
+ case SET_STRATEGY_RANDOM:
+ fibEntry->fwdStrategy = strategyRnd_Create();
break;
case SET_STRATEGY_RANDOM_PER_DASH_SEGMENT:
-#ifdef WITH_POLICY
- fibEntry->fwdStrategy = strategyRndSegment_Create(table);
-#else
fibEntry->fwdStrategy = strategyRndSegment_Create();
-#endif /* WITH_POLICY */
break;
case SET_STRATEGY_LOADBALANCER_WITH_DELAY:
-#ifdef WITH_POLICY
- fibEntry->fwdStrategy = strategyLoadBalancerWithPD_Create(table);
-#else
fibEntry->fwdStrategy = strategyLoadBalancerWithPD_Create();
-#endif /* WITH_POLICY */
break;
default:
// LB is the default strategy
-#ifdef WITH_POLICY
- fibEntry->fwdStrategy = strategyLoadBalancer_Create(table);
-#else
fibEntry->fwdStrategy = strategyLoadBalancer_Create();
-#endif /* WITH_POLICY */
// the LB strategy is the default one
// other strategies can be set using the appropiate function
break;
}
} else {
-#ifdef WITH_POLICY
- fibEntry->fwdStrategy = strategyLoadBalancer_Create(table);
-#else
fibEntry->fwdStrategy = strategyLoadBalancer_Create();
-#endif /* WITH_POLICY */
}
fibEntry->refcount = 1;
@@ -173,42 +156,27 @@ void fibEntry_Release(FibEntry **fibEntryPtr) {
void fibEntry_SetStrategy(FibEntry *fibEntry, strategy_type strategy) {
StrategyImpl *fwdStrategyImpl;
-#ifdef WITH_POLICY
- ConnectionTable * table = forwarder_GetConnectionTable(fibEntry->forwarder);
-#endif /* WITH_POLICY */
switch (strategy) {
case SET_STRATEGY_LOADBALANCER:
-#ifdef WITH_POLICY
- fwdStrategyImpl = strategyLoadBalancer_Create(table);
-#else
fwdStrategyImpl = strategyLoadBalancer_Create();
-#endif /* WITH_POLICY */
+ break;
+
+ case SET_STRATEGY_RANDOM:
+ fwdStrategyImpl = strategyRnd_Create();
break;
case SET_STRATEGY_RANDOM_PER_DASH_SEGMENT:
-#ifdef WITH_POLICY
- fwdStrategyImpl = strategyRndSegment_Create(table);
-#else
fwdStrategyImpl = strategyRndSegment_Create();
-#endif /* WITH_POLICY */
break;
case SET_STRATEGY_LOADBALANCER_WITH_DELAY:
-#ifdef WITH_POLICY
- fwdStrategyImpl = strategyLoadBalancerWithPD_Create(table);
-#else
fwdStrategyImpl = strategyLoadBalancerWithPD_Create();
-#endif /* WITH_POLICY */
break;
default:
// LB is the defualt strategy
-#ifdef WITH_POLICY
- fwdStrategyImpl = strategyLoadBalancer_Create(table);
-#else
fwdStrategyImpl = strategyLoadBalancer_Create();
-#endif /* WITH_POLICY */
// the LB strategy is the default one
// other strategies can be set using the appropiate function
break;