1 // Copyright (C) 2015,2017 Internet Systems Consortium, Inc. ("ISC") 2 // 3 // This Source Code Form is subject to the terms of the Mozilla Public 4 // License, v. 2.0. If a copy of the MPL was not distributed with this 5 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 #ifndef CFG_RSOO_H 8 #define CFG_RSOO_H 9 10 #include <cc/cfg_to_element.h> 11 #include <boost/shared_ptr.hpp> 12 #include <stdint.h> 13 #include <set> 14 15 namespace isc { 16 namespace dhcp { 17 18 /// @brief Represents configuration of the RSOO options for the DHCP server. 19 /// 20 /// This class holds the set of RSOO-enabled options (see RFC6422). The list 21 /// of RSOO-enabled options is maintained by IANA and currently the option 22 /// 65 is officially RSSO-enabled. The list may be extended in the future 23 /// and this class allows for specifying any future RSOO-enabled options. 24 /// The administrator may also use existing options as RSOO-enabled. 25 class CfgRSOO : public isc::data::CfgToElement { 26 public: 27 28 /// @brief Constructor. 29 /// 30 /// It adds the default (officially) RSOO-enabled options: 31 /// - OPTION_ERP_LOCAL_DOMAIN_NAME 32 CfgRSOO(); 33 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 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 45 /// @brief Marks specified option code as RSOO-enabled. 46 /// 47 /// @param code option to be enabled in RSOO 48 void enable(const uint16_t code); 49 50 /// @brief Unparse a configuration object 51 /// 52 /// @return a pointer to unparsed configuration 53 virtual isc::data::ElementPtr toElement() const; 54 55 private: 56 57 /// @brief Contains a set of options that are allowed in RSOO option 58 /// 59 /// RSOO stands for Relay-Supplied Options option. This is an option that 60 /// is inserted by the relay agent with the intention that the server will 61 /// echo those options back to the client. Only those options marked as 62 /// RSOO-enabled may appear in the RSOO. Currently only option 65 is marked 63 /// as such, but more options may be added in the future. See RFC6422 for details. 64 std::set<uint16_t> rsoo_options_; 65 66 }; 67 68 /// @name Pointers to the @c CfgRSOO objects. 69 //@{ 70 /// @brief Pointer to the Non-const object. 71 typedef boost::shared_ptr<CfgRSOO> CfgRSOOPtr; 72 73 /// @brief Pointer to the const object. 74 typedef boost::shared_ptr<const CfgRSOO> ConstCfgRSOOPtr; 75 76 //@} 77 78 } 79 } 80 81 #endif // CFG_RSOO_H 82