summaryrefslogtreecommitdiffstats
path: root/avahi-core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-25 01:08:29 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-25 01:08:29 +0200
commita97605e07ad7f44f2f65e15be64880e61a39ab43 (patch)
tree740527503048f5a2b2078741cfd13fc2ae6d4d1e /avahi-core
parent238909aaff10489fe538c8c54e3f82fe8a54b849 (diff)
from now on we enforce a strict whitespace regime
Diffstat (limited to 'avahi-core')
-rw-r--r--avahi-core/announce.c104
-rw-r--r--avahi-core/announce.h6
-rw-r--r--avahi-core/avahi-reflector.c10
-rw-r--r--avahi-core/avahi-test.c40
-rw-r--r--avahi-core/browse-dns-server.c64
-rw-r--r--avahi-core/browse-domain.c58
-rw-r--r--avahi-core/browse-service-type.c28
-rw-r--r--avahi-core/browse-service.c30
-rw-r--r--avahi-core/browse.c98
-rw-r--r--avahi-core/browse.h8
-rw-r--r--avahi-core/cache.c90
-rw-r--r--avahi-core/cache.h14
-rw-r--r--avahi-core/conformance-test.c26
-rw-r--r--avahi-core/core.h6
-rw-r--r--avahi-core/dns-spin-test.c6
-rw-r--r--avahi-core/dns-srv-rr.h8
-rw-r--r--avahi-core/dns-test.c14
-rw-r--r--avahi-core/dns.c168
-rw-r--r--avahi-core/dns.h6
-rw-r--r--avahi-core/domain-util.c26
-rw-r--r--avahi-core/domain-util.h8
-rw-r--r--avahi-core/entry.c198
-rw-r--r--avahi-core/fdutil.c16
-rw-r--r--avahi-core/fdutil.h6
-rw-r--r--avahi-core/hashmap-test.c10
-rw-r--r--avahi-core/hashmap.c36
-rw-r--r--avahi-core/hashmap.h6
-rw-r--r--avahi-core/iface-linux.c42
-rw-r--r--avahi-core/iface-linux.h10
-rw-r--r--avahi-core/iface-pfroute.c62
-rw-r--r--avahi-core/iface-pfroute.h6
-rw-r--r--avahi-core/iface.h16
-rw-r--r--avahi-core/internal.h28
-rw-r--r--avahi-core/log.c10
-rw-r--r--avahi-core/log.h6
-rw-r--r--avahi-core/lookup.h10
-rw-r--r--avahi-core/multicast-lookup.c54
-rw-r--r--avahi-core/multicast-lookup.h6
-rw-r--r--avahi-core/netlink.c26
-rw-r--r--avahi-core/netlink.h6
-rw-r--r--avahi-core/prioq-test.c12
-rw-r--r--avahi-core/prioq.c50
-rw-r--r--avahi-core/prioq.h6
-rw-r--r--avahi-core/probe-sched.c62
-rw-r--r--avahi-core/probe-sched.h6
-rw-r--r--avahi-core/publish.h22
-rw-r--r--avahi-core/querier-test.c20
-rw-r--r--avahi-core/querier.c44
-rw-r--r--avahi-core/querier.h6
-rw-r--r--avahi-core/query-sched.c68
-rw-r--r--avahi-core/query-sched.h6
-rw-r--r--avahi-core/resolve-address.c48
-rw-r--r--avahi-core/resolve-host-name.c56
-rw-r--r--avahi-core/resolve-service.c100
-rw-r--r--avahi-core/response-sched.c66
-rw-r--r--avahi-core/response-sched.h6
-rw-r--r--avahi-core/rr-util.h6
-rw-r--r--avahi-core/rr.h22
-rw-r--r--avahi-core/rrlist.c30
-rw-r--r--avahi-core/rrlist.h6
-rw-r--r--avahi-core/socket.h6
-rw-r--r--avahi-core/timeeventq-test.c6
-rw-r--r--avahi-core/timeeventq.c32
-rw-r--r--avahi-core/timeeventq.h6
-rw-r--r--avahi-core/update-test.c16
-rw-r--r--avahi-core/util.c24
-rw-r--r--avahi-core/util.h6
-rw-r--r--avahi-core/wide-area.c110
-rw-r--r--avahi-core/wide-area.h6
69 files changed, 1113 insertions, 1113 deletions
diff --git a/avahi-core/announce.c b/avahi-core/announce.c
index d0fd598..5a35045 100644
--- a/avahi-core/announce.c
+++ b/avahi-core/announce.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -45,7 +45,7 @@ static void remove_announcer(AvahiServer *s, AvahiAnnouncer *a) {
AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_interface, a->interface->announcers, a);
AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_entry, a->entry->announcers, a);
-
+
avahi_free(a);
}
@@ -61,7 +61,7 @@ static void set_timeout(AvahiAnnouncer *a, const struct timeval *tv) {
}
} else {
- if (a->time_event)
+ if (a->time_event)
avahi_time_event_update(a->time_event, tv);
else
a->time_event = avahi_time_event_new(a->server->time_event_queue, tv, elapse_announce, a);
@@ -76,28 +76,28 @@ void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) {
assert(!g->dead);
/* Check whether all group members have been probed */
-
- if (g->state != AVAHI_ENTRY_GROUP_REGISTERING || g->n_probing > 0)
+
+ if (g->state != AVAHI_ENTRY_GROUP_REGISTERING || g->n_probing > 0)
return;
avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_ESTABLISHED);
if (g->dead)
return;
-
+
for (e = g->entries; e; e = e->by_group_next) {
AvahiAnnouncer *a;
-
+
for (a = e->announcers; a; a = a->by_entry_next) {
-
+
if (a->state != AVAHI_WAITING)
continue;
-
+
a->state = AVAHI_ANNOUNCING;
if (immediately) {
/* Shortcut */
-
+
a->n_iteration = 1;
next_state(a);
} else {
@@ -118,17 +118,17 @@ static void next_state(AvahiAnnouncer *a) {
assert(a->entry->group);
avahi_s_entry_group_check_probed(a->entry->group, 1);
-
+
} else if (a->state == AVAHI_PROBING) {
if (a->n_iteration >= 4) {
/* Probing done */
-
+
if (a->entry->group) {
assert(a->entry->group->n_probing);
a->entry->group->n_probing--;
}
-
+
if (a->entry->group && a->entry->group->state == AVAHI_ENTRY_GROUP_REGISTERING)
a->state = AVAHI_WAITING;
else {
@@ -142,10 +142,10 @@ static void next_state(AvahiAnnouncer *a) {
struct timeval tv;
avahi_interface_post_probe(a->interface, a->entry->record, 0);
-
+
avahi_elapse_time(&tv, AVAHI_PROBE_INTERVAL_MSEC, 0);
set_timeout(a, &tv);
-
+
a->n_iteration++;
}
@@ -168,10 +168,10 @@ static void next_state(AvahiAnnouncer *a) {
} else {
struct timeval tv;
avahi_elapse_time(&tv, a->sec_delay*1000, AVAHI_ANNOUNCEMENT_JITTER_MSEC);
-
+
if (a->n_iteration < 10)
a->sec_delay *= 2;
-
+
set_timeout(a, &tv);
}
}
@@ -185,7 +185,7 @@ static void elapse_announce(AvahiTimeEvent *e, void *userdata) {
static AvahiAnnouncer *get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
AvahiAnnouncer *a;
-
+
assert(s);
assert(e);
assert(i);
@@ -200,7 +200,7 @@ static AvahiAnnouncer *get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterfa
static void go_to_initial_state(AvahiAnnouncer *a) {
AvahiEntry *e;
struct timeval tv;
-
+
assert(a);
e = a->entry;
@@ -212,7 +212,7 @@ static void go_to_initial_state(AvahiAnnouncer *a) {
a->state = AVAHI_ANNOUNCING;
else
a->state = AVAHI_WAITING;
-
+
} else
a->state = AVAHI_ESTABLISHED;
@@ -222,9 +222,9 @@ static void go_to_initial_state(AvahiAnnouncer *a) {
if (a->state == AVAHI_PROBING && e->group)
e->group->n_probing++;
- if (a->state == AVAHI_PROBING)
+ if (a->state == AVAHI_PROBING)
set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_PROBE_JITTER_MSEC));
- else if (a->state == AVAHI_ANNOUNCING)
+ else if (a->state == AVAHI_ANNOUNCING)
set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
else
set_timeout(a, NULL);
@@ -243,13 +243,13 @@ static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
/* We don't want duplicate announcers */
if (get_announcer(s, e, i))
- return;
+ return;
if ((!(a = avahi_new(AvahiAnnouncer, 1)))) {
avahi_log_error(__FILE__": Out of memory.");
return;
}
-
+
a->server = s;
a->interface = i;
a->entry = e;
@@ -263,7 +263,7 @@ static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
void avahi_announce_interface(AvahiServer *s, AvahiInterface *i) {
AvahiEntry *e;
-
+
assert(s);
assert(i);
@@ -277,7 +277,7 @@ void avahi_announce_interface(AvahiServer *s, AvahiInterface *i) {
static void announce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
AvahiEntry *e = userdata;
-
+
assert(m);
assert(i);
assert(e);
@@ -296,7 +296,7 @@ void avahi_announce_entry(AvahiServer *s, AvahiEntry *e) {
void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g) {
AvahiEntry *e;
-
+
assert(s);
assert(g);
@@ -315,7 +315,7 @@ int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i)
if (!(a = get_announcer(s, e, i)))
return 0;
-
+
return
a->state == AVAHI_ANNOUNCING ||
a->state == AVAHI_ESTABLISHED ||
@@ -332,7 +332,7 @@ int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
if (!(a = get_announcer(s, e, i)))
return 0;
-
+
return
a->state == AVAHI_PROBING ||
(a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE));
@@ -340,7 +340,7 @@ int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
AvahiAnnouncer *a;
-
+
assert(s);
assert(e);
assert(i);
@@ -356,12 +356,12 @@ void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInt
static AvahiRecord *make_goodbye_record(AvahiRecord *r) {
AvahiRecord *g;
-
+
assert(r);
if (!(g = avahi_record_copy(r)))
return NULL; /* OOM */
-
+
assert(g->ref == 1);
g->ttl = 0;
@@ -370,7 +370,7 @@ static AvahiRecord *make_goodbye_record(AvahiRecord *r) {
static int is_duplicate_entry(AvahiServer *s, AvahiEntry *e) {
AvahiEntry *i;
-
+
assert(s);
assert(e);
@@ -381,7 +381,7 @@ static int is_duplicate_entry(AvahiServer *s, AvahiEntry *e) {
if (!avahi_record_equal_no_ttl(i->record, e->record))
continue;
-
+
return 1;
}
@@ -391,7 +391,7 @@ static int is_duplicate_entry(AvahiServer *s, AvahiEntry *e) {
static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
AvahiEntry *e = userdata;
AvahiRecord *g;
-
+
assert(m);
assert(i);
assert(e);
@@ -408,10 +408,10 @@ static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, v
if (is_duplicate_entry(m->server, e))
return;
-
+
if (!(g = make_goodbye_record(e->record)))
return; /* OOM */
-
+
avahi_interface_post_response(i, g, e->flags & AVAHI_PUBLISH_UNIQUE, NULL, 1);
avahi_record_unref(g);
}
@@ -419,7 +419,7 @@ static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, v
static void reannounce(AvahiAnnouncer *a) {
AvahiEntry *e;
struct timeval tv;
-
+
assert(a);
e = a->entry;
@@ -430,12 +430,12 @@ static void reannounce(AvahiAnnouncer *a) {
/* Because we might change state we decrease the probing counter first */
if (a->state == AVAHI_PROBING && a->entry->group)
a->entry->group->n_probing--;
-
+
if (a->state == AVAHI_PROBING ||
(a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_NO_PROBE)))
/* We were probing or waiting after probe, so we restart probing from the beginning here */
-
+
a->state = AVAHI_PROBING;
else if (a->state == AVAHI_WAITING)
@@ -443,26 +443,26 @@ static void reannounce(AvahiAnnouncer *a) {
a->state = AVAHI_WAITING;
else if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)
-
+
/* No announcer needed */
a->state = AVAHI_ESTABLISHED;
else {
-
+
/* Ok, let's restart announcing */
a->state = AVAHI_ANNOUNCING;
- }
-
+ }
+
/* Now let's increase the probing counter again */
if (a->state == AVAHI_PROBING && e->group)
e->group->n_probing++;
-
+
a->n_iteration = 1;
a->sec_delay = 1;
if (a->state == AVAHI_PROBING)
set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_PROBE_JITTER_MSEC));
- else if (a->state == AVAHI_ANNOUNCING)
+ else if (a->state == AVAHI_ANNOUNCING)
set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
else
set_timeout(a, NULL);
@@ -472,7 +472,7 @@ static void reannounce(AvahiAnnouncer *a) {
static void reannounce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
AvahiEntry *e = userdata;
AvahiAnnouncer *a;
-
+
assert(m);
assert(i);
assert(e);
@@ -492,7 +492,7 @@ void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e) {
avahi_interface_monitor_walk(s->monitor, e->interface, e->protocol, reannounce_walk_callback, e);
}
-
+
void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye, int remove) {
assert(s);
assert(i);
@@ -500,7 +500,7 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye
if (send_goodbye)
if (i->announcing) {
AvahiEntry *e;
-
+
for (e = s->entries; e; e = e->entries_next)
if (!e->dead)
send_goodbye_callback(s->monitor, i, e);
@@ -514,7 +514,7 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye
void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int remove) {
assert(s);
assert(e);
-
+
if (send_goodbye)
if (!e->dead)
avahi_interface_monitor_walk(s->monitor, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, send_goodbye_callback, e);
diff --git a/avahi-core/announce.h b/avahi-core/announce.h
index 3a8bcf3..d50ca63 100644
--- a/avahi-core/announce.h
+++ b/avahi-core/announce.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/avahi-reflector.c b/avahi-core/avahi-reflector.c
index df5539f..fa178f0 100644
--- a/avahi-core/avahi-reflector.c
+++ b/avahi-core/avahi-reflector.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -40,7 +40,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
AvahiSimplePoll *simple_poll;
simple_poll = avahi_simple_poll_new();
-
+
avahi_server_config_init(&config);
config.publish_hinfo = 0;
config.publish_addresses = 0;
@@ -48,7 +48,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
config.publish_domain = 0;
config.use_ipv6 = 0;
config.enable_reflector = 1;
-
+
server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, NULL, NULL, &error);
avahi_server_config_free(&config);
diff --git a/avahi-core/avahi-test.c b/avahi-core/avahi-test.c
index cb7b97e..8d2d61b 100644
--- a/avahi-core/avahi-test.c
+++ b/avahi-core/avahi-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -61,7 +61,7 @@ static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
static void dump_timeout_callback(AvahiTimeout *timeout, void* userdata) {
struct timeval tv;
-
+
AvahiServer *avahi = userdata;
avahi_server_dump(avahi, dump_line, NULL);
@@ -98,7 +98,7 @@ static void record_browser_callback(
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
char *t;
-
+
assert(r);
if (record) {
@@ -113,7 +113,7 @@ static void remove_entries(void);
static void create_entries(int new_name);
static void entry_group_callback(AVAHI_GCC_UNUSED AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("entry group state: %i", state);
+ avahi_log_debug("entry group state: %i", state);
if (state == AVAHI_ENTRY_GROUP_COLLISION) {
remove_entries();
@@ -127,8 +127,8 @@ static void entry_group_callback(AVAHI_GCC_UNUSED AvahiServer *s, AVAHI_GCC_UNUS
static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
server = s;
- avahi_log_debug("server state: %i", state);
-
+ avahi_log_debug("server state: %i", state);
+
if (state == AVAHI_SERVER_RUNNING) {
avahi_log_debug("Server startup complete. Host name is <%s>. Service cookie is %u", avahi_server_get_host_name_fqdn(s), avahi_server_get_local_service_cookie(s));
create_entries(0);
@@ -155,11 +155,11 @@ static void create_entries(int new_name) {
remove_entries();
- if (!group)
+ if (!group)
group = avahi_s_entry_group_new(server, entry_group_callback, NULL);
assert(avahi_s_entry_group_is_empty(group));
-
+
if (!service_name)
service_name = avahi_strdup("Test Service");
else if (new_name) {
@@ -167,7 +167,7 @@ static void create_entries(int new_name) {
avahi_free(service_name);
service_name = n;
}
-
+
if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, service_name, "_http._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
avahi_log_error("Failed to add HTTP service");
goto fail;
@@ -190,7 +190,7 @@ static void create_entries(int new_name) {
r = avahi_record_new_full("cname.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_CNAME, AVAHI_DEFAULT_TTL);
r->data.cname.name = avahi_strdup("cocaine.local");
-
+
if (avahi_server_add(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, r) < 0) {
avahi_record_unref(r);
avahi_log_error("Failed to add CNAME record");
@@ -291,14 +291,14 @@ static void sr_callback(
const AvahiAddress *a,
uint16_t port,
AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
if (event != AVAHI_RESOLVER_FOUND)
avahi_log_debug("SR: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain_name, resolver_event_to_string(event));
else {
char t[AVAHI_ADDRESS_STR_MAX], *s;
-
+
avahi_address_snprint(t, sizeof(t), a);
s = avahi_string_list_to_string(txt);
@@ -317,9 +317,9 @@ static void dsb_callback(
uint16_t port,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
-
+
char t[AVAHI_ADDRESS_STR_MAX] = "n/a";
-
+
if (a)
avahi_address_snprint(t, sizeof(t), a);
@@ -344,7 +344,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
simple_poll = avahi_simple_poll_new();
poll_api = avahi_simple_poll_get(simple_poll);
-
+
avahi_server_config_init(&config);
avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
@@ -353,7 +353,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
server = avahi_server_new(poll_api, &config, server_callback, NULL, &error);
avahi_server_config_free(&config);
-
+
k = avahi_key_new("_http._tcp.0pointer.de", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR);
r = avahi_s_record_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, k, 0, record_browser_callback, NULL);
avahi_key_unref(k);
@@ -389,7 +389,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_s_dns_server_browser_free(dsb);
if (group)
- avahi_s_entry_group_free(group);
+ avahi_s_entry_group_free(group);
if (server)
avahi_server_free(server);
@@ -398,6 +398,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_simple_poll_free(simple_poll);
avahi_free(service_name);
-
+
return 0;
}
diff --git a/avahi-core/browse-dns-server.c b/avahi-core/browse-dns-server.c
index 48d23ad..49bb5e5 100644
--- a/avahi-core/browse-dns-server.c
+++ b/avahi-core/browse-dns-server.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,13 +44,13 @@ struct AvahiDNSServerInfo {
AvahiSHostNameResolver *host_name_resolver;
AvahiAddress address;
AvahiLookupResultFlags flags;
-
+
AVAHI_LLIST_FIELDS(AvahiDNSServerInfo, info);
};
struct AvahiSDNSServerBrowser {
AvahiServer *server;
-
+
AvahiSRecordBrowser *record_browser;
AvahiSDNSServerBrowserCallback callback;
void* userdata;
@@ -58,14 +58,14 @@ struct AvahiSDNSServerBrowser {
AvahiLookupFlags user_flags;
unsigned n_info;
-
+
AVAHI_LLIST_FIELDS(AvahiSDNSServerBrowser, browser);
AVAHI_LLIST_HEAD(AvahiDNSServerInfo, info);
};
static AvahiDNSServerInfo* get_server_info(AvahiSDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r) {
AvahiDNSServerInfo *i;
-
+
assert(b);
assert(r);
@@ -85,12 +85,12 @@ static void server_info_free(AvahiSDNSServerBrowser *b, AvahiDNSServerInfo *i) {
avahi_record_unref(i->srv_record);
if (i->host_name_resolver)
avahi_s_host_name_resolver_free(i->host_name_resolver);
-
+
AVAHI_LLIST_REMOVE(AvahiDNSServerInfo, info, b->info, i);
assert(b->n_info >= 1);
b->n_info--;
-
+
avahi_free(i);
}
@@ -103,9 +103,9 @@ static void host_name_resolver_callback(
const AvahiAddress *a,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiDNSServerInfo *i = userdata;
-
+
assert(r);
assert(host_name);
assert(i);
@@ -113,7 +113,7 @@ static void host_name_resolver_callback(
switch (event) {
case AVAHI_RESOLVER_FOUND: {
i->address = *a;
-
+
i->browser->callback(
i->browser,
i->interface,
@@ -145,7 +145,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSDNSServerBrowser *b = userdata;
assert(rr);
@@ -157,19 +157,19 @@ static void record_browser_callback(
switch (event) {
case AVAHI_BROWSER_NEW: {
AvahiDNSServerInfo *i;
-
+
assert(record);
assert(record->key->type == AVAHI_DNS_TYPE_SRV);
if (get_server_info(b, interface, protocol, record))
return;
-
+
if (b->n_info >= 10)
return;
-
+
if (!(i = avahi_new(AvahiDNSServerInfo, 1)))
return; /* OOM */
-
+
i->browser = b;
i->interface = interface;
i->protocol = protocol;
@@ -182,22 +182,22 @@ static void record_browser_callback(
b->user_flags,
host_name_resolver_callback, i);
i->flags = flags;
-
+
AVAHI_LLIST_PREPEND(AvahiDNSServerInfo, info, b->info, i);
-
+
b->n_info++;
break;
}
case AVAHI_BROWSER_REMOVE: {
AvahiDNSServerInfo *i;
-
+
assert(record);
assert(record->key->type == AVAHI_DNS_TYPE_SRV);
if (!(i = get_server_info(b, interface, protocol, record)))
return;
-
+
if (!i->host_name_resolver)
b->callback(
b,
@@ -209,7 +209,7 @@ static void record_browser_callback(
i->srv_record->data.srv.port,
i->flags | flags,
b->userdata);
-
+
server_info_free(b, i);
break;
}
@@ -228,7 +228,7 @@ static void record_browser_callback(
0,
flags,
b->userdata);
-
+
break;
}
}
@@ -248,12 +248,12 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
"_domain._udp",
"_dns-update._udp"
};
-
+
AvahiSDNSServerBrowser *b;
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
@@ -271,12 +271,12 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
avahi_server_set_errno(server, r);
return NULL;
}
-
+
if (!(b = avahi_new(AvahiSDNSServerBrowser, 1))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
b->server = server;
b->callback = callback;
b->userdata = userdata;
@@ -286,15 +286,15 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
AVAHI_LLIST_HEAD_INIT(AvahiDNSServerInfo, b->info);
AVAHI_LLIST_PREPEND(AvahiSDNSServerBrowser, browser, server->dns_server_browsers, b);
-
+
if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
goto fail;
-
+
avahi_key_unref(k);
return b;
@@ -303,7 +303,7 @@ fail:
if (k)
avahi_key_unref(k);
-
+
avahi_s_dns_server_browser_free(b);
return NULL;
}
@@ -313,7 +313,7 @@ void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b) {
while (b->info)
server_info_free(b, b->info);
-
+
AVAHI_LLIST_REMOVE(AvahiSDNSServerBrowser, browser, b->server->dns_server_browsers, b);
if (b->record_browser)
diff --git a/avahi-core/browse-domain.c b/avahi-core/browse-domain.c
index 0043806..465f85f 100644
--- a/avahi-core/browse-domain.c
+++ b/avahi-core/browse-domain.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -34,9 +34,9 @@
struct AvahiSDomainBrowser {
int ref;
-
+
AvahiServer *server;
-
+
AvahiSRecordBrowser *record_browser;
AvahiDomainBrowserType type;
@@ -46,7 +46,7 @@ struct AvahiSDomainBrowser {
AvahiTimeEvent *defer_event;
int all_for_now_scheduled;
-
+
AVAHI_LLIST_FIELDS(AvahiSDomainBrowser, browser);
};
@@ -65,7 +65,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSDomainBrowser *b = userdata;
char *n = NULL;
@@ -78,7 +78,7 @@ static void record_browser_callback(
b->all_for_now_scheduled = 1;
return;
}
-
+
/* Filter flags */
flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
@@ -90,21 +90,21 @@ static void record_browser_callback(
AvahiStringList *l;
/* Filter out entries defined statically */
-
+
for (l = b->server->config.browse_domains; l; l = l->next)
if (avahi_domain_equal((char*) l->text, n))
return;
}
-
+
}
-
+
b->callback(b, interface, protocol, event, n, flags, b->userdata);
}
static void defer_callback(AvahiTimeEvent *e, void *userdata) {
AvahiSDomainBrowser *b = userdata;
AvahiStringList *l;
-
+
assert(e);
assert(b);
@@ -117,22 +117,22 @@ static void defer_callback(AvahiTimeEvent *e, void *userdata) {
inc_ref(b);
for (l = b->server->config.browse_domains; l; l = l->next) {
-
+
/* Check whether this object still exists outside our own
* stack frame */
if (b->ref <= 1)
break;
-
+
b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_NEW, (char*) l->text, AVAHI_LOOKUP_RESULT_STATIC, b->userdata);
}
if (b->ref > 1) {
/* If the ALL_FOR_NOW event has already been scheduled, execute it now */
-
- if (b->all_for_now_scheduled)
+
+ if (b->all_for_now_scheduled)
b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_ALL_FOR_NOW, NULL, 0, b->userdata);
}
-
+
/* Decrease ref counter */
avahi_s_domain_browser_free(b);
}
@@ -154,12 +154,12 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
"dr",
"lb"
};
-
+
AvahiSDomainBrowser *b;
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
@@ -176,7 +176,7 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
avahi_server_set_errno(server, r);
return NULL;
}
-
+
if (!(b = avahi_new(AvahiSDomainBrowser, 1))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
return NULL;
@@ -197,24 +197,24 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
goto fail;
-
+
avahi_key_unref(k);
if (type == AVAHI_DOMAIN_BROWSER_BROWSE && b->server->config.browse_domains)
b->defer_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
-
+
return b;
-
+
fail:
-
+
if (k)
avahi_key_unref(k);
-
+
avahi_s_domain_browser_free(b);
-
+
return NULL;
}
@@ -224,7 +224,7 @@ void avahi_s_domain_browser_free(AvahiSDomainBrowser *b) {
assert(b->ref >= 1);
if (--b->ref > 0)
return;
-
+
AVAHI_LLIST_REMOVE(AvahiSDomainBrowser, browser, b->server->domain_browsers, b);
if (b->record_browser)
@@ -232,6 +232,6 @@ void avahi_s_domain_browser_free(AvahiSDomainBrowser *b) {
if (b->defer_event)
avahi_time_event_free(b->defer_event);
-
+
avahi_free(b);
}
diff --git a/avahi-core/browse-service-type.c b/avahi-core/browse-service-type.c
index 252e3cb..408d0b7 100644
--- a/avahi-core/browse-service-type.c
+++ b/avahi-core/browse-service-type.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -52,7 +52,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSServiceTypeBrowser *b = userdata;
assert(rr);
@@ -63,7 +63,7 @@ static void record_browser_callback(
if (record) {
char type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
-
+
assert(record->key->type == AVAHI_DNS_TYPE_PTR);
if (avahi_service_name_split(record->data.ptr.name, NULL, 0, type, sizeof(type), domain, sizeof(domain)) < 0) {
@@ -84,12 +84,12 @@ AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
AvahiLookupFlags flags,
AvahiSServiceTypeBrowserCallback callback,
void* userdata) {
-
+
AvahiSServiceTypeBrowser *b;
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
@@ -105,32 +105,32 @@ AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
avahi_server_set_errno(server, r);
return NULL;
}
-
+
if (!(b = avahi_new(AvahiSServiceTypeBrowser, 1))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
b->server = server;
b->callback = callback;
b->userdata = userdata;
b->record_browser = NULL;
-
+
AVAHI_LLIST_PREPEND(AvahiSServiceTypeBrowser, browser, server->service_type_browsers, b);
if (!(b->domain_name = avahi_normalize_name_strdup(domain))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
goto fail;
-
+
avahi_key_unref(k);
return b;
@@ -140,7 +140,7 @@ fail:
avahi_key_unref(k);
avahi_s_service_type_browser_free(b);
-
+
return NULL;
}
diff --git a/avahi-core/browse-service.c b/avahi-core/browse-service.c
index 43778dd..87d2690 100644
--- a/avahi-core/browse-service.c
+++ b/avahi-core/browse-service.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,7 +36,7 @@ struct AvahiSServiceBrowser {
AvahiServer *server;
char *domain_name;
char *service_type;
-
+
AvahiSRecordBrowser *record_browser;
AvahiSServiceBrowserCallback callback;
@@ -53,7 +53,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSServiceBrowser *b = userdata;
assert(rr);
@@ -61,7 +61,7 @@ static void record_browser_callback(
/* Filter flags */
flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
+
if (record) {
char service[AVAHI_LABEL_MAX], type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
@@ -76,7 +76,7 @@ static void record_browser_callback(
}
b->callback(b, interface, protocol, event, service, type, domain, flags, b->userdata);
-
+
} else
b->callback(b, interface, protocol, event, NULL, b->service_type, b->domain_name, flags, b->userdata);
@@ -96,7 +96,7 @@ AvahiSServiceBrowser *avahi_s_service_browser_new(
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
assert(service_type);
@@ -114,18 +114,18 @@ AvahiSServiceBrowser *avahi_s_service_browser_new(
avahi_server_set_errno(server, r);
return NULL;
}
-
+
if (!(b = avahi_new(AvahiSServiceBrowser, 1))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
b->server = server;
b->domain_name = b->service_type = NULL;
b->callback = callback;
b->userdata = userdata;
b->record_browser = NULL;
-
+
AVAHI_LLIST_PREPEND(AvahiSServiceBrowser, browser, server->service_browsers, b);
if (!(b->domain_name = avahi_normalize_name_strdup(domain)) ||
@@ -133,12 +133,12 @@ AvahiSServiceBrowser *avahi_s_service_browser_new(
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
goto fail;
@@ -150,7 +150,7 @@ fail:
if (k)
avahi_key_unref(k);
-
+
avahi_s_service_browser_free(b);
return NULL;
}
@@ -162,7 +162,7 @@ void avahi_s_service_browser_free(AvahiSServiceBrowser *b) {
if (b->record_browser)
avahi_s_record_browser_free(b->record_browser);
-
+
avahi_free(b->domain_name);
avahi_free(b->service_type);
avahi_free(b);
diff --git a/avahi-core/browse.c b/avahi-core/browse.c
index 16d8954..f56203f 100644
--- a/avahi-core/browse.c
+++ b/avahi-core/browse.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,20 +42,20 @@
struct AvahiSRBLookup {
AvahiSRecordBrowser *record_browser;
-
+
unsigned ref;
AvahiIfIndex interface;
AvahiProtocol protocol;
AvahiLookupFlags flags;
-
+
AvahiKey *key;
AvahiWideAreaLookup *wide_area;
AvahiMulticastLookup *multicast;
AvahiRList *cname_lookups;
-
+
AVAHI_LLIST_FIELDS(AvahiSRBLookup, lookups);
};
@@ -89,7 +89,7 @@ static AvahiSRBLookup* lookup_new(
AvahiKey *key) {
AvahiSRBLookup *l;
-
+
assert(b);
assert(AVAHI_IF_VALID(interface));
assert(AVAHI_PROTO_VALID(protocol));
@@ -97,10 +97,10 @@ static AvahiSRBLookup* lookup_new(
if (b->n_lookups >= AVAHI_LOOKUPS_PER_BROWSER_MAX)
/* We don't like cyclic CNAMEs */
return NULL;
-
+
if (!(l = avahi_new(AvahiSRBLookup, 1)))
return NULL;
-
+
l->ref = 1;
l->record_browser = b;
l->interface = interface;
@@ -112,11 +112,11 @@ static AvahiSRBLookup* lookup_new(
l->flags = flags;
transport_flags_from_domain(b->server, &l->flags, key->name);
-
+
AVAHI_LLIST_PREPEND(AvahiSRBLookup, lookups, b->lookups, l);
b->n_lookups ++;
-
+
return l;
}
@@ -134,7 +134,7 @@ static void lookup_unref(AvahiSRBLookup *l) {
avahi_wide_area_lookup_free(l->wide_area);
l->wide_area = NULL;
}
-
+
if (l->multicast) {
avahi_multicast_lookup_free(l->multicast);
l->multicast = NULL;
@@ -144,7 +144,7 @@ static void lookup_unref(AvahiSRBLookup *l) {
lookup_unref(l->cname_lookups->data);
l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, l->cname_lookups);
}
-
+
avahi_key_unref(l->key);
avahi_free(l);
}
@@ -163,9 +163,9 @@ static AvahiSRBLookup *lookup_find(
AvahiProtocol protocol,
AvahiLookupFlags flags,
AvahiKey *key) {
-
+
AvahiSRBLookup *l;
-
+
assert(b);
for (l = b->lookups; l; l = l->lookups_next) {
@@ -201,7 +201,7 @@ static void lookup_wide_area_callback(
AvahiLookupResultFlags flags,
AvahiRecord *r,
void *userdata) {
-
+
AvahiSRBLookup *l = userdata;
AvahiSRecordBrowser *b;
@@ -215,11 +215,11 @@ static void lookup_wide_area_callback(
return;
lookup_ref(l);
-
+
switch (event) {
case AVAHI_BROWSER_NEW:
assert(r);
-
+
if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
r->key->type == AVAHI_DNS_TYPE_CNAME)
/* It's a CNAME record, so let's follow it. We only follow it on wide area DNS! */
@@ -259,7 +259,7 @@ static void lookup_multicast_callback(
AvahiSRBLookup *l = userdata;
AvahiSRecordBrowser *b;
-
+
assert(e);
assert(l);
@@ -269,11 +269,11 @@ static void lookup_multicast_callback(
return;
lookup_ref(l);
-
+
switch (event) {
case AVAHI_BROWSER_NEW:
assert(r);
-
+
if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
r->key->type == AVAHI_DNS_TYPE_CNAME)
/* It's a CNAME record, so let's follow it. We allow browsing on both multicast and wide area. */
@@ -283,7 +283,7 @@ static void lookup_multicast_callback(
if (avahi_server_is_record_local(b->server, interface, protocol, r))
flags |= AVAHI_LOOKUP_RESULT_LOCAL;
-
+
b->callback(b, interface, protocol, event, r, flags, b->userdata);
}
break;
@@ -323,12 +323,12 @@ static int lookup_start(AvahiSRBLookup *l) {
assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST));
assert(!l->wide_area && !l->multicast);
-
+
if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {
if (!(l->wide_area = avahi_wide_area_lookup_new(l->record_browser->server->wide_area_lookup_engine, l->key, lookup_wide_area_callback, l)))
return -1;
-
+
} else {
assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST);
@@ -341,15 +341,15 @@ static int lookup_start(AvahiSRBLookup *l) {
static int lookup_scan_cache(AvahiSRBLookup *l) {
int n = 0;
-
+
assert(l);
assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST));
-
+
if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {
n = (int) avahi_wide_area_scan_cache(l->record_browser->server->wide_area_lookup_engine, l->key, lookup_wide_area_callback, l);
-
+
} else {
assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST);
n = (int) avahi_multicast_lookup_engine_scan_cache(l->record_browser->server->multicast_lookup_engine, l->interface, l->protocol, l->key, lookup_multicast_callback, l);
@@ -360,7 +360,7 @@ static int lookup_scan_cache(AvahiSRBLookup *l) {
static AvahiSRBLookup* lookup_add(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiKey *key) {
AvahiSRBLookup *l;
-
+
assert(b);
assert(!b->dead);
@@ -379,9 +379,9 @@ static int lookup_go(AvahiSRBLookup *l) {
if (l->record_browser->dead)
return 0;
-
+
lookup_ref(l);
-
+
/* Browse the cache for the root request */
n = lookup_scan_cache(l);
@@ -390,7 +390,7 @@ static int lookup_go(AvahiSRBLookup *l) {
if ((l->flags & AVAHI_LOOKUP_USE_MULTICAST) || n == 0)
/* We do no start a query if the cache contained entries and we're on wide area */
-
+
if (lookup_start(l) < 0)
n = -1;
}
@@ -403,7 +403,7 @@ static int lookup_go(AvahiSRBLookup *l) {
static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
AvahiKey *k;
AvahiSRBLookup *n;
-
+
assert(l);
assert(r);
@@ -411,7 +411,7 @@ static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, Avahi
assert(r->key->type == AVAHI_DNS_TYPE_CNAME);
k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type);
- n = lookup_add(l->record_browser, interface, protocol, flags, k);
+ n = lookup_add(l->record_browser, interface, protocol, flags, k);
avahi_key_unref(k);
if (!n) {
@@ -446,7 +446,7 @@ static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiPr
avahi_key_equal(n->key, k))
break;
}
-
+
avahi_key_unref(k);
if (rl) {
@@ -487,11 +487,11 @@ static void defer_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
b, b->interface, b->protocol, AVAHI_BROWSER_FAILURE, NULL,
b->flags & AVAHI_LOOKUP_USE_WIDE_AREA ? AVAHI_LOOKUP_RESULT_WIDE_AREA : AVAHI_LOOKUP_RESULT_MULTICAST,
b->userdata);
-
+
browser_cancel(b);
return;
}
-
+
/* Tell the client that we're done with the cache */
b->callback(
b, b->interface, b->protocol, AVAHI_BROWSER_CACHE_EXHAUSTED, NULL,
@@ -503,7 +503,7 @@ static void defer_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
/* If we do wide area lookups and the the cache contained
* entries, we assume that it is complete, and tell the user
* so by firing ALL_FOR_NOW. */
-
+
b->callback(b, b->interface, b->protocol, AVAHI_BROWSER_ALL_FOR_NOW, NULL, AVAHI_LOOKUP_RESULT_WIDE_AREA, b->userdata);
}
}
@@ -529,7 +529,7 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
AvahiLookupFlags flags,
AvahiSRecordBrowserCallback callback,
void* userdata) {
-
+
AvahiSRecordBrowser *b;
assert(server);
@@ -541,13 +541,13 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !avahi_key_is_pattern(key), AVAHI_ERR_IS_PATTERN);
AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_key_is_valid(key), AVAHI_ERR_INVALID_KEY);
AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !(flags & AVAHI_LOOKUP_USE_WIDE_AREA) || !(flags & AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
+ AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !(flags & AVAHI_LOOKUP_USE_WIDE_AREA) || !(flags & AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
+
if (!(b = avahi_new(AvahiSRecordBrowser, 1))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
b->dead = 0;
b->server = server;
b->interface = interface;
@@ -559,13 +559,13 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
b->n_lookups = 0;
AVAHI_LLIST_HEAD_INIT(AvahiSRBLookup, b->lookups);
b->root_lookup = NULL;
-
+
AVAHI_LLIST_PREPEND(AvahiSRecordBrowser, browser, server->record_browsers, b);
/* The currently cached entries are scanned a bit later, and than we will start querying, too */
b->defer_time_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
assert(b->defer_time_event);
-
+
return b;
}
@@ -583,30 +583,30 @@ void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b) {
assert(b);
browser_cancel(b);
-
+
AVAHI_LLIST_REMOVE(AvahiSRecordBrowser, browser, b->server->record_browsers, b);
avahi_key_unref(b->key);
-
+
avahi_free(b);
}
void avahi_browser_cleanup(AvahiServer *server) {
AvahiSRecordBrowser *b;
AvahiSRecordBrowser *n;
-
+
assert(server);
while (server->need_browser_cleanup) {
server->need_browser_cleanup = 0;
-
+
for (b = server->record_browsers; b; b = n) {
n = b->browser_next;
-
+
if (b->dead)
avahi_s_record_browser_destroy(b);
}
- }
+ }
if (server->wide_area_lookup_engine)
avahi_wide_area_cleanup(server->wide_area_lookup_engine);
diff --git a/avahi-core/browse.h b/avahi-core/browse.h
index 36d4e2e..771e593 100644
--- a/avahi-core/browse.h
+++ b/avahi-core/browse.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,7 +41,7 @@ struct AvahiSRecordBrowser {
AvahiIfIndex interface;
AvahiProtocol protocol;
AvahiLookupFlags flags;
-
+
AvahiTimeEvent *defer_time_event;
AvahiSRecordBrowserCallback callback;
diff --git a/avahi-core/cache.c b/avahi-core/cache.c
index 2786f74..3042ff6 100644
--- a/avahi-core/cache.c
+++ b/avahi-core/cache.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -54,14 +54,14 @@ static void remove_entry(AvahiCache *c, AvahiCacheEntry *e) {
/* Remove from linked list */
AVAHI_LLIST_REMOVE(AvahiCacheEntry, entry, c->entries, e);
-
+
if (e->time_event)
avahi_time_event_free(e->time_event);
avahi_multicast_lookup_engine_notify(c->server->multicast_lookup_engine, c->interface, e->record, AVAHI_BROWSER_REMOVE);
-
+
avahi_record_unref(e->record);
-
+
avahi_free(e);
assert(c->n_entries >= 1);
@@ -76,7 +76,7 @@ AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *iface) {
avahi_log_error(__FILE__": Out of memory.");
return NULL; /* OOM */
}
-
+
c->server = server;
c->interface = iface;
@@ -90,7 +90,7 @@ AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *iface) {
c->n_entries = 0;
c->last_rand_timestamp = 0;
-
+
return c;
}
@@ -100,9 +100,9 @@ void avahi_cache_free(AvahiCache *c) {
while (c->entries)
remove_entry(c, c->entries);
assert(c->n_entries == 0);
-
+
avahi_hashmap_free(c->hashmap);
-
+
avahi_free(c);
}
@@ -111,34 +111,34 @@ static AvahiCacheEntry *lookup_key(AvahiCache *c, AvahiKey *k) {
assert(k);
assert(!avahi_key_is_pattern(k));
-
+
return avahi_hashmap_lookup(c->hashmap, k);
}
void* avahi_cache_walk(AvahiCache *c, AvahiKey *pattern, AvahiCacheWalkCallback cb, void* userdata) {
void* ret;
-
+
assert(c);
assert(pattern);
assert(cb);
-
+
if (avahi_key_is_pattern(pattern)) {
AvahiCacheEntry *e, *n;
-
+
for (e = c->entries; e; e = n) {
n = e->entry_next;
-
+
if (avahi_key_pattern_match(pattern, e->record->key))
if ((ret = cb(c, pattern, e, userdata)))
return ret;
}
-
+
} else {
AvahiCacheEntry *e, *n;
for (e = lookup_key(c, pattern); e; e = n) {
n = e->by_key_next;
-
+
if ((ret = cb(c, pattern, e, userdata)))
return ret;
}
@@ -171,7 +171,7 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
AvahiCacheEntry *e = userdata;
/* char *txt; */
unsigned percent = 0;
-
+
assert(t);
assert(e);
@@ -185,17 +185,17 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
case AVAHI_CACHE_REPLACE_FINAL:
remove_entry(e->cache, e);
-
+
e = NULL;
/* avahi_log_debug("Removing entry from cache due to expiration (%s)", txt); */
break;
-
+
case AVAHI_CACHE_VALID:
case AVAHI_CACHE_POOF:
e->state = AVAHI_CACHE_EXPIRY1;
percent = 85;
break;
-
+
case AVAHI_CACHE_EXPIRY1:
e->state = AVAHI_CACHE_EXPIRY2;
percent = 90;
@@ -204,7 +204,7 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
e->state = AVAHI_CACHE_EXPIRY3;
percent = 95;
break;
-
+
case AVAHI_CACHE_EXPIRY3:
e->state = AVAHI_CACHE_EXPIRY_FINAL;
percent = 100;
@@ -218,10 +218,10 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
/* Request a cache update if we are subscribed to this entry */
if (avahi_querier_shall_refresh_cache(e->cache->interface, e->record->key))
avahi_interface_post_query(e->cache->interface, e->record->key, 0, NULL);
-
+
/* Check again later */
next_expiry(e->cache, e, percent);
-
+
}
/* avahi_free(txt); */
@@ -230,7 +230,7 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
static void update_time_event(AvahiCache *c, AvahiCacheEntry *e) {
assert(c);
assert(e);
-
+
if (e->time_event)
avahi_time_event_update(e->time_event, &e->expiry);
else
@@ -240,11 +240,11 @@ static void update_time_event(AvahiCache *c, AvahiCacheEntry *e) {
static void next_expiry(AvahiCache *c, AvahiCacheEntry *e, unsigned percent) {
AvahiUsec usec, left, right;
time_t now;
-
+
assert(c);
assert(e);
assert(percent > 0 && percent <= 100);
-
+
usec = (AvahiUsec) e->record->ttl * 10000;
left = usec * percent;
@@ -258,19 +258,19 @@ static void next_expiry(AvahiCache *c, AvahiCacheEntry *e, unsigned percent) {
}
usec = left + (AvahiUsec) ((double) (right-left) * c->last_rand / (RAND_MAX+1.0));
-
+
e->expiry = e->timestamp;
avahi_timeval_add(&e->expiry, usec);
-
+
/* g_message("wake up in +%lu seconds", e->expiry.tv_sec - e->timestamp.tv_sec); */
-
+
update_time_event(c, e);
}
static void expire_in_one_second(AvahiCache *c, AvahiCacheEntry *e, AvahiCacheEntryState state) {
assert(c);
assert(e);
-
+
e->state = state;
gettimeofday(&e->expiry, NULL);
avahi_timeval_add(&e->expiry, 1000000); /* 1s */
@@ -279,7 +279,7 @@ static void expire_in_one_second(AvahiCache *c, AvahiCacheEntry *e, AvahiCacheEn
void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const AvahiAddress *a) {
/* char *txt; */
-
+
assert(c);
assert(r && r->ref >= 1);
@@ -302,7 +302,7 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
/* This is an update request */
if ((first = lookup_key(c, r->key))) {
-
+
if (cache_flush) {
/* For unique entries drop all entries older than one second */
@@ -315,31 +315,31 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
expire_in_one_second(c, e, AVAHI_CACHE_REPLACE_FINAL);
}
}
-
+
/* Look for exactly the same entry */
for (e = first; e; e = e->by_key_next)
if (avahi_record_equal_no_ttl(e->record, r))
break;
}
-
+
if (e) {
-
+
/* avahi_log_debug("found matching cache entry"); */
/* We need to update the hash table key if we replace the
* record */
if (e->by_key_prev == NULL)
avahi_hashmap_replace(c->hashmap, r->key, e);
-
+
/* Update the record */
avahi_record_unref(e->record);
e->record = avahi_record_ref(r);
/* avahi_log_debug("cache: updating %s", txt); */
-
+
} else {
/* No entry found, therefore we create a new one */
-
+
/* avahi_log_debug("cache: couldn't find matching cache entry for %s", txt); */
if (c->n_entries >= AVAHI_CACHE_ENTRIES_MAX)
@@ -365,8 +365,8 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
/* Notify subscribers */
avahi_multicast_lookup_engine_notify(c->server->multicast_lookup_engine, c->interface, e->record, AVAHI_BROWSER_NEW);
- }
-
+ }
+
e->origin = *a;
e->timestamp = now;
next_expiry(c, e, 80);
@@ -396,7 +396,7 @@ static void dump_callback(void* key, void* data, void* userdata) {
if (!(t = avahi_record_to_string(e->record)))
continue; /* OOM */
-
+
dump_data->callback(t, dump_data->userdata);
avahi_free(t);
}
@@ -421,7 +421,7 @@ int avahi_cache_dump(AvahiCache *c, AvahiDumpCallback callback, void* userdata)
int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e) {
struct timeval now;
unsigned age;
-
+
assert(c);
assert(e);
@@ -430,7 +430,7 @@ int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e) {
age = (unsigned) (avahi_timeval_diff(&now, &e->timestamp)/1000000);
/* avahi_log_debug("age: %lli, ttl/2: %u", age, e->record->ttl); */
-
+
return age >= e->record->ttl/2;
}
@@ -484,7 +484,7 @@ static void* start_poof_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEnt
default:
;
}
-
+
return NULL;
}
diff --git a/avahi-core/cache.h b/avahi-core/cache.h
index fd74005..7477a5b 100644
--- a/avahi-core/cache.h
+++ b/avahi-core/cache.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -52,7 +52,7 @@ struct AvahiCacheEntry {
struct timeval expiry;
int cache_flush;
int poof_num;
-
+
AvahiAddress origin;
AvahiCacheEntryState state;
@@ -66,9 +66,9 @@ struct AvahiCacheEntry {
struct AvahiCache {
AvahiServer *server;
-
+
AvahiInterface *interface;
-
+
AvahiHashmap *hashmap;
AVAHI_LLIST_HEAD(AvahiCacheEntry, entries);
@@ -95,7 +95,7 @@ int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e);
* records of the specified key. The specified address is */
void avahi_cache_start_poof(AvahiCache *c, AvahiKey *key, const AvahiAddress *a);
-/* Stop a previously started POOF algorithm for a record. (Used for response suppresions records */
+/* Stop a previously started POOF algorithm for a record. (Used for response suppresions records */
void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddress *a);
void avahi_cache_flush(AvahiCache *c);
diff --git a/avahi-core/conformance-test.c b/avahi-core/conformance-test.c
index dc3c864..30e299d 100644
--- a/avahi-core/conformance-test.c
+++ b/avahi-core/conformance-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -55,7 +55,7 @@ static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
static void dump_timeout_callback(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void* userdata) {
struct timeval tv;
-
+
avahi_server_dump(avahi, dump_line, NULL);
avahi_elapse_time(&tv, 5000, 0);
@@ -77,8 +77,8 @@ static void create_service(const char *t) {
avahi_s_entry_group_reset(group);
else
group = avahi_s_entry_group_new(avahi, entry_group_callback, NULL);
-
- avahi_server_add_service(avahi, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_http._tcp", NULL, NULL, 80, "foo", NULL);
+
+ avahi_server_add_service(avahi, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_http._tcp", NULL, NULL, 80, "foo", NULL);
avahi_s_entry_group_commit(group);
try++;
@@ -86,8 +86,8 @@ static void create_service(const char *t) {
static void rename_timeout_callback(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
struct timeval tv;
-
- if (access("flag", F_OK) == 0) {
+
+ if (access("flag", F_OK) == 0) {
create_service("New - Bonjour Service Name");
return;
}
@@ -112,7 +112,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
avahi_server_dump(avahi, dump_line, NULL);
} else if (state == AVAHI_SERVER_COLLISION) {
char *n;
-
+
n = avahi_alternative_host_name(avahi_server_get_host_name(s));
avahi_log_warn("Host name conflict, retrying with <%s>", n);
avahi_server_set_host_name(s, n);
@@ -147,14 +147,14 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
/* Evil, but the conformace test requires that*/
create_service("gurke");
-
+
avahi_simple_poll_loop(simple_poll);
-
+
if (group)
- avahi_s_entry_group_free(group);
+ avahi_s_entry_group_free(group);
avahi_server_free(avahi);
avahi_simple_poll_free(simple_poll);
-
+
return 0;
}
diff --git a/avahi-core/core.h b/avahi-core/core.h
index 94d1970..f3aea9d 100644
--- a/avahi-core/core.h
+++ b/avahi-core/core.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/dns-spin-test.c b/avahi-core/dns-spin-test.c
index d93e508..8621f9f 100644
--- a/avahi-core/dns-spin-test.c
+++ b/avahi-core/dns-spin-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/dns-srv-rr.h b/avahi-core/dns-srv-rr.h
index 1a7f95f..b936195 100644
--- a/avahi-core/dns-srv-rr.h
+++ b/avahi-core/dns-srv-rr.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -76,7 +76,7 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
AvahiProtocol protocol,
const char *domain,
AvahiDNSServerType type,
- AvahiProtocol aprotocol, /**< Address protocol for the DNS server */
+ AvahiProtocol aprotocol, /**< Address protocol for the DNS server */
AvahiLookupFlags flags, /**< Lookup flags. */
AvahiSDNSServerBrowserCallback callback,
void* userdata);
diff --git a/avahi-core/dns-test.c b/avahi-core/dns-test.c
index ae2343d..4c47c3e 100644
--- a/avahi-core/dns-test.c
+++ b/avahi-core/dns-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -57,7 +57,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
avahi_log_debug(">%s<", t);
assert(avahi_domain_equal(a, t));
-
+
assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
avahi_log_debug(">%s<", t);
assert(avahi_domain_equal(b, t));
@@ -69,11 +69,11 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
avahi_log_debug(">%s<", t);
assert(avahi_domain_equal(d, t));
-
+
avahi_dns_packet_free(p);
/* RDATA PARSING AND SERIALIZATION */
-
+
/* Create an AvahiRecord with some usful data */
r = avahi_record_new_full("foobar.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, AVAHI_DEFAULT_TTL);
assert(r);
@@ -110,6 +110,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_free(m);
avahi_record_unref(r);
-
+
return 0;
}
diff --git a/avahi-core/dns.c b/avahi-core/dns.c
index 41ccc8f..0228fcb 100644
--- a/avahi-core/dns.c
+++ b/avahi-core/dns.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -51,10 +51,10 @@ AvahiDnsPacket* avahi_dns_packet_new(unsigned mtu) {
if (max_size < AVAHI_DNS_PACKET_HEADER_SIZE)
max_size = AVAHI_DNS_PACKET_HEADER_SIZE;
-
+
if (!(p = avahi_malloc(sizeof(AvahiDnsPacket) + max_size)))
return p;
-
+
p->size = p->rindex = AVAHI_DNS_PACKET_HEADER_SIZE;
p->max_size = max_size;
p->name_table = NULL;
@@ -69,7 +69,7 @@ AvahiDnsPacket* avahi_dns_packet_new_query(unsigned mtu) {
if (!(p = avahi_dns_packet_new(mtu)))
return NULL;
-
+
avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
return p;
}
@@ -79,7 +79,7 @@ AvahiDnsPacket* avahi_dns_packet_new_response(unsigned mtu, int aa) {
if (!(p = avahi_dns_packet_new(mtu)))
return NULL;
-
+
avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(1, 0, aa, 0, 0, 0, 0, 0, 0, 0));
return p;
}
@@ -97,7 +97,7 @@ AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int
saved_rindex = p->rindex;
p->rindex = AVAHI_DNS_PACKET_HEADER_SIZE;
-
+
for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); n > 0; n--) {
AvahiKey *k;
int unicast_response;
@@ -120,7 +120,7 @@ AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int
(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_OPCODE));
return r;
-}
+}
void avahi_dns_packet_free(AvahiDnsPacket *p) {
@@ -128,14 +128,14 @@ void avahi_dns_packet_free(AvahiDnsPacket *p) {
if (p->name_table)
avahi_hashmap_free(p->name_table);
-
+
avahi_free(p);
}
void avahi_dns_packet_set_field(AvahiDnsPacket *p, unsigned idx, uint16_t v) {
assert(p);
assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
-
+
((uint16_t*) AVAHI_DNS_PACKET_DATA(p))[idx] = htons(v);
}
@@ -151,12 +151,12 @@ void avahi_dns_packet_inc_field(AvahiDnsPacket *p, unsigned idx) {
assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
avahi_dns_packet_set_field(p, idx, avahi_dns_packet_get_field(p, idx) + 1);
-}
+}
static void name_table_cleanup(void *key, void *value, void *user_data) {
AvahiDnsPacket *p = user_data;
-
+
if ((uint8_t*) value >= AVAHI_DNS_PACKET_DATA(p) + p->size)
avahi_hashmap_remove(p->name_table, key);
}
@@ -169,23 +169,23 @@ void avahi_dns_packet_cleanup_name_table(AvahiDnsPacket *p) {
uint8_t* avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name) {
uint8_t *d, *saved_ptr = NULL;
size_t saved_size;
-
+
assert(p);
assert(name);
saved_size = p->size;
saved_ptr = avahi_dns_packet_extend(p, 0);
-
+
while (*name) {
uint8_t* prev;
const char *pname;
char label[64], *u;
-
+
/* Check whether we can compress this name. */
if (p->name_table && (prev = avahi_hashmap_lookup(p->name_table, name))) {
unsigned idx;
-
+
assert(prev >= AVAHI_DNS_PACKET_DATA(p));
idx = (unsigned) (prev - AVAHI_DNS_PACKET_DATA(p));
@@ -203,7 +203,7 @@ uint8_t* avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name) {
}
pname = name;
-
+
if (!(avahi_unescape_label(&name, label, sizeof(label))))
goto fail;
@@ -222,7 +222,7 @@ uint8_t* avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name) {
if (!(d = avahi_dns_packet_extend(p, 1)))
goto fail;
-
+
*d = 0;
return saved_ptr;
@@ -237,10 +237,10 @@ fail:
uint8_t* avahi_dns_packet_append_uint16(AvahiDnsPacket *p, uint16_t v) {
uint8_t *d;
assert(p);
-
+
if (!(d = avahi_dns_packet_extend(p, sizeof(uint16_t))))
return NULL;
-
+
d[0] = (uint8_t) (v >> 8);
d[1] = (uint8_t) v;
return d;
@@ -252,7 +252,7 @@ uint8_t *avahi_dns_packet_append_uint32(AvahiDnsPacket *p, uint32_t v) {
if (!(d = avahi_dns_packet_extend(p, sizeof(uint32_t))))
return NULL;
-
+
d[0] = (uint8_t) (v >> 24);
d[1] = (uint8_t) (v >> 16);
d[2] = (uint8_t) (v >> 8);
@@ -278,13 +278,13 @@ uint8_t *avahi_dns_packet_append_bytes(AvahiDnsPacket *p, const void *b, size_t
uint8_t* avahi_dns_packet_append_string(AvahiDnsPacket *p, const char *s) {
uint8_t* d;
size_t k;
-
+
assert(p);
assert(s);
if ((k = strlen(s)) >= 255)
k = 255;
-
+
if (!(d = avahi_dns_packet_extend(p, k+1)))
return NULL;
@@ -296,15 +296,15 @@ uint8_t* avahi_dns_packet_append_string(AvahiDnsPacket *p, const char *s) {
uint8_t *avahi_dns_packet_extend(AvahiDnsPacket *p, size_t l) {
uint8_t *d;
-
+
assert(p);
if (p->size+l > p->max_size)
return NULL;
-
+
d = AVAHI_DNS_PACKET_DATA(p) + p->size;
p->size += l;
-
+
return d;
}
@@ -316,7 +316,7 @@ int avahi_dns_packet_check_valid(AvahiDnsPacket *p) {
return -1;
flags = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS);
-
+
if (flags & AVAHI_DNS_FLAG_OPCODE)
return -1;
@@ -329,9 +329,9 @@ int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *p) {
if (avahi_dns_packet_check_valid(p) < 0)
return -1;
-
+
flags = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS);
-
+
if (flags & AVAHI_DNS_FLAG_RCODE)
return -1;
@@ -340,7 +340,7 @@ int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *p) {
int avahi_dns_packet_is_query(AvahiDnsPacket *p) {
assert(p);
-
+
return !(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_QR);
}
@@ -351,7 +351,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
unsigned label_ptr;
int i;
assert(p && ret_name && l);
-
+
for (i = 0; i < AVAHI_DNS_LABELS_MAX; i++) {
uint8_t n;
@@ -368,15 +368,15 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
if (l < 1)
return -1;
*ret_name = 0;
-
+
return ret;
-
+
} else if (n <= 63) {
/* Uncompressed label */
idx++;
if (!compressed)
ret++;
-
+
if (idx + n > p->size)
return -1;
@@ -393,7 +393,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
return -1;
idx += n;
-
+
if (!compressed)
ret += n;
} else if ((n & 0xC0) == 0xC0) {
@@ -411,7 +411,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
if (!compressed)
ret += 2;
-
+
compressed = 1;
} else
return -1;
@@ -422,7 +422,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
int avahi_dns_packet_consume_name(AvahiDnsPacket *p, char *ret_name, size_t l) {
int r;
-
+
if ((r = consume_labels(p, p->rindex, ret_name, l)) < 0)
return -1;
@@ -458,7 +458,7 @@ int avahi_dns_packet_consume_uint32(AvahiDnsPacket *p, uint32_t *ret_v) {
d = (uint8_t*) (AVAHI_DNS_PACKET_DATA(p) + p->rindex);
*ret_v = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
p->rindex += sizeof(uint32_t);
-
+
return 0;
}
@@ -466,7 +466,7 @@ int avahi_dns_packet_consume_bytes(AvahiDnsPacket *p, void * ret_data, size_t l)
assert(p);
assert(ret_data);
assert(l > 0);
-
+
if (p->rindex + l > p->size)
return -1;
@@ -478,7 +478,7 @@ int avahi_dns_packet_consume_bytes(AvahiDnsPacket *p, void * ret_data, size_t l)
int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t l) {
size_t k;
-
+
assert(p);
assert(ret_string);
assert(l > 0);
@@ -496,7 +496,7 @@ int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t
memcpy(ret_string, AVAHI_DNS_PACKET_DATA(p)+p->rindex+1, l-1);
ret_string[l-1] = 0;
-
+
p->rindex += 1+k;
return 0;
@@ -504,7 +504,7 @@ int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t
const void* avahi_dns_packet_get_rptr(AvahiDnsPacket *p) {
assert(p);
-
+
if (p->rindex > p->size)
return NULL;
@@ -524,32 +524,32 @@ int avahi_dns_packet_skip(AvahiDnsPacket *p, size_t length) {
static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
char buf[AVAHI_DOMAIN_NAME_MAX];
const void* start;
-
+
assert(p);
assert(r);
start = avahi_dns_packet_get_rptr(p);
-
+
switch (r->key->type) {
case AVAHI_DNS_TYPE_PTR:
case AVAHI_DNS_TYPE_CNAME:
case AVAHI_DNS_TYPE_NS:
-
+
if (avahi_dns_packet_consume_name(p, buf, sizeof(buf)) < 0)
return -1;
r->data.ptr.name = avahi_strdup(buf);
break;
-
+
case AVAHI_DNS_TYPE_SRV:
-
+
if (avahi_dns_packet_consume_uint16(p, &r->data.srv.priority) < 0 ||
avahi_dns_packet_consume_uint16(p, &r->data.srv.weight) < 0 ||
avahi_dns_packet_consume_uint16(p, &r->data.srv.port) < 0 ||
avahi_dns_packet_consume_name(p, buf, sizeof(buf)) < 0)
return -1;
-
+
r->data.srv.name = avahi_strdup(buf);
break;
@@ -557,12 +557,12 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
if (avahi_dns_packet_consume_string(p, buf, sizeof(buf)) < 0)
return -1;
-
+
r->data.hinfo.cpu = avahi_strdup(buf);
-
+
if (avahi_dns_packet_consume_string(p, buf, sizeof(buf)) < 0)
return -1;
-
+
r->data.hinfo.os = avahi_strdup(buf);
break;
@@ -571,12 +571,12 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
if (rdlength > 0) {
if (avahi_string_list_parse(avahi_dns_packet_get_rptr(p), rdlength, &r->data.txt.string_list) < 0)
return -1;
-
+
if (avahi_dns_packet_skip(p, rdlength) < 0)
return -1;
} else
r->data.txt.string_list = NULL;
-
+
break;
case AVAHI_DNS_TYPE_A:
@@ -585,27 +585,27 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
if (avahi_dns_packet_consume_bytes(p, &r->data.a.address, sizeof(AvahiIPv4Address)) < 0)
return -1;
-
+
break;
case AVAHI_DNS_TYPE_AAAA:
/* avahi_log_debug("aaaa"); */
-
+
if (avahi_dns_packet_consume_bytes(p, &r->data.aaaa.address, sizeof(AvahiIPv6Address)) < 0)
return -1;
-
+
break;
-
+
default:
/* avahi_log_debug("generic"); */
-
+
if (rdlength > 0) {
r->data.generic.data = avahi_memdup(avahi_dns_packet_get_rptr(p), rdlength);
- r->data.generic.size = rdlength;
-
+ r->data.generic.size = rdlength;
+
if (avahi_dns_packet_skip(p, rdlength) < 0)
return -1;
}
@@ -616,7 +616,7 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
/* Check if we read enough data */
if ((const uint8_t*) avahi_dns_packet_get_rptr(p) - (const uint8_t*) start != rdlength)
return -1;
-
+
return 0;
}
@@ -640,16 +640,16 @@ AvahiRecord* avahi_dns_packet_consume_record(AvahiDnsPacket *p, int *ret_cache_f
if (ret_cache_flush)
*ret_cache_flush = !!(class & AVAHI_DNS_CACHE_FLUSH);
class &= ~AVAHI_DNS_CACHE_FLUSH;
-
+
if (!(r = avahi_record_new_full(name, class, type, ttl)))
goto fail;
-
+
if (parse_rdata(p, r, rdlength) < 0)
goto fail;
if (!avahi_record_is_valid(r))
goto fail;
-
+
return r;
fail:
@@ -675,7 +675,7 @@ AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_respo
*ret_unicast_response = !!(class & AVAHI_DNS_UNICAST_RESPONSE);
class &= ~AVAHI_DNS_UNICAST_RESPONSE;
-
+
if (!(k = avahi_key_new(name, class, type)))
return NULL;
@@ -690,12 +690,12 @@ AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_respo
uint8_t* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, int unicast_response) {
uint8_t *t;
size_t size;
-
+
assert(p);
assert(k);
size = p->size;
-
+
if (!(t = avahi_dns_packet_append_name(p, k->name)) ||
!avahi_dns_packet_append_uint16(p, k->type) ||
!avahi_dns_packet_append_uint16(p, k->clazz | (unicast_response ? AVAHI_DNS_UNICAST_RESPONSE : 0))) {
@@ -711,16 +711,16 @@ uint8_t* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, int unicast
static int append_rdata(AvahiDnsPacket *p, AvahiRecord *r) {
assert(p);
assert(r);
-
+
switch (r->key->type) {
-
+
case AVAHI_DNS_TYPE_PTR:
case AVAHI_DNS_TYPE_CNAME:
case AVAHI_DNS_TYPE_NS:
-
+
if (!(avahi_dns_packet_append_name(p, r->data.ptr.name)))
return -1;
-
+
break;
case AVAHI_DNS_TYPE_SRV:
@@ -759,16 +759,16 @@ static int append_rdata(AvahiDnsPacket *p, AvahiRecord *r) {
if (!avahi_dns_packet_append_bytes(p, &r->data.a.address, sizeof(r->data.a.address)))
return -1;
-
+
break;
case AVAHI_DNS_TYPE_AAAA:
-
+
if (!avahi_dns_packet_append_bytes(p, &r->data.aaaa.address, sizeof(r->data.aaaa.address)))
return -1;
-
+
break;
-
+
default:
if (r->data.generic.size)
@@ -802,7 +802,7 @@ uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int c
if (append_rdata(p, r) < 0)
goto fail;
-
+
size = avahi_dns_packet_extend(p, 0) - start;
assert(size <= AVAHI_DNS_RDATA_MAX);
@@ -810,7 +810,7 @@ uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int c
l[0] = (uint8_t) ((uint16_t) size >> 8);
l[1] = (uint8_t) ((uint16_t) size);
-
+
return t;
@@ -831,17 +831,17 @@ size_t avahi_dns_packet_space(AvahiDnsPacket *p) {
assert(p);
assert(p->size <= p->max_size);
-
+
return p->max_size - p->size;
}
int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size) {
int ret;
AvahiDnsPacket p;
-
+
assert(record);
assert(rdata);
-
+
p.data = (void*) rdata;
p.max_size = p.size = size;
p.rindex = 0;
@@ -850,14 +850,14 @@ int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size) {
ret = parse_rdata(&p, record, size);
assert(!p.name_table);
-
+
return ret;
}
size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size) {
int ret;
AvahiDnsPacket p;
-
+
assert(record);
assert(rdata);
assert(max_size > 0);
@@ -874,6 +874,6 @@ size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size)
if (ret < 0)
return (size_t) -1;
-
+
return p.size;
}
diff --git a/avahi-core/dns.h b/avahi-core/dns.h
index 7ec9935..39fb291 100644
--- a/avahi-core/dns.h
+++ b/avahi-core/dns.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c
index 777a064..36d68bb 100644
--- a/avahi-core/domain-util.c
+++ b/avahi-core/domain-util.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,8 +41,8 @@ static void strip_bad_chars(char *s) {
char *p, *d;
s[strcspn(s, ".")] = 0;
-
- for (p = s, d = s; *p; p++)
+
+ for (p = s, d = s; *p; p++)
if ((*p >= 'a' && *p <= 'z') ||
(*p >= 'A' && *p <= 'Z') ||
(*p >= '0' && *p <= '9') ||
@@ -55,7 +55,7 @@ static void strip_bad_chars(char *s) {
#ifdef __linux__
static int load_lsb_distrib_id(char *ret_s, size_t size) {
FILE *f;
-
+
assert(ret_s);
assert(size > 0);
@@ -100,7 +100,7 @@ char *avahi_get_host_name(char *ret_s, size_t size) {
*ret_s = 0;
avahi_log_warn("System host name is set to 'localhost'. This is not a suitable mDNS host name, looking for alternatives.");
}
-
+
if (*ret_s == 0) {
/* No hostname was set, so let's take the OS name */
@@ -118,7 +118,7 @@ char *avahi_get_host_name(char *ret_s, size_t size) {
{
/* Try uname() second */
struct utsname utsname;
-
+
if (uname(&utsname) >= 0) {
snprintf(ret_s, size, "%s", utsname.sysname);
strip_bad_chars(ret_s);
@@ -132,8 +132,8 @@ char *avahi_get_host_name(char *ret_s, size_t size) {
}
if (size >= AVAHI_LABEL_MAX)
- ret_s[AVAHI_LABEL_MAX-1] = 0;
-
+ ret_s[AVAHI_LABEL_MAX-1] = 0;
+
return ret_s;
}
@@ -164,7 +164,7 @@ int avahi_binary_domain_cmp(const char *a, const char *b) {
if ((r = strcmp(ca, cb)))
return r;
-
+
if (!*a && !*b)
return 0;
}
@@ -179,12 +179,12 @@ int avahi_domain_ends_with(const char *domain, const char *suffix) {
if (*domain == 0)
return 0;
-
+
if (avahi_domain_equal(domain, suffix))
return 1;
r = avahi_unescape_label(&domain, dummy, sizeof(dummy));
assert(r);
- }
+ }
}
diff --git a/avahi-core/domain-util.h b/avahi-core/domain-util.h
index 01233d8..213bb71 100644
--- a/avahi-core/domain-util.h
+++ b/avahi-core/domain-util.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,7 +31,7 @@
AVAHI_C_DECL_BEGIN
/** Return the local host name. */
-char *avahi_get_host_name(char *ret_s, size_t size);
+char *avahi_get_host_name(char *ret_s, size_t size);
/** Return the local host name. avahi_free() the result! */
char *avahi_get_host_name_strdup(void);
diff --git a/avahi-core/entry.c b/avahi-core/entry.c
index 749fae5..6287033 100644
--- a/avahi-core/entry.c
+++ b/avahi-core/entry.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -107,7 +107,7 @@ void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g) {
if (g->register_time_event)
avahi_time_event_free(g->register_time_event);
-
+
AVAHI_LLIST_REMOVE(AvahiSEntryGroup, groups, s->groups, g);
avahi_free(g);
}
@@ -117,10 +117,10 @@ void avahi_cleanup_dead_entries(AvahiServer *s) {
if (s->need_group_cleanup) {
AvahiSEntryGroup *g, *next;
-
+
for (g = s->groups; g; g = next) {
next = g->groups_next;
-
+
if (g->dead)
avahi_entry_group_free(s, g);
}
@@ -130,10 +130,10 @@ void avahi_cleanup_dead_entries(AvahiServer *s) {
if (s->need_entry_cleanup) {
AvahiEntry *e, *next;
-
+
for (e = s->entries; e; e = next) {
next = e->entries_next;
-
+
if (e->dead)
avahi_entry_free(s, e);
}
@@ -147,7 +147,7 @@ void avahi_cleanup_dead_entries(AvahiServer *s) {
static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r, AvahiPublishFlags flags) {
AvahiEntry *e;
-
+
assert(s);
assert(r);
@@ -157,7 +157,7 @@ static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiPr
if (!(flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_UNIQUE))
continue;
-
+
if ((flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) && (e->flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) )
continue;
@@ -188,7 +188,7 @@ static AvahiEntry * server_add_internal(
AvahiRecord *r) {
AvahiEntry *e;
-
+
assert(s);
assert(r);
@@ -225,11 +225,11 @@ static AvahiEntry * server_add_internal(
!g ||
(g->state != AVAHI_ENTRY_GROUP_ESTABLISHED && g->state != AVAHI_ENTRY_GROUP_REGISTERING) ||
(flags & AVAHI_PUBLISH_UPDATE), AVAHI_ERR_BAD_STATE);
-
+
if (flags & AVAHI_PUBLISH_UPDATE) {
AvahiRecord *old_record;
int is_first = 1;
-
+
/* Update and existing record */
/* Find the first matching entry */
@@ -265,14 +265,14 @@ static AvahiEntry * server_add_internal(
/* If we were the first entry in the list, we need to update the key */
if (is_first)
avahi_hashmap_replace(s->entries_by_key, e->record->key, e);
-
+
avahi_record_unref(old_record);
} else {
AvahiEntry *t;
/* Add a new record */
-
+
if (check_record_conflict(s, interface, protocol, r, flags) < 0) {
avahi_server_set_errno(s, AVAHI_ERR_COLLISION);
return NULL;
@@ -282,7 +282,7 @@ static AvahiEntry * server_add_internal(
avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
e->server = s;
e->record = avahi_record_ref(r);
e->group = g;
@@ -290,20 +290,20 @@ static AvahiEntry * server_add_internal(
e->protocol = protocol;
e->flags = flags;
e->dead = 0;
-
+
AVAHI_LLIST_HEAD_INIT(AvahiAnnouncer, e->announcers);
-
+
AVAHI_LLIST_PREPEND(AvahiEntry, entries, s->entries, e);
-
+
/* Insert into hash table indexed by name */
t = avahi_hashmap_lookup(s->entries_by_key, e->record->key);
AVAHI_LLIST_PREPEND(AvahiEntry, by_key, t, e);
avahi_hashmap_replace(s->entries_by_key, e->record->key, t);
-
+
/* Insert into group list */
if (g)
- AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
-
+ AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
+
avahi_announce_entry(s, e);
}
@@ -331,10 +331,10 @@ const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, voi
if (!*e)
*e = g ? g->entries : s->entries;
-
+
while (*e && (*e)->dead)
*e = g ? (*e)->by_group_next : (*e)->entries_next;
-
+
if (!*e)
return NULL;
@@ -343,7 +343,7 @@ const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, voi
int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata) {
AvahiEntry *e;
-
+
assert(s);
assert(callback);
@@ -355,10 +355,10 @@ int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata
if (e->dead)
continue;
-
+
if (!(t = avahi_record_to_string(e->record)))
return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
+
snprintf(ln, sizeof(ln), "%s ; iface=%i proto=%i", t, e->interface, e->protocol);
avahi_free(t);
@@ -384,7 +384,7 @@ static AvahiEntry *server_add_ptr_internal(
AvahiRecord *r;
AvahiEntry *e;
-
+
assert(s);
assert(dest);
@@ -398,13 +398,13 @@ static AvahiEntry *server_add_ptr_internal(
avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
r->data.ptr.name = avahi_normalize_name_strdup(dest);
e = server_add_internal(s, g, interface, protocol, flags, r);
avahi_record_unref(r);
return e;
}
-
+
int avahi_server_add_ptr(
AvahiServer *s,
AvahiSEntryGroup *g,
@@ -438,7 +438,7 @@ int avahi_server_add_address(
int ret = AVAHI_OK;
AvahiEntry *entry = NULL, *reverse = NULL;
AvahiRecord *r;
-
+
assert(s);
assert(a);
@@ -454,7 +454,7 @@ int avahi_server_add_address(
AVAHI_CHECK_VALIDITY(s, !name || avahi_is_valid_fqdn(name), AVAHI_ERR_INVALID_HOST_NAME);
/* Prepare the host naem */
-
+
if (!name)
name = s->host_name_fqdn;
else {
@@ -464,29 +464,29 @@ int avahi_server_add_address(
transport_flags_from_domain(s, &flags, name);
AVAHI_CHECK_VALIDITY(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
+
/* Create the A/AAAA record */
-
+
if (a->proto == AVAHI_PROTO_INET) {
if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME))) {
ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
goto finish;
}
-
+
r->data.a.address = a->data.ipv4;
-
+
} else {
assert(a->proto == AVAHI_PROTO_INET6);
-
+
if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME))) {
ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
goto finish;
}
-
+
r->data.aaaa.address = a->data.ipv6;
}
-
+
entry = server_add_internal(s, g, interface, protocol, (flags & ~ AVAHI_PUBLISH_NO_REVERSE) | AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
avahi_record_unref(r);
@@ -496,17 +496,17 @@ int avahi_server_add_address(
}
/* Create the reverse lookup entry */
-
+
if (!(flags & AVAHI_PUBLISH_NO_REVERSE)) {
char reverse_n[AVAHI_DOMAIN_NAME_MAX];
avahi_reverse_lookup_name(a, reverse_n, sizeof(reverse_n));
-
+
if (!(reverse = server_add_ptr_internal(s, g, interface, protocol, flags | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse_n, name))) {
ret = avahi_server_errno(s);
goto finish;
}
}
-
+
finish:
if (ret != AVAHI_OK && !(flags & AVAHI_PUBLISH_UPDATE)) {
@@ -531,7 +531,7 @@ static AvahiEntry *server_add_txt_strlst_nocopy(
AvahiRecord *r;
AvahiEntry *e;
-
+
assert(s);
if (!(r = avahi_record_new_full(name ? name : s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT, ttl))) {
@@ -539,7 +539,7 @@ static AvahiEntry *server_add_txt_strlst_nocopy(
avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
r->data.txt.string_list = strlst;
e = server_add_internal(s, g, interface, protocol, flags, r);
avahi_record_unref(r);
@@ -580,7 +580,7 @@ static int server_add_service_strlst_nocopy(
AvahiRecord *r = NULL;
int ret = AVAHI_OK;
AvahiEntry *srv_entry = NULL, *txt_entry = NULL, *ptr_entry = NULL, *enum_entry = NULL;
-
+
assert(s);
assert(type);
assert(name);
@@ -605,7 +605,7 @@ static int server_add_service_strlst_nocopy(
transport_flags_from_domain(s, &flags, domain);
AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
+
if (!(h = avahi_normalize_name_strdup(host))) {
ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
goto fail;
@@ -619,19 +619,19 @@ static int server_add_service_strlst_nocopy(
}
/* Add service enumeration PTR record */
-
+
if (!(ptr_entry = server_add_ptr_internal(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, ptr_name, svc_name))) {
ret = avahi_server_errno(s);
goto fail;
}
/* Add SRV record */
-
+
if (!(r = avahi_record_new_full(svc_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV, AVAHI_DEFAULT_TTL_HOST_NAME))) {
ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
r->data.srv.priority = 0;
r->data.srv.weight = 0;
r->data.srv.port = port;
@@ -649,7 +649,7 @@ static int server_add_service_strlst_nocopy(
if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
strlst = add_magic_cookie(s, strlst);
-
+
txt_entry = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
strlst = NULL;
@@ -659,7 +659,7 @@ static int server_add_service_strlst_nocopy(
}
/* Add service type enumeration record */
-
+
if (!(enum_entry = server_add_ptr_internal(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, enum_ptr, ptr_name))) {
ret = avahi_server_errno(s);
goto fail;
@@ -676,10 +676,10 @@ fail:
if (enum_entry)
avahi_entry_free(s, enum_entry);
}
-
+
avahi_string_list_free(strlst);
avahi_free(h);
-
+
return ret;
}
@@ -718,11 +718,11 @@ int avahi_server_add_service(
va_list va;
int ret;
-
+
va_start(va, port);
ret = server_add_service_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, host, port, avahi_string_list_new_va(va));
va_end(va);
-
+
return ret;
}
@@ -732,15 +732,15 @@ static int server_update_service_txt_strlst_nocopy(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
AvahiStringList *strlst) {
char svc_name[AVAHI_DOMAIN_NAME_MAX];
int ret = AVAHI_OK;
AvahiEntry *e;
-
+
assert(s);
assert(type);
assert(name);
@@ -769,17 +769,17 @@ static int server_update_service_txt_strlst_nocopy(
/* Add TXT record */
if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
strlst = add_magic_cookie(s, strlst);
-
+
e = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_UPDATE, AVAHI_DEFAULT_TTL, svc_name, strlst);
strlst = NULL;
if (!e)
ret = avahi_server_errno(s);
-
+
fail:
-
+
avahi_string_list_free(strlst);
-
+
return ret;
}
@@ -789,9 +789,9 @@ int avahi_server_update_service_txt_strlst(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
AvahiStringList *strlst) {
return server_update_service_txt_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, avahi_string_list_copy(strlst));
@@ -804,18 +804,18 @@ int avahi_server_update_service_txt(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
...) {
va_list va;
int ret;
-
+
va_start(va, domain);
ret = server_update_service_txt_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, avahi_string_list_new_va(va));
va_end(va);
-
+
return ret;
}
@@ -825,14 +825,14 @@ int avahi_server_add_service_subtype(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
const char *subtype) {
int ret = AVAHI_OK;
char svc_name[AVAHI_DOMAIN_NAME_MAX], ptr_name[AVAHI_DOMAIN_NAME_MAX];
-
+
assert(name);
assert(type);
assert(subtype);
@@ -861,7 +861,7 @@ int avahi_server_add_service_subtype(
goto fail;
fail:
-
+
return ret;
}
@@ -877,7 +877,7 @@ static void hexstring(char *s, size_t sl, const void *p, size_t pl) {
k++;
pl--;
}
-
+
b = !b;
sl--;
@@ -900,9 +900,9 @@ static AvahiEntry *server_add_dns_server_name(
AvahiEntry *e;
char t[AVAHI_DOMAIN_NAME_MAX], normalized_d[AVAHI_DOMAIN_NAME_MAX], *n;
-
+
AvahiRecord *r;
-
+
assert(s);
assert(name);
@@ -911,7 +911,7 @@ static AvahiEntry *server_add_dns_server_name(
AVAHI_CHECK_VALIDITY_RETURN_NULL(s, port != 0, AVAHI_ERR_INVALID_PORT);
AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_is_valid_fqdn(name), AVAHI_ERR_INVALID_HOST_NAME);
AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
+
if (!domain)
domain = s->domain_name;
@@ -922,17 +922,17 @@ static AvahiEntry *server_add_dns_server_name(
avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
AVAHI_ASSERT_TRUE(avahi_normalize_name(domain, normalized_d, sizeof(normalized_d)));
snprintf(t, sizeof(t), "%s.%s", type == AVAHI_DNS_SERVER_RESOLVE ? "_domain._udp" : "_dns-update._udp", normalized_d);
-
+
if (!(r = avahi_record_new_full(t, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV, AVAHI_DEFAULT_TTL_HOST_NAME))) {
avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
avahi_free(n);
return NULL;
}
-
+
r->data.srv.priority = 0;
r->data.srv.weight = 0;
r->data.srv.port = port;
@@ -973,7 +973,7 @@ int avahi_server_add_dns_server_address(
transport_flags_from_domain(s, &flags, domain);
AVAHI_CHECK_VALIDITY(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
+
if (address->proto == AVAHI_PROTO_INET) {
hexstring(h, sizeof(h), &address->data, sizeof(AvahiIPv4Address));
snprintf(n, sizeof(n), "ip-%s.%s", h, domain);
@@ -988,13 +988,13 @@ int avahi_server_add_dns_server_address(
if (!r)
return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
+
a_entry = server_add_internal(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
avahi_record_unref(r);
if (!a_entry)
return avahi_server_errno(s);
-
+
if (!(s_entry = server_add_dns_server_name(s, g, interface, protocol, flags, domain, type, n, port))) {
if (!(flags & AVAHI_PUBLISH_UPDATE))
avahi_entry_free(s, a_entry);
@@ -1016,7 +1016,7 @@ void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState
/* If the entry group was established for a time longer then
* 5s, reset the establishment trial counter */
-
+
if (avahi_age(&g->established_at) > 5000000)
g->n_register_try = 0;
} else if (g->state == AVAHI_ENTRY_GROUP_REGISTERING) {
@@ -1025,30 +1025,30 @@ void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState
g->register_time_event = NULL;
}
}
-
+
if (state == AVAHI_ENTRY_GROUP_ESTABLISHED)
/* If the entry group is now established, remember the time
* this happened */
-
+
gettimeofday(&g->established_at, NULL);
-
+
g->state = state;
-
+
if (g->callback)
g->callback(g->server, g, state, g->userdata);
}
AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallback callback, void* userdata) {
AvahiSEntryGroup *g;
-
+
assert(s);
if (!(g = avahi_new(AvahiSEntryGroup, 1))) {
avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
g->server = s;
g->callback = callback;
g->userdata = userdata;
@@ -1067,7 +1067,7 @@ AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallba
void avahi_s_entry_group_free(AvahiSEntryGroup *g) {
AvahiEntry *e;
-
+
assert(g);
assert(g->server);
@@ -1084,7 +1084,7 @@ void avahi_s_entry_group_free(AvahiSEntryGroup *g) {
}
g->dead = 1;
-
+
g->server->need_group_cleanup = 1;
g->server->need_entry_cleanup = 1;
@@ -1111,14 +1111,14 @@ static void entry_group_register_time_event_callback(AVAHI_GCC_UNUSED AvahiTimeE
avahi_time_event_free(g->register_time_event);
g->register_time_event = NULL;
-
+
/* Holdoff time passed, so let's start probing */
entry_group_commit_real(g);
}
int avahi_s_entry_group_commit(AvahiSEntryGroup *g) {
struct timeval now;
-
+
assert(g);
assert(!g->dead);
@@ -1146,7 +1146,7 @@ int avahi_s_entry_group_commit(AvahiSEntryGroup *g) {
/* Holdoff time has not yet passed, so let's wait */
assert(!g->register_time_event);
g->register_time_event = avahi_time_event_new(g->server->time_event_queue, &g->register_time, entry_group_register_time_event_callback, g);
-
+
avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING);
}
@@ -1156,7 +1156,7 @@ int avahi_s_entry_group_commit(AvahiSEntryGroup *g) {
void avahi_s_entry_group_reset(AvahiSEntryGroup *g) {
AvahiEntry *e;
assert(g);
-
+
for (e = g->entries; e; e = e->by_group_next) {
if (!e->dead) {
avahi_goodbye_entry(g->server, e, 1, 1);
diff --git a/avahi-core/fdutil.c b/avahi-core/fdutil.c
index e35016d..4beb03d 100644
--- a/avahi-core/fdutil.c
+++ b/avahi-core/fdutil.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -34,7 +34,7 @@ int avahi_set_cloexec(int fd) {
int n;
assert(fd >= 0);
-
+
if ((n = fcntl(fd, F_GETFD)) < 0)
return -1;
@@ -46,7 +46,7 @@ int avahi_set_cloexec(int fd) {
int avahi_set_nonblock(int fd) {
int n;
-
+
assert(fd >= 0);
if ((n = fcntl(fd, F_GETFL)) < 0)
@@ -61,13 +61,13 @@ int avahi_set_nonblock(int fd) {
int avahi_wait_for_write(int fd) {
fd_set fds;
int r;
-
+
FD_ZERO(&fds);
FD_SET(fd, &fds);
-
+
if ((r = select(fd+1, NULL, &fds, NULL, NULL)) < 0)
return -1;
-
+
assert(r > 0);
return 0;
diff --git a/avahi-core/fdutil.h b/avahi-core/fdutil.h
index 047b9bb..ea1471d 100644
--- a/avahi-core/fdutil.h
+++ b/avahi-core/fdutil.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/hashmap-test.c b/avahi-core/hashmap-test.c
index 9826d53..2d731ee 100644
--- a/avahi-core/hashmap-test.c
+++ b/avahi-core/hashmap-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -46,7 +46,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
for (n = 0; n < 1000; n ++)
avahi_hashmap_insert(m, avahi_strdup_printf("key %u", n), avahi_strdup_printf("value %u", n));
-
+
printf("%s\n", (const char*) avahi_hashmap_lookup(m, "bla"));
avahi_hashmap_replace(m, avahi_strdup("bla"), avahi_strdup("#3"));
@@ -57,7 +57,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
t = (const char*) avahi_hashmap_lookup(m, "bla");
printf("%s\n", t ? t : "(null)");
-
+
avahi_hashmap_free(m);
return 0;
diff --git a/avahi-core/hashmap.c b/avahi-core/hashmap.c
index 07bd707..32c9c4a 100644
--- a/avahi-core/hashmap.c
+++ b/avahi-core/hashmap.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -49,7 +49,7 @@ struct AvahiHashmap {
AvahiHashFunc hash_func;
AvahiEqualFunc equal_func;
AvahiFreeFunc key_free_func, value_free_func;
-
+
Entry *entries[HASH_MAP_SIZE];
AVAHI_LLIST_HEAD(Entry, entries_list);
};
@@ -59,7 +59,7 @@ static Entry* entry_get(AvahiHashmap *m, const void *key) {
Entry *e;
idx = m->hash_func(key) % HASH_MAP_SIZE;
-
+
for (e = m->entries[idx]; e; e = e->bucket_next)
if (m->equal_func(key, e->key))
return e;
@@ -87,7 +87,7 @@ static void entry_free(AvahiHashmap *m, Entry *e, int stolen) {
AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_func, AvahiFreeFunc key_free_func, AvahiFreeFunc value_free_func) {
AvahiHashmap *m;
-
+
assert(hash_func);
assert(equal_func);
@@ -100,7 +100,7 @@ AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_fu
m->value_free_func = value_free_func;
AVAHI_LLIST_HEAD_INIT(Entry, m->entries_list);
-
+
return m;
}
@@ -109,13 +109,13 @@ void avahi_hashmap_free(AvahiHashmap *m) {
while (m->entries_list)
entry_free(m, m->entries_list, 0);
-
+
avahi_free(m);
}
void* avahi_hashmap_lookup(AvahiHashmap *m, const void *key) {
Entry *e;
-
+
assert(m);
if (!(e = entry_get(m, key)))
@@ -135,7 +135,7 @@ int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value) {
m->key_free_func(key);
if (m->value_free_func)
m->value_free_func(value);
-
+
return 1;
}
@@ -150,7 +150,7 @@ int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value) {
idx = m->hash_func(key) % HASH_MAP_SIZE;
AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
-
+
return 0;
}
@@ -169,7 +169,7 @@ int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value) {
e->key = key;
e->value = value;
-
+
return 1;
}
@@ -184,13 +184,13 @@ int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value) {
idx = m->hash_func(key) % HASH_MAP_SIZE;
AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
-
+
return 0;
}
void avahi_hashmap_remove(AvahiHashmap *m, const void *key) {
Entry *e;
-
+
assert(m);
if (!(e = entry_get(m, key)))
@@ -216,7 +216,7 @@ unsigned avahi_string_hash(const void *data) {
unsigned hash = 0;
assert(p);
-
+
for (; *p; p++)
hash = 31 * hash + *p;
@@ -228,7 +228,7 @@ int avahi_string_equal(const void *a, const void *b) {
assert(p);
assert(q);
-
+
return strcmp(p, q) == 0;
}
@@ -236,7 +236,7 @@ unsigned avahi_int_hash(const void *data) {
const int *i = data;
assert(i);
-
+
return (unsigned) *i;
}
@@ -245,6 +245,6 @@ int avahi_int_equal(const void *a, const void *b) {
assert(_a);
assert(_b);
-
+
return *_a == *_b;
}
diff --git a/avahi-core/hashmap.h b/avahi-core/hashmap.h
index 120cf30..95efa56 100644
--- a/avahi-core/hashmap.h
+++ b/avahi-core/hashmap.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/iface-linux.c b/avahi-core/iface-linux.c
index c8ed9e0..98fdea5 100644
--- a/avahi-core/iface-linux.c
+++ b/avahi-core/iface-linux.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -50,7 +50,7 @@ static int netlink_list_items(AvahiNetlink *nl, uint16_t type, unsigned *ret_seq
uint8_t req[1024];
/* Issue a wild dump NETLINK request */
-
+
memset(&req, 0, sizeof(req));
n = (struct nlmsghdr*) req;
n->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
@@ -69,7 +69,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
AvahiInterfaceMonitor *m = userdata;
/* This routine is called for every RTNETLINK response packet */
-
+
assert(m);
assert(n);
assert(m->osdep.netlink == nl);
@@ -77,7 +77,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
if (n->nlmsg_type == RTM_NEWLINK) {
/* A new interface appeared or an existing one has been modified */
-
+
struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
AvahiHwInterface *hw;
struct rtattr *a = NULL;
@@ -93,7 +93,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
* interface appears, but when it changes, too */
if (!(hw = avahi_interface_monitor_get_hw_interface(m, ifinfomsg->ifi_index)))
-
+
/* No object found, so let's create a new
* one. avahi_hw_interface_new() will call
* avahi_interface_new() internally twice for IPv4 and
@@ -136,10 +136,10 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
hw->mac_address_size = RTA_PAYLOAD(a);
if (hw->mac_address_size > AVAHI_MAC_ADDRESS_MAX)
hw->mac_address_size = AVAHI_MAC_ADDRESS_MAX;
-
+
memcpy(hw->mac_address, RTA_DATA(a), hw->mac_address_size);
break;
-
+
default:
;
}
@@ -156,7 +156,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* Update any associated RRs of this interface. (i.e. the
* _workstation._tcp record containing the MAC address) */
avahi_hw_interface_update_rrs(hw, 0);
-
+
} else if (n->nlmsg_type == RTM_DELLINK) {
/* An interface has been removed */
@@ -174,11 +174,11 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* Free our object */
avahi_hw_interface_free(hw, 0);
-
+
} else if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
/* An address has been added, modified or removed */
-
+
struct ifaddrmsg *ifaddrmsg = NLMSG_DATA(n);
AvahiInterface *i;
struct rtattr *a = NULL;
@@ -207,7 +207,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
switch(a->rta_type) {
case IFA_ADDRESS:
/* Fill in address data */
-
+
if ((raddr.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
(raddr.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
return;
@@ -220,7 +220,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
default:
;
}
-
+
a = RTA_NEXT(a, l);
}
@@ -260,16 +260,16 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* Update any associated RRs, like A or AAAA for our new/removed address */
avahi_interface_update_rrs(i, 0);
-
+
} else if (n->nlmsg_type == NLMSG_DONE) {
/* This wild dump request ended, so let's see what we do next */
-
+
if (m->osdep.list == LIST_IFACE) {
/* Mmmm, interfaces have been wild dumped already, so
* let's go on with wild dumping the addresses */
-
+
if (netlink_list_items(m->osdep.netlink, RTM_GETADDR, &m->osdep.query_addr_seq) < 0) {
avahi_log_warn("NETLINK: Failed to list addrs: %s", strerror(errno));
m->osdep.list = LIST_DONE;
@@ -300,14 +300,14 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* Tell the user that the wild dump is complete */
avahi_log_info("Network interface enumeration completed.");
}
-
+
} else if (n->nlmsg_type == NLMSG_ERROR &&
(n->nlmsg_seq == m->osdep.query_link_seq || n->nlmsg_seq == m->osdep.query_addr_seq)) {
struct nlmsgerr *e = NLMSG_DATA (n);
/* Some kind of error happened. Let's just tell the user and
* ignore it otherwise */
-
+
if (e->error)
avahi_log_warn("NETLINK: Failed to browse: %s", strerror(-e->error));
}
@@ -317,7 +317,7 @@ int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
assert(m);
/* Initialize our own data */
-
+
m->osdep.netlink = NULL;
m->osdep.query_addr_seq = m->osdep.query_link_seq = 0;
@@ -361,7 +361,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
/* Let's handle netlink events until we are done with wild
* dumping */
-
+
while (!m->list_complete)
if (!avahi_netlink_work(m->osdep.netlink, 1) == 0)
break;
diff --git a/avahi-core/iface-linux.h b/avahi-core/iface-linux.h
index eed648c..5878089 100644
--- a/avahi-core/iface-linux.h
+++ b/avahi-core/iface-linux.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,9 +28,9 @@ typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
struct AvahiInterfaceMonitorOSDep {
AvahiNetlink *netlink;
-
+
unsigned query_addr_seq, query_link_seq;
-
+
enum {
LIST_IFACE,
LIST_ADDR,
diff --git a/avahi-core/iface-pfroute.c b/avahi-core/iface-pfroute.c
index 391081e..bd91e92 100644
--- a/avahi-core/iface-pfroute.c
+++ b/avahi-core/iface-pfroute.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,8 +48,8 @@
#include "iface-pfroute.h"
#include "util.h"
-static int bitcount (unsigned int n)
-{
+static int bitcount (unsigned int n)
+{
int count=0 ;
while (n)
{
@@ -64,39 +64,39 @@ static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
AvahiHwInterface *hw;
struct if_msghdr *ifm = (struct if_msghdr *)rtm;
struct sockaddr_dl *sdl = (struct sockaddr_dl *)(ifm + 1);
-
+
if (sdl->sdl_family != AF_LINK)
return;
-
+
if (ifm->ifm_addrs == 0 && ifm->ifm_index > 0) {
if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) ifm->ifm_index)))
return;
avahi_hw_interface_free(hw, 0);
return;
}
-
+
if (!(hw = avahi_interface_monitor_get_hw_interface(m, ifm->ifm_index)))
if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) ifm->ifm_index)))
return; /* OOM */
-
+
hw->flags_ok =
(ifm->ifm_flags & IFF_UP) &&
(!m->server->config.use_iff_running || (ifm->ifm_flags & IFF_RUNNING)) &&
!(ifm->ifm_flags & IFF_LOOPBACK) &&
(ifm->ifm_flags & IFF_MULTICAST) &&
(m->server->config.allow_point_to_point || !(ifm->ifm_flags & IFF_POINTOPOINT));
-
+
avahi_free(hw->name);
hw->name = avahi_strndup(sdl->sdl_data, sdl->sdl_nlen);
-
+
hw->mtu = ifm->ifm_data.ifi_mtu;
-
+
hw->mac_address_size = sdl->sdl_alen;
if (hw->mac_address_size > AVAHI_MAC_ADDRESS_MAX)
hw->mac_address_size = AVAHI_MAC_ADDRESS_MAX;
-
+
memcpy(hw->mac_address, sdl->sdl_data + sdl->sdl_nlen, hw->mac_address_size);
-
+
/* { */
/* char mac[256]; */
/* avahi_log_debug("======\n name: %s\n index:%d\n mtu:%d\n mac:%s\n flags_ok:%d\n======", */
@@ -105,7 +105,7 @@ static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
/* avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size), */
/* hw->flags_ok); */
/* } */
-
+
avahi_hw_interface_check_relevant(hw);
avahi_hw_interface_update_rrs(hw, 0);
}
@@ -155,14 +155,14 @@ static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
return;
raddr.proto = avahi_af_to_proto(sa->sa_family);
-
+
for(cp = cp0, i = 0; i < RTAX_MAX; i++)
{
if (!(ifam->ifam_addrs & (1<<i)))
continue;
sa = (struct sockaddr *)cp;
#ifdef HAVE_SYS_SYSCTL_H
- if (sa->sa_len == 0)
+ if (sa->sa_len == 0)
continue;
#endif
switch(sa->sa_family) {
@@ -231,7 +231,7 @@ static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
return;
avahi_interface_address_free(addriface);
}
-
+
avahi_interface_check_relevant(iface);
avahi_interface_update_rrs(iface, 0);
}
@@ -240,7 +240,7 @@ static void parse_rtmsg(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
{
assert(m);
assert(rtm);
-
+
if (rtm->rtm_version != RTM_VERSION) {
avahi_log_warn("routing message version %d not understood",
rtm->rtm_version);
@@ -301,15 +301,15 @@ int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
}
m->osdep.pfroute->fd = fd;
- if (!(m->osdep.pfroute->watch = m->server->poll_api->watch_new(m->server->poll_api,
- m->osdep.pfroute->fd,
- AVAHI_WATCH_IN,
- socket_event,
+ if (!(m->osdep.pfroute->watch = m->server->poll_api->watch_new(m->server->poll_api,
+ m->osdep.pfroute->fd,
+ AVAHI_WATCH_IN,
+ socket_event,
m))) {
avahi_log_error(__FILE__": Failed to create watch.");
goto fail;
}
-
+
return 0;
fail:
@@ -317,10 +317,10 @@ fail:
if (m->osdep.pfroute) {
if (m->osdep.pfroute->watch)
m->server->poll_api->watch_free(m->osdep.pfroute->watch);
-
+
if (fd >= 0)
close(fd);
-
+
m->osdep.pfroute = NULL;
}
@@ -333,7 +333,7 @@ void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m) {
if (m->osdep.pfroute) {
if (m->osdep.pfroute->watch)
m->server->poll_api->watch_free(m->osdep.pfroute->watch);
-
+
if (m->osdep.pfroute->fd >= 0)
close(m->osdep.pfroute->fd);
@@ -423,7 +423,7 @@ static void if_add_interface(struct lifreq *lifreq, AvahiInterfaceMonitor *m, in
index = if_nametoindex(lifreq->lifr_name);
if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) index))) {
- if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) index)))
+ if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) index)))
return; /* OOM */
hw->flags_ok =
@@ -445,7 +445,7 @@ static void if_add_interface(struct lifreq *lifreq, AvahiInterfaceMonitor *m, in
return; /* OOM */
addriface->global_scope = 1;
-
+
avahi_hw_interface_check_relevant(hw);
avahi_hw_interface_update_rrs(hw, 0);
}
@@ -459,7 +459,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
struct rt_msghdr *rtm;
assert(m);
-
+
retry2:
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
@@ -492,7 +492,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
rtm = (struct rt_msghdr *)next;
parse_rtmsg(rtm, m);
}
-
+
m->list_complete = 1;
avahi_interface_monitor_check_relevant(m);
avahi_interface_monitor_update_rrs(m, 0);
diff --git a/avahi-core/iface-pfroute.h b/avahi-core/iface-pfroute.h
index 34098da..e5dab53 100644
--- a/avahi-core/iface-pfroute.h
+++ b/avahi-core/iface-pfroute.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/iface.h b/avahi-core/iface.h
index 4106ea7..9e5dc62 100644
--- a/avahi-core/iface.h
+++ b/avahi-core/iface.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -47,9 +47,9 @@ typedef struct AvahiHwInterface AvahiHwInterface;
#else
typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
struct AvahiInterfaceMonitorOSDep {
-
+
unsigned query_addr_seq, query_link_seq;
-
+
enum {
LIST_IFACE,
LIST_ADDR,
@@ -79,7 +79,7 @@ struct AvahiHwInterface {
char *name;
AvahiIfIndex index;
int flags_ok;
-
+
unsigned mtu;
uint8_t mac_address[AVAHI_MAC_ADDRESS_MAX];
@@ -96,7 +96,7 @@ struct AvahiInterface {
AVAHI_LLIST_FIELDS(AvahiInterface, interface);
AVAHI_LLIST_FIELDS(AvahiInterface, by_hardware);
-
+
AvahiProtocol protocol;
int announcing;
AvahiAddress local_mcast_address;
@@ -125,7 +125,7 @@ struct AvahiInterfaceAddress {
unsigned prefix_len;
int global_scope;
-
+
AvahiSEntryGroup *entry_group;
};
diff --git a/avahi-core/internal.h b/avahi-core/internal.h
index d0a10d6..958890f 100644
--- a/avahi-core/internal.h
+++ b/avahi-core/internal.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -53,7 +53,7 @@ typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot;
struct AvahiLegacyUnicastReflectSlot {
AvahiServer *server;
-
+
uint16_t id, original_id;
AvahiAddress address;
uint16_t port;
@@ -67,7 +67,7 @@ struct AvahiEntry {
AvahiSEntryGroup *group;
int dead;
-
+
AvahiPublishFlags flags;
AvahiRecord *record;
AvahiIfIndex interface;
@@ -76,7 +76,7 @@ struct AvahiEntry {
AVAHI_LLIST_FIELDS(AvahiEntry, entries);
AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
-
+
AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
};
@@ -89,20 +89,20 @@ struct AvahiSEntryGroup {
AvahiSEntryGroupCallback callback;
unsigned n_probing;
-
+
unsigned n_register_try;
struct timeval register_time;
AvahiTimeEvent *register_time_event;
struct timeval established_at;
-
+
AVAHI_LLIST_FIELDS(AvahiSEntryGroup, groups);
AVAHI_LLIST_HEAD(AvahiEntry, entries);
};
struct AvahiServer {
const AvahiPoll *poll_api;
-
+
AvahiInterfaceMonitor *monitor;
AvahiServerConfig config;
@@ -110,7 +110,7 @@ struct AvahiServer {
AvahiHashmap *entries_by_key;
AVAHI_LLIST_HEAD(AvahiSEntryGroup, groups);
-
+
AVAHI_LLIST_HEAD(AvahiSRecordBrowser, record_browsers);
AvahiHashmap *record_browser_hashmap;
AVAHI_LLIST_HEAD(AvahiSHostNameResolver, host_name_resolvers);
@@ -122,9 +122,9 @@ struct AvahiServer {
AVAHI_LLIST_HEAD(AvahiSDNSServerBrowser, dns_server_browsers);
int need_entry_cleanup, need_group_cleanup, need_browser_cleanup;
-
+
AvahiTimeEventQueue *time_event_queue;
-
+
char *host_name, *host_name_fqdn, *domain_name;
int fd_ipv4, fd_ipv6,
@@ -189,8 +189,8 @@ int avahi_server_add_ptr(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
+ uint32_t ttl,
+ const char *name,
const char *dest);
#define AVAHI_CHECK_VALIDITY(server, expression, error) { \
diff --git a/avahi-core/log.c b/avahi-core/log.c
index bfd4021..63ed5b5 100644
--- a/avahi-core/log.c
+++ b/avahi-core/log.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,9 +36,9 @@ void avahi_set_log_function(AvahiLogFunction function) {
void avahi_log_ap(AvahiLogLevel level, const char*format, va_list ap) {
char txt[256];
-
+
vsnprintf(txt, sizeof(txt), format, ap);
-
+
if (log_function)
log_function(level, txt);
else
diff --git a/avahi-core/log.h b/avahi-core/log.h
index 25e3940..3a1711a 100644
--- a/avahi-core/log.h
+++ b/avahi-core/log.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/lookup.h b/avahi-core/lookup.h
index 0ce6fe8..435d554 100644
--- a/avahi-core/lookup.h
+++ b/avahi-core/lookup.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -80,7 +80,7 @@ void avahi_s_record_browser_free(AvahiSRecordBrowser *b);
/** Callback prototype for AvahiSHostNameResolver events */
typedef void (*AvahiSHostNameResolverCallback)(
AvahiSHostNameResolver *r,
- AvahiIfIndex interface,
+ AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiResolverEvent event, /**< Resolving event */
const char *host_name, /**< Host name which should be resolved. May differ in case from the query */
@@ -108,7 +108,7 @@ typedef void (*AvahiSAddressResolverCallback)(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiResolverEvent event,
- const AvahiAddress *a,
+ const AvahiAddress *a,
const char *host_name, /**< A host name for the specified address, if one was found, i.e. event == AVAHI_RESOLVER_FOUND */
AvahiLookupResultFlags flags, /**< Lookup flags */
void* userdata);
diff --git a/avahi-core/multicast-lookup.c b/avahi-core/multicast-lookup.c
index c3afcb0..75e01f1 100644
--- a/avahi-core/multicast-lookup.c
+++ b/avahi-core/multicast-lookup.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,17 +41,17 @@ struct AvahiMulticastLookup {
int dead;
AvahiKey *key, *cname_key;
-
+
AvahiMulticastLookupCallback callback;
void *userdata;
AvahiIfIndex interface;
AvahiProtocol protocol;
-
+
int queriers_added;
AvahiTimeEvent *all_for_now_event;
-
+
AVAHI_LLIST_FIELDS(AvahiMulticastLookup, lookups);
AVAHI_LLIST_FIELDS(AvahiMulticastLookup, by_key);
};
@@ -85,10 +85,10 @@ AvahiMulticastLookup *avahi_multicast_lookup_new(
AvahiKey *key,
AvahiMulticastLookupCallback callback,
void *userdata) {
-
+
AvahiMulticastLookup *l, *t;
struct timeval tv;
-
+
assert(e);
assert(AVAHI_IF_VALID(interface));
assert(AVAHI_PROTO_VALID(protocol));
@@ -121,7 +121,7 @@ AvahiMulticastLookup *avahi_multicast_lookup_new(
/* Issue the ALL_FOR_NOW event one second after the querier was initially created */
l->all_for_now_event = avahi_time_event_new(e->server->time_event_queue, &tv, all_for_now_callback, l);
-
+
return l;
}
@@ -146,7 +146,7 @@ static void lookup_destroy(AvahiMulticastLookup *l) {
assert(l);
lookup_stop(l);
-
+
t = avahi_hashmap_lookup(l->engine->lookups_by_key, l->key);
AVAHI_LLIST_REMOVE(AvahiMulticastLookup, by_key, t, l);
if (t)
@@ -161,7 +161,7 @@ static void lookup_destroy(AvahiMulticastLookup *l) {
if (l->cname_key)
avahi_key_unref(l->cname_key);
-
+
avahi_free(l);
}
@@ -179,13 +179,13 @@ void avahi_multicast_lookup_free(AvahiMulticastLookup *l) {
void avahi_multicast_lookup_engine_cleanup(AvahiMulticastLookupEngine *e) {
AvahiMulticastLookup *l, *n;
assert(e);
-
+
while (e->cleanup_dead) {
e->cleanup_dead = 0;
-
+
for (l = e->lookups; l; l = n) {
n = l->lookups_next;
-
+
if (l->dead)
lookup_destroy(l);
}
@@ -219,7 +219,7 @@ static void* scan_cache_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEnt
cbdata->userdata);
cbdata->n_found ++;
-
+
return NULL;
}
@@ -231,12 +231,12 @@ static void scan_interface_callback(AvahiInterfaceMonitor *m, AvahiInterface *i,
assert(cbdata);
cbdata->interface = i;
-
+
avahi_cache_walk(i->cache, cbdata->key, scan_cache_callback, cbdata);
if (cbdata->cname_key)
avahi_cache_walk(i->cache, cbdata->cname_key, scan_cache_callback, cbdata);
-
+
cbdata->interface = NULL;
}
@@ -247,9 +247,9 @@ unsigned avahi_multicast_lookup_engine_scan_cache(
AvahiKey *key,
AvahiMulticastLookupCallback callback,
void *userdata) {
-
+
struct cbdata cbdata;
-
+
assert(e);
assert(key);
assert(callback);
@@ -264,9 +264,9 @@ unsigned avahi_multicast_lookup_engine_scan_cache(
cbdata.userdata = userdata;
cbdata.interface = NULL;
cbdata.n_found = 0;
-
+
avahi_interface_monitor_walk(e->server->monitor, interface, protocol, scan_interface_callback, &cbdata);
-
+
if (cbdata.cname_key)
avahi_key_unref(cbdata.cname_key);
@@ -275,12 +275,12 @@ unsigned avahi_multicast_lookup_engine_scan_cache(
void avahi_multicast_lookup_engine_new_interface(AvahiMulticastLookupEngine *e, AvahiInterface *i) {
AvahiMulticastLookup *l;
-
+
assert(e);
assert(i);
for (l = e->lookups; l; l = l->lookups_next) {
-
+
if (l->dead || !l->callback)
continue;
@@ -291,7 +291,7 @@ void avahi_multicast_lookup_engine_new_interface(AvahiMulticastLookupEngine *e,
void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiInterface *i, AvahiRecord *record, AvahiBrowserEvent event) {
AvahiMulticastLookup *l;
-
+
assert(e);
assert(record);
assert(i);
@@ -313,7 +313,7 @@ void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiIn
if (l->dead || !l->callback)
continue;
-
+
if ((key = avahi_key_new_cname(l->key))) {
if (avahi_key_equal(record->key, key))
l->callback(e, i->hardware->index, i->protocol, event, AVAHI_LOOKUP_RESULT_MULTICAST, record, l->userdata);
@@ -326,9 +326,9 @@ void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiIn
AvahiMulticastLookupEngine *avahi_multicast_lookup_engine_new(AvahiServer *s) {
AvahiMulticastLookupEngine *e;
-
+
assert(s);
-
+
e = avahi_new(AvahiMulticastLookupEngine, 1);
e->server = s;
e->cleanup_dead = 0;
diff --git a/avahi-core/multicast-lookup.h b/avahi-core/multicast-lookup.h
index 43e240d..e3e6a85 100644
--- a/avahi-core/multicast-lookup.h
+++ b/avahi-core/multicast-lookup.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/netlink.c b/avahi-core/netlink.c
index 5050801..d109358 100644
--- a/avahi-core/netlink.c
+++ b/avahi-core/netlink.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -53,7 +53,7 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) {
struct iovec iov;
struct nlmsghdr *p;
char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
-
+
assert(nl);
iov.iov_base = nl->buffer;
@@ -70,7 +70,7 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) {
if ((bytes = recvmsg(nl->fd, &smsg, 0)) < 0) {
if (errno == EAGAIN || errno == EINTR)
return 0;
-
+
avahi_log_error(__FILE__": recvmsg() failed: %s", strerror(errno));
return -1;
}
@@ -88,18 +88,18 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) {
return -1;
p = (struct nlmsghdr *) nl->buffer;
-
+
assert(nl->callback);
-
+
for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
if (!NLMSG_OK(p, (size_t) bytes)) {
avahi_log_warn(__FILE__": packet truncated");
return -1;
}
-
+
nl->callback(nl, p, nl->userdata);
}
-
+
return 0;
}
@@ -126,7 +126,7 @@ AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void
avahi_log_error(__FILE__": socket(PF_NETLINK): %s", strerror(errno));
return NULL;
}
-
+
memset(&addr, 0, sizeof(addr));
addr.nl_family = AF_NETLINK;
addr.nl_groups = groups;
@@ -162,7 +162,7 @@ AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void
avahi_log_error(__FILE__": Failed to create watch.");
goto fail;
}
-
+
return nl;
fail:
@@ -186,7 +186,7 @@ void avahi_netlink_free(AvahiNetlink *nl) {
if (nl->fd >= 0)
close(nl->fd);
-
+
avahi_free(nl->buffer);
avahi_free(nl);
}
@@ -194,7 +194,7 @@ void avahi_netlink_free(AvahiNetlink *nl) {
int avahi_netlink_send(AvahiNetlink *nl, struct nlmsghdr *m, unsigned *ret_seq) {
assert(nl);
assert(m);
-
+
m->nlmsg_seq = nl->seq++;
m->nlmsg_flags |= NLM_F_ACK;
diff --git a/avahi-core/netlink.h b/avahi-core/netlink.h
index 8f2f8cb..0d0b8a2 100644
--- a/avahi-core/netlink.h
+++ b/avahi-core/netlink.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/prioq-test.c b/avahi-core/prioq-test.c
index d85a222..3d85b78 100644
--- a/avahi-core/prioq-test.c
+++ b/avahi-core/prioq-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -69,7 +69,7 @@ static void rec(AvahiPrioQueueNode *n) {
assert(n->parent->right == NULL);
}
-
+
if (n->parent) {
int a = POINTER_TO_INT(n->parent->data), b = POINTER_TO_INT(n->data);
if (a > b) {
@@ -101,12 +101,12 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
assert(q->n_nodes == q2->n_nodes);
printf("%i\n", POINTER_TO_INT(((AvahiPrioQueueNode*)q2->root->data)->data));
-
+
avahi_prio_queue_remove(q, q2->root->data);
avahi_prio_queue_remove(q2, q2->root);
}
-
+
/* prev = 0; */
/* while (q->root) { */
/* int v = GPOINTER_TO_INT(q->root->data); */
diff --git a/avahi-core/prioq.c b/avahi-core/prioq.c
index 8d91d87..243a410 100644
--- a/avahi-core/prioq.c
+++ b/avahi-core/prioq.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,11 +36,11 @@ AvahiPrioQueue* avahi_prio_queue_new(AvahiPQCompareFunc compare) {
if (!(q = avahi_new(AvahiPrioQueue, 1)))
return NULL; /* OOM */
-
+
q->root = q->last = NULL;
q->n_nodes = 0;
q->compare = compare;
-
+
return q;
}
@@ -64,7 +64,7 @@ static AvahiPrioQueueNode* get_node_at_xy(AvahiPrioQueue *q, unsigned x, unsigne
for (r = 0; r < y; r++) {
assert(n);
-
+
if ((x >> (y-r-1)) & 1)
n = n->right;
else
@@ -91,7 +91,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
if (a->parent == b) {
/* B is parent of A */
-
+
p = b->parent;
b->parent = a;
@@ -113,7 +113,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
a->right->parent = a;
if ((b->right = r))
b->right->parent = b;
-
+
} else {
if ((b->right = a->right))
b->right->parent = b;
@@ -127,7 +127,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
}
} else if (b->parent == a) {
/* A ist parent of B */
-
+
p = a->parent;
a->parent = b;
@@ -162,7 +162,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
}
} else {
AvahiPrioQueueNode *apl = NULL, *bpl = NULL;
-
+
/* Swap parents */
ap = a->parent;
bp = b->parent;
@@ -171,15 +171,15 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
apl = ap->left;
if (bp)
bpl = bp->left;
-
+
if ((a->parent = bp)) {
if (bpl == b)
bp->left = a;
- else
+ else
bp->right = a;
} else
q->root = a;
-
+
if ((b->parent = ap)) {
if (apl == a)
ap->left = b;
@@ -189,8 +189,8 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
q->root = b;
/* Swap children */
- l = a->left;
- r = a->right;
+ l = a->left;
+ r = a->right;
if ((a->left = b->left))
a->left->parent = a;
@@ -204,7 +204,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
if ((b->right = r))
b->right->parent = b;
}
-
+
/* Swap siblings */
ap = a->prev; an = a->next;
bp = b->prev; bn = b->next;
@@ -221,7 +221,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
if ((b->prev = ap))
b->prev->next = b;
-
+
} else if (b->next == a) {
/* B is predecessor of A */
a->next = b;
@@ -240,15 +240,15 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
if ((a->prev = bp))
a->prev->next = a;
-
+
if ((a->next = bn))
a->next->prev = a;
else
q->last = a;
-
+
if ((b->prev = ap))
b->prev->next = b;
-
+
if ((b->next = an))
b->next->prev = b;
else
@@ -295,14 +295,14 @@ AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
if (!(n = avahi_new(AvahiPrioQueueNode, 1)))
return NULL; /* OOM */
-
+
n->queue = q;
n->data = data;
if (q->last) {
assert(q->root);
assert(q->n_nodes);
-
+
n->y = q->last->y;
n->x = q->last->x+1;
@@ -313,7 +313,7 @@ AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
q->last->next = n;
n->prev = q->last;
-
+
assert(n->y > 0);
n->parent = get_node_at_xy(q, n->x/2, n->y-1);
@@ -324,7 +324,7 @@ AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
} else {
assert(!q->root);
assert(!q->n_nodes);
-
+
n->y = n->x = 0;
q->root = n;
n->prev = n->parent = NULL;
@@ -358,7 +358,7 @@ void avahi_prio_queue_remove(AvahiPrioQueue *q, AvahiPrioQueueNode *n) {
assert(!n->right);
q->last = n->prev;
-
+
if (n->prev) {
n->prev->next = NULL;
assert(n->parent);
diff --git a/avahi-core/prioq.h b/avahi-core/prioq.h
index ace92f6..bf122fb 100644
--- a/avahi-core/prioq.h
+++ b/avahi-core/prioq.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/probe-sched.c b/avahi-core/probe-sched.c
index 106bb81..15bc6a6 100644
--- a/avahi-core/probe-sched.c
+++ b/avahi-core/probe-sched.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,13 +41,13 @@ typedef struct AvahiProbeJob AvahiProbeJob;
struct AvahiProbeJob {
AvahiProbeScheduler *scheduler;
AvahiTimeEvent *time_event;
-
+
int chosen; /* Use for packet assembling */
int done;
struct timeval delivery;
AvahiRecord *record;
-
+
AVAHI_LLIST_FIELDS(AvahiProbeJob, jobs);
};
@@ -61,7 +61,7 @@ struct AvahiProbeScheduler {
static AvahiProbeJob* job_new(AvahiProbeScheduler *s, AvahiRecord *record, int done) {
AvahiProbeJob *pj;
-
+
assert(s);
assert(record);
@@ -69,7 +69,7 @@ static AvahiProbeJob* job_new(AvahiProbeScheduler *s, AvahiRecord *record, int d
avahi_log_error(__FILE__": Out of memory");
return NULL; /* OOM */
}
-
+
pj->scheduler = s;
pj->record = avahi_record_ref(record);
pj->time_event = NULL;
@@ -138,13 +138,13 @@ AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i) {
avahi_log_error(__FILE__": Out of memory");
return NULL;
}
-
+
s->interface = i;
s->time_event_queue = i->monitor->server->time_event_queue;
AVAHI_LLIST_HEAD_INIT(AvahiProbeJob, s->jobs);
AVAHI_LLIST_HEAD_INIT(AvahiProbeJob, s->history);
-
+
return s;
}
@@ -157,13 +157,13 @@ void avahi_probe_scheduler_free(AvahiProbeScheduler *s) {
void avahi_probe_scheduler_clear(AvahiProbeScheduler *s) {
assert(s);
-
+
while (s->jobs)
job_free(s, s->jobs);
while (s->history)
job_free(s, s->history);
}
-
+
static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, AvahiProbeJob *pj) {
size_t size;
AvahiKey *k;
@@ -174,7 +174,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
assert(pj);
assert(!pj->chosen);
-
+
/* Estimate the size for this record */
size =
avahi_key_get_estimate_size(pj->record->key) +
@@ -187,7 +187,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
/* Create the probe query */
if (!(k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY)))
return 0; /* OOM */
-
+
b = !!avahi_dns_packet_append_key(p, k, 0);
assert(b);
@@ -202,7 +202,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
/* Does the record match the probe? */
if (k->clazz != pj->record->key->clazz || !avahi_domain_equal(k->name, pj->record->key->name))
continue;
-
+
/* This job wouldn't fit in */
if (avahi_record_get_estimate_size(pj->record) > avahi_dns_packet_space(p))
break;
@@ -212,7 +212,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
}
avahi_key_unref(k);
-
+
return 1;
}
@@ -234,7 +234,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
if (!(p = avahi_dns_packet_new_query(s->interface->hardware->mtu)))
return; /* OOM */
n = 1;
-
+
/* Add the import probe */
if (!packet_add_probe_query(s, p, pj)) {
size_t size;
@@ -249,7 +249,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
avahi_key_get_estimate_size(pj->record->key) +
avahi_record_get_estimate_size(pj->record) +
AVAHI_DNS_PACKET_HEADER_SIZE;
-
+
if (!(p = avahi_dns_packet_new_query(size + AVAHI_DNS_PACKET_EXTRA_SIZE)))
return; /* OOM */
@@ -257,7 +257,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
avahi_dns_packet_free(p);
return; /* OOM */
}
-
+
b = avahi_dns_packet_append_key(p, k, 0) && avahi_dns_packet_append_record(p, pj->record, 0, 0);
avahi_key_unref(k);
@@ -266,8 +266,8 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_QDCOUNT, 1);
avahi_interface_send_packet(s->interface, p);
} else
- avahi_log_warn("Probe record too large, cannot send");
-
+ avahi_log_warn("Probe record too large, cannot send");
+
avahi_dns_packet_free(p);
job_mark_done(s, pj);
@@ -279,10 +279,10 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
if (pj->chosen)
continue;
-
+
if (!packet_add_probe_query(s, p, pj))
break;
-
+
n++;
}
@@ -304,15 +304,15 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
/* Unmark all following jobs */
for (; pj; pj = pj->jobs_next)
pj->chosen = 0;
-
+
break;
}
job_mark_done(s, pj);
-
+
n ++;
}
-
+
avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_NSCOUNT, n);
/* Send it now */
@@ -328,7 +328,7 @@ static AvahiProbeJob* find_scheduled_job(AvahiProbeScheduler *s, AvahiRecord *re
for (pj = s->jobs; pj; pj = pj->jobs_next) {
assert(!pj->done);
-
+
if (avahi_record_equal_no_ttl(pj->record, record))
return pj;
}
@@ -338,7 +338,7 @@ static AvahiProbeJob* find_scheduled_job(AvahiProbeScheduler *s, AvahiRecord *re
static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *record) {
AvahiProbeJob *pj;
-
+
assert(s);
assert(record);
@@ -353,7 +353,7 @@ static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *reco
job_free(s, pj);
return NULL;
}
-
+
return pj;
}
}
@@ -364,7 +364,7 @@ static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *reco
int avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, int immediately) {
AvahiProbeJob *pj;
struct timeval tv;
-
+
assert(s);
assert(record);
assert(!avahi_key_is_pattern(record->key));
@@ -387,11 +387,11 @@ int avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, int
/* Create a new job and schedule it */
if (!(pj = job_new(s, record, 0)))
return 0; /* OOM */
-
+
pj->delivery = tv;
pj->time_event = avahi_time_event_new(s->time_event_queue, &pj->delivery, elapse_callback, pj);
-
+
/* avahi_log_debug("Accepted new probe job."); */
return 1;
diff --git a/avahi-core/probe-sched.h b/avahi-core/probe-sched.h
index 3af1319..bb43399 100644
--- a/avahi-core/probe-sched.h
+++ b/avahi-core/probe-sched.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/publish.h b/avahi-core/publish.h
index 77c49af..fde8653 100644
--- a/avahi-core/publish.h
+++ b/avahi-core/publish.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -83,7 +83,7 @@ int avahi_server_add(
AvahiProtocol protocol, /**< A protocol family to attach this record to. One of the AVAHI_PROTO_xxx constants. Use AVAHI_PROTO_UNSPEC to make this record available on all protocols (wich means on both IPv4 and IPv6). */
AvahiPublishFlags flags, /**< Special flags for this record */
AvahiRecord *r /**< The record to add. This function increases the reference counter of this object. */);
-
+
/** Add an IP address mapping to the server. This will add both the
* host-name-to-address and the reverse mapping to the server. See
* avahi_server_add() for more information. If adding one of the RRs
@@ -114,7 +114,7 @@ int avahi_server_add_service(
AvahiPublishFlags flags,
const char *name, /**< Service name, e.g. "Lennart's Files" */
const char *type, /**< DNS-SD type, e.g. "_http._tcp" */
- const char *domain,
+ const char *domain,
const char *host, /**< Host name where this servcie resides, or NULL if on the local host */
uint16_t port, /**< Port number of the service */
... /**< Text records, terminated by NULL */) AVAHI_GCC_SENTINEL;
@@ -152,9 +152,9 @@ int avahi_server_update_service_txt_strlst(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
AvahiStringList *strlst);
/** Update the TXT record for a service with the NULL termonate list of strings */
@@ -164,9 +164,9 @@ int avahi_server_update_service_txt(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
...) AVAHI_GCC_SENTINEL;
/** Check if there is a service locally defined and return the entry group it is attached to. Returns NULL if the service isn't local*/
diff --git a/avahi-core/querier-test.c b/avahi-core/querier-test.c
index 1c28ea0..21fb9ed 100644
--- a/avahi-core/querier-test.c
+++ b/avahi-core/querier-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -73,7 +73,7 @@ static void create_second_service_browser(AvahiTimeout *timeout, AVAHI_GCC_UNUSE
service_browser2 = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, DOMAIN, 0, sb_callback, NULL);
assert(service_browser2);
-
+
poll_api->timeout_free(timeout);
}
@@ -84,10 +84,10 @@ static void quit(AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *
int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
struct timeval tv;
AvahiServerConfig config;
-
+
simple_poll = avahi_simple_poll_new();
assert(simple_poll);
-
+
poll_api = avahi_simple_poll_get(simple_poll);
assert(poll_api);
@@ -100,25 +100,25 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
config.n_wide_area_servers = 1;
config.enable_wide_area = 1;
-
+
server = avahi_server_new(poll_api, &config, NULL, NULL, NULL);
assert(server);
avahi_server_config_free(&config);
service_browser1 = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, DOMAIN, 0, sb_callback, NULL);
assert(service_browser1);
-
+
poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 10000, 0), create_second_service_browser, NULL);
poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 60000, 0), quit, NULL);
-
+
for (;;)
if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
break;
avahi_server_free(server);
avahi_simple_poll_free(simple_poll);
-
+
return 0;
}
diff --git a/avahi-core/querier.c b/avahi-core/querier.c
index 8a230cd..90eca37 100644
--- a/avahi-core/querier.c
+++ b/avahi-core/querier.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -47,7 +47,7 @@ struct AvahiQuerier {
unsigned post_id;
int post_id_valid;
-
+
AVAHI_LLIST_FIELDS(AvahiQuerier, queriers);
};
@@ -59,14 +59,14 @@ void avahi_querier_free(AvahiQuerier *q) {
avahi_key_unref(q->key);
avahi_time_event_free(q->time_event);
-
+
avahi_free(q);
}
static void querier_elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
AvahiQuerier *q = userdata;
struct timeval tv;
-
+
assert(q);
if (q->n_used <= 0) {
@@ -84,15 +84,15 @@ static void querier_elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *us
/* The queue accepted our query. We store the query id here,
* that allows us to drop the query at a later point if the
* query is very short-lived. */
-
+
q->post_id_valid = 1;
}
q->sec_delay *= 2;
-
+
if (q->sec_delay >= 60*60) /* 1h */
q->sec_delay = 60*60;
-
+
avahi_elapse_time(&tv, q->sec_delay*1000, 0);
avahi_time_event_update(q->time_event, &tv);
}
@@ -100,12 +100,12 @@ static void querier_elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *us
void avahi_querier_add(AvahiInterface *i, AvahiKey *key, struct timeval *ret_ctime) {
AvahiQuerier *q;
struct timeval tv;
-
+
assert(i);
assert(key);
-
+
if ((q = avahi_hashmap_lookup(i->queriers_by_key, key))) {
-
+
/* Someone is already browsing for records of this RR key */
q->n_used++;
@@ -120,7 +120,7 @@ void avahi_querier_add(AvahiInterface *i, AvahiKey *key, struct timeval *ret_cti
/* No one is browsing for this RR key, so we add a new querier */
if (!(q = avahi_new(AvahiQuerier, 1)))
return; /* OOM */
-
+
q->key = avahi_key_ref(key);
q->interface = i;
q->n_used = 1;
@@ -185,7 +185,7 @@ static void remove_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i,
void avahi_querier_remove_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key) {
assert(s);
assert(key);
-
+
avahi_interface_monitor_walk(s->monitor, idx, protocol, remove_querier_callback, key);
}
@@ -196,7 +196,7 @@ struct cbdata {
static void add_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
struct cbdata *cbdata = userdata;
-
+
assert(m);
assert(i);
assert(cbdata);
@@ -212,7 +212,7 @@ static void add_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, vo
void avahi_querier_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, struct timeval *ret_ctime) {
struct cbdata cbdata;
-
+
assert(s);
assert(key);
@@ -221,13 +221,13 @@ void avahi_querier_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol p
if (ret_ctime)
ret_ctime->tv_sec = ret_ctime->tv_usec = 0;
-
+
avahi_interface_monitor_walk(s->monitor, idx, protocol, add_querier_callback, &cbdata);
}
int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key) {
AvahiQuerier *q;
-
+
assert(i);
assert(key);
@@ -237,19 +237,19 @@ int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key) {
/* This key is currently not subscribed at all, so no cache
* refresh is needed */
return 0;
-
+
if (q->n_used <= 0) {
/* If this is an entry nobody references right now, don't
* consider it "existing". */
-
+
/* Remove this querier since it is referenced by nobody
* and the cached data will soon be out of date */
avahi_querier_free(q);
/* Tell the cache that no refresh is needed */
return 0;
-
+
} else {
struct timeval tv;
@@ -266,6 +266,6 @@ int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key) {
void avahi_querier_free_all(AvahiInterface *i) {
assert(i);
- while (i->queriers)
+ while (i->queriers)
avahi_querier_free(i->queriers);
}
diff --git a/avahi-core/querier.h b/avahi-core/querier.h
index 3f4eead..c942aef 100644
--- a/avahi-core/querier.h
+++ b/avahi-core/querier.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/query-sched.c b/avahi-core/query-sched.c
index 0319b02..5cad11b 100644
--- a/avahi-core/query-sched.c
+++ b/avahi-core/query-sched.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -40,10 +40,10 @@ typedef struct AvahiKnownAnswer AvahiKnownAnswer;
struct AvahiQueryJob {
unsigned id;
int n_posted;
-
+
AvahiQueryScheduler *scheduler;
AvahiTimeEvent *time_event;
-
+
int done;
struct timeval delivery;
@@ -56,7 +56,7 @@ struct AvahiQueryJob {
* entries) most of the time, but this might be a wrong
* assumption, especially on setups where traffic reflection is
* involved. */
-
+
AVAHI_LLIST_FIELDS(AvahiQueryJob, jobs);
};
@@ -80,7 +80,7 @@ struct AvahiQueryScheduler {
static AvahiQueryJob* job_new(AvahiQueryScheduler *s, AvahiKey *key, int done) {
AvahiQueryJob *qj;
-
+
assert(s);
assert(key);
@@ -88,14 +88,14 @@ static AvahiQueryJob* job_new(AvahiQueryScheduler *s, AvahiKey *key, int done) {
avahi_log_error(__FILE__": Out of memory");
return NULL;
}
-
+
qj->scheduler = s;
qj->key = avahi_key_ref(key);
qj->time_event = NULL;
qj->n_posted = 1;
qj->id = s->next_id++;
-
- if ((qj->done = done))
+
+ if ((qj->done = done))
AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->history, qj);
else
AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->jobs, qj);
@@ -158,11 +158,11 @@ AvahiQueryScheduler *avahi_query_scheduler_new(AvahiInterface *i) {
avahi_log_error(__FILE__": Out of memory");
return NULL; /* OOM */
}
-
+
s->interface = i;
s->time_event_queue = i->monitor->server->time_event_queue;
s->next_id = 0;
-
+
AVAHI_LLIST_HEAD_INIT(AvahiQueryJob, s->jobs);
AVAHI_LLIST_HEAD_INIT(AvahiQueryJob, s->history);
AVAHI_LLIST_HEAD_INIT(AvahiKnownAnswer, s->known_answers);
@@ -180,7 +180,7 @@ void avahi_query_scheduler_free(AvahiQueryScheduler *s) {
void avahi_query_scheduler_clear(AvahiQueryScheduler *s) {
assert(s);
-
+
while (s->jobs)
job_free(s, s->jobs);
while (s->history)
@@ -190,7 +190,7 @@ void avahi_query_scheduler_clear(AvahiQueryScheduler *s) {
static void* known_answer_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
AvahiQueryScheduler *s = userdata;
AvahiKnownAnswer *ka;
-
+
assert(c);
assert(pattern);
assert(e);
@@ -198,12 +198,12 @@ static void* known_answer_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiC
if (avahi_cache_entry_half_ttl(c, e))
return NULL;
-
+
if (!(ka = avahi_new0(AvahiKnownAnswer, 1))) {
avahi_log_error(__FILE__": Out of memory");
return NULL;
}
-
+
ka->scheduler = s;
ka->record = avahi_record_ref(e->record);
@@ -221,7 +221,7 @@ static int packet_add_query_job(AvahiQueryScheduler *s, AvahiDnsPacket *p, Avahi
/* Add all matching known answers to the list */
avahi_cache_walk(s->interface->cache, qj->key, known_answer_walk_callback, s);
-
+
job_mark_done(s, qj);
return 1;
@@ -234,7 +234,7 @@ static void append_known_answers_and_send(AvahiQueryScheduler *s, AvahiDnsPacket
assert(p);
n = 0;
-
+
while ((ka = s->known_answers)) {
int too_large = 0;
@@ -266,7 +266,7 @@ static void append_known_answers_and_send(AvahiQueryScheduler *s, AvahiDnsPacket
if (!too_large)
n++;
}
-
+
avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ANCOUNT, n);
avahi_interface_send_packet(s->interface, p);
avahi_dns_packet_free(p);
@@ -289,10 +289,10 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
}
assert(!s->known_answers);
-
+
if (!(p = avahi_dns_packet_new_query(s->interface->hardware->mtu)))
return; /* OOM */
-
+
b = packet_add_query_job(s, p, qj);
assert(b); /* An query must always fit in */
n = 1;
@@ -320,7 +320,7 @@ static AvahiQueryJob* find_scheduled_job(AvahiQueryScheduler *s, AvahiKey *key)
for (qj = s->jobs; qj; qj = qj->jobs_next) {
assert(!qj->done);
-
+
if (avahi_key_equal(qj->key, key))
return qj;
}
@@ -330,7 +330,7 @@ static AvahiQueryJob* find_scheduled_job(AvahiQueryScheduler *s, AvahiKey *key)
static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
AvahiQueryJob *qj;
-
+
assert(s);
assert(key);
@@ -345,7 +345,7 @@ static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
job_free(s, qj);
return NULL;
}
-
+
return qj;
}
}
@@ -356,13 +356,13 @@ static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
int avahi_query_scheduler_post(AvahiQueryScheduler *s, AvahiKey *key, int immediately, unsigned *ret_id) {
struct timeval tv;
AvahiQueryJob *qj;
-
+
assert(s);
assert(key);
if ((qj = find_history_job(s, key)))
return 0;
-
+
avahi_elapse_time(&tv, immediately ? 0 : AVAHI_QUERY_DEFER_MSEC, 0);
if ((qj = find_scheduled_job(s, key))) {
@@ -376,25 +376,25 @@ int avahi_query_scheduler_post(AvahiQueryScheduler *s, AvahiKey *key, int immedi
}
qj->n_posted++;
-
+
} else {
if (!(qj = job_new(s, key, 0)))
return 0; /* OOM */
-
+
qj->delivery = tv;
qj->time_event = avahi_time_event_new(s->time_event_queue, &qj->delivery, elapse_callback, qj);
}
if (ret_id)
*ret_id = qj->id;
-
+
return 1;
}
void avahi_query_scheduler_incoming(AvahiQueryScheduler *s, AvahiKey *key) {
AvahiQueryJob *qj;
-
+
assert(s);
assert(key);
@@ -412,14 +412,14 @@ void avahi_query_scheduler_incoming(AvahiQueryScheduler *s, AvahiKey *key) {
if (!(qj = find_history_job(s, key)))
if (!(qj = job_new(s, key, 1)))
return; /* OOM */
-
+
gettimeofday(&qj->delivery, NULL);
job_set_elapse_time(s, qj, AVAHI_QUERY_HISTORY_MSEC, 0);
}
int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id) {
AvahiQueryJob *qj;
-
+
assert(s);
/* Very short lived queries can withdraw an already scheduled item
@@ -428,7 +428,7 @@ int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id) {
for (qj = s->jobs; qj; qj = qj->jobs_next) {
assert(!qj->done);
-
+
if (qj->id == id) {
/* Entry found */
@@ -441,7 +441,7 @@ int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id) {
* case since there should exist only one querier per
* key, but there are exceptions, notably reflected
* traffic.) */
-
+
job_free(s, qj);
return 1;
}
diff --git a/avahi-core/query-sched.h b/avahi-core/query-sched.h
index 5238558..1accc05 100644
--- a/avahi-core/query-sched.h
+++ b/avahi-core/query-sched.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c
index 25d21ac..140fc3c 100644
--- a/avahi-core/resolve-address.c
+++ b/avahi-core/resolve-address.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,7 +37,7 @@
struct AvahiSAddressResolver {
AvahiServer *server;
AvahiAddress address;
-
+
AvahiSRecordBrowser *record_browser;
AvahiSAddressResolverCallback callback;
@@ -58,7 +58,7 @@ struct AvahiSAddressResolver {
static void finish(AvahiSAddressResolver *r, AvahiResolverEvent event) {
assert(r);
-
+
if (r->time_event) {
avahi_time_event_free(r->time_event);
r->time_event = NULL;
@@ -78,7 +78,7 @@ static void finish(AvahiSAddressResolver *r, AvahiResolverEvent event) {
static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
AvahiSAddressResolver *r = userdata;
-
+
assert(e);
assert(r);
@@ -105,53 +105,53 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSAddressResolver *r = userdata;
assert(rr);
assert(r);
switch (event) {
- case AVAHI_BROWSER_NEW:
+ case AVAHI_BROWSER_NEW:
assert(record);
assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
+
if (r->interface > 0 && interface != r->interface)
return;
-
+
if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
return;
-
+
if (r->interface <= 0)
r->interface = interface;
-
+
if (r->protocol == AVAHI_PROTO_UNSPEC)
r->protocol = protocol;
-
+
if (!r->ptr_record) {
r->ptr_record = avahi_record_ref(record);
r->flags = flags;
-
+
finish(r, AVAHI_RESOLVER_FOUND);
}
break;
-
+
case AVAHI_BROWSER_REMOVE:
assert(record);
assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
+
if (r->ptr_record && avahi_record_equal_no_ttl(record, r->ptr_record)) {
avahi_record_unref(r->ptr_record);
r->ptr_record = NULL;
r->flags = flags;
-
+
/** Look for a replacement */
avahi_s_record_browser_restart(r->record_browser);
start_timeout(r);
}
break;
-
+
case AVAHI_BROWSER_CACHE_EXHAUSTED:
case AVAHI_BROWSER_ALL_FOR_NOW:
break;
@@ -184,7 +184,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
AvahiLookupFlags flags,
AvahiSAddressResolverCallback callback,
void* userdata) {
-
+
AvahiSAddressResolver *r;
AvahiKey *k;
char n[AVAHI_DOMAIN_NAME_MAX];
@@ -197,7 +197,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
AVAHI_CHECK_VALIDITY_RETURN_NULL(server, address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6, AVAHI_ERR_INVALID_PROTOCOL);
AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
+
avahi_reverse_lookup_name(address, n, sizeof(n));
if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
@@ -210,7 +210,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
avahi_key_unref(k);
return NULL;
}
-
+
r->server = server;
r->address = *address;
r->callback = callback;
@@ -236,7 +236,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
r->retry_with_multicast = 1;
}
}
-
+
r->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, r);
if (!r->record_browser) {
@@ -245,7 +245,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
}
start_timeout(r);
-
+
return r;
}
@@ -265,6 +265,6 @@ void avahi_s_address_resolver_free(AvahiSAddressResolver *r) {
if (r->key)
avahi_key_unref(r->key);
-
+
avahi_free(r);
}
diff --git a/avahi-core/resolve-host-name.c b/avahi-core/resolve-host-name.c
index 59dc3cf..30857c8 100644
--- a/avahi-core/resolve-host-name.c
+++ b/avahi-core/resolve-host-name.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -38,7 +38,7 @@
struct AvahiSHostNameResolver {
AvahiServer *server;
char *host_name;
-
+
AvahiSRecordBrowser *record_browser_a;
AvahiSRecordBrowser *record_browser_aaaa;
@@ -66,20 +66,20 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
switch (event) {
case AVAHI_RESOLVER_FOUND: {
AvahiAddress a;
-
+
assert(r->address_record);
-
+
switch (r->address_record->key->type) {
case AVAHI_DNS_TYPE_A:
a.proto = AVAHI_PROTO_INET;
a.data.ipv4 = r->address_record->data.a.address;
break;
-
+
case AVAHI_DNS_TYPE_AAAA:
a.proto = AVAHI_PROTO_INET6;
a.data.ipv6 = r->address_record->data.aaaa.address;
break;
-
+
default:
abort();
}
@@ -88,9 +88,9 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
break;
}
-
+
case AVAHI_RESOLVER_FAILURE:
-
+
r->callback(r, r->interface, r->protocol, event, r->host_name, NULL, r->flags, r->userdata);
break;
}
@@ -98,7 +98,7 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
AvahiSHostNameResolver *r = userdata;
-
+
assert(e);
assert(r);
@@ -126,9 +126,9 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSHostNameResolver *r = userdata;
-
+
assert(rr);
assert(r);
@@ -140,20 +140,20 @@ static void record_browser_callback(
if (r->interface > 0 && interface != r->interface)
return;
-
+
if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
return;
-
+
if (r->interface <= 0)
r->interface = interface;
-
+
if (r->protocol == AVAHI_PROTO_UNSPEC)
r->protocol = protocol;
-
+
if (!r->address_record) {
r->address_record = avahi_record_ref(record);
r->flags = flags;
-
+
finish(r, AVAHI_RESOLVER_FOUND);
}
@@ -169,13 +169,13 @@ static void record_browser_callback(
r->flags = flags;
-
+
/** Look for a replacement */
if (r->record_browser_aaaa)
avahi_s_record_browser_restart(r->record_browser_aaaa);
if (r->record_browser_a)
avahi_s_record_browser_restart(r->record_browser_a);
-
+
start_timeout(r);
}
@@ -189,7 +189,7 @@ static void record_browser_callback(
case AVAHI_BROWSER_FAILURE:
/* Stop browsers */
-
+
if (r->record_browser_aaaa)
avahi_s_record_browser_free(r->record_browser_aaaa);
if (r->record_browser_a)
@@ -197,7 +197,7 @@ static void record_browser_callback(
r->record_browser_a = r->record_browser_aaaa = NULL;
r->flags = flags;
-
+
finish(r, AVAHI_RESOLVER_FAILURE);
break;
}
@@ -212,10 +212,10 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
AvahiLookupFlags flags,
AvahiSHostNameResolverCallback callback,
void* userdata) {
-
+
AvahiSHostNameResolver *r;
AvahiKey *k;
-
+
assert(server);
assert(host_name);
assert(callback);
@@ -230,7 +230,7 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
r->server = server;
r->host_name = avahi_normalize_name_strdup(host_name);
r->callback = callback;
@@ -255,7 +255,7 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
if (!r->record_browser_a)
goto fail;
- }
+ }
if (aprotocol == AVAHI_PROTO_INET6 || aprotocol == AVAHI_PROTO_UNSPEC) {
k = avahi_key_new(host_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA);
@@ -269,7 +269,7 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
assert(r->record_browser_aaaa || r->record_browser_a);
start_timeout(r);
-
+
return r;
fail:
@@ -293,7 +293,7 @@ void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r) {
if (r->address_record)
avahi_record_unref(r->address_record);
-
+
avahi_free(r->host_name);
avahi_free(r);
}
diff --git a/avahi-core/resolve-service.c b/avahi-core/resolve-service.c
index 1ad6078..48a6012 100644
--- a/avahi-core/resolve-service.c
+++ b/avahi-core/resolve-service.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -54,7 +54,7 @@ struct AvahiSServiceResolver {
AvahiRecord *srv_record, *txt_record, *address_record;
AvahiLookupResultFlags srv_flags, txt_flags, address_flags;
-
+
AvahiSServiceResolverCallback callback;
void* userdata;
AvahiLookupFlags user_flags;
@@ -66,7 +66,7 @@ struct AvahiSServiceResolver {
static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
AvahiLookupResultFlags flags;
-
+
assert(r);
if (r->time_event) {
@@ -78,10 +78,10 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
r->txt_flags |
r->srv_flags |
r->address_flags;
-
+
switch (event) {
case AVAHI_RESOLVER_FAILURE:
-
+
r->callback(
r,
r->interface,
@@ -101,9 +101,9 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
case AVAHI_RESOLVER_FOUND: {
AvahiAddress a;
-
+
assert(event == AVAHI_RESOLVER_FOUND);
-
+
assert(r->srv_record);
if (r->address_record) {
@@ -112,17 +112,17 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
a.proto = AVAHI_PROTO_INET;
a.data.ipv4 = r->address_record->data.a.address;
break;
-
+
case AVAHI_DNS_TYPE_AAAA:
a.proto = AVAHI_PROTO_INET6;
a.data.ipv6 = r->address_record->data.aaaa.address;
break;
-
+
default:
assert(0);
}
}
-
+
r->callback(
r,
r->interface,
@@ -145,7 +145,7 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
AvahiSServiceResolver *r = userdata;
-
+
assert(e);
assert(r);
@@ -173,7 +173,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSServiceResolver *r = userdata;
assert(rr);
@@ -191,30 +191,30 @@ static void record_browser_callback(
case AVAHI_BROWSER_NEW: {
int changed = 0;
assert(record);
-
+
if (r->interface > 0 && interface > 0 && interface != r->interface)
return;
-
+
if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
return;
-
+
if (r->interface <= 0)
r->interface = interface;
-
+
if (r->protocol == AVAHI_PROTO_UNSPEC)
r->protocol = protocol;
-
+
switch (record->key->type) {
case AVAHI_DNS_TYPE_SRV:
if (!r->srv_record) {
r->srv_record = avahi_record_ref(record);
changed = 1;
-
+
if (r->record_browser_a) {
avahi_s_record_browser_free(r->record_browser_a);
r->record_browser_a = NULL;
}
-
+
if (r->record_browser_aaaa) {
avahi_s_record_browser_free(r->record_browser_aaaa);
r->record_browser_aaaa = NULL;
@@ -226,8 +226,8 @@ static void record_browser_callback(
AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A);
r->record_browser_a = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, r->user_flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
avahi_key_unref(k);
- }
-
+ }
+
if (r->address_protocol == AVAHI_PROTO_INET6 || r->address_protocol == AVAHI_PROTO_UNSPEC) {
AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA);
r->record_browser_aaaa = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, r->user_flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
@@ -236,7 +236,7 @@ static void record_browser_callback(
}
}
break;
-
+
case AVAHI_DNS_TYPE_TXT:
assert(!(r->user_flags & AVAHI_LOOKUP_NO_TXT));
@@ -246,7 +246,7 @@ static void record_browser_callback(
changed = 1;
}
break;
-
+
case AVAHI_DNS_TYPE_A:
case AVAHI_DNS_TYPE_AAAA:
@@ -257,7 +257,7 @@ static void record_browser_callback(
changed = 1;
}
break;
-
+
default:
abort();
}
@@ -272,14 +272,14 @@ static void record_browser_callback(
break;
}
-
+
case AVAHI_BROWSER_REMOVE:
assert(record);
switch (record->key->type) {
case AVAHI_DNS_TYPE_SRV:
-
+
if (r->srv_record && avahi_record_equal_no_ttl(record, r->srv_record)) {
avahi_record_unref(r->srv_record);
r->srv_record = NULL;
@@ -288,42 +288,42 @@ static void record_browser_callback(
avahi_s_record_browser_free(r->record_browser_a);
r->record_browser_a = NULL;
}
-
+
if (r->record_browser_aaaa) {
avahi_s_record_browser_free(r->record_browser_aaaa);
r->record_browser_aaaa = NULL;
}
-
+
/** Look for a replacement */
avahi_s_record_browser_restart(r->record_browser_srv);
start_timeout(r);
}
-
+
break;
-
+
case AVAHI_DNS_TYPE_TXT:
-
+
assert(!(r->user_flags & AVAHI_LOOKUP_NO_TXT));
-
+
if (r->txt_record && avahi_record_equal_no_ttl(record, r->txt_record)) {
avahi_record_unref(r->txt_record);
r->txt_record = NULL;
-
+
/** Look for a replacement */
avahi_s_record_browser_restart(r->record_browser_txt);
start_timeout(r);
}
break;
-
+
case AVAHI_DNS_TYPE_A:
case AVAHI_DNS_TYPE_AAAA:
-
+
assert(!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS));
-
+
if (r->address_record && avahi_record_equal_no_ttl(record, r->address_record)) {
avahi_record_unref(r->address_record);
r->address_record = NULL;
-
+
/** Look for a replacement */
if (r->record_browser_aaaa)
avahi_s_record_browser_restart(r->record_browser_aaaa);
@@ -332,7 +332,7 @@ static void record_browser_callback(
start_timeout(r);
}
break;
-
+
default:
abort();
}
@@ -344,7 +344,7 @@ static void record_browser_callback(
break;
case AVAHI_BROWSER_FAILURE:
-
+
if (rr == r->record_browser_a && r->record_browser_aaaa) {
/* We were looking for both AAAA and A, and the other query is still living, so we'll not die */
avahi_s_record_browser_free(r->record_browser_a);
@@ -360,7 +360,7 @@ static void record_browser_callback(
}
/* Hmm, everything's lost, tell the user */
-
+
if (r->record_browser_srv)
avahi_s_record_browser_free(r->record_browser_srv);
if (r->record_browser_txt)
@@ -388,12 +388,12 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
AvahiLookupFlags flags,
AvahiSServiceResolverCallback callback,
void* userdata) {
-
+
AvahiSServiceResolver *r;
AvahiKey *k;
char n[AVAHI_DOMAIN_NAME_MAX];
int ret;
-
+
assert(server);
assert(type);
assert(callback);
@@ -413,12 +413,12 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
avahi_server_set_errno(server, ret);
return NULL;
}
-
+
if (!(r = avahi_new(AvahiSServiceResolver, 1))) {
avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
r->server = server;
r->service_name = avahi_strdup(name);
r->service_type = avahi_normalize_name_strdup(type);
@@ -448,7 +448,7 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT);
r->record_browser_txt = avahi_s_record_browser_new(server, interface, protocol, k, flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
avahi_key_unref(k);
-
+
if (!r->record_browser_txt) {
avahi_s_service_resolver_free(r);
return NULL;
@@ -456,7 +456,7 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
}
start_timeout(r);
-
+
return r;
}
@@ -467,7 +467,7 @@ void avahi_s_service_resolver_free(AvahiSServiceResolver *r) {
if (r->time_event)
avahi_time_event_free(r->time_event);
-
+
if (r->record_browser_srv)
avahi_s_record_browser_free(r->record_browser_srv);
if (r->record_browser_txt)
@@ -483,7 +483,7 @@ void avahi_s_service_resolver_free(AvahiSServiceResolver *r) {
avahi_record_unref(r->txt_record);
if (r->address_record)
avahi_record_unref(r->address_record);
-
+
avahi_free(r->service_name);
avahi_free(r->service_type);
avahi_free(r->domain_name);
diff --git a/avahi-core/response-sched.c b/avahi-core/response-sched.c
index b194ef3..74bb7b0 100644
--- a/avahi-core/response-sched.c
+++ b/avahi-core/response-sched.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -55,7 +55,7 @@ typedef enum {
struct AvahiResponseJob {
AvahiResponseScheduler *scheduler;
AvahiTimeEvent *time_event;
-
+
AvahiResponseJobState state;
struct timeval delivery;
@@ -63,7 +63,7 @@ struct AvahiResponseJob {
int flush_cache;
AvahiAddress querier;
int querier_valid;
-
+
AVAHI_LLIST_FIELDS(AvahiResponseJob, jobs);
};
@@ -78,7 +78,7 @@ struct AvahiResponseScheduler {
static AvahiResponseJob* job_new(AvahiResponseScheduler *s, AvahiRecord *record, AvahiResponseJobState state) {
AvahiResponseJob *rj;
-
+
assert(s);
assert(record);
@@ -86,14 +86,14 @@ static AvahiResponseJob* job_new(AvahiResponseScheduler *s, AvahiRecord *record,
avahi_log_error(__FILE__": Out of memory");
return NULL;
}
-
+
rj->scheduler = s;
rj->record = avahi_record_ref(record);
rj->time_event = NULL;
rj->flush_cache = 0;
rj->querier_valid = 0;
-
- if ((rj->state = state) == AVAHI_SCHEDULED)
+
+ if ((rj->state = state) == AVAHI_SCHEDULED)
AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->jobs, rj);
else if (rj->state == AVAHI_DONE)
AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->history, rj);
@@ -161,10 +161,10 @@ AvahiResponseScheduler *avahi_response_scheduler_new(AvahiInterface *i) {
avahi_log_error(__FILE__": Out of memory");
return NULL;
}
-
+
s->interface = i;
s->time_event_queue = i->monitor->server->time_event_queue;
-
+
AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->jobs);
AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->history);
AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->suppressed);
@@ -181,7 +181,7 @@ void avahi_response_scheduler_free(AvahiResponseScheduler *s) {
void avahi_response_scheduler_clear(AvahiResponseScheduler *s) {
assert(s);
-
+
while (s->jobs)
job_free(s, s->jobs);
while (s->history)
@@ -192,7 +192,7 @@ void avahi_response_scheduler_clear(AvahiResponseScheduler *s) {
static void enumerate_aux_records_callback(AVAHI_GCC_UNUSED AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata) {
AvahiResponseJob *rj = userdata;
-
+
assert(r);
assert(rj);
@@ -212,7 +212,7 @@ static int packet_add_response_job(AvahiResponseScheduler *s, AvahiDnsPacket *p,
* auxilliary packets, too */
avahi_server_enumerate_aux_records(s->interface->monitor->server, s->interface, rj->record, enumerate_aux_records_callback, rj);
job_mark_done(s, rj);
-
+
return 1;
}
@@ -232,16 +232,16 @@ static void send_response_packet(AvahiResponseScheduler *s, AvahiResponseJob *rj
/* Try to fill up packet with more responses, if available */
while (s->jobs) {
-
+
if (!packet_add_response_job(s, p, s->jobs))
break;
-
+
n++;
}
-
+
} else {
size_t size;
-
+
avahi_dns_packet_free(p);
/* OK, the packet was too small, so create one that fits */
@@ -269,7 +269,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
assert(rj);
- if (rj->state == AVAHI_DONE || rj->state == AVAHI_SUPPRESSED)
+ if (rj->state == AVAHI_DONE || rj->state == AVAHI_SUPPRESSED)
job_free(rj->scheduler, rj); /* Lets drop this entry */
else
send_response_packet(rj->scheduler, rj);
@@ -283,7 +283,7 @@ static AvahiResponseJob* find_scheduled_job(AvahiResponseScheduler *s, AvahiReco
for (rj = s->jobs; rj; rj = rj->jobs_next) {
assert(rj->state == AVAHI_SCHEDULED);
-
+
if (avahi_record_equal_no_ttl(rj->record, record))
return rj;
}
@@ -293,7 +293,7 @@ static AvahiResponseJob* find_scheduled_job(AvahiResponseScheduler *s, AvahiReco
static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord *record) {
AvahiResponseJob *rj;
-
+
assert(s);
assert(record);
@@ -304,13 +304,13 @@ static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord
/* Check whether this entry is outdated */
/* avahi_log_debug("history age: %u", (unsigned) (avahi_age(&rj->delivery)/1000)); */
-
+
if (avahi_age(&rj->delivery)/1000 > AVAHI_RESPONSE_HISTORY_MSEC) {
/* it is outdated, so let's remove it */
job_free(s, rj);
return NULL;
}
-
+
return rj;
}
}
@@ -320,7 +320,7 @@ static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord
static AvahiResponseJob* find_suppressed_job(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier) {
AvahiResponseJob *rj;
-
+
assert(s);
assert(record);
assert(querier);
@@ -328,7 +328,7 @@ static AvahiResponseJob* find_suppressed_job(AvahiResponseScheduler *s, AvahiRec
for (rj = s->suppressed; rj; rj = rj->jobs_next) {
assert(rj->state == AVAHI_SUPPRESSED);
assert(rj->querier_valid);
-
+
if (avahi_record_equal_no_ttl(rj->record, record) &&
avahi_address_cmp(&rj->querier, querier) == 0) {
/* Check whether this entry is outdated */
@@ -350,7 +350,7 @@ int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record
AvahiResponseJob *rj;
struct timeval tv;
/* char *t; */
-
+
assert(s);
assert(record);
@@ -385,7 +385,7 @@ int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record
}
avahi_elapse_time(&tv, immediately ? 0 : AVAHI_RESPONSE_DEFER_MSEC, immediately ? 0 : AVAHI_RESPONSE_JITTER_MSEC);
-
+
if ((rj = find_scheduled_job(s, record))) {
/* avahi_log_debug("Response suppressed by local duplicate suppression (scheduled)"); */
@@ -416,7 +416,7 @@ int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record
/* Create a new job and schedule it */
if (!(rj = job_new(s, record, AVAHI_SCHEDULED)))
return 0; /* OOM */
-
+
rj->delivery = tv;
rj->time_event = avahi_time_event_new(s->time_event_queue, &rj->delivery, elapse_callback, rj);
rj->flush_cache = flush_cache;
@@ -435,7 +435,7 @@ void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *r
/* This function is called whenever an incoming response was
* receieved. We drop scheduled responses which match here. The
* keyword is "DUPLICATE ANSWER SUPPRESION". */
-
+
if ((rj = find_scheduled_job(s, record))) {
if ((!rj->flush_cache || flush_cache) && /* flush cache bit was set correctly */
@@ -461,20 +461,20 @@ void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *r
rj->flush_cache = flush_cache;
rj->querier_valid = 0;
-
+
gettimeofday(&rj->delivery, NULL);
job_set_elapse_time(s, rj, AVAHI_RESPONSE_HISTORY_MSEC, 0);
}
void avahi_response_scheduler_suppress(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier) {
AvahiResponseJob *rj;
-
+
assert(s);
assert(record);
assert(querier);
if ((rj = find_scheduled_job(s, record))) {
-
+
if (rj->querier_valid && avahi_address_cmp(querier, &rj->querier) == 0 && /* same originator */
avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) && /* both goodbye packets, or both not */
record->ttl >= rj->record->ttl/2) { /* sensible TTL */
@@ -490,7 +490,7 @@ void avahi_response_scheduler_suppress(AvahiResponseScheduler *s, AvahiRecord *r
/* Let's update the old entry */
avahi_record_unref(rj->record);
rj->record = avahi_record_ref(record);
-
+
} else {
/* Create a new entry */
diff --git a/avahi-core/response-sched.h b/avahi-core/response-sched.h
index 68c4a9d..0fe6acc 100644
--- a/avahi-core/response-sched.h
+++ b/avahi-core/response-sched.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/rr-util.h b/avahi-core/rr-util.h
index b3c35b4..0fbcf98 100644
--- a/avahi-core/rr-util.h
+++ b/avahi-core/rr-util.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/rr.h b/avahi-core/rr.h
index 2160507..94126a6 100644
--- a/avahi-core/rr.h
+++ b/avahi-core/rr.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,8 +37,8 @@ AVAHI_C_DECL_BEGIN
enum {
AVAHI_DNS_TYPE_ANY = 0xFF, /**< Special query type for requesting all records */
AVAHI_DNS_TYPE_OPT = 41, /**< EDNS0 option */
- AVAHI_DNS_TYPE_TKEY = 249,
- AVAHI_DNS_TYPE_TSIG = 250,
+ AVAHI_DNS_TYPE_TKEY = 249,
+ AVAHI_DNS_TYPE_TSIG = 250,
AVAHI_DNS_TYPE_IXFR = 251,
AVAHI_DNS_TYPE_AXFR = 252
};
@@ -67,16 +67,16 @@ typedef struct AvahiKey {
typedef struct AvahiRecord {
int ref; /**< Reference counter */
AvahiKey *key; /**< Reference to the query key of this record */
-
+
uint32_t ttl; /**< DNS TTL of this record */
union {
-
+
struct {
void* data;
uint16_t size;
} generic; /**< Generic record data for unknown types */
-
+
struct {
uint16_t priority;
uint16_t weight;
@@ -106,7 +106,7 @@ typedef struct AvahiRecord {
} aaaa; /**< Data for AAAA records */
} data; /**< Record data */
-
+
} AvahiRecord;
/** Create a new AvahiKey object. The reference counter will be set to 1. */
@@ -121,7 +121,7 @@ void avahi_key_unref(AvahiKey *k);
/** Check whether two AvahiKey object contain the same
* data. AVAHI_DNS_CLASS_ANY/AVAHI_DNS_TYPE_ANY are treated like any
* other class/type. */
-int avahi_key_equal(const AvahiKey *a, const AvahiKey *b);
+int avahi_key_equal(const AvahiKey *a, const AvahiKey *b);
/** Return a numeric hash value for a key for usage in hash tables. */
unsigned avahi_key_hash(const AvahiKey *k);
@@ -152,7 +152,7 @@ char *avahi_key_to_string(const AvahiKey *k);
/** Create a textual representation of the specified record, similar
* in style to BIND zone file data. avahi_free() the result! */
-char *avahi_record_to_string(const AvahiRecord *r);
+char *avahi_record_to_string(const AvahiRecord *r);
/** Check whether two records are equal (regardless of the TTL */
int avahi_record_equal_no_ttl(const AvahiRecord *a, const AvahiRecord *b);
diff --git a/avahi-core/rrlist.c b/avahi-core/rrlist.c
index 915ecbb..308ecd1 100644
--- a/avahi-core/rrlist.c
+++ b/avahi-core/rrlist.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -57,7 +57,7 @@ AvahiRecordList *avahi_record_list_new(void) {
avahi_log_error("avahi_new() failed.");
return NULL;
}
-
+
AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->read);
AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->unread);
@@ -76,18 +76,18 @@ static void item_free(AvahiRecordList *l, AvahiRecordListItem *i) {
assert(l);
assert(i);
- if (i->read)
+ if (i->read)
AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->read, i);
else
AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
-
+
avahi_record_unref(i->record);
avahi_free(i);
}
void avahi_record_list_flush(AvahiRecordList *l) {
assert(l);
-
+
while (l->read)
item_free(l, l->read);
while (l->unread)
@@ -104,7 +104,7 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, in
return NULL;
assert(!i->read);
-
+
r = avahi_record_ref(i->record);
if (ret_unicast_response)
*ret_unicast_response = i->unicast_response;
@@ -117,7 +117,7 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, in
AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->read, i);
i->read = 1;
-
+
return r;
}
@@ -126,7 +126,7 @@ static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) {
assert(l);
assert(r);
-
+
for (i = l->read; i; i = i->items_next)
if (avahi_record_equal_no_ttl(i->record, r))
return i;
@@ -140,7 +140,7 @@ static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) {
void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary) {
AvahiRecordListItem *i;
-
+
assert(l);
assert(r);
@@ -151,7 +151,7 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache,
avahi_log_error("avahi_new() failed.");
return;
}
-
+
i->unicast_response = unicast_response;
i->flush_cache = flush_cache;
i->auxiliary = auxiliary;
@@ -159,7 +159,7 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache,
i->read = 0;
l->all_flush_cache = l->all_flush_cache && flush_cache;
-
+
AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->unread, i);
}
@@ -177,7 +177,7 @@ void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r) {
int avahi_record_list_is_empty(AvahiRecordList *l) {
assert(l);
-
+
return !l->unread && !l->read;
}
@@ -185,6 +185,6 @@ int avahi_record_list_all_flush_cache(AvahiRecordList *l) {
assert(l);
/* Return TRUE if all entries in this list have flush_cache set */
-
+
return l->all_flush_cache;
}
diff --git a/avahi-core/rrlist.h b/avahi-core/rrlist.h
index 9c07ecd..89bd138 100644
--- a/avahi-core/rrlist.h
+++ b/avahi-core/rrlist.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/socket.h b/avahi-core/socket.h
index 237b534..596ab50 100644
--- a/avahi-core/socket.h
+++ b/avahi-core/socket.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/timeeventq-test.c b/avahi-core/timeeventq-test.c
index c66a55a..e02a685 100644
--- a/avahi-core/timeeventq-test.c
+++ b/avahi-core/timeeventq-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/timeeventq.c b/avahi-core/timeeventq.c
index 17334ee..6502a59 100644
--- a/avahi-core/timeeventq.c
+++ b/avahi-core/timeeventq.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -83,7 +83,7 @@ static void expiration_event(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void *userd
struct timeval now;
gettimeofday(&now, NULL);
-
+
/* Check if expired */
if (avahi_timeval_compare(&now, &e->expiry) >= 0) {
@@ -97,7 +97,7 @@ static void expiration_event(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void *userd
update_timeout(q);
return;
- }
+ }
}
avahi_log_debug(__FILE__": Strange, expiration_event() called, but nothing really happened.");
@@ -129,9 +129,9 @@ AvahiTimeEventQueue* avahi_time_event_queue_new(const AvahiPoll *poll_api) {
if (!(q->prioq = avahi_prio_queue_new(compare)))
goto oom;
- if (!(q->timeout = poll_api->timeout_new(poll_api, NULL, expiration_event, q)))
+ if (!(q->timeout = poll_api->timeout_new(poll_api, NULL, expiration_event, q)))
goto oom;
-
+
return q;
oom:
@@ -142,13 +142,13 @@ oom:
if (q->prioq)
avahi_prio_queue_free(q->prioq);
}
-
+
return NULL;
}
void avahi_time_event_queue_free(AvahiTimeEventQueue *q) {
AvahiTimeEvent *e;
-
+
assert(q);
while ((e = time_event_queue_root(q)))
@@ -156,7 +156,7 @@ void avahi_time_event_queue_free(AvahiTimeEventQueue *q) {
avahi_prio_queue_free(q->prioq);
q->poll_api->timeout_free(q->timeout);
-
+
avahi_free(q);
}
@@ -165,9 +165,9 @@ AvahiTimeEvent* avahi_time_event_new(
const struct timeval *timeval,
AvahiTimeEventCallback callback,
void* userdata) {
-
+
AvahiTimeEvent *e;
-
+
assert(q);
assert(callback);
assert(userdata);
@@ -176,7 +176,7 @@ AvahiTimeEvent* avahi_time_event_new(
avahi_log_error(__FILE__": Out of memory");
return NULL; /* OOM */
}
-
+
e->queue = q;
e->callback = callback;
e->userdata = userdata;
@@ -187,9 +187,9 @@ AvahiTimeEvent* avahi_time_event_new(
e->expiry.tv_sec = 0;
e->expiry.tv_usec = 0;
}
-
+
fix_expiry_time(e);
-
+
e->last_run.tv_sec = 0;
e->last_run.tv_usec = 0;
@@ -221,7 +221,7 @@ void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval) {
e->expiry = *timeval;
fix_expiry_time(e);
avahi_prio_queue_shuffle(e->queue->prioq, e->node);
-
+
update_timeout(e->queue);
}
diff --git a/avahi-core/timeeventq.h b/avahi-core/timeeventq.h
index cdfa5e6..05cfe8b 100644
--- a/avahi-core/timeeventq.h
+++ b/avahi-core/timeeventq.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/update-test.c b/avahi-core/update-test.c
index 6b92900..e623967 100644
--- a/avahi-core/update-test.c
+++ b/avahi-core/update-test.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,11 +42,11 @@ static AvahiSEntryGroup *group = NULL;
static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("server state: %i", state);
-
+ avahi_log_debug("server state: %i", state);
+
if (state == AVAHI_SERVER_RUNNING) {
int ret;
-
+
group = avahi_s_entry_group_new(s, NULL, NULL);
assert(group);
@@ -62,7 +62,7 @@ static void modify_txt_callback(AVAHI_GCC_UNUSED AvahiTimeout *e, void *userdata
AvahiServer *s = userdata;
avahi_log_debug("modifying");
-
+
ret = avahi_server_update_service_txt(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "foo", "_http._tcp", NULL, "test2", NULL);
assert(ret == AVAHI_OK);
}
@@ -76,7 +76,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
simple_poll = avahi_simple_poll_new();
assert(simple_poll);
-
+
poll_api = avahi_simple_poll_get(simple_poll);
assert(poll_api);
diff --git a/avahi-core/util.c b/avahi-core/util.c
index b1925f0..09f35f2 100644
--- a/avahi-core/util.c
+++ b/avahi-core/util.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,11 +37,11 @@ void avahi_hexdump(const void* p, size_t size) {
assert(p);
printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
-
+
while (size > 0) {
unsigned i;
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
if (i < size)
printf("%02x ", c[i]);
else
@@ -54,14 +54,14 @@ void avahi_hexdump(const void* p, size_t size) {
else
printf(" ");
}
-
+
printf("\n");
c += 16;
if (size <= 16)
break;
-
+
size -= 16;
}
}
@@ -74,22 +74,22 @@ char *avahi_format_mac_address(char *r, size_t l, const uint8_t* mac, size_t siz
assert(r);
assert(l > 0);
assert(mac);
-
+
if (size <= 0) {
*r = 0;
return r;
}
-
+
for (i = 0; i < size; i++) {
if (l < 3)
break;
-
+
*(t++) = hex[*mac >> 4];
*(t++) = hex[*mac & 0xF];
*(t++) = ':';
l -= 3;
-
+
mac++;
}
@@ -97,7 +97,7 @@ char *avahi_format_mac_address(char *r, size_t l, const uint8_t* mac, size_t siz
*(t-1) = 0;
else
*r = 0;
-
+
return r;
}
diff --git a/avahi-core/util.h b/avahi-core/util.h
index 8d2caee..8e8ad44 100644
--- a/avahi-core/util.h
+++ b/avahi-core/util.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c
index add81c7..5997d84 100644
--- a/avahi-core/wide-area.c
+++ b/avahi-core/wide-area.c
@@ -2,17 +2,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,13 +48,13 @@ typedef struct AvahiWideAreaCacheEntry AvahiWideAreaCacheEntry;
struct AvahiWideAreaCacheEntry {
AvahiWideAreaLookupEngine *engine;
-
+
AvahiRecord *record;
struct timeval timestamp;
struct timeval expiry;
AvahiTimeEvent *time_event;
-
+
AVAHI_LLIST_FIELDS(AvahiWideAreaCacheEntry, by_key);
AVAHI_LLIST_FIELDS(AvahiWideAreaCacheEntry, cache);
};
@@ -62,12 +62,12 @@ struct AvahiWideAreaCacheEntry {
struct AvahiWideAreaLookup {
AvahiWideAreaLookupEngine *engine;
int dead;
-
+
uint32_t id; /* effectively just an uint16_t, but we need it as an index for a hash table */
AvahiTimeEvent *time_event;
AvahiKey *key, *cname_key;
-
+
int n_send;
AvahiDnsPacket *packet;
@@ -87,7 +87,7 @@ struct AvahiWideAreaLookupEngine {
AvahiWatch *watch_ipv4, *watch_ipv6;
uint16_t next_id;
-
+
/* Cache */
AVAHI_LLIST_HEAD(AvahiWideAreaCacheEntry, cache);
AvahiHashmap *cache_by_key;
@@ -108,23 +108,23 @@ struct AvahiWideAreaLookupEngine {
static AvahiWideAreaLookup* find_lookup(AvahiWideAreaLookupEngine *e, uint16_t id) {
AvahiWideAreaLookup *l;
int i = (int) id;
-
+
assert(e);
if (!(l = avahi_hashmap_lookup(e->lookups_by_id, &i)))
return NULL;
-
+
assert(l->id == id);
if (l->dead)
return NULL;
-
+
return l;
}
static int send_to_dns_server(AvahiWideAreaLookup *l, AvahiDnsPacket *p) {
AvahiAddress *a;
-
+
assert(l);
assert(p);
@@ -135,20 +135,20 @@ static int send_to_dns_server(AvahiWideAreaLookup *l, AvahiDnsPacket *p) {
a = &l->engine->dns_servers[l->engine->current_dns_server];
l->dns_server_used = *a;
-
+
if (a->proto == AVAHI_PROTO_INET) {
if (l->engine->fd_ipv4 < 0)
return -1;
-
+
return avahi_send_dns_packet_ipv4(l->engine->fd_ipv4, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv4, AVAHI_DNS_PORT);
-
+
} else {
assert(a->proto == AVAHI_PROTO_INET6);
if (l->engine->fd_ipv6 < 0)
return -1;
-
+
return avahi_send_dns_packet_ipv6(l->engine->fd_ipv6, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv6, AVAHI_DNS_PORT);
}
}
@@ -164,7 +164,7 @@ static void next_dns_server(AvahiWideAreaLookupEngine *e) {
static void lookup_stop(AvahiWideAreaLookup *l) {
assert(l);
-
+
l->callback = NULL;
if (l->time_event) {
@@ -187,7 +187,7 @@ static void sender_timeout_callback(AvahiTimeEvent *e, void *userdata) {
/* There is no other DNS server, fail */
l->n_send = 1000;
}
-
+
if (l->n_send >= 6) {
avahi_log_warn(__FILE__": Query timed out.");
avahi_server_set_errno(l->engine->server, AVAHI_ERR_TIMEOUT);
@@ -208,7 +208,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
AvahiKey *key,
AvahiWideAreaLookupCallback callback,
void *userdata) {
-
+
struct timeval tv;
AvahiWideAreaLookup *l, *t;
uint8_t *p;
@@ -234,7 +234,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
break; /* This ID is not yet used. */
l->id = e->next_id++;
-
+
/* We keep the packet around in case we need to repeat our query */
l->packet = avahi_dns_packet_new(0);
@@ -243,7 +243,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
p = avahi_dns_packet_append_key(l->packet, key, 0);
assert(p);
-
+
avahi_dns_packet_set_field(l->packet, AVAHI_DNS_FIELD_QDCOUNT, 1);
if (send_to_dns_server(l, l->packet) < 0) {
@@ -257,7 +257,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
}
l->n_send = 1;
-
+
l->time_event = avahi_time_event_new(e->server->time_event_queue, avahi_elapse_time(&tv, 500, 0), sender_timeout_callback, l);
avahi_hashmap_insert(e->lookups_by_id, &l->id, l);
@@ -267,14 +267,14 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
avahi_hashmap_replace(e->lookups_by_key, avahi_key_ref(l->key), t);
AVAHI_LLIST_PREPEND(AvahiWideAreaLookup, lookups, e->lookups, l);
-
+
return l;
}
static void lookup_destroy(AvahiWideAreaLookup *l) {
AvahiWideAreaLookup *t;
assert(l);
-
+
lookup_stop(l);
t = avahi_hashmap_lookup(l->engine->lookups_by_key, l->key);
@@ -285,7 +285,7 @@ static void lookup_destroy(AvahiWideAreaLookup *l) {
avahi_hashmap_remove(l->engine->lookups_by_key, l->key);
AVAHI_LLIST_REMOVE(AvahiWideAreaLookup, lookups, l->engine->lookups, l);
-
+
avahi_hashmap_remove(l->engine->lookups_by_id, &l->id);
avahi_dns_packet_free(l->packet);
@@ -294,7 +294,7 @@ static void lookup_destroy(AvahiWideAreaLookup *l) {
if (l->cname_key)
avahi_key_unref(l->cname_key);
-
+
avahi_free(l);
}
@@ -315,10 +315,10 @@ void avahi_wide_area_cleanup(AvahiWideAreaLookupEngine *e) {
while (e->cleanup_dead) {
e->cleanup_dead = 0;
-
+
for (l = e->lookups; l; l = n) {
n = l->lookups_next;
-
+
if (l->dead)
lookup_destroy(l);
}
@@ -349,7 +349,7 @@ static void cache_entry_free(AvahiWideAreaCacheEntry *c) {
static void expiry_event(AvahiTimeEvent *te, void *userdata) {
AvahiWideAreaCacheEntry *e = userdata;
-
+
assert(te);
assert(e);
@@ -358,7 +358,7 @@ static void expiry_event(AvahiTimeEvent *te, void *userdata) {
static AvahiWideAreaCacheEntry* find_record_in_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
AvahiWideAreaCacheEntry *c;
-
+
assert(e);
assert(r);
@@ -371,17 +371,17 @@ static AvahiWideAreaCacheEntry* find_record_in_cache(AvahiWideAreaLookupEngine *
static void run_callbacks(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
AvahiWideAreaLookup *l;
-
+
assert(e);
assert(r);
for (l = avahi_hashmap_lookup(e->lookups_by_key, r->key); l; l = l->by_key_next) {
if (l->dead || !l->callback)
continue;
-
+
l->callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA, r, l->userdata);
}
-
+
if (r->key->clazz == AVAHI_DNS_CLASS_IN && r->key->type == AVAHI_DNS_TYPE_CNAME) {
/* It's a CNAME record, so we have to scan the all lookups to see if one matches */
@@ -390,7 +390,7 @@ static void run_callbacks(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
if (l->dead || !l->callback)
continue;
-
+
if ((key = avahi_key_new_cname(l->key))) {
if (avahi_key_equal(r->key, key))
l->callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA, r, l->userdata);
@@ -404,7 +404,7 @@ static void run_callbacks(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
AvahiWideAreaCacheEntry *c;
int is_new;
-
+
assert(e);
assert(r);
@@ -422,7 +422,7 @@ static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
if (e->cache_n_entries >= CACHE_ENTRIES_MAX)
/* Eventually we should improve the caching algorithm here */
goto finish;
-
+
c = avahi_new(AvahiWideAreaCacheEntry, 1);
c->engine = e;
c->time_event = NULL;
@@ -438,7 +438,7 @@ static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
}
c->record = avahi_record_ref(r);
-
+
gettimeofday(&c->timestamp, NULL);
c->expiry = c->timestamp;
avahi_timeval_add(&c->expiry, r->ttl * 1000000);
@@ -449,7 +449,7 @@ static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
c->time_event = avahi_time_event_new(e->server->time_event_queue, &c->expiry, expiry_event, c);
finish:
-
+
if (is_new)
run_callbacks(e, r);
}
@@ -484,7 +484,7 @@ static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
int i, r;
AvahiBrowserEvent final_event = AVAHI_BROWSER_ALL_FOR_NOW;
-
+
assert(e);
assert(p);
@@ -513,7 +513,7 @@ static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
/* Skip over the question */
for (i = (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); i > 0; i--) {
AvahiKey *k;
-
+
if (!(k = avahi_dns_packet_consume_key(p, NULL))) {
avahi_log_warn(__FILE__": Wide area response packet too short or invalid while reading question key. (Maybe a UTF-8 problem?)");
avahi_server_set_errno(e->server, AVAHI_ERR_INVALID_PACKET);
@@ -543,7 +543,7 @@ static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
}
finish:
-
+
if (l && !l->dead) {
if (l->callback)
l->callback(e, final_event, AVAHI_LOOKUP_RESULT_WIDE_AREA, NULL, l->userdata);
@@ -555,7 +555,7 @@ finish:
static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent events, void *userdata) {
AvahiWideAreaLookupEngine *e = userdata;
AvahiDnsPacket *p = NULL;
-
+
if (fd == e->fd_ipv4)
p = avahi_recv_dns_packet_ipv4(e->fd_ipv4, NULL, NULL, NULL, NULL, NULL);
else {
@@ -571,7 +571,7 @@ static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSE
AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
AvahiWideAreaLookupEngine *e;
-
+
assert(s);
e = avahi_new(AvahiWideAreaLookupEngine, 1);
@@ -590,7 +590,7 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
if (e->fd_ipv4 >= 0)
close(e->fd_ipv4);
-
+
avahi_free(e);
return NULL;
}
@@ -598,7 +598,7 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
/* Create watches */
e->watch_ipv4 = e->watch_ipv6 = NULL;
-
+
if (e->fd_ipv4 >= 0)
e->watch_ipv4 = s->poll_api->watch_new(e->server->poll_api, e->fd_ipv4, AVAHI_WATCH_IN, socket_event, e);
if (e->fd_ipv6 >= 0)
@@ -622,12 +622,12 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e) {
assert(e);
-
+
avahi_wide_area_clear_cache(e);
while (e->lookups)
lookup_destroy(e->lookups);
-
+
avahi_hashmap_free(e->cache_by_key);
avahi_hashmap_free(e->lookups_by_id);
avahi_hashmap_free(e->lookups_by_key);
@@ -640,7 +640,7 @@ void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e) {
if (e->fd_ipv6 >= 0)
close(e->fd_ipv6);
-
+
if (e->fd_ipv4 >= 0)
close(e->fd_ipv4);
@@ -660,14 +660,14 @@ void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddres
assert(e);
if (a) {
- for (e->n_dns_servers = 0; n > 0 && e->n_dns_servers < AVAHI_WIDE_AREA_SERVERS_MAX; a++, n--)
+ for (e->n_dns_servers = 0; n > 0 && e->n_dns_servers < AVAHI_WIDE_AREA_SERVERS_MAX; a++, n--)
if ((a->proto == AVAHI_PROTO_INET && e->fd_ipv4 >= 0) || (a->proto == AVAHI_PROTO_INET6 && e->fd_ipv6 >= 0))
e->dns_servers[e->n_dns_servers++] = *a;
} else {
assert(n == 0);
e->n_dns_servers = 0;
}
-
+
e->current_dns_server = 0;
avahi_wide_area_clear_cache(e);
@@ -675,12 +675,12 @@ void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddres
void avahi_wide_area_cache_dump(AvahiWideAreaLookupEngine *e, AvahiDumpCallback callback, void* userdata) {
AvahiWideAreaCacheEntry *c;
-
+
assert(e);
assert(callback);
callback(";; WIDE AREA CACHE ;;; ", userdata);
-
+
for (c = e->cache; c; c = c->cache_next) {
char *t = avahi_record_to_string(c->record);
callback(t, userdata);
@@ -692,7 +692,7 @@ unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key,
AvahiWideAreaCacheEntry *c;
AvahiKey *cname_key;
unsigned n = 0;
-
+
assert(e);
assert(key);
assert(callback);
@@ -708,7 +708,7 @@ unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key,
callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA|AVAHI_LOOKUP_RESULT_CACHED, c->record, userdata);
n++;
}
-
+
avahi_key_unref(cname_key);
}
@@ -722,4 +722,4 @@ int avahi_wide_area_has_servers(AvahiWideAreaLookupEngine *e) {
}
-
+
diff --git a/avahi-core/wide-area.h b/avahi-core/wide-area.h
index 1af613b..84fa851 100644
--- a/avahi-core/wide-area.h
+++ b/avahi-core/wide-area.h
@@ -5,17 +5,17 @@
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307