home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import dns.exception as dns
- import dns.rdata as dns
- import dns.tokenizer as dns
-
- class HINFO(dns.rdata.Rdata):
- __slots__ = [
- 'cpu',
- 'os']
-
- def __init__(self, rdclass, rdtype, cpu, os):
- super(HINFO, self).__init__(rdclass, rdtype)
- self.cpu = cpu
- self.os = os
-
-
- def to_text(self, origin = None, relativize = True, **kw):
- return '"%s" "%s"' % (dns.rdata._escapify(self.cpu), dns.rdata._escapify(self.os))
-
-
- def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
- cpu = tok.get_string()
- os = tok.get_string()
- tok.get_eol()
- return cls(rdclass, rdtype, cpu, os)
-
- from_text = classmethod(from_text)
-
- def to_wire(self, file, compress = None, origin = None):
- l = len(self.cpu)
- byte = chr(l)
- file.write(byte)
- file.write(self.cpu)
- l = len(self.os)
- byte = chr(l)
- file.write(byte)
- file.write(self.os)
-
-
- def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
- l = ord(wire[current])
- current += 1
- rdlen -= 1
- if l > rdlen:
- raise dns.exception.FormError
- l > rdlen
- cpu = wire[current:current + l]
- current += l
- rdlen -= l
- l = ord(wire[current])
- current += 1
- rdlen -= 1
- if l != rdlen:
- raise dns.exception.FormError
- l != rdlen
- os = wire[current:current + l]
- return cls(rdclass, rdtype, cpu, os)
-
- from_wire = classmethod(from_wire)
-
- def _cmp(self, other):
- v = cmp(self.cpu, other.cpu)
- if v == 0:
- v = cmp(self.os, other.os)
-
- return v
-
-
-