diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-05-06 15:31:30 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-05-06 15:31:30 +0000 |
commit | f93eca3530bef2cc23ffe6c3a04493ad171c2aed (patch) | |
tree | b1053873411a868b751d7471cd4cb02fa54ed29a /libavahi-core/cache.h | |
parent | 42c9b99f2bb21d0ff1f1918314f9d5dd82a62763 (diff) |
move the sources to libavahi-core/
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@50 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'libavahi-core/cache.h')
-rw-r--r-- | libavahi-core/cache.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/libavahi-core/cache.h b/libavahi-core/cache.h new file mode 100644 index 0000000..de0ec9f --- /dev/null +++ b/libavahi-core/cache.h @@ -0,0 +1,66 @@ +#ifndef foocachehfoo +#define foocachehfoo + +#include <glib.h> + +struct _AvahiCache; +typedef struct _AvahiCache AvahiCache; + +#include "prioq.h" +#include "server.h" +#include "llist.h" +#include "timeeventq.h" + +typedef enum { + AVAHI_CACHE_VALID, + AVAHI_CACHE_EXPIRY1, + AVAHI_CACHE_EXPIRY2, + AVAHI_CACHE_EXPIRY3, + AVAHI_CACHE_FINAL +} AvahiCacheEntryState; + +typedef struct AvahiCacheEntry AvahiCacheEntry; + +struct AvahiCacheEntry { + AvahiCache *cache; + AvahiRecord *record; + GTimeVal timestamp; + GTimeVal expiry; + + AvahiAddress origin; + + AvahiCacheEntryState state; + AvahiTimeEvent *time_event; + + AVAHI_LLIST_FIELDS(AvahiCacheEntry, by_key); + AVAHI_LLIST_FIELDS(AvahiCacheEntry, entry); +}; + +struct _AvahiCache { + AvahiServer *server; + + AvahiInterface *interface; + + GHashTable *hash_table; + + AVAHI_LLIST_HEAD(AvahiCacheEntry, entries); +}; + +AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *interface); +void avahi_cache_free(AvahiCache *c); + +AvahiCacheEntry *avahi_cache_lookup_key(AvahiCache *c, AvahiKey *k); +AvahiCacheEntry *avahi_cache_lookup_record(AvahiCache *c, AvahiRecord *r); + +void avahi_cache_update(AvahiCache *c, AvahiRecord *r, gboolean unique, const AvahiAddress *a); + +void avahi_cache_drop_record(AvahiCache *c, AvahiRecord *r); + +void avahi_cache_dump(AvahiCache *c, FILE *f); + +typedef gpointer AvahiCacheWalkCallback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, gpointer userdata); +gpointer avahi_cache_walk(AvahiCache *c, AvahiKey *pattern, AvahiCacheWalkCallback cb, gpointer userdata); + +gboolean avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e); + +#endif |