]> git.meshlink.io Git - catta/commitdiff
* fix Server introspection data
authorLennart Poettering <lennart@poettering.net>
Sat, 30 Jul 2005 16:30:18 +0000 (16:30 +0000)
committerLennart Poettering <lennart@poettering.net>
Sat, 30 Jul 2005 16:30:18 +0000 (16:30 +0000)
* define interface, path and service names in avahi.py
* DBUS: server object is now available on path "/"

git-svn-id: file:///home/lennart/svn/public/avahi/trunk@202 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-common/dbus.h
avahi-daemon/DBUS-API
avahi-daemon/Server.introspect
avahi-daemon/dbus-protocol.c
avahi-daemon/dbus-test.py
avahi-utils/avahi-dump-all
avahi-utils/avahi-publish-address
avahi-utils/avahi-publish-service
avahi-utils/avahi.py

index 27ee40a421a0889aa2f1db9f56585643e36a0e02..f6ad4d26ffaab4a3876f80d2b0ab4fbb9bce3897 100644 (file)
@@ -26,7 +26,7 @@
 
 #define AVAHI_DBUS_NAME "org.freedesktop.Avahi"
 #define AVAHI_DBUS_INTERFACE_SERVER AVAHI_DBUS_NAME".Server"
-#define AVAHI_DBUS_PATH_SERVER "/org/freedesktop/Avahi/Server"
+#define AVAHI_DBUS_PATH_SERVER "/"
 #define AVAHI_DBUS_INTERFACE_ENTRY_GROUP AVAHI_DBUS_NAME".EntryGroup"
 #define AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER AVAHI_DBUS_NAME".DomainBrowser"
 #define AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER AVAHI_DBUS_NAME".ServiceTypeBrowser"
index ff3cc7896a98722403e699ec5a86205082f6fee8..2ad5fa19d1e0f14187cac1015ef2d8607a2270d1 100644 (file)
@@ -1,6 +1,6 @@
 $Id$
 
-org.freedesktop.Avahi.Server               -- Accessible through /org/freedesktop/Avahi/Server
+org.freedesktop.Avahi.Server               
         string GetHostName()
         string GetHostNameFqdn()
         string GetDomainName()
@@ -11,7 +11,7 @@ org.freedesktop.Avahi.Server               -- Accessible through /org/freedeskto
         [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 EntryGroupNew()              
         path DomainBrowserNew(int32 interface, int32 protocol, string domain, int32 btype)
         path ServiceTypeBrowserNew(int32 interface, int32 protocol, string domain)
         path ServiceBrowserNew(int32 interface, int32 protocol, string type, string domain)
index cff7baef6ef6384c6f2084cb554a3988df360be7..da7eb361e9d6e1db24498b7ebe08f4c958c70fbd 100644 (file)
@@ -42,7 +42,6 @@
       <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"/>
@@ -89,7 +88,7 @@
     </method>
 
     <method name="EntryGroupNew">
-      <arg name="path" type="s" direction="out"/> <!-- FIXME -->
+      <arg name="path" type="o" direction="out"/>
     </method>
 
     <method name="DomainBrowserNew">
@@ -98,7 +97,7 @@
       <arg name="domain" type="s" direction="in"/>
       <arg name="btype" type="i" direction="in"/>
 
-      <arg name="path" type="s" direction="out"/> <!-- FIXME -->
+      <arg name="path" type="o" direction="out"/>
     </method>
 
     <method name="ServiceTypeBrowserNew">
       <arg name="protocol" type="i" direction="in"/>
       <arg name="domain" type="s" direction="in"/>
 
-      <arg name="path" type="s" direction="out"/> <!-- FIXME -->
+      <arg name="path" type="o" direction="out"/>
     </method>
 
     <method name="ServiceBrowserNew">
       <arg name="type" type="s" direction="in"/>
       <arg name="domain" type="s" direction="in"/>
 
-      <arg name="path" type="s" direction="out"/> <!-- FIXME -->
+      <arg name="path" type="o" direction="out"/>
     </method>
 
   </interface>
index b5c3e9a349bdf06836dfda8a056236d35deb023f..626e4a066ad2fafa48a11d50a85e889db466e789 100644 (file)
@@ -989,7 +989,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void
         i = g_new(EntryGroupInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/EntryGroup%u", client->id, i->id);
+        i->path = g_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
         AVAHI_LLIST_PREPEND(EntryGroupInfo, entry_groups, client->entry_groups, i);
 
         if (!(i->entry_group = avahi_entry_group_new(avahi_server, entry_group_callback, i))) {
@@ -1105,7 +1105,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void
         i = g_new(DomainBrowserInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/DomainBrowser%u", client->id, i->id);
+        i->path = g_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
 
         AVAHI_LLIST_PREPEND(DomainBrowserInfo, domain_browsers, client->domain_browsers, i);
 
@@ -1150,7 +1150,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void
         i = g_new(ServiceTypeBrowserInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/ServiceTypeBrowser%u", client->id, i->id);
+        i->path = g_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
 
         AVAHI_LLIST_PREPEND(ServiceTypeBrowserInfo, service_type_browsers, client->service_type_browsers, i);
 
@@ -1196,7 +1196,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void
         i = g_new(ServiceBrowserInfo, 1);
         i->id = ++client->current_id;
         i->client = client;
-        i->path = g_strdup_printf("/org/freedesktop/Avahi/Client%u/ServiceBrowser%u", client->id, i->id);
+        i->path = g_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
 
         AVAHI_LLIST_PREPEND(ServiceBrowserInfo, service_browsers, client->service_browsers, i);
 
index baebf40a4a9a9a6a4d3f75f5d3838bb76c6fac5e..310a3c224b534b3b98f506e10d21684ad6c1b6ff 100755 (executable)
@@ -7,7 +7,7 @@ except ImportError, e: pass
 
 bus = dbus.SystemBus()
 
-server = dbus.Interface(bus.get_object("org.freedesktop.Avahi", '/org/freedesktop/Avahi/Server'), 'org.freedesktop.Avahi.Server')
+server = dbus.Interface(bus.get_object("org.freedesktop.Avahi", '/'), 'org.freedesktop.Avahi.Server')
 
 def server_state_changed_callback(t):
     print "Server::StateChanged: ", t
index 03efa85b7331fbf57d224ebfbaedec0b2d64fced..035f5819a10460226ce83539da0dc889655d99bd 100755 (executable)
@@ -39,7 +39,7 @@ def new_service_type(interface, protocol, type, domain):
 
     print "Browsing for services of type '%s' in domain '%s' on %i.%i ..." % (type, domain, interface, protocol)
     
-    b = dbus.Interface(bus.get_object("org.freedesktop.Avahi", server.ServiceBrowserNew(interface, protocol, type, domain)), 'org.freedesktop.Avahi.ServiceBrowser')
+    b = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.ServiceBrowserNew(interface, protocol, type, domain)), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
     b.connect_to_signal('ItemNew', new_service)
     b.connect_to_signal('ItemRemove', remove_service)
 
@@ -54,7 +54,7 @@ def browse_domain(interface, protocol, domain):
 
     print "Browsing domain '%s' on %i.%i ..." % (domain, interface, protocol)
     
-    b = dbus.Interface(bus.get_object("org.freedesktop.Avahi", server.ServiceTypeBrowserNew(interface, protocol, domain)), 'org.freedesktop.Avahi.ServiceTypeBrowser')
+    b = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.ServiceTypeBrowserNew(interface, protocol, domain)), avahi.DBUS_INTERFACE_SERVICE_TYPE_BROWSER)
     b.connect_to_signal('ItemNew', new_service_type)
 
     service_type_browsers[(interface, protocol, domain)] = b
@@ -72,14 +72,14 @@ if len(sys.argv) > 1:
     domain = sys.argv[1]
         
 bus = dbus.SystemBus()
-server = dbus.Interface(bus.get_object("org.freedesktop.Avahi", '/org/freedesktop/Avahi/Server'), 'org.freedesktop.Avahi.Server')
+server = dbus.Interface(bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
 
 if domain is None:
     # Explicitly browse .local
     browse_domain(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "local")
 
     # Browse for other browsable domains
-    db = dbus.Interface(bus.get_object("org.freedesktop.Avahi", server.DomainBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "", avahi.DOMAIN_BROWSER_BROWSE)), 'org.freedesktop.Avahi.DomainBrowser')
+    db = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.DomainBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "", avahi.DOMAIN_BROWSER_BROWSE)), avahi.DBUS_INTERFACE_DOMAIN_BROWSER)
     db.connect_to_signal('ItemNew', new_domain)
 
 else:
index dce00bd2af5768ca641aacf6ce9d254d8f7aaeda..d03f9287917c8dc5f9268cbdba35e31db49db7ac 100755 (executable)
@@ -34,7 +34,7 @@ def add_address():
     assert group is None
 
     print "Adding address '%s' for '%s' ..." % (name, address)
-    group = dbus.Interface(bus.get_object("org.freedesktop.Avahi", server.EntryGroupNew()), 'org.freedesktop.Avahi.EntryGroup')
+    group = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP)
     group.connect_to_signal('StateChanged', entry_group_state_changed)
     group.AddAddress(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, name, address)
     group.Commit()
@@ -61,7 +61,7 @@ def entry_group_state_changed(state):
 main_loop = gobject.MainLoop()
 
 bus = dbus.SystemBus()
-server = dbus.Interface(bus.get_object("org.freedesktop.Avahi", '/org/freedesktop/Avahi/Server'), 'org.freedesktop.Avahi.Server')
+server = dbus.Interface(bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
 
 add_address()
 
index 376df346c717eb3ba2ee457e543cba8d85dcd333..d823f141ad466d509c3e1c2782ea5e0a1fbc4624 100755 (executable)
@@ -62,7 +62,7 @@ def add_service():
     assert group is None
 
     print "Adding service '%s' of type '%s' ..." % (name, stype)
-    group = dbus.Interface(bus.get_object("org.freedesktop.Avahi", server.EntryGroupNew()), 'org.freedesktop.Avahi.EntryGroup')
+    group = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP)
     group.connect_to_signal('StateChanged', entry_group_state_changed)
     group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, name, stype, domain, host, dbus.UInt16(port), txt)
     group.Commit()
@@ -94,7 +94,7 @@ def server_state_changed(state):
 main_loop = gobject.MainLoop()
 
 bus = dbus.SystemBus()
-server = dbus.Interface(bus.get_object("org.freedesktop.Avahi", '/org/freedesktop/Avahi/Server'), 'org.freedesktop.Avahi.Server')
+server = dbus.Interface(bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
 server.connect_to_signal("StateChanged", server_state_changed)
 server_state_changed(server.GetState())
 
index 40e9fbf80c103c468bfffd0a51d8361e96f4f927..1e2761c90007f3e6742f8fb9522bcd402f39d0d4 100644 (file)
@@ -13,3 +13,11 @@ DOMAIN_BROWSER_REGISTER, DOMAIN_BROWSER_REGISTER_DEFAULT, DOMAIN_BROWSER_BROWSE,
 PROTO_INET, PROTO_INET6, PROTO_UNSPEC = socket.AF_INET, socket.AF_INET6, socket.AF_UNSPEC
 
 IF_UNSPEC = -1
+
+DBUS_NAME = "org.freedesktop.Avahi"
+DBUS_INTERFACE_SERVER = DBUS_NAME + ".Server"
+DBUS_PATH_SERVER = "/"
+DBUS_INTERFACE_ENTRY_GROUP = DBUS_NAME + ".EntryGroup"
+DBUS_INTERFACE_DOMAIN_BROWSER = DBUS_NAME + ".DomainBrowser"
+DBUS_INTERFACE_SERVICE_TYPE_BROWSER = DBUS_NAME + ".ServiceTypeBrowser"
+DBUS_INTERFACE_SERVICE_BROWSER = DBUS_NAME + ".ServiceBrowser"