d2_config.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209
  1. // Copyright (C) 2013-2016 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. #ifndef D2_CONFIG_H
  7. #define D2_CONFIG_H
  8. #include <asiolink/io_service.h>
  9. #include <cc/data.h>
  10. #include <dhcpsrv/parsers/dhcp_parsers.h>
  11. #include <dns/tsig.h>
  12. #include <exceptions/exceptions.h>
  13. #include <process/d_cfg_mgr.h>
  14. #include <boost/foreach.hpp>
  15. #include <stdint.h>
  16. #include <string>
  17. namespace isc {
  18. namespace d2 {
  19. /// @file d2_config.h
  20. /// @brief A collection of classes for housing and parsing the application
  21. /// configuration necessary for the DHCP-DDNS application (aka D2).
  22. ///
  23. /// This file contains the class declarations for the class hierarchy created
  24. /// from the D2 configuration and the parser classes used to create it.
  25. /// The application configuration consists of a set of scalar parameters,
  26. /// a list of TSIG keys, and two managed lists of domains: one list for
  27. /// forward domains and one list for reverse domains.
  28. ///
  29. /// The key list consists of one or more TSIG keys, each entry described by
  30. /// a name, the algorithm method name, optionally the minimum truncated
  31. /// length, and its secret key component.
  32. ///
  33. /// @todo NOTE that TSIG configuration parsing is functional, the use of
  34. /// TSIG Keys during the actual DNS update transactions is not. This will be
  35. /// implemented in a future release.
  36. ///
  37. /// Each managed domain list consists of a list one or more domains and is
  38. /// represented by the class DdnsDomainListMgr.
  39. ///
  40. /// Each domain consists of a set of scalars parameters and a list of DNS
  41. /// servers which support that domain. Among its scalars, is key_name, which
  42. /// is the name of the TSIG Key to use for with this domain. This value should
  43. /// map to one of the TSIG Keys in the key list. Domains are represented by
  44. /// the class, DdnsDomain.
  45. ///
  46. /// Each server consists of a set of scalars used to describe the server such
  47. /// that the application can carry out DNS update exchanges with it. Servers
  48. /// are represented by the class, DnsServerInfo.
  49. ///
  50. /// The configuration specification for use with Kea is detailed in the file
  51. /// dhcp-ddns.spec.
  52. ///
  53. /// The parsing class hierarchy reflects this same scheme. Working top down:
  54. ///
  55. /// A DdnsDomainListMgrParser parses a managed domain list entry. It handles
  56. /// any scalars which belong to the manager as well as creating and invoking a
  57. /// DdnsDomainListParser to parse its list of domain entries.
  58. ///
  59. /// A DdnsDomainListParser creates and invokes a DdnsDomainParser for each
  60. /// domain entry in its list.
  61. ///
  62. /// A DdnsDomainParser handles the scalars which belong to the domain as well as
  63. /// creating and invoking a DnsSeverInfoListParser to parse its list of server
  64. /// entries.
  65. ///
  66. /// A DnsServerInfoListParser creates and invokes a DnsServerInfoParser for
  67. /// each server entry in its list.
  68. ///
  69. /// A DdnsServerInfoParser handles the scalars which belong to the server.
  70. /// The following is sample configuration in JSON form with extra spacing
  71. /// for clarity:
  72. ///
  73. /// @code
  74. /// {
  75. /// "interface" : "eth1" ,
  76. /// "ip-address" : "192.168.1.33" ,
  77. /// "port" : 88 ,
  78. /// "tsig-keys":
  79. //// [
  80. /// {
  81. /// "name": "d2_key.tmark.org" ,
  82. /// "algorithm": "md5" ,
  83. /// "secret": "0123456989"
  84. /// }
  85. /// ],
  86. /// "forward-ddns" :
  87. /// {
  88. /// "ddns-domains":
  89. /// [
  90. /// {
  91. /// "name": "tmark.org." ,
  92. /// "key-name": "d2_key.tmark.org" ,
  93. /// "dns-servers" :
  94. /// [
  95. /// { "hostname": "fserver.tmark.org" },
  96. /// { "hostname": "f2server.tmark.org" }
  97. /// ]
  98. /// },
  99. /// {
  100. /// "name": "pub.tmark.org." ,
  101. /// "key-name": "d2_key.tmark.org" ,
  102. /// "dns-servers" :
  103. /// [
  104. /// { "hostname": "f3server.tmark.org" }
  105. /// ]
  106. /// }
  107. /// ]
  108. /// },
  109. /// "reverse-ddns" :
  110. /// {
  111. /// "ddns-domains":
  112. /// [
  113. /// {
  114. /// "name": " 0.168.192.in.addr.arpa." ,
  115. /// "key-name": "d2_key.tmark.org" ,
  116. /// "dns-servers" :
  117. /// [
  118. /// { "ip-address": "127.0.0.101" , "port": 100 }
  119. /// ]
  120. /// }
  121. /// ]
  122. /// }
  123. /// }
  124. /// @endcode
  125. /// @brief Exception thrown when the error during configuration handling
  126. /// occurs.
  127. class D2CfgError : public isc::Exception {
  128. public:
  129. D2CfgError(const char* file, size_t line, const char* what) :
  130. isc::Exception(file, line, what) { };
  131. };
  132. /// @brief Acts as a storage vault for D2 global scalar parameters
  133. class D2Params {
  134. public:
  135. /// @brief Default configuration constants.
  136. //@{
  137. /// @todo For now these are hard-coded as configuration layer cannot
  138. /// readily provide them (see Trac #3358).
  139. static const char *DFT_IP_ADDRESS;
  140. static const size_t DFT_PORT;
  141. static const size_t DFT_DNS_SERVER_TIMEOUT;
  142. static const char *DFT_NCR_PROTOCOL;
  143. static const char *DFT_NCR_FORMAT;
  144. //@}
  145. /// @brief Constructor
  146. ///
  147. /// @param ip_address IP address at which D2 should listen for NCRs
  148. /// @param port port on which D2 should listen NCRs
  149. /// @param dns_server_timeout maximum amount of time in milliseconds to
  150. /// wait for a response to a single DNS update request.
  151. /// @param ncr_protocol socket protocol D2 should use to receive NCRS
  152. /// @param ncr_format packet format of the inbound NCRs
  153. ///
  154. /// @throw D2CfgError if:
  155. /// -# ip_address is 0.0.0.0 or ::
  156. /// -# port is 0
  157. /// -# dns_server_timeout is < 1
  158. /// -# ncr_protocol is invalid, currently only NCR_UDP is supported
  159. /// -# ncr_format is invalid, currently only FMT_JSON is supported
  160. D2Params(const isc::asiolink::IOAddress& ip_address,
  161. const size_t port,
  162. const size_t dns_server_timeout,
  163. const dhcp_ddns::NameChangeProtocol& ncr_protocol,
  164. const dhcp_ddns::NameChangeFormat& ncr_format);
  165. /// @brief Default constructor
  166. /// The default constructor creates an instance that has updates disabled.
  167. D2Params();
  168. /// @brief Destructor
  169. virtual ~D2Params();
  170. /// @brief Return the IP address D2 listens on.
  171. const isc::asiolink::IOAddress& getIpAddress() const {
  172. return(ip_address_);
  173. }
  174. /// @brief Return the TCP/UPD port D2 listens on.
  175. size_t getPort() const {
  176. return(port_);
  177. }
  178. /// @brief Return the DNS server timeout value.
  179. size_t getDnsServerTimeout() const {
  180. return(dns_server_timeout_);
  181. }
  182. /// @brief Return the socket protocol in use.
  183. const dhcp_ddns::NameChangeProtocol& getNcrProtocol() const {
  184. return(ncr_protocol_);
  185. }
  186. /// @brief Return the expected format of inbound requests (NCRs).
  187. const dhcp_ddns::NameChangeFormat& getNcrFormat() const {
  188. return(ncr_format_);
  189. }
  190. /// @brief Return summary of the configuration used by D2.
  191. ///
  192. /// The returned summary of the configuration is meant to be appended to
  193. /// the log message informing about the successful completion of the
  194. /// D2 configuration.
  195. ///
  196. /// @return Configuration summary in the textual format.
  197. std::string getConfigSummary() const;
  198. /// @brief Compares two D2Paramss for equality
  199. bool operator == (const D2Params& other) const;
  200. /// @brief Compares two D2Paramss for inequality
  201. bool operator != (const D2Params& other) const;
  202. /// @brief Generates a string representation of the class contents.
  203. std::string toText() const;
  204. protected:
  205. /// @brief Validates member values.
  206. ///
  207. /// Method is used by the constructor to validate member contents.
  208. /// Currently checks:
  209. /// -# ip_address is not 0.0.0.0 or ::
  210. /// -# port is not 0
  211. /// -# dns_server_timeout is 0
  212. /// -# ncr_protocol is UDP
  213. /// -# ncr_format is JSON
  214. ///
  215. /// @throw D2CfgError if contents are invalid
  216. virtual void validateContents();
  217. private:
  218. /// @brief IP address D2 listens on.
  219. isc::asiolink::IOAddress ip_address_;
  220. /// @brief IP port D2 listens on.
  221. size_t port_;
  222. /// @brief Timeout for a single DNS packet exchange in milliseconds.
  223. size_t dns_server_timeout_;
  224. /// @brief The socket protocol to use.
  225. /// Currently only UDP is supported.
  226. dhcp_ddns::NameChangeProtocol ncr_protocol_;
  227. /// @brief Format of the inbound requests (NCRs).
  228. /// Currently only JSON format is supported.
  229. dhcp_ddns::NameChangeFormat ncr_format_;
  230. };
  231. /// @brief Dumps the contents of a D2Params as text to an output stream
  232. ///
  233. /// @param os output stream to which text should be sent
  234. /// @param config D2Param instnace to dump
  235. std::ostream&
  236. operator<<(std::ostream& os, const D2Params& config);
  237. /// @brief Defines a pointer for D2Params instances.
  238. typedef boost::shared_ptr<D2Params> D2ParamsPtr;
  239. /// @brief Represents a TSIG Key.
  240. ///
  241. /// Acts as both a storage class containing the basic attributes which
  242. /// describe a TSIG Key, as well as owning and providing access to an
  243. /// instance of the actual key (@ref isc::dns::TSIGKey) that can be used
  244. /// by the IO layer for signing and verifying messages.
  245. ///
  246. class TSIGKeyInfo {
  247. public:
  248. /// @brief Defines string values for the supported TSIG algorithms
  249. //@{
  250. static const char* HMAC_MD5_STR;
  251. static const char* HMAC_SHA1_STR;
  252. static const char* HMAC_SHA256_STR;
  253. static const char* HMAC_SHA224_STR;
  254. static const char* HMAC_SHA384_STR;
  255. static const char* HMAC_SHA512_STR;
  256. //}@
  257. /// @brief Constructor
  258. ///
  259. /// @param name the unique label used to identify this key
  260. /// @param algorithm the id of the encryption alogirthm this key uses.
  261. /// Currently supported values are (case insensitive):
  262. /// -# "HMAC-MD5"
  263. /// -# "HMAC-SHA1"
  264. /// -# "HMAC-SHA224"
  265. /// -# "HMAC-SHA256"
  266. /// -# "HMAC-SHA384"
  267. /// -# "HMAC-SHA512"
  268. ///
  269. /// @param secret The base-64 encoded secret component for this key.
  270. /// (A suitable string for use here could be obtained by running the
  271. /// BIND 9 dnssec-keygen program; the contents of resulting key file
  272. /// will look similar to:
  273. /// @code
  274. /// Private-key-format: v1.3
  275. /// Algorithm: 157 (HMAC_MD5)
  276. /// Key: LSWXnfkKZjdPJI5QxlpnfQ==
  277. /// Bits: AAA=
  278. /// Created: 20140515143700
  279. /// Publish: 20140515143700
  280. /// Activate: 20140515143700
  281. /// @endcode
  282. /// where the value the "Key:" entry is the secret component of the key.)
  283. /// @param digestbits the minimum truncated length in bits
  284. ///
  285. /// @throw D2CfgError if values supplied are invalid:
  286. /// name cannot be blank, algorithm must be a supported value,
  287. /// secret must be a non-blank, base64 encoded string.
  288. TSIGKeyInfo(const std::string& name, const std::string& algorithm,
  289. const std::string& secret, uint32_t digestbits = 0);
  290. /// @brief Destructor
  291. virtual ~TSIGKeyInfo();
  292. /// @brief Getter which returns the key's name.
  293. ///
  294. /// @return returns the name as a std::string.
  295. const std::string getName() const {
  296. return (name_);
  297. }
  298. /// @brief Getter which returns the key's algorithm string ID
  299. ///
  300. /// @return returns the algorithm as a std::string.
  301. const std::string getAlgorithm() const {
  302. return (algorithm_);
  303. }
  304. /// @brief Getter which returns the key's minimum truncated length
  305. ///
  306. /// @return returns the minimum truncated length or 0 as an uint32_t
  307. uint32_t getDigestbits() const {
  308. return (digestbits_);
  309. }
  310. /// @brief Getter which returns the key's secret.
  311. ///
  312. /// @return returns the secret as a std::string.
  313. const std::string getSecret() const {
  314. return (secret_);
  315. }
  316. /// @brief Getter which returns the TSIG key used to sign and verify
  317. /// messages
  318. ///
  319. /// @return const pointer reference to dns::TSIGKey.
  320. const dns::TSIGKeyPtr& getTSIGKey() const {
  321. return (tsig_key_);
  322. }
  323. /// @brief Converts algorithm id to dns::TSIGKey algorithm dns::Name
  324. ///
  325. /// @param algorithm_id string value to translate into an algorithm name.
  326. /// Currently supported values are (case insensitive):
  327. /// -# "HMAC-MD5"
  328. /// -# "HMAC-SHA1"
  329. /// -# "HMAC-SHA224"
  330. /// -# "HMAC-SHA256"
  331. /// -# "HMAC-SHA384"
  332. /// -# "HMAC-SHA512"
  333. ///
  334. /// @return const reference to a dns::Name containing the algorithm name
  335. /// @throw BadValue if ID isn't recognized.
  336. static const dns::Name& stringToAlgorithmName(const std::string&
  337. algorithm_id);
  338. private:
  339. /// @brief Creates the actual TSIG key instance member
  340. ///
  341. /// Replaces this tsig_key member with a key newly created using the key
  342. /// name, algorithm id, digest bits, and secret.
  343. /// This method is currently only called by the constructor, however it
  344. /// could be called post-construction should keys ever support expiration.
  345. ///
  346. /// @throw D2CfgError with an explanation if the key could not be created.
  347. void remakeKey();
  348. /// @brief The name of the key.
  349. ///
  350. /// This value is the unique identifier that domains use to
  351. /// to specify which TSIG key they need.
  352. std::string name_;
  353. /// @brief The string ID of the algorithm that should be used for this key.
  354. std::string algorithm_;
  355. /// @brief The base64 encoded string secret value component of this key.
  356. std::string secret_;
  357. /// @brief The minimum truncated length in bits
  358. /// (0 means no truncation is allowed and is the default)
  359. uint32_t digestbits_;
  360. /// @brief The actual TSIG key.
  361. dns::TSIGKeyPtr tsig_key_;
  362. };
  363. /// @brief Defines a pointer for TSIGKeyInfo instances.
  364. typedef boost::shared_ptr<TSIGKeyInfo> TSIGKeyInfoPtr;
  365. /// @brief Defines a map of TSIGKeyInfos, keyed by the name.
  366. typedef std::map<std::string, TSIGKeyInfoPtr> TSIGKeyInfoMap;
  367. /// @brief Defines a iterator pairing of name and TSIGKeyInfo
  368. typedef std::pair<std::string, TSIGKeyInfoPtr> TSIGKeyInfoMapPair;
  369. /// @brief Defines a pointer to map of TSIGkeyInfos
  370. typedef boost::shared_ptr<TSIGKeyInfoMap> TSIGKeyInfoMapPtr;
  371. /// @brief Represents a specific DNS Server.
  372. /// It provides information about the server's network identity and typically
  373. /// belongs to a list of servers supporting DNS for a given domain. It will
  374. /// be used to establish communications with the server to carry out DNS
  375. /// updates.
  376. class DnsServerInfo {
  377. public:
  378. /// @brief defines DNS standard port value
  379. static const uint32_t STANDARD_DNS_PORT = 53;
  380. /// @brief defines an "empty" string version of an ip address.
  381. static const char* EMPTY_IP_STR;
  382. /// @brief Constructor
  383. ///
  384. /// @param hostname is the resolvable name of the server. If not blank,
  385. /// then the server address should be resolved at runtime.
  386. /// @param ip_address is the static IP address of the server. If hostname
  387. /// is blank, then this address should be used to connect to the server.
  388. /// @param port is the port number on which the server listens.
  389. /// primarily meant for testing purposes. Normally, DNS traffic is on
  390. /// is port 53. (NOTE the constructing code is responsible for setting
  391. /// the default.)
  392. /// @param enabled is a flag that indicates whether this server is
  393. /// enabled for use. It defaults to true.
  394. DnsServerInfo(const std::string& hostname,
  395. isc::asiolink::IOAddress ip_address,
  396. uint32_t port = STANDARD_DNS_PORT,
  397. bool enabled=true);
  398. /// @brief Destructor
  399. virtual ~DnsServerInfo();
  400. /// @brief Getter which returns the server's hostname.
  401. ///
  402. /// @return returns the hostname as as std::string.
  403. const std::string getHostname() const {
  404. return (hostname_);
  405. }
  406. /// @brief Getter which returns the server's port number.
  407. ///
  408. /// @return returns the port number as a unsigned integer.
  409. uint32_t getPort() const {
  410. return (port_);
  411. }
  412. /// @brief Getter which returns the server's ip_address.
  413. ///
  414. /// @return returns the address as an IOAddress reference.
  415. const isc::asiolink::IOAddress& getIpAddress() const {
  416. return (ip_address_);
  417. }
  418. /// @brief Convenience method which returns whether or not the
  419. /// server is enabled.
  420. ///
  421. /// @return returns true if the server is enabled, false otherwise.
  422. bool isEnabled() const {
  423. return (enabled_);
  424. }
  425. /// @brief Sets the server's enabled flag to true.
  426. void enable() {
  427. enabled_ = true;
  428. }
  429. /// @brief Sets the server's enabled flag to false.
  430. void disable() {
  431. enabled_ = false;
  432. }
  433. /// @brief Returns a text representation for the server.
  434. std::string toText() const;
  435. private:
  436. /// @brief The resolvable name of the server. If not blank, then the
  437. /// server's IP address should be dynamically resolved at runtime.
  438. std::string hostname_;
  439. /// @brief The static IP address of the server. When hostname is blank,
  440. /// then this address should be used to connect to the server.
  441. isc::asiolink::IOAddress ip_address_;
  442. /// @brief The port number on which the server listens for DNS traffic.
  443. uint32_t port_;
  444. /// @param enabled is a flag that indicates whether this server is
  445. /// enabled for use. It defaults to true.
  446. bool enabled_;
  447. };
  448. std::ostream&
  449. operator<<(std::ostream& os, const DnsServerInfo& server);
  450. /// @brief Defines a pointer for DnsServerInfo instances.
  451. typedef boost::shared_ptr<DnsServerInfo> DnsServerInfoPtr;
  452. /// @brief Defines a storage container for DnsServerInfo pointers.
  453. typedef std::vector<DnsServerInfoPtr> DnsServerInfoStorage;
  454. /// @brief Defines a pointer to DnsServerInfo storage containers.
  455. typedef boost::shared_ptr<DnsServerInfoStorage> DnsServerInfoStoragePtr;
  456. /// @brief Represents a DNS domain that is may be updated dynamically.
  457. /// This class specifies a DNS domain and the list of DNS servers that support
  458. /// it. It's primary use is to map a domain to the DNS server(s) responsible
  459. /// for it.
  460. /// @todo Currently the name entry for a domain is just an std::string. It
  461. /// may be worthwhile to change this to a dns::Name for purposes of better
  462. /// validation and matching capabilities.
  463. class DdnsDomain {
  464. public:
  465. /// @brief Constructor
  466. ///
  467. /// @param name is the domain name of the domain.
  468. /// @param servers is the list of server(s) supporting this domain.
  469. /// @param tsig_key_info pointer to the TSIGKeyInfo for the dommain's key
  470. /// It defaults to an empty pointer, signifying the domain has no key.
  471. DdnsDomain(const std::string& name,
  472. DnsServerInfoStoragePtr servers,
  473. const TSIGKeyInfoPtr& tsig_key_info = TSIGKeyInfoPtr());
  474. /// @brief Destructor
  475. virtual ~DdnsDomain();
  476. /// @brief Getter which returns the domain's name.
  477. ///
  478. /// @return returns the name in an std::string.
  479. const std::string getName() const {
  480. return (name_);
  481. }
  482. /// @brief Convenience method which returns the domain's TSIG key name.
  483. ///
  484. /// @return returns the key name in an std::string. If domain has no
  485. /// TSIG key, the string will empty.
  486. const std::string getKeyName() const;
  487. /// @brief Getter which returns the domain's list of servers.
  488. ///
  489. /// @return returns the pointer to the server storage.
  490. const DnsServerInfoStoragePtr& getServers() {
  491. return (servers_);
  492. }
  493. /// @brief Getter which returns the domain's TSIGKey info
  494. ///
  495. /// @return returns the pointer to the server storage. If the domain
  496. /// is not configured to use TSIG the pointer will be empty.
  497. const TSIGKeyInfoPtr& getTSIGKeyInfo() {
  498. return (tsig_key_info_);
  499. }
  500. private:
  501. /// @brief The domain name of the domain.
  502. std::string name_;
  503. /// @brief The list of server(s) supporting this domain.
  504. DnsServerInfoStoragePtr servers_;
  505. /// @brief Pointer to domain's the TSIGKeyInfo.
  506. /// Value is empty if the domain is not configured for TSIG.
  507. TSIGKeyInfoPtr tsig_key_info_;
  508. };
  509. /// @brief Defines a pointer for DdnsDomain instances.
  510. typedef boost::shared_ptr<DdnsDomain> DdnsDomainPtr;
  511. /// @brief Defines a map of DdnsDomains, keyed by the domain name.
  512. typedef std::map<std::string, DdnsDomainPtr> DdnsDomainMap;
  513. /// @brief Defines a iterator pairing domain name and DdnsDomain
  514. typedef std::pair<std::string, DdnsDomainPtr> DdnsDomainMapPair;
  515. /// @brief Defines a pointer to DdnsDomain storage containers.
  516. typedef boost::shared_ptr<DdnsDomainMap> DdnsDomainMapPtr;
  517. /// @brief Provides storage for and management of a list of DNS domains.
  518. /// In addition to housing the domain list storage, it provides domain matching
  519. /// services. These services are used to match a FQDN to a domain. Currently
  520. /// it supports a single matching service, which will return the matching
  521. /// domain or a wild card domain if one is specified. The wild card domain is
  522. /// specified as a domain whose name is "*". The wild card domain will match
  523. /// any entry and is provided for flexibility in FQDNs If for instance, all
  524. /// forward requests are handled by the same servers, the configuration could
  525. /// specify the wild card domain as the only forward domain. All forward DNS
  526. /// updates would be sent to that one list of servers, regardless of the FQDN.
  527. /// As matching capabilities evolve this class is expected to expand.
  528. class DdnsDomainListMgr {
  529. public:
  530. /// @brief defines the domain name for denoting the wildcard domain.
  531. static const char* wildcard_domain_name_;
  532. /// @brief Constructor
  533. ///
  534. /// @param name is an arbitrary label assigned to this manager.
  535. DdnsDomainListMgr(const std::string& name);
  536. /// @brief Destructor
  537. virtual ~DdnsDomainListMgr ();
  538. /// @brief Matches a given name to a domain based on a longest match
  539. /// scheme.
  540. ///
  541. /// Given a FQDN, search the list of domains, successively removing a
  542. /// sub-domain from the FQDN until a match is found. If no match is found
  543. /// and the wild card domain is present in the list, then return it as the
  544. /// match. If the wild card domain is the only domain in the list, then
  545. /// it will be returned immediately for any FQDN.
  546. ///
  547. /// @param fqdn is the name for which to look.
  548. /// @param domain receives the matching domain. If no match is found its
  549. /// contents will be unchanged.
  550. ///
  551. /// @return returns true if a match is found, false otherwise.
  552. /// @todo This is a very basic match method, which expects valid FQDNs
  553. /// both as input and for the DdnsDomain::getName(). Currently both are
  554. /// simple strings and there is no normalization (i.e. added trailing dots
  555. /// if missing).
  556. virtual bool matchDomain(const std::string& fqdn, DdnsDomainPtr& domain);
  557. /// @brief Fetches the manager's name.
  558. ///
  559. /// @return returns a std::string containing the name of the manager.
  560. const std::string getName() const {
  561. return (name_);
  562. }
  563. /// @brief Returns the number of domains in the domain list.
  564. ///
  565. /// @brief returns an unsigned int containing the domain count.
  566. uint32_t size() const {
  567. return (domains_->size());
  568. }
  569. /// @brief Fetches the wild card domain.
  570. ///
  571. /// @return returns a pointer reference to the domain. The pointer will
  572. /// empty if the wild card domain is not present.
  573. const DdnsDomainPtr& getWildcardDomain() {
  574. return (wildcard_domain_);
  575. }
  576. /// @brief Fetches the domain list.
  577. ///
  578. /// @return returns a pointer reference to the list of domains.
  579. const DdnsDomainMapPtr &getDomains() {
  580. return (domains_);
  581. }
  582. /// @brief Sets the manger's domain list to the given list of domains.
  583. /// This method will scan the inbound list for the wild card domain and
  584. /// set the internal wild card domain pointer accordingly.
  585. void setDomains(DdnsDomainMapPtr domains);
  586. private:
  587. /// @brief An arbitrary label assigned to this manager.
  588. std::string name_;
  589. /// @brief Map of the domains, keyed by name.
  590. DdnsDomainMapPtr domains_;
  591. /// @brief Pointer to the wild card domain.
  592. DdnsDomainPtr wildcard_domain_;
  593. };
  594. /// @brief Defines a pointer for DdnsDomain instances.
  595. typedef boost::shared_ptr<DdnsDomainListMgr> DdnsDomainListMgrPtr;
  596. /// @brief Storage container for scalar configuration parameters.
  597. ///
  598. /// This class is useful for implementing parsers for more complex configuration
  599. /// elements (e.g. those of item type "map"). It provides a convenient way to
  600. /// add storage to the parser for an arbitrary number and variety of scalar
  601. /// configuration items (e.g. ints, bools, strings...) without explicitly adding
  602. /// storage for each individual type needed by the parser.
  603. ///
  604. /// This class implements a concrete version of the base class by supplying a
  605. /// "clone" method.
  606. class DScalarContext : public DCfgContextBase {
  607. public:
  608. /// @brief Constructor
  609. DScalarContext() {
  610. };
  611. /// @brief Destructor
  612. virtual ~DScalarContext() {
  613. }
  614. /// @brief Creates a clone of a DStubContext.
  615. ///
  616. /// @return returns a pointer to the new clone.
  617. virtual DCfgContextBasePtr clone() {
  618. return (DCfgContextBasePtr(new DScalarContext(*this)));
  619. }
  620. protected:
  621. /// @brief Copy constructor
  622. DScalarContext(const DScalarContext& rhs) : DCfgContextBase(rhs) {
  623. }
  624. private:
  625. /// @brief Private assignment operator, not implemented.
  626. DScalarContext& operator=(const DScalarContext& rhs);
  627. };
  628. /// @brief Defines a pointer for DScalarContext instances.
  629. typedef boost::shared_ptr<DScalarContext> DScalarContextPtr;
  630. /// @brief Parser for TSIGKeyInfo
  631. ///
  632. /// This class parses the configuration element "tsig-key" defined in
  633. /// src/bin/d2/dhcp-ddns.spec and creates an instance of a TSIGKeyInfo.
  634. class TSIGKeyInfoParser : public isc::dhcp::DhcpConfigParser {
  635. public:
  636. /// @brief Constructor
  637. ///
  638. /// @param entry_name is an arbitrary label assigned to this configuration
  639. /// definition. Since servers are specified in a list this value is likely
  640. /// be something akin to "key:0", set during parsing.
  641. /// @param keys is a pointer to the storage area to which the parser
  642. /// should commit the newly created TSIGKeyInfo instance.
  643. TSIGKeyInfoParser(const std::string& entry_name, TSIGKeyInfoMapPtr keys);
  644. /// @brief Destructor
  645. virtual ~TSIGKeyInfoParser();
  646. /// @brief Performs the actual parsing of the given "tsig-key" element.
  647. ///
  648. /// Parses a configuration for the elements needed to instantiate a
  649. /// TSIGKeyInfo, validates those entries, creates a TSIGKeyInfo instance
  650. /// then attempts to add to a list of keys
  651. ///
  652. /// @param key_config is the "tsig-key" configuration to parse
  653. virtual void build(isc::data::ConstElementPtr key_config);
  654. /// @brief Creates a parser for the given "tsig-key" member element id.
  655. ///
  656. /// The key elements currently supported are(see dhcp-ddns.spec):
  657. /// 1. name
  658. /// 2. algorithm
  659. /// 3. digestbits
  660. /// 4. secret
  661. ///
  662. /// @param config_id is the "item_name" for a specific member element of
  663. /// the "tsig-key" specification.
  664. /// @param pos position within the configuration text (or file) of element
  665. /// to be parsed. This is passed for error messaging.
  666. ///
  667. /// @return returns a pointer to newly created parser.
  668. ///
  669. /// @throw D2CfgError if configuration contains an unknown parameter
  670. virtual isc::dhcp::ParserPtr
  671. createConfigParser(const std::string& config_id,
  672. const isc::data::Element::Position& pos =
  673. isc::data::Element::ZERO_POSITION());
  674. /// @brief Commits the TSIGKeyInfo configuration
  675. /// Currently this method is a NOP, as the key instance is created and
  676. /// then added to a local list of keys in build().
  677. virtual void commit();
  678. private:
  679. /// @brief Arbitrary label assigned to this parser instance.
  680. /// Since servers are specified in a list this value is likely be something
  681. /// akin to "key:0", set during parsing. Primarily here for diagnostics.
  682. std::string entry_name_;
  683. /// @brief Pointer to the storage area to which the parser should commit
  684. /// the newly created TSIGKeyInfo instance. This is given to us as a
  685. /// constructor argument by an upper level.
  686. TSIGKeyInfoMapPtr keys_;
  687. /// @brief Local storage area for scalar parameter values. Use to hold
  688. /// data until time to commit.
  689. DScalarContext local_scalars_;
  690. };
  691. /// @brief Parser for a list of TSIGKeyInfos
  692. ///
  693. /// This class parses a list of "tsig-key" configuration elements.
  694. /// (see src/bin/d2/dhcp-ddns.spec). The TSIGKeyInfo instances are added
  695. /// to the given storage upon commit.
  696. class TSIGKeyInfoListParser : public isc::dhcp::DhcpConfigParser {
  697. public:
  698. /// @brief Constructor
  699. ///
  700. /// @param list_name is an arbitrary label assigned to this parser instance.
  701. /// @param keys is a pointer to the storage area to which the parser
  702. /// should commit the newly created TSIGKeyInfo instance.
  703. TSIGKeyInfoListParser(const std::string& list_name, TSIGKeyInfoMapPtr keys);
  704. /// @brief Destructor
  705. virtual ~TSIGKeyInfoListParser();
  706. /// @brief Performs the parsing of the given list "tsig-key" elements.
  707. ///
  708. /// It iterates over each key entry in the list:
  709. /// 1. Instantiate a TSIGKeyInfoParser for the entry
  710. /// 2. Pass the element configuration to the parser's build method
  711. /// 3. Add the parser instance to local storage
  712. ///
  713. /// The net effect is to parse all of the key entries in the list
  714. /// prepping them for commit.
  715. ///
  716. /// @param key_list_config is the list of "tsig_key" elements to parse.
  717. virtual void build(isc::data::ConstElementPtr key_list_config);
  718. /// @brief Commits the list of TSIG keys
  719. ///
  720. /// Iterates over the internal list of TSIGKeyInfoParsers, invoking
  721. /// commit on each one. Then commits the local list of keys to
  722. /// storage.
  723. virtual void commit();
  724. private:
  725. /// @brief Arbitrary label assigned to this parser instance.
  726. std::string list_name_;
  727. /// @brief Pointer to the storage area to which the parser should commit
  728. /// the list of newly created TSIGKeyInfo instances. This is given to us
  729. /// as a constructor argument by an upper level.
  730. TSIGKeyInfoMapPtr keys_;
  731. /// @brief Local storage area to which individual key parsers commit.
  732. TSIGKeyInfoMapPtr local_keys_;
  733. /// @brief Local storage of TSIGKeyInfoParser instances
  734. isc::dhcp::ParserCollection parsers_;
  735. };
  736. /// @brief Parser for DnsServerInfo
  737. ///
  738. /// This class parses the configuration element "dns-server" defined in
  739. /// src/bin/d2/dhcp-ddns.spec and creates an instance of a DnsServerInfo.
  740. class DnsServerInfoParser : public isc::dhcp::DhcpConfigParser {
  741. public:
  742. /// @brief Constructor
  743. ///
  744. /// @param entry_name is an arbitrary label assigned to this configuration
  745. /// definition. Since servers are specified in a list this value is likely
  746. /// be something akin to "server:0", set during parsing.
  747. /// @param servers is a pointer to the storage area to which the parser
  748. /// should commit the newly created DnsServerInfo instance.
  749. DnsServerInfoParser(const std::string& entry_name,
  750. DnsServerInfoStoragePtr servers);
  751. /// @brief Destructor
  752. virtual ~DnsServerInfoParser();
  753. /// @brief Performs the actual parsing of the given "dns-server" element.
  754. ///
  755. /// Parses a configuration for the elements needed to instantiate a
  756. /// DnsServerInfo, validates those entries, creates a DnsServerInfo instance
  757. /// then attempts to add to a list of servers.
  758. ///
  759. /// @param server_config is the "dns-server" configuration to parse
  760. ///
  761. /// @throw D2CfgError if:
  762. /// -# hostname is not blank, hostname is not yet supported
  763. /// -# ip_address is invalid
  764. /// -# port is 0
  765. virtual void build(isc::data::ConstElementPtr server_config);
  766. /// @brief Creates a parser for the given "dns-server" member element id.
  767. ///
  768. /// The server elements currently supported are(see dhcp-ddns.spec):
  769. /// 1. hostname
  770. /// 2. ip_address
  771. /// 3. port
  772. ///
  773. /// @param config_id is the "item_name" for a specific member element of
  774. /// the "dns-server" specification.
  775. /// @param pos position within the configuration text (or file) of element
  776. /// to be parsed. This is passed for error messaging.
  777. ///
  778. /// @return returns a pointer to newly created parser.
  779. ///
  780. /// @throw D2CfgError if configuration contains an unknown parameter
  781. virtual isc::dhcp::ParserPtr
  782. createConfigParser(const std::string& config_id,
  783. const isc::data::Element::Position& =
  784. isc::data::Element::ZERO_POSITION());
  785. /// @brief Commits the configured DnsServerInfo
  786. /// Currently this method is a NOP, as the server instance is created and
  787. /// then added to the list of servers in build().
  788. virtual void commit();
  789. private:
  790. /// @brief Arbitrary label assigned to this parser instance.
  791. /// Since servers are specified in a list this value is likely be something
  792. /// akin to "server:0", set during parsing. Primarily here for diagnostics.
  793. std::string entry_name_;
  794. /// @brief Pointer to the storage area to which the parser should commit
  795. /// the newly created DnsServerInfo instance. This is given to us as a
  796. /// constructor argument by an upper level.
  797. DnsServerInfoStoragePtr servers_;
  798. /// @brief Local storage area for scalar parameter values. Use to hold
  799. /// data until time to commit.
  800. DScalarContext local_scalars_;
  801. };
  802. /// @brief Parser for a list of DnsServerInfos
  803. ///
  804. /// This class parses a list of "dns-server" configuration elements.
  805. /// (see src/bin/d2/dhcp-ddns.spec). The DnsServerInfo instances are added
  806. /// to the given storage upon commit.
  807. class DnsServerInfoListParser : public isc::dhcp::DhcpConfigParser {
  808. public:
  809. /// @brief Constructor
  810. ///
  811. /// @param list_name is an arbitrary label assigned to this parser instance.
  812. /// @param servers is a pointer to the storage area to which the parser
  813. /// should commit the newly created DnsServerInfo instance.
  814. DnsServerInfoListParser(const std::string& list_name,
  815. DnsServerInfoStoragePtr servers);
  816. /// @brief Destructor
  817. virtual ~DnsServerInfoListParser();
  818. /// @brief Performs the actual parsing of the given list "dns-server"
  819. /// elements.
  820. /// It iterates over each server entry in the list:
  821. /// 1. Instantiate a DnsServerInfoParser for the entry
  822. /// 2. Pass the element configuration to the parser's build method
  823. /// 3. Add the parser instance to local storage
  824. ///
  825. /// The net effect is to parse all of the server entries in the list
  826. /// prepping them for commit.
  827. ///
  828. /// @param server_list_config is the list of "dns-server" elements to parse.
  829. virtual void build(isc::data::ConstElementPtr server_list_config);
  830. /// @brief Commits the list of DnsServerInfos
  831. ///
  832. /// Iterates over the internal list of DdnsServerInfoParsers, invoking
  833. /// commit on each one.
  834. virtual void commit();
  835. private:
  836. /// @brief Arbitrary label assigned to this parser instance.
  837. std::string list_name_;
  838. /// @brief Pointer to the storage area to which the parser should commit
  839. /// the list of newly created DnsServerInfo instances. This is given to us
  840. /// as a constructor argument by an upper level.
  841. DnsServerInfoStoragePtr servers_;
  842. /// @brief Local storage of DnsServerInfoParser instances
  843. isc::dhcp::ParserCollection parsers_;
  844. };
  845. /// @brief Parser for DdnsDomain
  846. ///
  847. /// This class parses the configuration element "ddns-domain" defined in
  848. /// src/bin/d2/dhcp-ddns.spec and creates an instance of a DdnsDomain.
  849. class DdnsDomainParser : public isc::dhcp::DhcpConfigParser {
  850. public:
  851. /// @brief Constructor
  852. ///
  853. /// @param entry_name is an arbitrary label assigned to this configuration
  854. /// definition. Since domains are specified in a list this value is likely
  855. /// be something akin to "forward-ddns:0", set during parsing.
  856. /// @param domains is a pointer to the storage area to which the parser
  857. /// @param keys is a pointer to a map of the defined TSIG keys.
  858. /// should commit the newly created DdnsDomain instance.
  859. DdnsDomainParser(const std::string& entry_name, DdnsDomainMapPtr domains,
  860. TSIGKeyInfoMapPtr keys);
  861. /// @brief Destructor
  862. virtual ~DdnsDomainParser();
  863. /// @brief Performs the actual parsing of the given "ddns-domain" element.
  864. ///
  865. /// Parses a configuration for the elements needed to instantiate a
  866. /// DdnsDomain, validates those entries, creates a DdnsDomain instance
  867. /// then attempts to add it to a list of domains.
  868. ///
  869. /// @param domain_config is the "ddns-domain" configuration to parse
  870. virtual void build(isc::data::ConstElementPtr domain_config);
  871. /// @brief Creates a parser for the given "ddns-domain" member element id.
  872. ///
  873. /// The domain elements currently supported are(see dhcp-ddns.spec):
  874. /// 1. name
  875. /// 2. key_name
  876. /// 3. dns_servers
  877. ///
  878. /// @param config_id is the "item_name" for a specific member element of
  879. /// the "ddns-domain" specification.
  880. /// @param pos position within the configuration text (or file) of element
  881. /// to be parsed. This is passed for error messaging.
  882. ///
  883. /// @return returns a pointer to newly created parser.
  884. ///
  885. /// @throw D2CfgError if configuration contains an unknown parameter
  886. virtual isc::dhcp::ParserPtr
  887. createConfigParser(const std::string& config_id,
  888. const isc::data::Element::Position& pos =
  889. isc::data::Element::ZERO_POSITION());
  890. /// @brief Commits the configured DdnsDomain
  891. /// Currently this method is a NOP, as the domain instance is created and
  892. /// then added to the list of domains in build().
  893. virtual void commit();
  894. private:
  895. /// @brief Arbitrary label assigned to this parser instance.
  896. std::string entry_name_;
  897. /// @brief Pointer to the storage area to which the parser should commit
  898. /// the newly created DdnsDomain instance. This is given to us as a
  899. /// constructor argument by an upper level.
  900. DdnsDomainMapPtr domains_;
  901. /// @brief Pointer to the map of defined TSIG keys.
  902. /// This map is passed into us and contains all of the TSIG keys defined
  903. /// for this configuration. It is used to validate the key name entry of
  904. /// DdnsDomains that specify one.
  905. TSIGKeyInfoMapPtr keys_;
  906. /// @brief Local storage for DnsServerInfo instances. This is passed into
  907. /// DnsServerInfoListParser(s), which in turn passes it into each
  908. /// DnsServerInfoParser. When the DnsServerInfoParsers "commit" they add
  909. /// their server instance to this storage.
  910. DnsServerInfoStoragePtr local_servers_;
  911. /// @brief Local storage area for scalar parameter values. Use to hold
  912. /// data until time to commit.
  913. DScalarContext local_scalars_;
  914. };
  915. /// @brief Parser for a list of DdnsDomains
  916. ///
  917. /// This class parses a list of "ddns-domain" configuration elements.
  918. /// (see src/bin/d2/dhcp-ddns.spec). The DdnsDomain instances are added
  919. /// to the given storage upon commit.
  920. class DdnsDomainListParser : public isc::dhcp::DhcpConfigParser {
  921. public:
  922. /// @brief Constructor
  923. ///
  924. /// @param list_name is an arbitrary label assigned to this parser instance.
  925. /// @param domains is a pointer to the storage area to which the parser
  926. /// @param keys is a pointer to a map of the defined TSIG keys.
  927. /// should commit the newly created DdnsDomain instance.
  928. DdnsDomainListParser(const std::string& list_name,
  929. DdnsDomainMapPtr domains, TSIGKeyInfoMapPtr keys);
  930. /// @brief Destructor
  931. virtual ~DdnsDomainListParser();
  932. /// @brief Performs the actual parsing of the given list "ddns-domain"
  933. /// elements.
  934. /// It iterates over each domain entry in the list:
  935. /// 1. Instantiate a DdnsDomainParser for the entry
  936. /// 2. Pass the element configuration to the parser's build method
  937. /// 3. Add the parser instance to local storage
  938. ///
  939. /// The net effect is to parse all of the domain entries in the list
  940. /// prepping them for commit.
  941. ///
  942. /// @param domain_list_config is the list of "ddns-domain" elements to
  943. /// parse.
  944. virtual void build(isc::data::ConstElementPtr domain_list_config);
  945. /// @brief Commits the list of DdnsDomains
  946. ///
  947. /// Iterates over the internal list of DdnsDomainParsers, invoking
  948. /// commit on each one.
  949. virtual void commit();
  950. private:
  951. /// @brief Arbitrary label assigned to this parser instance.
  952. std::string list_name_;
  953. /// @brief Pointer to the storage area to which the parser should commit
  954. /// the list of newly created DdnsDomain instances. This is given to us
  955. /// as a constructor argument by an upper level.
  956. DdnsDomainMapPtr domains_;
  957. /// @brief Pointer to the map of defined TSIG keys.
  958. /// This map is passed into us and contains all of the TSIG keys defined
  959. /// for this configuration. It is used to validate the key name entry of
  960. /// DdnsDomains that specify one.
  961. TSIGKeyInfoMapPtr keys_;
  962. /// @brief Local storage of DdnsDomainParser instances
  963. isc::dhcp::ParserCollection parsers_;
  964. };
  965. /// @brief Parser for DdnsDomainListMgr
  966. ///
  967. /// This class parses the configuration elements "forward-ddns" and
  968. /// "reverse-ddns" as defined in src/bin/d2/dhcp-ddns.spec. It populates the
  969. /// given DdnsDomainListMgr with parsed information upon commit. Note that
  970. /// unlike other parsers, this parser does NOT instantiate the final object
  971. /// during the commit phase, it populates it. It must pre-exist.
  972. class DdnsDomainListMgrParser : public isc::dhcp::DhcpConfigParser {
  973. public:
  974. /// @brief Constructor
  975. ///
  976. /// @param entry_name is an arbitrary label assigned to this configuration
  977. /// definition.
  978. /// @param mgr is a pointer to the DdnsDomainListMgr to populate.
  979. /// @param keys is a pointer to a map of the defined TSIG keys.
  980. /// @throw throws D2CfgError if mgr pointer is empty.
  981. DdnsDomainListMgrParser(const std::string& entry_name,
  982. DdnsDomainListMgrPtr mgr, TSIGKeyInfoMapPtr keys);
  983. /// @brief Destructor
  984. virtual ~DdnsDomainListMgrParser();
  985. /// @brief Performs the actual parsing of the given manager element.
  986. ///
  987. /// Parses a configuration for the elements needed to instantiate a
  988. /// DdnsDomainListMgr, validates those entries, then creates a
  989. /// DdnsDomainListMgr.
  990. ///
  991. /// @param mgr_config is the manager configuration to parse
  992. virtual void build(isc::data::ConstElementPtr mgr_config);
  993. /// @brief Creates a parser for the given manager member element id.
  994. ///
  995. /// The manager elements currently supported are (see dhcp-ddns.spec):
  996. /// 1. ddns_domains
  997. ///
  998. /// @param config_id is the "item_name" for a specific member element of
  999. /// the manager specification.
  1000. /// @param pos position within the configuration text (or file) of element
  1001. /// to be parsed. This is passed for error messaging.
  1002. ///
  1003. /// @return returns a pointer to newly created parser.
  1004. ///
  1005. /// @throw D2CfgError if configuration contains an unknown parameter
  1006. virtual isc::dhcp::ParserPtr
  1007. createConfigParser(const std::string& config_id,
  1008. const isc::data::Element::Position& pos =
  1009. isc::data::Element::ZERO_POSITION());
  1010. /// @brief Commits the configured DdsnDomainListMgr
  1011. /// Currently this method is a NOP, as the manager instance is created
  1012. /// in build().
  1013. virtual void commit();
  1014. private:
  1015. /// @brief Arbitrary label assigned to this parser instance.
  1016. std::string entry_name_;
  1017. /// @brief Pointer to manager instance to which the parser should commit
  1018. /// the parsed data. This is given to us as a constructor argument by an
  1019. /// upper level.
  1020. DdnsDomainListMgrPtr mgr_;
  1021. /// @brief Pointer to the map of defined TSIG keys.
  1022. /// This map is passed into us and contains all of the TSIG keys defined
  1023. /// for this configuration. It is used to validate the key name entry of
  1024. /// DdnsDomains that specify one.
  1025. TSIGKeyInfoMapPtr keys_;
  1026. /// @brief Local storage for DdnsDomain instances. This is passed into a
  1027. /// DdnsDomainListParser(s), which in turn passes it into each
  1028. /// DdnsDomainParser. When the DdnsDomainParsers "commit" they add their
  1029. /// domain instance to this storage.
  1030. DdnsDomainMapPtr local_domains_;
  1031. /// @brief Local storage area for scalar parameter values. Use to hold
  1032. /// data until time to commit.
  1033. /// @todo Currently, the manager has no scalars but this is likely to
  1034. /// change as matching capabilities expand.
  1035. DScalarContext local_scalars_;
  1036. };
  1037. }; // end of isc::d2 namespace
  1038. }; // end of isc namespace
  1039. #endif // D2_CONFIG_H