From 8dce3504fde7da933dc6e7ecfeb99b4b45125f32 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 15 Jan 2009 23:19:58 +0100 Subject: cache: add status field to store the object status This patch adds the status field to the cache object. This avoids the (ab)use of the alarm to check if an entry is active or dead. This is the first step to possibly move the alarm to the cache_extra memory space of the ftfw (which is the only use by now). Signed-off-by: Pablo Neira Ayuso --- src/network.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/network.c') diff --git a/src/network.c b/src/network.c index 598195f..320cdea 100644 --- a/src/network.c +++ b/src/network.c @@ -177,3 +177,16 @@ int mcast_track_is_seq_set() { return local_seq_set; } + +#include "cache.h" + +static int status2type[] = { + [C_OBJ_NEW] = NET_T_STATE_NEW, + [C_OBJ_ALIVE] = NET_T_STATE_UPD, + [C_OBJ_DEAD] = NET_T_STATE_DEL, +}; + +int object_status_to_network_type(int status) +{ + return status2type[status]; +} -- cgit v1.2.3