Package dns :: Package rdtypes :: Package ANY :: Module AFSDB |
[hide private]
[frames] | no frames]

# Source Code for Module dns.rdtypes.ANY.AFSDB

     1  # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
     2  #
     3  # Permission to use, copy, modify, and distribute this software and its
     4  # documentation for any purpose with or without fee is hereby granted,
     5  # provided that the above copyright notice and this permission notice
     6  # appear in all copies.
     7  #
     8  # THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
     9  # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    10  # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
    11  # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    12  # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    13  # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
    14  # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    15
    16  import dns.rdtypes.mxbase
    17
    18 -class AFSDB(dns.rdtypes.mxbase.UncompressedDowncasingMX):
    19      """AFSDB record
    20
    21      @ivar subtype: the subtype value
    22      @type subtype: int
    23      @ivar hostname: the hostname name
    24      @type hostname: dns.name.Name object"""
    25
    26      # Use the property mechanism to make "subtype" an alias for the
    27      # "preference" attribute, and "hostname" an alias for the "exchange"
    28      # attribute.
    29      #
    30      # This lets us inherit the UncompressedMX implementation but lets
    31      # the caller use appropriate attribute names for the rdata type.
    32      #
    33      # We probably lose some performance vs. a cut-and-paste
    34      # implementation, but this way we don't copy code, and that's
    35      # good.
    36
    37 -    def get_subtype(self):
    38          return self.preference
    39
    40 -    def set_subtype(self, subtype):
    41          self.preference = subtype
    42
    43      subtype = property(get_subtype, set_subtype)
    44
    45 -    def get_hostname(self):
    46          return self.exchange
    47
    48 -    def set_hostname(self, hostname):
    49          self.exchange = hostname
    50
    51      hostname = property(get_hostname, set_hostname)
    52