Kea
1.9.9-git
|
Acts as a storage vault for D2 client configuration. More...
#include <d2_client_cfg.h>
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 (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) | |
Constructor. More... | |
D2ClientConfig () | |
Default constructor The default constructor creates an instance that has updates disabled. 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... | |
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... | |
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... | |
virtual void | validateContents () |
Validates member values. 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 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 = "::" |
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 56 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 75 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 | ||
) |
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. enable_updates is mandatory, other parameters are optional. |
D2ClientError | if given an invalid protocol or format. |
Definition at line 82 of file d2_client_cfg.cc.
References validateContents().
isc::dhcp::D2ClientConfig::D2ClientConfig | ( | ) |
Default constructor The default constructor creates an instance that has updates disabled.
Definition at line 103 of file d2_client_cfg.cc.
References validateContents().
|
virtual |
Destructor.
Definition at line 115 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 118 of file d2_client_cfg.cc.
|
inline |
Return whether or not DHCP-DDNS updating is enabled.
Definition at line 114 of file d2_client_cfg.h.
|
inline |
Return Maximum sender queue size.
Definition at line 139 of file d2_client_cfg.h.
|
inline |
Return the kea-dhcp-ddns request format.
Definition at line 149 of file d2_client_cfg.h.
|
inline |
Return the socket protocol to use with kea-dhcp-ddns.
Definition at line 144 of file d2_client_cfg.h.
|
inline |
Return the IP address client should use to send.
Definition at line 129 of file d2_client_cfg.h.
|
inline |
Return the IP port client should use to send.
Definition at line 134 of file d2_client_cfg.h.
|
inline |
Return the IP address of kea-dhcp-ddns (IPv4 or IPv6).
Definition at line 119 of file d2_client_cfg.h.
|
inline |
Return the IP port of kea-dhcp-ddns.
Definition at line 124 of file d2_client_cfg.h.
bool isc::dhcp::D2ClientConfig::operator!= | ( | const D2ClientConfig & | other | ) | const |
Compares two D2ClientConfigs for inequality.
Definition at line 167 of file d2_client_cfg.cc.
bool isc::dhcp::D2ClientConfig::operator== | ( | const D2ClientConfig & | other | ) | const |
Compares two D2ClientConfigs for equality.
Definition at line 155 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.
|
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.
Referenced by isc::dhcp::Network::getDdnsReplaceClientNameMode().
|
virtual |
Unparse a configuration object.
Implements isc::data::CfgToElement.
Definition at line 191 of file d2_client_cfg.cc.
References isc::data::UserContext::contextToElement(), isc::dhcp_ddns::ncrFormatToString(), isc::dhcp_ddns::ncrProtocolToString(), and isc::asiolink::IOAddress::toText().
std::string isc::dhcp::D2ClientConfig::toText | ( | ) | const |
Generates a string representation of the class contents.
Definition at line 172 of file d2_client_cfg.cc.
References isc::dhcp_ddns::ncrFormatToString(), isc::dhcp_ddns::ncrProtocolToString(), and isc::asiolink::IOAddress::toText().
Referenced by isc::dhcp::operator<<().
|
virtual |
Validates member values.
Method is used by the constructor to validate member contents.
D2ClientError | if given an invalid protocol or format. |
Definition at line 123 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().
|
static |
Definition at line 70 of file d2_client_cfg.h.
|
static |
Definition at line 72 of file d2_client_cfg.h.
|
static |
Definition at line 71 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 65 of file d2_client_cfg.h.
|
static |
Definition at line 68 of file d2_client_cfg.h.
|
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 63 of file d2_client_cfg.h.
|
static |
Default configuration constants.
These values need to match those used in D2ClientConfigParser::SimpleDefaults.
Definition at line 59 of file d2_client_cfg.h.
|
static |
Definition at line 60 of file d2_client_cfg.h.
|
static |
Definition at line 61 of file d2_client_cfg.h.
|
static |
Definition at line 62 of file d2_client_cfg.h.