![]() |
Kea
1.5.0
|
Acts as a storage vault for D2 client configuration. More...
#include <d2_client_cfg.h>
Inheritance diagram for isc::dhcp::D2ClientConfig:Public Types | |
| enum | ReplaceClientNameMode { RCM_NEVER, RCM_ALWAYS, RCM_WHEN_PRESENT, RCM_WHEN_NOT_PRESENT } |
| Defines the client name replacement modes. More... | |
Public Member Functions | |
| D2ClientConfig () | |
| Default constructor The default constructor creates an instance that has updates disabled. More... | |
| D2ClientConfig (const bool enable_updates, const isc::asiolink::IOAddress &server_ip, const size_t server_port, const isc::asiolink::IOAddress &sender_ip, const size_t sender_port, const size_t max_queue_size, const dhcp_ddns::NameChangeProtocol &ncr_protocol, const dhcp_ddns::NameChangeFormat &ncr_format, const bool override_no_update, const bool override_client_update, const ReplaceClientNameMode replace_client_name_mode, const std::string &generated_prefix, const std::string &qualifying_suffix, const std::string &hostname_char_set, const std::string &hostname_char_replacement) | |
| Constructor. More... | |
| virtual | ~D2ClientConfig () |
| Destructor. More... | |
| void | enableUpdates (bool enable) |
| Sets enable-updates flag to the given value. More... | |
| bool | getEnableUpdates () const |
| Return whether or not DHCP-DDNS updating is enabled. More... | |
| const std::string & | getGeneratedPrefix () const |
| Return the prefix to use when generating domain-names. More... | |
| const std::string & | getHostnameCharReplacement () const |
| Return the invalid char replacement used to sanitize client hostnames. More... | |
| const std::string & | getHostnameCharSet () const |
| Return the char set regexp used to sanitize client hostnames. More... | |
| util::str::StringSanitizerPtr | getHostnameSanitizer () const |
| Return pointer to compiled regular expression string sanitizer Will be empty if hostname-char-set is empty. More... | |
| size_t | getMaxQueueSize () const |
| Return Maximum sender queue size. More... | |
| const dhcp_ddns::NameChangeFormat & | getNcrFormat () const |
| Return the kea-dhcp-ddns request format. More... | |
| const dhcp_ddns::NameChangeProtocol & | getNcrProtocol () const |
| Return the socket protocol to use with kea-dhcp-ddns. More... | |
| bool | getOverrideClientUpdate () const |
| Return if updates are done even when clients request delegation. More... | |
| bool | getOverrideNoUpdate () const |
| Return if updates are done even if clients request no updates. More... | |
| const std::string & | getQualifyingSuffix () const |
| Return the suffix to use to qualify partial domain-names. More... | |
| ReplaceClientNameMode | getReplaceClientNameMode () const |
| Return mode of replacement to use regarding client's client's domain-name. More... | |
| const isc::asiolink::IOAddress & | getSenderIp () const |
| Return the IP address client should use to send. More... | |
| size_t | getSenderPort () const |
| Return the IP port client should use to send. More... | |
| const isc::asiolink::IOAddress & | getServerIp () const |
| Return the IP address of kea-dhcp-ddns (IPv4 or IPv6). More... | |
| size_t | getServerPort () const |
| Return the IP port of kea-dhcp-ddns. More... | |
| bool | operator!= (const D2ClientConfig &other) const |
| Compares two D2ClientConfigs for inequality. More... | |
| bool | operator== (const D2ClientConfig &other) const |
| Compares two D2ClientConfigs for equality. More... | |
| virtual isc::data::ElementPtr | toElement () const |
| Unparse a configuration object. More... | |
| std::string | toText () const |
| Generates a string representation of the class contents. More... | |
Public Member Functions inherited from isc::data::UserContext | |
| void | contextToElement (data::ElementPtr map) const |
| Merge unparse a user_context object. More... | |
| data::ConstElementPtr | getContext () const |
| Returns const pointer to the user context. More... | |
| void | setContext (const data::ConstElementPtr &ctx) |
| Sets user context. More... | |
Public Member Functions inherited from isc::data::CfgToElement | |
| virtual | ~CfgToElement () |
| Destructor. More... | |
Static Public Member Functions | |
| static std::string | replaceClientNameModeToString (const ReplaceClientNameMode &mode) |
| Converts NameChangeFormat enums to text labels. More... | |
| static ReplaceClientNameMode | stringToReplaceClientNameMode (const std::string &mode_str) |
| Converts labels to ReplaceClientNameMode enum values. More... | |
Static Public Member Functions inherited from isc::data::UserContext | |
| static data::ElementPtr | toElement (data::ConstElementPtr map) |
| Copy extracting comments an Element map. More... | |
Static Public Attributes | |
| static const char * | DFT_GENERATED_PREFIX = "myhost" |
| static const char * | DFT_HOSTNAME_CHAR_REPLACEMENT = "" |
| static const char * | DFT_HOSTNAME_CHAR_SET = "" |
| static const size_t | DFT_MAX_QUEUE_SIZE = 1024 |
| static const char * | DFT_NCR_FORMAT = "JSON" |
| static const char * | DFT_NCR_PROTOCOL = "UDP" |
| static const bool | DFT_OVERRIDE_CLIENT_UPDATE = false |
| static const bool | DFT_OVERRIDE_NO_UPDATE = false |
| static const char * | DFT_REPLACE_CLIENT_NAME_MODE = "NEVER" |
| static const size_t | DFT_SENDER_PORT = 0 |
| static const char * | DFT_SERVER_IP = "127.0.0.1" |
| Default configuration constants. More... | |
| static const size_t | DFT_SERVER_PORT = 53001 |
| static const char * | DFT_V4_SENDER_IP = "0.0.0.0" |
| static const char * | DFT_V6_SENDER_IP = "::" |
Protected Member Functions | |
| virtual void | validateContents () |
| Validates member values. More... | |
Additional Inherited Members | |
Protected Attributes inherited from isc::data::UserContext | |
| data::ConstElementPtr | user_context_ |
| Pointer to the user context (may be NULL) More... | |
Acts as a storage vault for D2 client configuration.
A simple container class for storing and retrieving the configuration parameters associated with DHCP-DDNS and acting as a client of D2. Instances of this class may be constructed through configuration parsing.
Definition at line 53 of file d2_client_cfg.h.
Defines the client name replacement modes.
| Enumerator | |
|---|---|
| RCM_NEVER | |
| RCM_ALWAYS | |
| RCM_WHEN_PRESENT | |
| RCM_WHEN_NOT_PRESENT | |
Definition at line 72 of file d2_client_cfg.h.
| isc::dhcp::D2ClientConfig::D2ClientConfig | ( | const bool | enable_updates, |
| const isc::asiolink::IOAddress & | server_ip, | ||
| const size_t | server_port, | ||
| const isc::asiolink::IOAddress & | sender_ip, | ||
| const size_t | sender_port, | ||
| const size_t | max_queue_size, | ||
| const dhcp_ddns::NameChangeProtocol & | ncr_protocol, | ||
| const dhcp_ddns::NameChangeFormat & | ncr_format, | ||
| const bool | override_no_update, | ||
| const bool | override_client_update, | ||
| const ReplaceClientNameMode | replace_client_name_mode, | ||
| const std::string & | generated_prefix, | ||
| const std::string & | qualifying_suffix, | ||
| const std::string & | hostname_char_set, | ||
| const std::string & | hostname_char_replacement | ||
| ) |
Constructor.
| enable_updates | Enables DHCP-DDNS updates |
| server_ip | IP address of the kea-dhcp-ddns server (IPv4 or IPv6) |
| server_port | IP port of the kea-dhcp-ddns server |
| sender_ip | IP address of the kea-dhcp-ddns server (IPv4 or IPv6) |
| sender_port | IP port of the kea-dhcp-ddns server |
| max_queue_size | maximum NCRs allowed in sender's queue |
| ncr_protocol | Socket protocol to use with kea-dhcp-ddns Currently only UDP is supported. |
| ncr_format | Format of the kea-dhcp-ddns requests. Currently only JSON format is supported. |
| override_no_update | Enables updates, even if clients request no updates. |
| override_client_update | Perform updates, even if client requested delegation. |
| replace_client_name_mode | enables replacement of the domain-name supplied by the client with a generated name. |
| generated_prefix | Prefix to use when generating domain-names. |
| qualifying_suffix | Suffix to use to qualify partial domain-names. |
| hostname_char_set | regular expression string which describes invalid characters to be scrubbed from client host names |
| hostname_char_replacement | string of zero or more characters to replace invalid chars when sanitizing client host names |
enable_updates is mandatory, qualifying_suffix is mandatory when updates are enabled, other parameters are optional.
| D2ClientError | if given an invalid protocol or format. |
Definition at line 82 of file d2_client_cfg.cc.
References validateContents().
Here is the call graph for this function:| isc::dhcp::D2ClientConfig::D2ClientConfig | ( | ) |
Default constructor The default constructor creates an instance that has updates disabled.
Definition at line 118 of file d2_client_cfg.cc.
References validateContents().
Here is the call graph for this function:
|
virtual |
Destructor.
Definition at line 138 of file d2_client_cfg.cc.
| void isc::dhcp::D2ClientConfig::enableUpdates | ( | bool | enable | ) |
Sets enable-updates flag to the given value.
This is the only value that may be altered outside the constructor as it may be desirable to toggle it off and on when dealing with D2 IO errors.
| enable | boolean value to assign to the enable-updates flag |
Definition at line 141 of file d2_client_cfg.cc.
|
inline |
Return whether or not DHCP-DDNS updating is enabled.
Definition at line 133 of file d2_client_cfg.h.
|
inline |
Return the prefix to use when generating domain-names.
Definition at line 188 of file d2_client_cfg.h.
|
inline |
Return the invalid char replacement used to sanitize client hostnames.
Definition at line 203 of file d2_client_cfg.h.
|
inline |
Return the char set regexp used to sanitize client hostnames.
Definition at line 198 of file d2_client_cfg.h.
|
inline |
Return pointer to compiled regular expression string sanitizer Will be empty if hostname-char-set is empty.
Definition at line 209 of file d2_client_cfg.h.
|
inline |
Return Maximum sender queue size.
Definition at line 158 of file d2_client_cfg.h.
|
inline |
Return the kea-dhcp-ddns request format.
Definition at line 168 of file d2_client_cfg.h.
|
inline |
Return the socket protocol to use with kea-dhcp-ddns.
Definition at line 163 of file d2_client_cfg.h.
|
inline |
Return if updates are done even when clients request delegation.
Definition at line 178 of file d2_client_cfg.h.
|
inline |
Return if updates are done even if clients request no updates.
Definition at line 173 of file d2_client_cfg.h.
|
inline |
Return the suffix to use to qualify partial domain-names.
Definition at line 193 of file d2_client_cfg.h.
|
inline |
Return mode of replacement to use regarding client's client's domain-name.
Definition at line 183 of file d2_client_cfg.h.
|
inline |
Return the IP address client should use to send.
Definition at line 148 of file d2_client_cfg.h.
|
inline |
Return the IP port client should use to send.
Definition at line 153 of file d2_client_cfg.h.
|
inline |
Return the IP address of kea-dhcp-ddns (IPv4 or IPv6).
Definition at line 138 of file d2_client_cfg.h.
|
inline |
Return the IP port of kea-dhcp-ddns.
Definition at line 143 of file d2_client_cfg.h.
| bool isc::dhcp::D2ClientConfig::operator!= | ( | const D2ClientConfig & | other | ) | const |
Compares two D2ClientConfigs for inequality.
Definition at line 207 of file d2_client_cfg.cc.
| bool isc::dhcp::D2ClientConfig::operator== | ( | const D2ClientConfig & | other | ) | const |
Compares two D2ClientConfigs for equality.
Definition at line 188 of file d2_client_cfg.cc.
|
static |
Converts NameChangeFormat enums to text labels.
| mode | enum value to convert to label |
Definition at line 63 of file d2_client_cfg.cc.
Referenced by toElement(), and toText().
|
static |
Converts labels to ReplaceClientNameMode enum values.
| mode_str | text to convert to an enum. Valid string values: "never", "always", "when-present", "when-not-present" (case-insensitive) |
| isc::BadValue | if given a string value which does not map to an enum value. |
Definition at line 41 of file d2_client_cfg.cc.
References isc_throw.
|
virtual |
Unparse a configuration object.
Implements isc::data::CfgToElement.
Definition at line 240 of file d2_client_cfg.cc.
References isc::data::UserContext::contextToElement(), isc::dhcp_ddns::ncrFormatToString(), isc::dhcp_ddns::ncrProtocolToString(), replaceClientNameModeToString(), and isc::asiolink::IOAddress::toText().
Here is the call graph for this function:| std::string isc::dhcp::D2ClientConfig::toText | ( | ) | const |
Generates a string representation of the class contents.
Definition at line 212 of file d2_client_cfg.cc.
References isc::dhcp_ddns::ncrFormatToString(), isc::dhcp_ddns::ncrProtocolToString(), replaceClientNameModeToString(), and isc::asiolink::IOAddress::toText().
Referenced by isc::dhcp::operator<<().
Here is the call graph for this function:
|
protectedvirtual |
Validates member values.
Method is used by the constructor to validate member contents.
| D2ClientError | if given an invalid protocol or format. |
Definition at line 146 of file d2_client_cfg.cc.
References isc::dhcp_ddns::FMT_JSON, isc::asiolink::IOAddress::getFamily(), isc_throw, isc::asiolink::IOAddress::isV4(), isc::dhcp_ddns::NCR_UDP, isc::dhcp_ddns::ncrFormatToString(), isc::dhcp_ddns::ncrProtocolToString(), and isc::asiolink::IOAddress::toText().
Referenced by D2ClientConfig().
Here is the call graph for this function:
|
static |
Definition at line 67 of file d2_client_cfg.h.
|
static |
Definition at line 69 of file d2_client_cfg.h.
|
static |
Definition at line 68 of file d2_client_cfg.h.
|
static |
Definition at line 61 of file d2_client_cfg.h.
|
static |
Definition at line 63 of file d2_client_cfg.h.
|
static |
Definition at line 62 of file d2_client_cfg.h.
|
static |
Definition at line 65 of file d2_client_cfg.h.
|
static |
Definition at line 64 of file d2_client_cfg.h.
|
static |
Definition at line 66 of file d2_client_cfg.h.
|
static |
Definition at line 60 of file d2_client_cfg.h.
|
static |
Default configuration constants.
These values need to match those used in D2ClientConfigParser::SimpleDefaults.
Definition at line 56 of file d2_client_cfg.h.
|
static |
Definition at line 57 of file d2_client_cfg.h.
|
static |
Definition at line 58 of file d2_client_cfg.h.
|
static |
Definition at line 59 of file d2_client_cfg.h.