-#ifndef fooflxserverhfoo
-#define fooflxserverhfoo
+#ifndef fooAvahiserverhfoo
+#define fooAvahiserverhfoo
-struct _flxEntry;
-typedef struct _flxEntry flxEntry;
-
-#include "flx.h"
+#include "Avahi.h"
#include "iface.h"
#include "prioq.h"
+#include "llist.h"
+#include "timeeventq.h"
+#include "announce.h"
+#include "subscribe.h"
+
+struct _AvahiEntry {
+ AvahiServer *server;
+ AvahiEntryGroup *group;
-struct _flxEntry {
- flxRecord rr;
- gint id;
+ gboolean dead;
+
+ AvahiEntryFlags flags;
+ AvahiRecord *record;
gint interface;
guchar protocol;
- gboolean unique;
-
- flxEntry *next, *prev;
- flxEntry *next_by_name, *prev_by_name;
- flxEntry *next_by_id, *prev_by_id;
+ AVAHI_LLIST_FIELDS(AvahiEntry, entries);
+ AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
+ AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
+
+ AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements);
};
-typedef struct _flxQueryJob {
- gint ref;
- GTimeVal time;
- flxQuery query;
-} flxQueryJob;
+struct _AvahiEntryGroup {
+ AvahiServer *server;
+ gboolean dead;
-typedef struct _flxQueryJobInstance {
- flxPrioQueueNode *node;
- flxQueryJob *job;
- gint interface;
- guchar protocol;
-} flxQueryJobInstance;
+ AvahiEntryGroupState state;
+ gpointer userdata;
+ AvahiEntryGroupCallback callback;
-typedef struct _flxResponseJob {
- gint ref;
- GTimeVal time;
- flxRecord response;
-} flxResponseJob;
-
-typedef struct _flxResponseJobInstance {
- flxPrioQueueNode *node;
- flxResponseJob *job;
- gint interface;
- guchar protocol;
-} flxResponseJobInstance;
+ guint n_probing;
+
+ AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
+ AVAHI_LLIST_HEAD(AvahiEntry, entries);
+};
-struct _flxServer {
+struct _AvahiServer {
GMainContext *context;
- flxInterfaceMonitor *monitor;
+ AvahiInterfaceMonitor *monitor;
+
+ AVAHI_LLIST_HEAD(AvahiEntry, entries);
+ GHashTable *entries_by_key;
- gint current_id;
+ AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
- GHashTable *rrset_by_id;
- GHashTable *rrset_by_name;
+ AVAHI_LLIST_HEAD(AvahiSubscription, subscriptions);
+ GHashTable *subscription_hashtable;
- flxEntry *entries;
+ gboolean need_entry_cleanup, need_group_cleanup;
+
+ AvahiTimeEventQueue *time_event_queue;
+
+ gchar *hostname;
- flxPrioQueue *query_job_queue;
- flxPrioQueue *response_job_queue;
+ gint fd_ipv4, fd_ipv6;
- gint hinfo_rr_id;
+ GPollFD pollfd_ipv4, pollfd_ipv6;
+ GSource *source;
- gchar *hostname;
+ gboolean ignore_bad_ttl;
};
-flxQueryJob* flx_query_job_new(void);
-flxQueryJob* flx_query_job_ref(flxQueryJob *job);
-void flx_query_job_unref(flxQueryJob *job);
+gboolean avahi_server_entry_match_interface(AvahiEntry *e, AvahiInterface *i);
-void flx_server_post_query_job(flxServer *s, gint interface, guchar protocol, const GTimeVal *tv, const flxQuery *q);
-void flx_server_drop_query_job(flxServer *s, gint interface, guchar protocol, const flxQuery *q);
+void avahi_server_post_query(AvahiServer *s, gint interface, guchar protocol, AvahiKey *key);
+void avahi_server_post_response(AvahiServer *s, gint interface, guchar protocol, AvahiRecord *record, gboolean flush_cache);
-void flx_server_remove_query_job_instance(flxServer *s, flxQueryJobInstance *i);
+void avahi_entry_group_change_state(AvahiEntryGroup *g, AvahiEntryGroupState state);
-gboolean flx_query_equal(const flxQuery *a, const flxQuery *b);
+gboolean avahi_entry_commited(AvahiEntry *e);
#endif