Guido van Rossum | 705d517 | 1994-10-08 19:30:50 +0000 | [diff] [blame] | 1 | # CLASS values (section 3.2.4) |
| 2 | |
| 3 | IN = 1 # the Internet |
| 4 | CS = 2 # the CSNET class (Obsolete - used only for examples in |
| 5 | # some obsolete RFCs) |
| 6 | CH = 3 # the CHAOS class |
| 7 | HS = 4 # Hesiod [Dyer 87] |
| 8 | |
| 9 | # QCLASS values (section 3.2.5) |
| 10 | |
| 11 | ANY = 255 # any class |
| 12 | |
| 13 | |
| 14 | # Construct reverse mapping dictionary |
| 15 | |
| 16 | _names = dir() |
| 17 | classmap = {} |
| 18 | for _name in _names: |
| 19 | if _name[0] != '_': classmap[eval(_name)] = _name |
| 20 | |
| 21 | def classstr(klass): |
| 22 | if classmap.has_key(klass): return classmap[klass] |
| 23 | else: return `klass` |