summaryrefslogtreecommitdiffstats
path: root/Demo/dns/dnsclass.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-10-08 19:30:50 (GMT)
committerGuido van Rossum <guido@python.org>1994-10-08 19:30:50 (GMT)
commit705d517e3f4df74b8c04edf54ac73b087c982f32 (patch)
tree7b0543f1165fc1bdfc4717277f67d8e699dcbeb4 /Demo/dns/dnsclass.py
parent3dc44aba71305cd9be8cba7703a96b6528f34169 (diff)
downloadcpython-705d517e3f4df74b8c04edf54ac73b087c982f32.zip
cpython-705d517e3f4df74b8c04edf54ac73b087c982f32.tar.gz
cpython-705d517e3f4df74b8c04edf54ac73b087c982f32.tar.bz2
initial checkin
Diffstat (limited to 'Demo/dns/dnsclass.py')
-rwxr-xr-xDemo/dns/dnsclass.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Demo/dns/dnsclass.py b/Demo/dns/dnsclass.py
new file mode 100755
index 0000000..f90b9e8
--- /dev/null
+++ b/Demo/dns/dnsclass.py
@@ -0,0 +1,23 @@
+# CLASS values (section 3.2.4)
+
+IN = 1 # the Internet
+CS = 2 # the CSNET class (Obsolete - used only for examples in
+ # some obsolete RFCs)
+CH = 3 # the CHAOS class
+HS = 4 # Hesiod [Dyer 87]
+
+# QCLASS values (section 3.2.5)
+
+ANY = 255 # any class
+
+
+# Construct reverse mapping dictionary
+
+_names = dir()
+classmap = {}
+for _name in _names:
+ if _name[0] != '_': classmap[eval(_name)] = _name
+
+def classstr(klass):
+ if classmap.has_key(klass): return classmap[klass]
+ else: return `klass`