rp_17.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. // BEGIN_HEADER_GUARD
  15. #include <string>
  16. #include <dns/name.h>
  17. #include <dns/rdata.h>
  18. // BEGIN_ISC_NAMESPACE
  19. // BEGIN_COMMON_DECLARATIONS
  20. // END_COMMON_DECLARATIONS
  21. // BEGIN_RDATA_NAMESPACE
  22. /// \brief \c rdata::generic::RP class represents the RP RDATA as defined in
  23. /// RFC1183.
  24. ///
  25. /// This class implements the basic interfaces inherited from the abstract
  26. /// \c rdata::Rdata class, and provides trivial accessors specific to the
  27. /// RP RDATA.
  28. class RP : public Rdata {
  29. public:
  30. // BEGIN_COMMON_MEMBERS
  31. // END_COMMON_MEMBERS
  32. /// We use the default copy constructor and assignment operator.
  33. /// \brief Constructor from RDATA field parameters.
  34. ///
  35. /// The parameters are a straightforward mapping of %RP RDATA
  36. /// fields as defined in RFC1183.
  37. RP(const Name& mailbox, const Name& text) :
  38. mailbox_(mailbox), text_(text)
  39. {}
  40. /// \brief Return the value of the mailbox field.
  41. ///
  42. /// This method normally does not throw an exception, but if resource
  43. /// allocation for the returned \c Name object fails, a corresponding
  44. /// standard exception will be thrown.
  45. ///
  46. /// \note
  47. /// Unlike the case of some other RDATA classes (such as
  48. /// \c NS::getNSName()), this method constructs a new \c Name object
  49. /// and returns it, instead of returning a reference to a \c Name object
  50. /// internally maintained in the class (which is a private member).
  51. /// This is based on the observation that this method will be rarely used
  52. /// and even when it's used it will not be in a performance context
  53. /// (for example, a recursive resolver won't need this field in its
  54. /// resolution process). By returning a new object we have flexibility of
  55. /// changing the internal representation without the risk of changing
  56. /// the interface or method property.
  57. /// The same note applies to the \c getText() method.
  58. Name getMailbox() const { return (mailbox_); }
  59. /// \brief Return the value of the text field.
  60. ///
  61. /// This method normally does not throw an exception, but if resource
  62. /// allocation for the returned \c Name object fails, a corresponding
  63. /// standard exception will be thrown.
  64. Name getText() const { return (text_); }
  65. private:
  66. Name mailbox_;
  67. Name text_;
  68. };
  69. // END_RDATA_NAMESPACE
  70. // END_ISC_NAMESPACE
  71. // END_HEADER_GUARD
  72. // Local Variables:
  73. // mode: c++
  74. // End: