int32 GetState()
string GetAlternativeHostName(string name)
string GetAlternativeServiceName(string name)
- [int32 interface, int32 protocol, string host_name, int32 aprotocol, string address] ResolveHostName(int32 interface, int32 protocol, string name, int32 aprotocol)
- [int32 interface, int32 protocol, int32 aprotocol, string address, string host_name] ResolveAddress(int32 interface, int32 protocol, string address)
+ [int32 interface, int32 protocol, string name, int32 aprotocol, string address] ResolveHostName(int32 interface, int32 protocol, string name, int32 aprotocol)
+ [int32 interface, int32 protocol, int32 aprotocol, string address, string name] ResolveAddress(int32 interface, int32 protocol, string address)
[int32 interface, int32 protocol, string name, string type, string domain, string host, int32 aprotocol, string address, uint16 port, string txt[]] ResolveService(int32 interface, int32 protocol, string name, string type, string domain, int32 aprotocol)
path EntryGroupNew() -- Creates a new org.freedesktop.Avahi.EntryGroup object
path DomainBrowserNew(int32 interface, int32 protocol, string domain, int32 btype)
pkgdata_DATA = \
avahi-service.dtd
-EXTRA_DIST = avahi-service.dtd avahi-daemon.conf example.service dbus-test.py
+EXTRA_DIST = avahi-service.dtd avahi-daemon.conf example.service dbus-test.py Server.introspect server-introspect-xml.c
+BUILT_SOURCES = server-introspect-xml.c
if ENABLE_DBUS
avahi_daemon_SOURCES += dbus-protocol.c dbus-protocol.h
xmllint:
xmllint --noout --valid example.service
xmllint --noout --valid Server.introspect
+ xmllint --noout --valid EntryGroup.introspect
+
+server-introspect-xml.c: Server.introspect
+ python embedd-file.py -s $< server_introspect_xml > $@
--- /dev/null
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE node SYSTEM "introspect.dtd">
+<node>
+
+ <!-- $Id$ -->
+
+ <interface name="org.freedesktop.Avahi.Server">
+
+ <method name="GetVersionString">
+ <arg name="version" type="s" direction="out"/>
+ </method>
+
+ <method name="GetHostName">
+ <arg name="name" type="s" direction="out"/>
+ </method>
+ <method name="GetHostNameFqdn">
+ <arg name="name" type="s" direction="out"/>
+ </method>
+ <method name="GetDomainName">
+ <arg name="name" type="s" direction="out"/>
+ </method>
+
+ <method name="GetState">
+ <arg name="state" type="i" direction="out"/>
+ </method>
+ <signal name="StateChanged">
+ <arg name="state" type="i"/>
+ </signal>
+
+ <method name="GetAlternativeHostName">
+ <arg name="name" type="s" direction="in"/>
+ <arg name="name" type="s" direction="out"/>
+ </method>
+ <method name="GetAlternativeServiceName">
+ <arg name="name" type="s" direction="in"/>
+ <arg name="name" type="s" direction="out"/>
+ </method>
+
+ <method name="ResolveHostName">
+ <arg name="interface" type="i" direction="in"/>
+ <arg name="protocol" type="i" direction="in"/>
+ <arg name="name" type="s" direction="in"/>
+ <arg name="aprotocol" type="i" direction="in"/>
+
+ <arg name="interface" type="i" direction="out"/>
+ <arg name="protocol" type="i" direction="out"/>
+ <arg name="name" type="s" direction="out"/>
+ <arg name="aprotocol" type="i" direction="out"/>
+ <arg name="address" type="s" direction="out"/>
+ </method>
+
+ <method name="ResolveAddress">
+ <arg name="interface" type="i" direction="in"/>
+ <arg name="protocol" type="i" direction="in"/>
+ <arg name="address" type="s" direction="in"/>
+
+ <arg name="interface" type="i" direction="out"/>
+ <arg name="protocol" type="i" direction="out"/>
+ <arg name="aprotocol" type="i" direction="out"/>
+ <arg name="address" type="s" direction="out"/>
+ <arg name="name" type="s" direction="out"/>
+ </method>
+
+ <method name="ResolveService">
+ <arg name="interface" type="i" direction="in"/>
+ <arg name="protocol" type="i" direction="in"/>
+ <arg name="name" type="s" direction="in"/>
+ <arg name="type" type="s" direction="in"/>
+ <arg name="domain" type="s" direction="in"/>
+ <arg name="aprotocol" type="i" direction="in"/>
+
+ <arg name="interface" type="i" direction="out"/>
+ <arg name="protocol" type="i" direction="out"/>
+ <arg name="name" type="s" direction="out"/>
+ <arg name="type" type="s" direction="out"/>
+ <arg name="domain" type="s" direction="out"/>
+ <arg name="host" type="s" direction="out"/>
+ <arg name="aprotocol" type="i" direction="out"/>
+ <arg name="address" type="s" direction="out"/>
+ <arg name="port" type="q" direction="out"/>
+ <arg name="txt" type="as" direction="out"/>
+ </method>
+
+ <method name="EntryGroupNew">
+ <arg name="path" type="o" direction="out"/>
+ </method>
+
+ <method name="DomainBrowserNew">
+ <arg name="interface" type="i" direction="in"/>
+ <arg name="protocol" type="i" direction="in"/>
+ <arg name="domain" type="s" direction="in"/>
+ <arg name="btype" type="i" direction="in"/>
+
+ <arg name="path" type="o" direction="out"/>
+ </method>
+
+ <method name="ServiceTypeBrowserNew">
+ <arg name="interface" type="i" direction="in"/>
+ <arg name="protocol" type="i" direction="in"/>
+ <arg name="domain" type="s" direction="in"/>
+
+ <arg name="path" type="o" direction="out"/>
+ </method>
+
+ <method name="ServiceBrowserNew">
+ <arg name="interface" type="i" direction="in"/>
+ <arg name="protocol" type="i" direction="in"/>
+ <arg name="type" type="s" direction="in"/>
+ <arg name="domain" type="s" direction="in"/>
+
+ <arg name="path" type="o" direction="out"/>
+ </method>
+
+ </interface>
+</node>
#include "dbus-protocol.h"
#include "main.h"
+/* Include generated introspection data */
+#include "server-introspect-xml.c"
+
typedef struct Server Server;
typedef struct Client Client;
typedef struct EntryGroupInfo EntryGroupInfo;
dbus_message_get_path(m),
dbus_message_get_member(m));
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostName")) {
+ if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
+
+ if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
+ avahi_log_warn("Error parsing Introspect message");
+ goto fail;
+ }
+
+ return respond_string(c, m, server_introspect_xml);
+
+ } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostName")) {
if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
avahi_log_warn("Error parsing Server::GetHostName message");
--- /dev/null
+#!/usr/bin/python
+
+import os, sys
+
+def usage(ret = 0):
+ print "%s [-s] <file> <symbol>" % sys.argv[0]
+ sys.exit(ret)
+
+args = sys.argv[1:]
+
+use_static = False
+
+if len(args) >= 1 and args[0] == '-s':
+ use_static = True
+ args = args[1:]
+
+if len(args) >= 1 and args[0] == '-h':
+ usage()
+
+if len(args) != 2:
+ sys.stderr("Wrong number of arguments")
+ usage(1)
+
+f = file(args[0])
+t = f.read()
+f.close()
+
+out = sys.stdout
+
+if use_static:
+ out.write("static ")
+
+out.write('const char %s[] = \n"' % args[1]);
+
+n = 0
+
+for c in t:
+ if c == '\n':
+ out.write('\\n"\n"')
+ n = 0
+ elif c == '"':
+ out.write('\\"')
+ n += 2
+ elif ord(c) < 32 or ord(c) >= 127:
+ out.write('\\x%02x' % ord(c))
+ n += 4
+ else:
+ out.write(c)
+ n += 1
+
+ if n >= 76:
+ out.write('"\n"')
+ n = 0
+
+out.write('";\n');
+
--- /dev/null
+<!-- DTD for D-BUS Introspection data -->
+<!-- (C) 2005-02-02 David A. Wheeler; released under the D-BUS licenses,
+ GNU GPL version 2 (or greater) and AFL 1.1 (or greater) -->
+
+<!-- see D-BUS specification for documentation -->
+
+<!ELEMENT node (node*,interface,(node|interface)*)>
+<!ATTLIST node name CDATA #IMPLIED>
+
+<!ELEMENT interface (method|signal|property|annotation)*>
+<!ATTLIST interface name CDATA #REQUIRED>
+
+<!ELEMENT method (arg|annotation)*>
+<!ATTLIST method name CDATA #REQUIRED>
+
+<!ELEMENT signal (arg|annotation)*>
+<!ATTLIST signal name CDATA #REQUIRED>
+
+<!ELEMENT arg EMPTY>
+<!ATTLIST arg name CDATA #IMPLIED>
+<!ATTLIST arg type CDATA #REQUIRED>
+<!-- Method arguments SHOULD include "direction",
+ while signal and error arguments SHOULD not (since there's no point).
+ The DTD format can't express that subtlety. -->
+<!ATTLIST arg direction (in|out) "in">
+
+<!-- AKA "attribute" -->
+<!ELEMENT property (annotation)*>
+<!ATTLIST property name CDATA #REQUIRED>
+<!ATTLIST property type CDATA #REQUIRED>
+<!ATTLIST property access (read|write|readwrite) #REQUIRED>
+
+<!ELEMENT annotation EMPTY> <!-- Generic metadata -->
+<!ATTLIST annotation name CDATA #REQUIRED>
+<!ATTLIST annotation value CDATA #REQUIRED>
+
+
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
+#include <stdio.h>
#include <libdaemon/dfork.h>
#include <libdaemon/dsignal.h>