diff options
Diffstat (limited to 'project2/proj2_s4498062/dns/rcodes.py')
-rw-r--r-- | project2/proj2_s4498062/dns/rcodes.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/project2/proj2_s4498062/dns/rcodes.py b/project2/proj2_s4498062/dns/rcodes.py deleted file mode 100644 index 8f63b90..0000000 --- a/project2/proj2_s4498062/dns/rcodes.py +++ /dev/null @@ -1,70 +0,0 @@ -""" DNS RCODE values - -This module contains an Enum of RCODE values. See section 4.1.4 of RFC 1035 for -more info. -""" - - -class RCode(object): - """ Enum of RCODE values - - Usage: - >>> NoError - 0 - >>> NXDomain - 3 - """ - - NoError = 0 - FormErr = 1 - ServFail = 2 - NXDomain = 3 - NotImp = 4 - Refused = 5 - YXDomain = 6 - YXRRSet = 7 - NXRRSet = 8 - NotAuth = 9 - NotZone = 10 - BADVERS = 16 - BADSIG = 16 - BADKEY = 17 - BADTIME = 18 - BADMODE = 19 - BADNAME = 20 - BADALG = 21 - BADTRUNC = 22 - - by_string = { - "NoError": NoError, - "FormErr": FormErr, - "ServFail": ServFail, - "NXDomain": NXDomain, - "NotImp": NotImp, - "Refused": Refused, - "YXDomain": YXDomain, - "YXRRSet": YXRRSet, - "NXRRSet": NXRRSet, - "NotAuth": NotAuth, - "NotZone": NotZone, - "BADVERS": BADVERS, - "BADSIG": BADSIG, - "BADKEY": BADKEY, - "BADTIME": BADTIME, - "BADMODE": BADMODE, - "BADNAME": BADNAME, - "BADALG": BADALG, - "BADTRUNC": BADTRUNC - } - - by_value = dict([(y, x) for x, y in by_string.items()]) - - @staticmethod - def to_string(rcode): - """Convert a return code to a string""" - return RCode.by_value[rcode] - - @staticmethod - def from_string(string): - """Convert a string to a return code""" - return RCode.by_string[string] |