Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > media > contrib-release-debug > by-pkgid > e15638eab2afcd5cb258393c684c3bbc > files > 13

drill-debug-0.9.2-7mdv2011.0.i586.rpm

/* 
 * cache.h
 *
 * Header file for cache.c
 *
 * for the license see LICENSE
 *
 * (c) NLnet Labs, 2004
 * 
 */


/* we should be implemented here
 * - push, put something in the cache
 * - pop,  retrieve latest pushed item
 * - search, look for an item
 * - rm, remove an specific item
 *
 * Cache is like a mathematical set, no duplicates are allowed
 * the internal implemention right now it's a double linked list.
 * This will change in future
 */

struct t_cache {
	/* rr themselves are single linked lists */
	struct t_rr *rr;
	struct t_cache *prev;
	struct t_cache *next;
};


struct t_cache * cache_new(void);
struct t_cache * cache_new_from_rr(struct t_rr *);
struct t_cache * cache_push(struct t_cache *, struct t_rr *) ;
struct t_cache * cache_pop(struct t_cache *, struct t_rr *);
struct t_cache * cache_rm_name(struct t_cache *, struct t_rdata *);
struct t_cache * cache_rm_type(struct t_cache *, uint16_t);
void cache_print(struct t_cache *);
struct t_rr * cache_search_name(struct t_cache *, struct t_rdata *);
struct t_rr * cache_search_type(struct t_cache *, uint16_t);