| 1 |
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license |
| 2 |
|
| 3 |
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc. |
| 4 |
# |
| 5 |
# Permission to use, copy, modify, and distribute this software and its |
| 6 |
# documentation for any purpose with or without fee is hereby granted, |
| 7 |
# provided that the above copyright notice and this permission notice |
| 8 |
# appear in all copies. |
| 9 |
# |
| 10 |
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES |
| 11 |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 12 |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR |
| 13 |
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 14 |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 15 |
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
| 16 |
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 |
|
| 18 |
import dns.immutable |
| 19 |
import dns.rdtypes.mxbase |
| 20 |
|
| 21 |
|
| 22 |
@dns.immutable.immutable |
| 23 |
class AFSDB(dns.rdtypes.mxbase.UncompressedDowncasingMX): |
| 24 |
"""AFSDB record""" |
| 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 |
@property |
| 38 |
def subtype(self): |
| 39 |
"the AFSDB subtype" |
| 40 |
return self.preference |
| 41 |
|
| 42 |
@property |
| 43 |
def hostname(self): |
| 44 |
"the AFSDB hostname" |
| 45 |
return self.exchange |