linkchecker/bk/net/dns/Opcode.py
2004-07-20 19:36:03 +00:00

31 lines
572 B
Python

# -*- coding: iso-8859-1 -*-
"""
$Id$
This file is part of the pydns project.
Homepage: http://pydns.sourceforge.net
This code is covered by the standard Python License.
Opcode values in message header. RFC 1035, 1996, 2136.
"""
QUERY = 0
IQUERY = 1
STATUS = 2
NOTIFY = 4
UPDATE = 5
# Construct reverse mapping dictionary
_opcodemap = {}
for _name in dir():
if not _name.startswith('_'):
_opcodemap[eval(_name)] = _name
def opcodestr (opcode):
"""return string representation of DNS opcode"""
return _opcodemap.get(opcode, repr(opcode))