cfg_rsoo.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright (C) 2015 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. #ifndef CFG_RSOO_H
  15. #define CFG_RSOO_H
  16. #include <boost/shared_ptr.hpp>
  17. #include <set>
  18. namespace isc {
  19. namespace dhcp {
  20. /// @brief Represents configuration of the RSOO options for the DHCP server.
  21. ///
  22. /// This class holds the set of RSOO-enabled options (see RFC6422). The list
  23. /// of RSOO-enabled options is maintained by IANA and currently the option
  24. /// 65 is officially RSSO-enabled. The list may be extended in the future
  25. /// and this class allows for specifying any future RSOO-enabled options.
  26. /// The administrator may also use existing options as RSOO-enabled.
  27. class CfgRSOO {
  28. public:
  29. /// @brief Constructor.
  30. ///
  31. /// It adds the default (officially) RSOO-enabled options:
  32. /// - OPTION_ERP_LOCAL_DOMAIN_NAME
  33. CfgRSOO();
  34. /// @brief Removes designation of all options as RSOO_enabled.
  35. ///
  36. /// This method removes all designations of all options as being RSOO-enabled.
  37. void clear();
  38. /// @brief Returns whether specific option code is RSOO-enabled.
  39. ///
  40. /// @param code Option code to check
  41. /// @return true, if it is allowed in Relay-Supplied Options option
  42. bool enabled(const uint16_t code) const;
  43. /// @brief Marks specified option code as RSOO-enabled.
  44. ///
  45. /// @param code option to be enabled in RSOO
  46. void enable(const uint16_t code);
  47. private:
  48. /// @brief Contains a set of options that are allowed in RSOO option
  49. ///
  50. /// RSOO stands for Relay-Supplied Options option. This is an option that
  51. /// is inserted by the relay agent with the intention that the server will
  52. /// echo those options back to the client. Only those options marked as
  53. /// RSOO-enabled may appear in the RSOO. Currently only option 65 is marked
  54. /// as such, but more options may be added in the future. See RFC6422 for details.
  55. std::set<uint16_t> rsoo_options_;
  56. };
  57. /// @name Pointers to the @c CfgRSOO objects.
  58. //@{
  59. /// @brief Pointer to the Non-const object.
  60. typedef boost::shared_ptr<CfgRSOO> CfgRSOOPtr;
  61. /// @brief Pointer to the const object.
  62. typedef boost::shared_ptr<const CfgRSOO> ConstCfgRSOOPtr;
  63. //@}
  64. }
  65. }
  66. #endif // CFG_RSOO_H