summaryrefslogtreecommitdiffstats
path: root/avahi-core/avahi-test.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-06-24 01:00:13 +0000
committerLennart Poettering <lennart@poettering.net>2005-06-24 01:00:13 +0000
commit9f9f4f6ea2405edc642d322c19f6f13e31920046 (patch)
tree2a4a3a8ecbe0f942a140a98b4f1621d183575297 /avahi-core/avahi-test.c
parent697d33e34648286fd42ff6086087e0111726f749 (diff)
* update todo list
* add avvahi-dnsconfd * implement AvahiDNSServerBrowser * Update special browse/register RRs to match current RFC * add support to avahi-daemon to publish name server information * add support to avahi-daemon to publish /etc/resolv.conf DNS server information * add new simple protocol command: "BROWSE-DNS-SERVERS" * cleanup final configure message git-svn-id: file:///home/lennart/svn/public/avahi/trunk@143 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-core/avahi-test.c')
-rw-r--r--avahi-core/avahi-test.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/avahi-core/avahi-test.c b/avahi-core/avahi-test.c
index 0d47941..908212c 100644
--- a/avahi-core/avahi-test.c
+++ b/avahi-core/avahi-test.c
@@ -102,6 +102,7 @@ static void remove_entries(void) {
}
static void create_entries(gboolean new_name) {
+ AvahiAddress a;
remove_entries();
group = avahi_entry_group_new(server, entry_group_callback, NULL);
@@ -128,7 +129,12 @@ static void create_entries(gboolean new_name) {
avahi_log_error("Failed to add WEBDAV service");
goto fail;
}
-
+
+ if (avahi_server_add_dns_server_address(server, group, 0, AF_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, avahi_address_parse("192.168.50.1", AF_UNSPEC, &a), 53) < 0) {
+ avahi_log_error("Failed to add new DNS Server address");
+ goto fail;
+ }
+
avahi_entry_group_commit(group);
return;
@@ -186,6 +192,12 @@ static void sr_callback(AvahiServiceResolver *r, gint iface, guchar protocol, Av
}
}
+static void dsb_callback(AvahiDNSServerBrowser *b, gint iface, guchar protocol, AvahiBrowserEvent event, const gchar*hostname, const AvahiAddress *a, guint16 port, gpointer userdata) {
+ gchar t[64];
+ avahi_address_snprint(t, sizeof(t), a);
+ avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname, t, port, event == AVAHI_BROWSER_NEW ? "new" : "remove");
+}
+
int main(int argc, char *argv[]) {
GMainLoop *loop = NULL;
AvahiRecordBrowser *r;
@@ -198,7 +210,8 @@ int main(int argc, char *argv[]) {
AvahiServiceTypeBrowser *stb;
AvahiServiceBrowser *sb;
AvahiServiceResolver *sr;
-
+ AvahiDNSServerBrowser *dsb;
+
avahi_server_config_init(&config);
/* config.host_name = g_strdup("test"); */
server = avahi_server_new(NULL, &config, server_callback, NULL);
@@ -219,7 +232,9 @@ int main(int argc, char *argv[]) {
sb = avahi_service_browser_new(server, -1, AF_UNSPEC, "_http._tcp", NULL, sb_callback, NULL);
sr = avahi_service_resolver_new(server, -1, AF_UNSPEC, "Ecstasy HTTP", "_http._tcp", "local", AF_UNSPEC, sr_callback, NULL);
-
+
+ dsb = avahi_dns_server_browser_new(server, -1, AF_UNSPEC, "local", AVAHI_DNS_SERVER_RESOLVE, AF_UNSPEC, dsb_callback, NULL);
+
loop = g_main_loop_new(NULL, FALSE);
g_timeout_add(1000*5, dump_timeout, server);
@@ -234,6 +249,7 @@ int main(int argc, char *argv[]) {
avahi_service_type_browser_free(stb);
avahi_service_browser_free(sb);
avahi_service_resolver_free(sr);
+ avahi_dns_server_browser_free(dsb);
if (group)
avahi_entry_group_free(group);