--- a/util/Zeroconf.py Mon Aug 14 22:30:41 2017 +0300
+++ b/util/Zeroconf.py Mon Aug 14 23:27:15 2017 +0300
@@ -183,29 +183,36 @@
# utility functions
+
def currentTimeMillis():
"""Current system time in milliseconds"""
return time.time() * 1000
# Exceptions
+
class NonLocalNameException(Exception):
pass
+
class NonUniqueNameException(Exception):
pass
+
class NamePartTooLongException(Exception):
pass
+
class AbstractMethodException(Exception):
pass
+
class BadTypeInNameException(Exception):
pass
# implementation classes
+
class DNSEntry(object):
"""A DNS entry"""
@@ -254,6 +261,7 @@
result += "]"
return result
+
class DNSQuestion(DNSEntry):
"""A DNS question entry"""
@@ -332,6 +340,7 @@
arg = "%s/%s,%s" % (self.ttl, self.getRemainingTTL(currentTimeMillis()), other)
return DNSEntry.toString(self, "record", arg)
+
class DNSAddress(DNSRecord):
"""A DNS address record"""
@@ -356,6 +365,7 @@
except:
return self.address
+
class DNSHinfo(DNSRecord):
"""A DNS host information record"""
@@ -379,6 +389,7 @@
"""String representation"""
return self.cpu + " " + self.os
+
class DNSPointer(DNSRecord):
"""A DNS pointer record"""
@@ -400,6 +411,7 @@
"""String representation"""
return self.toString(self.alias)
+
class DNSText(DNSRecord):
"""A DNS text record"""
@@ -424,6 +436,7 @@
else:
return self.toString(self.text)
+
class DNSService(DNSRecord):
"""A DNS service record"""
@@ -451,6 +464,7 @@
"""String representation"""
return self.toString("%s:%s" % (self.server, self.port))
+
class DNSIncoming(object):
"""Object representation of an incoming DNS packet"""
@@ -890,6 +904,7 @@
self.condition.notify()
self.condition.release()
+
class Listener(object):
"""A Listener is used by this module to listen on the multicast
group to which DNS messages are sent, allowing the implementation