cfg_rsoo.h 2.9 KB

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