ncr_msg.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. // Copyright (C) 2013 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 NCR_MSG_H
  15. #define NCR_MSG_H
  16. /// @file ncr_msg.h
  17. /// @brief This file provides the classes needed to embody, compose, and
  18. /// decompose DNS update requests that are sent by DHCP-DDNS clients to
  19. /// DHCP-DDNS. These requests are referred to as NameChangeRequests.
  20. #include <cc/data.h>
  21. #include <dhcp/duid.h>
  22. #include <dhcp/hwaddr.h>
  23. #include <dns/name.h>
  24. #include <exceptions/exceptions.h>
  25. #include <util/buffer.h>
  26. #include <util/encode/hex.h>
  27. #include <util/time_utilities.h>
  28. #include <time.h>
  29. #include <string>
  30. namespace isc {
  31. namespace dhcp_ddns {
  32. /// @brief Exception thrown when NameChangeRequest marshalling error occurs.
  33. class NcrMessageError : public isc::Exception {
  34. public:
  35. NcrMessageError(const char* file, size_t line, const char* what) :
  36. isc::Exception(file, line, what) { };
  37. };
  38. /// @brief Exception thrown when there is an error occured during computation
  39. /// of the DHCID.
  40. class DhcidRdataComputeError : public isc::Exception {
  41. public:
  42. DhcidRdataComputeError(const char* file, size_t line, const char* what) :
  43. isc::Exception(file, line, what) { };
  44. };
  45. /// @brief Defines the types of DNS updates that can be requested.
  46. enum NameChangeType {
  47. CHG_ADD,
  48. CHG_REMOVE
  49. };
  50. /// @brief Defines the runtime processing status values for requests.
  51. enum NameChangeStatus {
  52. ST_NEW,
  53. ST_PENDING,
  54. ST_COMPLETED,
  55. ST_FAILED
  56. };
  57. /// @brief Defines the list of data wire formats supported.
  58. enum NameChangeFormat {
  59. FMT_JSON
  60. };
  61. /// @brief Function which converts labels to NameChangeFormat enum values.
  62. ///
  63. /// @param format_str text to convert to an enum.
  64. /// Valid string values: "JSON"
  65. ///
  66. /// @return NameChangeFormat value which maps to the given string.
  67. ///
  68. /// @throw isc::BadValue if given a string value which does not map to an
  69. /// enum value.
  70. extern NameChangeFormat stringToNcrFormat(const std::string& fmt_str);
  71. /// @brief Function which converts NameChangeFormat enums to text labels.
  72. ///
  73. /// @param format enum value to convert to label
  74. ///
  75. /// @return std:string containing the text label if the value is valid, or
  76. /// "UNKNOWN" if not.
  77. extern std::string ncrFormatToString(NameChangeFormat format);
  78. /// @brief Container class for handling the DHCID value within a
  79. /// NameChangeRequest. It provides conversion to and from string for JSON
  80. /// formatting, but stores the data internally as unsigned bytes.
  81. class D2Dhcid {
  82. public:
  83. /// @brief Default constructor
  84. D2Dhcid();
  85. /// @brief Constructor - Creates a new instance, populated by converting
  86. /// a given string of digits into an array of unsigned bytes.
  87. ///
  88. /// @param data is a string of hexadecimal digits. The format is simply
  89. /// a contiguous stream of digits, with no delimiters. For example a string
  90. /// containing "14A3" converts to a byte array containing: 0x14, 0xA3.
  91. ///
  92. /// @throw NcrMessageError if the input data contains non-digits
  93. /// or there is an odd number of digits.
  94. D2Dhcid(const std::string& data);
  95. /// @brief Constructor, creates an instance of the @c D2Dhcid from the
  96. /// HW address.
  97. ///
  98. /// @param hwaddr A pointer to the object encapsulating HW address.
  99. /// @param wire_fqdn A on-wire canonical representation of the FQDN.
  100. D2Dhcid(const isc::dhcp::HWAddrPtr& hwaddr,
  101. const std::vector<uint8_t>& wire_fqdn);
  102. /// @brief Constructor, creates an instance of the @c D2Dhcid from the
  103. /// client identifier carried in the Client Identifier option.
  104. ///
  105. /// @param clientid_data Holds the raw bytes representing client identifier.
  106. /// @param wire_fqdn A on-wire canonical representation of the FQDN.
  107. D2Dhcid(const std::vector<uint8_t>& clientid_data,
  108. const std::vector<uint8_t>& wire_fqdn);
  109. /// @brief Constructor, creates an instance of the @c D2Dhcid from the
  110. /// @c isc::dhcp::DUID.
  111. ///
  112. /// @param duid An object representing DUID.
  113. /// @param wire_fqdn A on-wire canonical representation of the FQDN.
  114. D2Dhcid(const isc::dhcp::DUID& duid,
  115. const std::vector<uint8_t>& wire_fqdn);
  116. /// @brief Returns the DHCID value as a string of hexadecimal digits.
  117. ///
  118. /// @return a string containing a contiguous stream of digits.
  119. std::string toStr() const;
  120. /// @brief Sets the DHCID value based on the given string.
  121. ///
  122. /// @param data is a string of hexadecimal digits. The format is simply
  123. /// a contiguous stream of digits, with no delimiters. For example a string
  124. /// containing "14A3" converts to a byte array containing: 0x14, 0xA3.
  125. ///
  126. /// @throw NcrMessageError if the input data contains non-digits
  127. /// or there is an odd number of digits.
  128. void fromStr(const std::string& data);
  129. /// @brief Sets the DHCID value based on the Client Identifier.
  130. ///
  131. /// @param clientid_data Holds the raw bytes representing client identifier.
  132. /// @param wire_fqdn A on-wire canonical representation of the FQDN.
  133. void fromClientId(const std::vector<uint8_t>& clientid_data,
  134. const std::vector<uint8_t>& wire_fqdn);
  135. /// @brief Sets the DHCID value based on the DUID and FQDN.
  136. ///
  137. /// This function requires that the FQDN conforms to the section 3.5
  138. /// of the RFC4701, which says that the FQDN must be in lowercase.
  139. /// This function doesn't validate if it really converted.
  140. ///
  141. /// @param duid A @c isc::dhcp::DUID object encapsulating DUID.
  142. /// @param wire_fqdn A on-wire canonical representation of the FQDN.
  143. void fromDUID(const isc::dhcp::DUID& duid,
  144. const std::vector<uint8_t>& wire_fqdn);
  145. /// @brief Sets the DHCID value based on the HW address and FQDN.
  146. ///
  147. /// @param hwaddr A pointer to the object encapsulating HW address.
  148. /// @param wire_fqdn A on-wire canonical representation of the FQDN.
  149. void fromHWAddr(const isc::dhcp::HWAddrPtr& hwaddr,
  150. const std::vector<uint8_t>& wire_fqdn);
  151. /// @brief Returns a reference to the DHCID byte vector.
  152. ///
  153. /// @return a reference to the vector.
  154. const std::vector<uint8_t>& getBytes() const {
  155. return (bytes_);
  156. }
  157. /// @brief Compares two D2Dhcids for equality
  158. bool operator==(const D2Dhcid& other) const {
  159. return (this->bytes_ == other.bytes_);
  160. }
  161. /// @brief Compares two D2Dhcids for inequality
  162. bool operator!=(const D2Dhcid& other) const {
  163. return (this->bytes_ != other.bytes_);
  164. }
  165. /// @brief Compares two D2Dhcids lexcially
  166. bool operator<(const D2Dhcid& other) const {
  167. return (this->bytes_ < other.bytes_);
  168. }
  169. private:
  170. /// @brief Creates the DHCID using specified indetifier.
  171. ///
  172. /// This function creates the DHCID RDATA as specified in RFC4701,
  173. /// section 3.5.
  174. ///
  175. /// @param identifier_type is a less significant byte of the identifier-type
  176. /// defined in RFC4701.
  177. /// @param identifier_data A buffer holding client identifier raw data -
  178. /// e.g. DUID, data carried in the Client Identifier option or client's
  179. /// HW address.
  180. /// @param A on-wire canonical representation of the FQDN.
  181. void createDigest(const uint8_t identifier_type,
  182. const std::vector<uint8_t>& identifier_data,
  183. const std::vector<uint8_t>& wire_fqdn);
  184. /// @brief Storage for the DHCID value in unsigned bytes.
  185. std::vector<uint8_t> bytes_;
  186. };
  187. std::ostream&
  188. operator<<(std::ostream& os, const D2Dhcid& dhcid);
  189. class NameChangeRequest;
  190. /// @brief Defines a pointer to a NameChangeRequest.
  191. typedef boost::shared_ptr<NameChangeRequest> NameChangeRequestPtr;
  192. /// @brief Defines a map of Elements, keyed by their string name.
  193. typedef std::map<std::string, isc::data::ConstElementPtr> ElementMap;
  194. /// @brief Represents a DHCP-DDNS client request.
  195. /// This class is used by DHCP-DDNS clients (e.g. DHCP4, DHCP6) to
  196. /// request DNS updates. Each message contains a single DNS change (either an
  197. /// add/update or a remove) for a single FQDN. It provides marshalling services
  198. /// for moving instances to and from the wire. Currently, the only format
  199. /// supported is JSON, however the class provides an interface such that other
  200. /// formats can be readily supported.
  201. class NameChangeRequest {
  202. public:
  203. /// @brief Default Constructor.
  204. ///
  205. /// @todo Currently, fromWire makes use of the ability to create an empty
  206. /// NameChangeRequest and then builds it bit by bit. This means that it
  207. /// is technically possible to create one and attempt to use in ways
  208. /// other than intended and its invalid content may or may not be handled
  209. /// gracefully by consuming code. It might be wise to revisit this
  210. /// structuring such that we do not use a default constructor and only
  211. /// allow valid instantiations.
  212. NameChangeRequest();
  213. /// @brief Constructor. Full constructor, which provides parameters for
  214. /// all of the class members, except status.
  215. ///
  216. /// @param change_type the type of change (Add or Update)
  217. /// @param forward_change indicates if this change should be sent to forward
  218. /// DNS servers.
  219. /// @param reverse_change indicates if this change should be sent to reverse
  220. /// DNS servers.
  221. /// @param fqdn the domain name whose pointer record(s) should be
  222. /// updated.
  223. /// @param ip_address the ip address leased to the given FQDN.
  224. /// @param dhcid the lease client's unique DHCID.
  225. /// @param lease_expires_on a timestamp containing the date/time the lease
  226. /// expires.
  227. /// @param lease_length the amount of time in seconds for which the
  228. /// lease is valid (TTL).
  229. NameChangeRequest(const NameChangeType change_type,
  230. const bool forward_change, const bool reverse_change,
  231. const std::string& fqdn, const std::string& ip_address,
  232. const D2Dhcid& dhcid,
  233. const uint64_t lease_expires_on,
  234. const uint32_t lease_length);
  235. /// @brief Static method for creating a NameChangeRequest from a
  236. /// buffer containing a marshalled request in a given format.
  237. ///
  238. /// When the format is:
  239. ///
  240. /// JSON: The buffer is expected to contain a two byte unsigned integer
  241. /// which specified the length of the JSON text; followed by the JSON
  242. /// text itself. This method attempts to extract "length" characters
  243. /// from the buffer. This data is used to create a character string that
  244. /// is than treated as JSON which is then parsed into the data needed
  245. /// to create a request instance.
  246. ///
  247. /// (NOTE currently only JSON is supported.)
  248. ///
  249. /// @param format indicates the data format to use
  250. /// @param buffer is the input buffer containing the marshalled request
  251. ///
  252. /// @return a pointer to the new NameChangeRequest
  253. ///
  254. /// @throw NcrMessageError if an error occurs creating new
  255. /// request.
  256. static NameChangeRequestPtr fromFormat(const NameChangeFormat format,
  257. isc::util::InputBuffer& buffer);
  258. /// @brief Instance method for marshalling the contents of the request
  259. /// into the given buffer in the given format.
  260. ///
  261. /// When the format is:
  262. ///
  263. /// JSON: Upon completion, the buffer will contain a two byte unsigned
  264. /// integer which specifies the length of the JSON text; followed by the
  265. /// JSON text itself. The JSON text contains the names and values for all
  266. /// the request data needed to reassemble the request on the receiving
  267. /// end. The JSON text in the buffer is NOT null-terminated.
  268. ///
  269. /// (NOTE currently only JSON is supported.)
  270. ///
  271. /// @param format indicates the data format to use
  272. /// @param buffer is the output buffer to which the request should be
  273. /// marshalled.
  274. void toFormat(const NameChangeFormat format,
  275. isc::util::OutputBuffer& buffer) const;
  276. /// @brief Static method for creating a NameChangeRequest from a
  277. /// string containing a JSON rendition of a request.
  278. ///
  279. /// @param json is a string containing the JSON text
  280. ///
  281. /// @return a pointer to the new NameChangeRequest
  282. ///
  283. /// @throw NcrMessageError if an error occurs creating new request.
  284. static NameChangeRequestPtr fromJSON(const std::string& json);
  285. /// @brief Instance method for marshalling the contents of the request
  286. /// into a string of JSON text.
  287. ///
  288. /// @return a string containing the JSON rendition of the request
  289. std::string toJSON() const;
  290. /// @brief Validates the content of a populated request. This method is
  291. /// used by both the full constructor and from-wire marshalling to ensure
  292. /// that the request is content valid. Currently it enforces the
  293. /// following rules:
  294. ///
  295. /// - FQDN must not be blank.
  296. /// - The IP address must be a valid address.
  297. /// - The DHCID must not be blank.
  298. /// - The lease expiration date must be a valid date/time.
  299. /// - That at least one of the two direction flags, forward change and
  300. /// reverse change is true.
  301. ///
  302. /// @todo This is an initial implementation which provides a minimal amount
  303. /// of validation. FQDN, DHCID, and IP Address members are all currently
  304. /// strings, these may be replaced with richer classes.
  305. ///
  306. /// @throw NcrMessageError if the request content violates any
  307. /// of the validation rules.
  308. void validateContent();
  309. /// @brief Fetches the request change type.
  310. ///
  311. /// @return the change type
  312. NameChangeType getChangeType() const {
  313. return (change_type_);
  314. }
  315. /// @brief Sets the change type to the given value.
  316. ///
  317. /// @param value is the NameChangeType value to assign to the request.
  318. void setChangeType(const NameChangeType value);
  319. /// @brief Sets the change type to the value of the given Element.
  320. ///
  321. /// @param element is an integer Element containing the change type value.
  322. ///
  323. /// @throw NcrMessageError if the element is not an integer
  324. /// Element or contains an invalid value.
  325. void setChangeType(isc::data::ConstElementPtr element);
  326. /// @brief Checks forward change flag.
  327. ///
  328. /// @return a true if the forward change flag is true.
  329. bool isForwardChange() const {
  330. return (forward_change_);
  331. }
  332. /// @brief Sets the forward change flag to the given value.
  333. ///
  334. /// @param value contains the new value to assign to the forward change
  335. /// flag
  336. void setForwardChange(const bool value);
  337. /// @brief Sets the forward change flag to the value of the given Element.
  338. ///
  339. /// @param element is a boolean Element containing the forward change flag
  340. /// value.
  341. ///
  342. /// @throw NcrMessageError if the element is not a boolean
  343. /// Element
  344. void setForwardChange(isc::data::ConstElementPtr element);
  345. /// @brief Checks reverse change flag.
  346. ///
  347. /// @return a true if the reverse change flag is true.
  348. bool isReverseChange() const {
  349. return (reverse_change_);
  350. }
  351. /// @brief Sets the reverse change flag to the given value.
  352. ///
  353. /// @param value contains the new value to assign to the reverse change
  354. /// flag
  355. void setReverseChange(const bool value);
  356. /// @brief Sets the reverse change flag to the value of the given Element.
  357. ///
  358. /// @param element is a boolean Element containing the reverse change flag
  359. /// value.
  360. ///
  361. /// @throw NcrMessageError if the element is not a boolean
  362. /// Element
  363. void setReverseChange(isc::data::ConstElementPtr element);
  364. /// @brief Fetches the request FQDN
  365. ///
  366. /// @return a string containing the FQDN
  367. const std::string getFqdn() const {
  368. return (fqdn_);
  369. }
  370. /// @brief Sets the FQDN to the given value.
  371. ///
  372. /// @param value contains the new value to assign to the FQDN
  373. void setFqdn(const std::string& value);
  374. /// @brief Sets the FQDN to the value of the given Element.
  375. ///
  376. /// @param element is a string Element containing the FQDN
  377. ///
  378. /// @throw NcrMessageError if the element is not a string
  379. /// Element
  380. void setFqdn(isc::data::ConstElementPtr element);
  381. /// @brief Fetches the request IP address string.
  382. ///
  383. /// @return a string containing the IP address
  384. std::string getIpAddress() const {
  385. return (ip_io_address_.toText());
  386. }
  387. /// @brief Fetches the request IP address as an IOAddress.
  388. ///
  389. /// @return a asiolink::IOAddress containing the IP address
  390. const asiolink::IOAddress& getIpIoAddress() const {
  391. return (ip_io_address_);
  392. }
  393. /// @brief Returns true if the lease address is a IPv4 lease.
  394. ///
  395. /// @return boolean true if the lease address family is AF_INET.
  396. bool isV4 () const {
  397. return (ip_io_address_.isV4());
  398. }
  399. /// @brief Returns true if the lease address is a IPv6 lease.
  400. ///
  401. /// @return boolean true if the lease address family is AF_INET6.
  402. bool isV6 () const {
  403. return (ip_io_address_.isV6());
  404. }
  405. /// @brief Sets the IP address to the given value.
  406. ///
  407. /// @param value contains the new value to assign to the IP address
  408. void setIpAddress(const std::string& value);
  409. /// @brief Sets the IP address to the value of the given Element.
  410. ///
  411. /// @param element is a string Element containing the IP address
  412. ///
  413. /// @throw NcrMessageError if the element is not a string
  414. /// Element
  415. void setIpAddress(isc::data::ConstElementPtr element);
  416. /// @brief Fetches the request DHCID
  417. ///
  418. /// @return a reference to the request's D2Dhcid
  419. const D2Dhcid& getDhcid() const {
  420. return (dhcid_);
  421. }
  422. /// @brief Sets the DHCID based on the given string value.
  423. ///
  424. /// @param value is a string of hexadecimal digits. The format is simply
  425. /// a contiguous stream of digits, with no delimiters. For example a string
  426. /// containing "14A3" converts to a byte array containing: 0x14, 0xA3.
  427. ///
  428. /// @throw NcrMessageError if the input data contains non-digits
  429. /// or there is an odd number of digits.
  430. void setDhcid(const std::string& value);
  431. /// @brief Sets the DHCID based on the value of the given Element.
  432. ///
  433. /// @param element is a string Element containing the string of hexadecimal
  434. /// digits. (See setDhcid(std::string&) above.)
  435. ///
  436. /// @throw NcrMessageError if the input data contains non-digits
  437. /// or there is an odd number of digits.
  438. void setDhcid(isc::data::ConstElementPtr element);
  439. /// @brief Fetches the request lease expiration
  440. ///
  441. /// @return the lease expiration as the number of seconds since
  442. /// the (00:00:00 January 1, 1970)
  443. uint64_t getLeaseExpiresOn() const {
  444. return (lease_expires_on_);
  445. }
  446. /// @brief Fetches the request lease expiration as string.
  447. ///
  448. /// The format of the string returned is:
  449. ///
  450. /// YYYYMMDDHHmmSS
  451. ///
  452. /// Example: 18:54:54 June 26, 2013 would be: 20130626185455
  453. /// NOTE This is always UTC time.
  454. ///
  455. /// @return a ISO date-time string of the lease expiration.
  456. std::string getLeaseExpiresOnStr() const;
  457. /// @brief Sets the lease expiration based on the given string.
  458. ///
  459. /// @param value is an date-time string from which to set the
  460. /// lease expiration. The format of the input is:
  461. ///
  462. /// YYYYMMDDHHmmSS
  463. ///
  464. /// Example: 18:54:54 June 26, 2013 would be: 20130626185455
  465. /// NOTE This is always UTC time.
  466. ///
  467. /// @throw NcrMessageError if the ISO string is invalid.
  468. void setLeaseExpiresOn(const std::string& value);
  469. /// @brief Sets the lease expiration based on the given Element.
  470. ///
  471. /// @param element is string Element containing a date-time string.
  472. ///
  473. /// @throw NcrMessageError if the element is not a string
  474. /// Element, or if the element value is an invalid date-time string.
  475. void setLeaseExpiresOn(isc::data::ConstElementPtr element);
  476. /// @brief Fetches the request lease length.
  477. ///
  478. /// @return an integer containing the lease length
  479. uint32_t getLeaseLength() const {
  480. return (lease_length_);
  481. }
  482. /// @brief Sets the lease length to the given value.
  483. ///
  484. /// @param value contains the new value to assign to the lease length
  485. void setLeaseLength(const uint32_t value);
  486. /// @brief Sets the lease length to the value of the given Element.
  487. ///
  488. /// @param element is a integer Element containing the lease length
  489. ///
  490. /// @throw NcrMessageError if the element is not a string
  491. /// Element
  492. void setLeaseLength(isc::data::ConstElementPtr element);
  493. /// @brief Fetches the request status.
  494. ///
  495. /// @return the request status as a NameChangeStatus
  496. NameChangeStatus getStatus() const {
  497. return (status_);
  498. }
  499. /// @brief Sets the request status to the given value.
  500. ///
  501. /// @param value contains the new value to assign to request status
  502. void setStatus(const NameChangeStatus value);
  503. /// @brief Given a name, finds and returns an element from a map of
  504. /// elements.
  505. ///
  506. /// @param name is the name of the desired element
  507. /// @param element_map is the map of elements to search
  508. ///
  509. /// @return a pointer to the element if located
  510. /// @throw NcrMessageError if the element cannot be found within
  511. /// the map
  512. isc::data::ConstElementPtr getElement(const std::string& name,
  513. const ElementMap& element_map) const;
  514. /// @brief Returns a text rendition of the contents of the request.
  515. /// This method is primarily for logging purposes.
  516. ///
  517. /// @return a string containing the text.
  518. std::string toText() const;
  519. bool operator == (const NameChangeRequest& b);
  520. bool operator != (const NameChangeRequest& b);
  521. private:
  522. /// @brief Denotes the type of this change as either an Add or a Remove.
  523. NameChangeType change_type_;
  524. /// @brief Indicates if this change should sent to forward DNS servers.
  525. bool forward_change_;
  526. /// @brief Indicates if this change should sent to reverse DNS servers.
  527. bool reverse_change_;
  528. /// @brief The domain name whose DNS entry(ies) are to be updated.
  529. /// @todo Currently, this is a std::string but may be replaced with
  530. /// dns::Name which provides additional validation and domain name
  531. /// manipulation.
  532. std::string fqdn_;
  533. /// @brief The ip address leased to the FQDN as an IOAddress.
  534. ///
  535. /// The lease address is used in many places, sometimes as a string
  536. /// and sometimes as an IOAddress. To avoid converting back and forth
  537. /// continually over the life span of an NCR, we do it once when the
  538. /// ip address is actually set.
  539. asiolink::IOAddress ip_io_address_;
  540. /// @brief The lease client's unique DHCID.
  541. /// @todo Currently, this is uses D2Dhcid it but may be replaced with
  542. /// dns::DHCID which provides additional validation.
  543. D2Dhcid dhcid_;
  544. /// @brief The date-time the lease expires.
  545. uint64_t lease_expires_on_;
  546. /// @brief The amount of time in seconds for which the lease is valid (TTL).
  547. uint32_t lease_length_;
  548. /// @brief The processing status of the request. Used internally.
  549. NameChangeStatus status_;
  550. };
  551. }; // end of isc::dhcp_ddns namespace
  552. }; // end of isc namespace
  553. #endif