diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-01-21 00:16:08 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-01-21 00:16:08 +0000 |
commit | 0781d5363fb6fd723a2316fc7558aef6439b2f71 (patch) | |
tree | f6a942889c55230611d4472c21a7075a7c2fc609 /cache.h | |
parent | d6e2dbabccb08970da991e6d2b0fda7a56d83e6f (diff) |
massive work
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@8 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 44 |
1 files changed, 39 insertions, 5 deletions
@@ -1,22 +1,56 @@ #ifndef foocachehfoo #define foocachehfoo +#include <glib.h> + +struct _flxCache; +typedef struct _flxCache flxCache; + +#include "prioq.h" +#include "server.h" +#include "llist.h" + typedef enum { FLX_CACHE_VALID, FLX_CACHE_EXPIRY1, FLX_CACHE_EXPIRY2, FLX_CACHE_EXPIRY3 -} flxCacheEntry; +} flxCacheEntryState; + +typedef struct flxCacheEntry flxCacheEntry; -typedef struct flxCacheEntry { +struct flxCacheEntry { + flxRecord *record; GTimeVal timestamp; - flxRecord rr; - gint interface; + GTimeVal expiry; + flxAddress origin; flxCacheEntryState state; + + FLX_LLIST_FIELDS(flxCacheEntry, by_name); + + flxPrioQueueNode *node; -} flxCacheEntry; +}; + +struct _flxCache { + flxServer *server; + flxInterface *interface; + + GHashTable *hash_table; +}; + +flxCache *flx_cache_new(flxServer *server, flxInterface *interface); +void flx_cache_free(flxCache *c); + +flxCacheEntry *flx_cache_lookup_key(flxCache *c, flxKey *k); +flxCacheEntry *flx_cache_lookup_record(flxCache *c, flxRecord *r); + +flxCacheEntry *flx_cache_update(flxCache *c, flxRecord *r, gboolean unique, const flxAddress *a); + +void flx_cache_drop_key(flxCache *c, flxKey *k); +void flx_cache_drop_record(flxCache *c, flxRecord *r); #endif |