3 # This file is part of avahi.
5 # avahi is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation; either version 2 of the
8 # License, or (at your option) any later version.
10 # avahi is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 # License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with avahi; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 # Some definitions matching those in avahi-common/defs.h
24 SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION, SERVER_FAILURE = range(0, 5)
26 ENTRY_GROUP_UNCOMMITED, ENTRY_GROUP_REGISTERING, ENTRY_GROUP_ESTABLISHED, ENTRY_GROUP_COLLISION, ENTRY_GROUP_FAILURE = range(0, 5)
28 DOMAIN_BROWSER_BROWSE, DOMAIN_BROWSER_BROWSE_DEFAULT, DOMAIN_BROWSER_REGISTER, DOMAIN_BROWSER_REGISTER_DEFAULT, DOMAIN_BROWSER_BROWSE_LEGACY = range(0, 5)
30 PROTO_UNSPEC, PROTO_INET, PROTO_INET6 = -1, 0, 1
36 PUBLISH_NO_ANNOUNCE = 4
37 PUBLISH_ALLOW_MULTIPLE = 8
38 PUBLISH_NO_REVERSE = 16
39 PUBLISH_NO_COOKIE = 32
41 PUBLISH_USE_WIDE_AREA = 128
42 PUBLISH_USE_MULTICAST = 256
44 LOOKUP_USE_WIDE_AREA = 1
45 LOOKUP_USE_MULTICAST = 2
49 LOOKUP_RESULT_CACHED = 1
50 LOOKUP_RESULT_WIDE_AREA = 2
51 LOOKUP_RESULT_MULTICAST = 4
52 LOOKUP_RESULT_LOCAL = 8
53 LOOKUP_RESULT_OUR_OWN = 16
54 LOOKUP_RESULT_STATIC = 32
56 SERVICE_COOKIE = "org.freedesktop.Avahi.cookie"
57 SERVICE_COOKIE_INVALID = 0
59 DBUS_NAME = "org.freedesktop.Avahi"
60 DBUS_INTERFACE_SERVER = DBUS_NAME + ".Server"
61 DBUS_PATH_SERVER = "/"
62 DBUS_INTERFACE_ENTRY_GROUP = DBUS_NAME + ".EntryGroup"
63 DBUS_INTERFACE_DOMAIN_BROWSER = DBUS_NAME + ".DomainBrowser"
64 DBUS_INTERFACE_SERVICE_TYPE_BROWSER = DBUS_NAME + ".ServiceTypeBrowser"
65 DBUS_INTERFACE_SERVICE_BROWSER = DBUS_NAME + ".ServiceBrowser"
66 DBUS_INTERFACE_ADDRESS_RESOLVER = DBUS_NAME + ".AddressResolver"
67 DBUS_INTERFACE_HOST_NAME_RESOLVER = DBUS_NAME + ".HostNameResolver"
68 DBUS_INTERFACE_SERVICE_RESOLVER = DBUS_NAME + ".ServiceResolver"
70 def byte_array_to_string(s):
75 if c >= 32 and c < 127:
82 def txt_array_to_string_array(t):
86 l.append(byte_array_to_string(s))
91 def string_to_byte_array(s):
95 r.append(dbus.Byte(ord(c)))
99 def string_array_to_txt_array(t):
103 l.append(string_to_byte_array(s))
107 def dict_to_txt_array(txt_dict):
110 for k,v in txt_dict.items():
111 l.append(string_to_byte_array("%s=%s" % (k,v)))