From e59d53a034f0cfdede9c439d1fd7e5f25aea5802 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 17 Oct 2005 18:28:18 +0000 Subject: [PATCH] Rename "AvahiAnnouncement" to "AvahiAnnouncer" to match AvahiQuerier git-svn-id: file:///home/lennart/svn/public/avahi/trunk@794 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/announce.c | 74 +++++++++++++++++++++---------------------- avahi-core/announce.h | 20 ++++++------ avahi-core/iface.c | 4 +-- avahi-core/iface.h | 2 +- avahi-core/server.c | 2 +- avahi-core/server.h | 2 +- docs/TODO | 2 +- 7 files changed, 53 insertions(+), 53 deletions(-) diff --git a/avahi-core/announce.c b/avahi-core/announce.c index d1e5995..f769e98 100644 --- a/avahi-core/announce.c +++ b/avahi-core/announce.c @@ -33,22 +33,22 @@ #define AVAHI_PROBE_JITTER_MSEC 250 #define AVAHI_PROBE_INTERVAL_MSEC 250 -static void remove_announcement(AvahiServer *s, AvahiAnnouncement *a) { +static void remove_announcer(AvahiServer *s, AvahiAnnouncer *a) { assert(s); assert(a); if (a->time_event) avahi_time_event_free(a->time_event); - AVAHI_LLIST_REMOVE(AvahiAnnouncement, by_interface, a->interface->announcements, a); - AVAHI_LLIST_REMOVE(AvahiAnnouncement, by_entry, a->entry->announcements, a); + AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_interface, a->interface->announcers, a); + AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_entry, a->entry->announcers, a); avahi_free(a); } static void elapse_announce(AvahiTimeEvent *e, void *userdata); -static void set_timeout(AvahiAnnouncement *a, const struct timeval *tv) { +static void set_timeout(AvahiAnnouncer *a, const struct timeval *tv) { assert(a); if (!tv) { @@ -65,7 +65,7 @@ static void set_timeout(AvahiAnnouncement *a, const struct timeval *tv) { } } -static void next_state(AvahiAnnouncement *a); +static void next_state(AvahiAnnouncer *a); void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) { AvahiEntry *e; @@ -83,9 +83,9 @@ void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) { return; for (e = g->entries; e; e = e->entries_next) { - AvahiAnnouncement *a; + AvahiAnnouncer *a; - for (a = e->announcements; a; a = a->by_entry_next) { + for (a = e->announcers; a; a = a->by_entry_next) { if (a->state != AVAHI_WAITING) continue; @@ -107,7 +107,7 @@ void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) { } } -static void next_state(AvahiAnnouncement *a) { +static void next_state(AvahiAnnouncer *a) { assert(a); /* avahi_log_debug("%i -- %u", a->state, a->n_iteration); */ @@ -191,21 +191,21 @@ static void elapse_announce(AvahiTimeEvent *e, void *userdata) { next_state(userdata); } -AvahiAnnouncement *avahi_get_announcement(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) { - AvahiAnnouncement *a; +AvahiAnnouncer *avahi_get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) { + AvahiAnnouncer *a; assert(s); assert(e); assert(i); - for (a = e->announcements; a; a = a->by_entry_next) + for (a = e->announcers; a; a = a->by_entry_next) if (a->interface == i) return a; return NULL; } -static void go_to_initial_state(AvahiAnnouncement *a, int immediately) { +static void go_to_initial_state(AvahiAnnouncer *a, int immediately) { AvahiEntry *e; struct timeval tv; @@ -238,8 +238,8 @@ static void go_to_initial_state(AvahiAnnouncement *a, int immediately) { set_timeout(a, NULL); } -static void new_announcement(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) { - AvahiAnnouncement *a; +static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) { + AvahiAnnouncer *a; /* char *t; */ assert(s); @@ -247,17 +247,17 @@ static void new_announcement(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) { assert(e); assert(!e->dead); -/* avahi_log_debug("NEW ANNOUNCEMENT: %s.%i [%s]", i->hardware->name, i->protocol, t = avahi_record_to_string(e->record)); */ +/* avahi_log_debug("NEW ANNOUNCER: %s.%i [%s]", i->hardware->name, i->protocol, t = avahi_record_to_string(e->record)); */ /* avahi_free(t); */ if (!avahi_interface_match(i, e->interface, e->protocol) || !i->announcing || !avahi_entry_is_commited(e)) return; - /* We don't want duplicate announcements */ - if (avahi_get_announcement(s, e, i)) + /* We don't want duplicate announcers */ + if (avahi_get_announcer(s, e, i)) return; - if ((!(a = avahi_new(AvahiAnnouncement, 1)))) { + if ((!(a = avahi_new(AvahiAnnouncer, 1)))) { avahi_log_error(__FILE__": Out of memory."); return; } @@ -267,12 +267,12 @@ static void new_announcement(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) { a->entry = e; a->time_event = NULL; - AVAHI_LLIST_PREPEND(AvahiAnnouncement, by_interface, i->announcements, a); - AVAHI_LLIST_PREPEND(AvahiAnnouncement, by_entry, e->announcements, a); + AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_interface, i->announcers, a); + AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_entry, e->announcers, a); go_to_initial_state(a, 0); -/* avahi_log_debug("New announcement on interface %s.%i for entry [%s] state=%i", i->hardware->name, i->protocol, t = avahi_record_to_string(e->record), a->state); */ +/* avahi_log_debug("New announcer on interface %s.%i for entry [%s] state=%i", i->hardware->name, i->protocol, t = avahi_record_to_string(e->record), a->state); */ /* avahi_free(t); */ } @@ -287,7 +287,7 @@ void avahi_announce_interface(AvahiServer *s, AvahiInterface *i) { for (e = s->entries; e; e = e->entries_next) if (!e->dead) - new_announcement(s, i, e); + new_announcer(s, i, e); } static void announce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) { @@ -298,7 +298,7 @@ static void announce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, assert(e); assert(!e->dead); - new_announcement(m->server, i, e); + new_announcer(m->server, i, e); } void avahi_announce_entry(AvahiServer *s, AvahiEntry *e) { @@ -321,14 +321,14 @@ void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g) { } int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) { - AvahiAnnouncement *a; + AvahiAnnouncer *a; assert(s); assert(e); assert(i); assert(!e->dead); - if (!(a = avahi_get_announcement(s, e, i))) + if (!(a = avahi_get_announcer(s, e, i))) return 0; return @@ -338,14 +338,14 @@ int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) } int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) { - AvahiAnnouncement *a; + AvahiAnnouncer *a; assert(s); assert(e); assert(i); assert(!e->dead); - if (!(a = avahi_get_announcement(s, e, i))) + if (!(a = avahi_get_announcer(s, e, i))) return 0; /* avahi_log_debug("state: %i", a->state); */ @@ -356,13 +356,13 @@ int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) { } void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) { - AvahiAnnouncement *a; + AvahiAnnouncer *a; assert(s); assert(e); assert(i); - if (!(a = avahi_get_announcement(s, e, i))) + if (!(a = avahi_get_announcer(s, e, i))) return; if (a->state == AVAHI_PROBING && a->entry->group) @@ -437,7 +437,7 @@ static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, v avahi_record_unref(g); } -static void reannounce(AvahiAnnouncement *a) { +static void reannounce(AvahiAnnouncer *a) { AvahiEntry *e; struct timeval tv; @@ -465,7 +465,7 @@ static void reannounce(AvahiAnnouncement *a) { else if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE) - /* No announcement needed */ + /* No announcer needed */ a->state = AVAHI_ESTABLISHED; else { @@ -492,14 +492,14 @@ static void reannounce(AvahiAnnouncement *a) { static void reannounce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) { AvahiEntry *e = userdata; - AvahiAnnouncement *a; + AvahiAnnouncer *a; assert(m); assert(i); assert(e); assert(!e->dead); - if (!(a = avahi_get_announcement(m->server, e, i))) + if (!(a = avahi_get_announcer(m->server, e, i))) return; reannounce(a); @@ -528,8 +528,8 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye } if (remove) - while (i->announcements) - remove_announcement(s, i->announcements); + while (i->announcers) + remove_announcer(s, i->announcers); } void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int remove) { @@ -541,8 +541,8 @@ void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int re avahi_interface_monitor_walk(s->monitor, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, send_goodbye_callback, e); if (remove) - while (e->announcements) - remove_announcement(s, e->announcements); + while (e->announcers) + remove_announcer(s, e->announcers); } void avahi_goodbye_all(AvahiServer *s, int send_goodbye, int remove) { diff --git a/avahi-core/announce.h b/avahi-core/announce.h index 21dd148..71fd246 100644 --- a/avahi-core/announce.h +++ b/avahi-core/announce.h @@ -22,7 +22,7 @@ USA. ***/ -typedef struct AvahiAnnouncement AvahiAnnouncement; +typedef struct AvahiAnnouncer AvahiAnnouncer; #include #include "iface.h" @@ -31,25 +31,25 @@ typedef struct AvahiAnnouncement AvahiAnnouncement; #include "publish.h" typedef enum { - AVAHI_PROBING, + AVAHI_PROBING, /* probing phase */ AVAHI_WAITING, /* wait for other records in group */ - AVAHI_ANNOUNCING, - AVAHI_ESTABLISHED -} AvahiAnnouncementState; + AVAHI_ANNOUNCING, /* announcing phase */ + AVAHI_ESTABLISHED /* we'e established */ +} AvahiAnnouncerState; -struct AvahiAnnouncement { +struct AvahiAnnouncer { AvahiServer *server; AvahiInterface *interface; AvahiEntry *entry; AvahiTimeEvent *time_event; - AvahiAnnouncementState state; + AvahiAnnouncerState state; unsigned n_iteration; unsigned sec_delay; - AVAHI_LLIST_FIELDS(AvahiAnnouncement, by_interface); - AVAHI_LLIST_FIELDS(AvahiAnnouncement, by_entry); + AVAHI_LLIST_FIELDS(AvahiAnnouncer, by_interface); + AVAHI_LLIST_FIELDS(AvahiAnnouncer, by_entry); }; void avahi_announce_interface(AvahiServer *s, AvahiInterface *i); @@ -67,7 +67,7 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int rem); void avahi_goodbye_all(AvahiServer *s, int send_goodbye, int rem); -AvahiAnnouncement *avahi_get_announcement(AvahiServer *s, AvahiEntry *e, AvahiInterface *i); +AvahiAnnouncer *avahi_get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i); void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e); diff --git a/avahi-core/iface.c b/avahi-core/iface.c index b2e8161..2b11e5f 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -188,7 +188,7 @@ void avahi_interface_free(AvahiInterface *i, int send_goodbye) { /* Handle goodbyes and remove announcers */ avahi_goodbye_interface(i->monitor->server, i, send_goodbye, 1); avahi_response_scheduler_force(i->response_scheduler); - assert(!i->announcements); + assert(!i->announcers); /* Remove queriers */ avahi_querier_free_all(i); @@ -245,7 +245,7 @@ AvahiInterface* avahi_interface_new(AvahiInterfaceMonitor *m, AvahiHwInterface * i->announcing = 0; AVAHI_LLIST_HEAD_INIT(AvahiInterfaceAddress, i->addresses); - AVAHI_LLIST_HEAD_INIT(AvahiAnnouncement, i->announcements); + AVAHI_LLIST_HEAD_INIT(AvahiAnnouncer, i->announcers); AVAHI_LLIST_HEAD_INIT(AvahiQuerier, i->queriers); i->queriers_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL); diff --git a/avahi-core/iface.h b/avahi-core/iface.h index f7e78a6..76b3540 100644 --- a/avahi-core/iface.h +++ b/avahi-core/iface.h @@ -95,7 +95,7 @@ struct AvahiInterface { AvahiProbeScheduler *probe_scheduler; AVAHI_LLIST_HEAD(AvahiInterfaceAddress, addresses); - AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements); + AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers); AvahiHashmap *queriers_by_key; AVAHI_LLIST_HEAD(AvahiQuerier, queriers); diff --git a/avahi-core/server.c b/avahi-core/server.c index dd3adcd..96311ea 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -1662,7 +1662,7 @@ int avahi_server_add( e->flags = flags; e->dead = 0; - AVAHI_LLIST_HEAD_INIT(AvahiAnnouncement, e->announcements); + AVAHI_LLIST_HEAD_INIT(AvahiAnnouncer, e->announcers); AVAHI_LLIST_PREPEND(AvahiEntry, entries, s->entries, e); diff --git a/avahi-core/server.h b/avahi-core/server.h index e7e77a2..27b9607 100644 --- a/avahi-core/server.h +++ b/avahi-core/server.h @@ -72,7 +72,7 @@ struct AvahiEntry { AVAHI_LLIST_FIELDS(AvahiEntry, by_key); AVAHI_LLIST_FIELDS(AvahiEntry, by_group); - AVAHI_LLIST_HEAD(AvahiAnnouncement, announcements); + AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers); }; struct AvahiSEntryGroup { diff --git a/docs/TODO b/docs/TODO index 9f50688..ea30ad6 100644 --- a/docs/TODO +++ b/docs/TODO @@ -3,7 +3,6 @@ for 0.6: * remove outgoing queries from queue if the browse object they were issued from is destroyed * add API to allow user to tell the server that some service is not reachable * generate local CNAME responses -* rename AvahiAnnouncement to AvahiAnnouncer (to match AvahiQuerier) * add support for subtypes in static services * Add static host configuration like static services [lathiat] * wrap avahi_server_add_record() via DBUS and in avahi-client [lathiat] @@ -89,3 +88,4 @@ done: * split linux specific parts from iface.c * consolidate browsing failure events and add an API to query the reason * Add sensible record updating API +* rename AvahiAnnouncement to AvahiAnnouncer (to match AvahiQuerier) -- 2.39.5