]> git.meshlink.io Git - catta/blobdiff - avahi-core/probe-sched.c
* Rename various data structures to prevent a namespace conflict with avahi-core
[catta] / avahi-core / probe-sched.c
index 26071d38505e0854726abc36ea499acd04d0a05b..d7f9ca0de36be947d7635aee8696a26f4b415486 100644 (file)
 #include <config.h>
 #endif
 
+#include <avahi-common/domain.h>
+
 #include "probe-sched.h"
-#include "util.h"
+#include "timeval.h"
 #include "log.h"
 
 #define AVAHI_PROBE_HISTORY_MSEC 150
@@ -38,7 +40,7 @@ struct AvahiProbeJob {
     
     gboolean chosen; /* Use for packet assembling */
     gboolean done;
-    GTimeVal delivery;
+    struct timeval delivery;
 
     AvahiRecord *record;
     
@@ -91,7 +93,7 @@ static void job_free(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
 static void elapse_callback(AvahiTimeEvent *e, gpointer data);
 
 static void job_set_elapse_time(AvahiProbeScheduler *s, AvahiProbeJob *pj, guint msec, guint jitter) {
-    GTimeVal tv;
+    struct timeval tv;
 
     g_assert(s);
     g_assert(pj);
@@ -116,7 +118,7 @@ static void job_mark_done(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
     pj->done = TRUE;
 
     job_set_elapse_time(s, pj, AVAHI_PROBE_HISTORY_MSEC, 0);
-    g_get_current_time(&pj->delivery);
+    gettimeofday(&pj->delivery, NULL);
 }
 
 AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i) {
@@ -171,7 +173,7 @@ static gboolean packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p
         return FALSE;
 
     /* Create the probe query */
-    k = avahi_key_new(pj->record->key->name, pj->record->key->class, AVAHI_DNS_TYPE_ANY);
+    k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY);
     b = !!avahi_dns_packet_append_key(p, k, FALSE);
     g_assert(b);
 
@@ -184,7 +186,7 @@ static gboolean packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p
             continue;
 
         /* Does the record match the probe? */
-        if (k->class != pj->record->key->class || !avahi_domain_equal(k->name, pj->record->key->name))
+        if (k->clazz != pj->record->key->clazz || !avahi_domain_equal(k->name, pj->record->key->name))
             continue;
         
         /* This job wouldn't fit in */
@@ -238,7 +240,7 @@ static void elapse_callback(AvahiTimeEvent *e, gpointer data) {
         
         p = avahi_dns_packet_new_query(size);
 
-        k = avahi_key_new(pj->record->key->name, pj->record->key->class, AVAHI_DNS_TYPE_ANY);
+        k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY);
         b = avahi_dns_packet_append_key(p, k, FALSE) && avahi_dns_packet_append_record(p, pj->record, FALSE, 0);
         avahi_key_unref(k);
 
@@ -344,7 +346,7 @@ static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *reco
 
 gboolean avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, gboolean immediately) {
     AvahiProbeJob *pj;
-    GTimeVal tv;
+    struct timeval tv;
     
     g_assert(s);
     g_assert(record);
@@ -352,7 +354,7 @@ gboolean avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record,
 
     if ((pj = find_history_job(s, record)))
         return FALSE;
-    
+
     avahi_elapse_time(&tv, immediately ? 0 : AVAHI_PROBE_DEFER_MSEC, 0);
 
     if ((pj = find_scheduled_job(s, record))) {