host.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. // Copyright (C) 2014-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 HOST_H
  7. #define HOST_H
  8. #include <asiolink/io_address.h>
  9. #include <dhcp/classify.h>
  10. #include <dhcp/duid.h>
  11. #include <dhcp/hwaddr.h>
  12. #include <dhcpsrv/cfg_option.h>
  13. #include <dhcpsrv/subnet_id.h>
  14. #include <boost/shared_ptr.hpp>
  15. #include <list>
  16. #include <map>
  17. #include <string>
  18. #include <utility>
  19. namespace isc {
  20. namespace dhcp {
  21. /// @brief HostID (used only when storing in MySQL or Postgres)
  22. typedef uint64_t HostID;
  23. /// @brief IPv6 reservation for a host.
  24. ///
  25. /// This class represents a reservation for a host of a single IPv6
  26. /// address or prefix (in @c Host object).
  27. ///
  28. /// The class holds the address and prefix length, a value of 128
  29. /// for the latter implying that the reservation is for a single
  30. /// IPv6 address.
  31. class IPv6Resrv {
  32. public:
  33. /// @brief Type of the reservation.
  34. ///
  35. /// Currently supported types are NA and PD.
  36. enum Type {
  37. TYPE_NA,
  38. TYPE_PD
  39. };
  40. /// @brief Constructor.
  41. ///
  42. /// Creates a reservation from the IPv6 address and prefix length
  43. /// value. If the prefix length is not specified, the default value
  44. /// of 128 is used. This value indicates that the reservation is made
  45. /// for an IPv6 address.
  46. ///
  47. /// @param type Reservation type: NA or PD.
  48. /// @param prefix Address or prefix to be reserved.
  49. /// @param prefix_len Prefix length.
  50. ///
  51. /// @throw isc::BadValue if prefix is not IPv6 prefix, is a
  52. /// multicast address or the prefix length is greater than 128.
  53. IPv6Resrv(const Type& type,
  54. const asiolink::IOAddress& prefix,
  55. const uint8_t prefix_len = 128);
  56. /// @brief Returns prefix for the reservation.
  57. const asiolink::IOAddress& getPrefix() const {
  58. return (prefix_);
  59. }
  60. /// @brief Returns prefix length.
  61. uint8_t getPrefixLen() const {
  62. return (prefix_len_);
  63. }
  64. /// @brief Returns reservation type.
  65. ///
  66. /// The type of reservation is determined using a prefix length.
  67. ///
  68. /// @return NA for prefix length equal to 128, PD otherwise.
  69. Type getType() const {
  70. return (type_);
  71. }
  72. /// @brief Sets a new prefix and prefix length.
  73. ///
  74. /// @param type Reservation type: NA or PD.
  75. /// @param prefix New prefix.
  76. /// @param prefix_len New prefix length.
  77. ///
  78. /// @throw isc::BadValue if prefix is not IPv6 prefix, is a
  79. /// multicast address or the prefix length is greater than 128.
  80. void set(const Type& type, const asiolink::IOAddress& prefix,
  81. const uint8_t prefix_len);
  82. /// @brief Returns information about the reservation in the textual format.
  83. std::string toText() const;
  84. /// @brief Equality operator.
  85. ///
  86. /// @param other Reservation to compare to.
  87. bool operator==(const IPv6Resrv& other) const;
  88. /// @brief Inequality operator.
  89. ///
  90. /// @param other Reservation to compare to.
  91. bool operator!=(const IPv6Resrv& other) const;
  92. private:
  93. Type type_; ///< Reservation type.
  94. asiolink::IOAddress prefix_; ///< Prefix
  95. uint8_t prefix_len_; ///< Prefix length.
  96. };
  97. /// @brief Collection of IPv6 reservations for the host.
  98. typedef std::multimap<IPv6Resrv::Type, IPv6Resrv> IPv6ResrvCollection;
  99. typedef IPv6ResrvCollection::const_iterator IPv6ResrvIterator;
  100. typedef std::pair<IPv6Resrv::Type, IPv6Resrv> IPv6ResrvTuple;
  101. typedef std::pair<IPv6ResrvIterator, IPv6ResrvIterator> IPv6ResrvRange;
  102. /// @brief Represents a device with IPv4 and/or IPv6 reservations.
  103. ///
  104. /// This class represents a network device which can be identified
  105. /// by a unique property, such as MAC address on the interface or
  106. /// client identifier (DUID), and for which some resources are statically
  107. /// assigned:
  108. /// - IPv4 address which the device obtains when it contacts a DHCPv4 server
  109. /// - IPv6 address(es) which the device obtains when it contacts a DHCPv6
  110. /// server
  111. /// - IPv6 prefix(es) obtained when the device contacts the DHCPv6 server
  112. /// and requests allocation of prefixes using prefix delegation mechanism
  113. /// - hostname which is used for dynamic DNS updates for both DHCPv4 and
  114. /// DHCPv6 exchanges.
  115. /// - client classes which the client is associated with
  116. /// - DHCP options specifically configured for the device
  117. ///
  118. /// Note, that "host" in this context has a different meaning from
  119. /// host construed as device attached to a network with (possibly) multiple
  120. /// interfaces. For the MAC address based reservations, each interface on a
  121. /// network device maps to a single @c Host object as each @c Host object
  122. /// contains at most one MAC address. So, it is possible that a single
  123. /// device is associated with multiple distinct @c Host objects if the
  124. /// device has multiple interfaces. Under normal circumstances, a non-mobile
  125. /// dual stack device using one interface should be represented by a single
  126. /// @c Host object.
  127. ///
  128. /// A DHCPv6 DUID is common for all interfaces on a device. Therefore, for
  129. /// DUID based reservations a @c Host object may represent a network device with
  130. /// multiple interfaces. However, since @c Host objects are grouped by
  131. /// subnets to which device's interfaces are connected a single instance of
  132. /// @c Host object usually defines reservations for a single interface.
  133. ///
  134. /// The @c Host object combines reservations for both IPv4 and IPv6 resources
  135. /// to allow for correlation of the information about the dual stack devices
  136. /// using DHCPv4 and DHCPv6 respectively. For example: both the DHCPv4 and
  137. /// DHCPv6 servers may use the same database for storing host reservations, so
  138. /// the information about the DHCPv4 reservations are available for the
  139. /// DHCPv6 server and vice versa. Also, this approach allows for reserving
  140. /// common resources such as host name for DHCPv4 and DHCPv6 clients.
  141. ///
  142. /// This class also holds pointers to specific DHCP options reserved
  143. /// for a host. Options instances are held in @c CfgOption objects.
  144. /// There are two @c CfgOption objects in this class, one holding
  145. /// DHCPv4 options, another one holding DHCPv6 options.
  146. ///
  147. /// @todo This class offers basic functionality for storing host information.
  148. /// It will need to be extended to allow for the following operations:
  149. /// - remove and replace IPv6 reservations
  150. /// - remove and replace client classes
  151. /// - disable IPv4 reservation without a need to set it to the 0.0.0.0 address
  152. /// Note that the last three operations are mainly required for managing
  153. /// host reservations which will be implemented later.
  154. class Host {
  155. public:
  156. /// @brief Type of the host identifier.
  157. ///
  158. /// Currently supported identifiers are:
  159. /// - hardware address (DHCPv4 and DHCPv6) (identifier name: "hw-address"),
  160. /// - DUID (DHCPv4 and DHCPv6) (identifier name: "duid"),
  161. /// - circuit identifier (DHCPv4) (identifier name: "circuit-id"),
  162. /// - client identifier (DHCPv4) (identifier name: "client-id")
  163. enum IdentifierType {
  164. IDENT_HWADDR,
  165. IDENT_DUID,
  166. IDENT_CIRCUIT_ID,
  167. IDENT_CLIENT_ID
  168. };
  169. /// @brief Constant pointing to the last identifier of the
  170. /// @ref IdentifierType enumeration.
  171. static const IdentifierType LAST_IDENTIFIER_TYPE = IDENT_CLIENT_ID;
  172. /// @brief Constructor.
  173. ///
  174. /// Creates a @c Host object using an identifier in a binary format. This
  175. /// is most useful in cases where the identifier is obtained from the
  176. /// database. The constructor will create an instance of the @c HWAddr
  177. /// or @c DUID object depending on the identifier type.
  178. ///
  179. /// @param identifier Pointer to the binary value holding an identifier.
  180. /// @param identifier_len Length of the identifier.
  181. /// @param identifier_type Type of the identifier (hardware address or
  182. /// DUID).
  183. /// @param ipv4_subnet_id Identifier of the IPv4 subnet to which the host
  184. /// is connected.
  185. /// @param ipv6_subnet_id Identifier of the IPv6 subnet to which the host
  186. /// is connected.
  187. /// @param ipv4_reservation An IPv4 address reserved for the client. If
  188. /// this address is set to 0, there is no reservation.
  189. /// @param hostname Hostname to be allocated to both DHCPv4 and DHCPv6
  190. /// clients. This is empty string if hostname is not allocated.
  191. /// @param dhcp4_client_classes A string holding DHCPv4 client class names
  192. /// separated by commas. The names get trimmed by this constructor.
  193. /// @param dhcp6_client_classes A string holding DHCPv6 client class names
  194. /// separated by commas. The names get trimmed by this constructor.
  195. /// @param next_server IPv4 address of next server (siaddr).
  196. /// @param server_host_name Server host name (a.k.a. sname).
  197. /// @param boot_file_name Boot file name (a.k.a. file).
  198. ///
  199. /// @throw BadValue if the provided values are invalid. In particular,
  200. /// if the identifier is invalid.
  201. Host(const uint8_t* identifier, const size_t identifier_len,
  202. const IdentifierType& identifier_type,
  203. const SubnetID ipv4_subnet_id, const SubnetID ipv6_subnet_id,
  204. const asiolink::IOAddress& ipv4_reservation,
  205. const std::string& hostname = "",
  206. const std::string& dhcp4_client_classes = "",
  207. const std::string& dhcp6_client_classes = "",
  208. const asiolink::IOAddress& next_server = asiolink::IOAddress::IPV4_ZERO_ADDRESS(),
  209. const std::string& server_host_name = "",
  210. const std::string& boot_file_name = "");
  211. /// @brief Constructor.
  212. ///
  213. /// Creates @c Host object using an identifier in a textual format. This
  214. /// is useful in cases when the reservation is specified in the server
  215. /// configuration file. Identifiers can be specified in the following
  216. /// formats:
  217. /// - "yy:yy:yy:yy:yy:yy"
  218. /// - "yyyyyyyyyy",
  219. /// - "0xyyyyyyyyyy",
  220. /// - "'some identfier'".
  221. /// where y is a hexadecimal digit.
  222. ///
  223. /// Note that it is possible to use textual representation, e.g. 'some identifier',
  224. /// which is converted to a vector of ASCII codes representing characters in a
  225. /// given string, excluding quotes. This is useful in cases when specific
  226. /// identifiers, e.g. circuit-id are manually assigned user friendly values.
  227. ///
  228. /// @param identifier Identifier in the textual format. The expected formats
  229. /// for the hardware address and other identifiers are provided above.
  230. /// @param identifier_name One of the supported identifiers in the text form as
  231. /// described for @ref IdentifierType.
  232. /// @param ipv4_subnet_id Identifier of the IPv4 subnet to which the host
  233. /// is connected.
  234. /// @param ipv6_subnet_id Identifier of the IPv6 subnet to which the host
  235. /// is connected.
  236. /// @param ipv4_reservation An IPv4 address reserved for the client. If
  237. /// this address is set to 0, there is no reservation.
  238. /// @param hostname Hostname to be allocated to both DHCPv4 and DHCPv6
  239. /// clients. This is empty string if hostname is not allocated.
  240. /// @param dhcp4_client_classes A string holding DHCPv4 client class names
  241. /// separated by commas. The names get trimmed by this constructor.
  242. /// @param dhcp6_client_classes A string holding DHCPv6 client class names
  243. /// separated by commas. The names get trimmed by this constructor.
  244. /// @param next_server IPv4 address of next server (siaddr).
  245. /// @param server_host_name Server host name (a.k.a. sname).
  246. /// @param boot_file_name Boot file name (a.k.a. file).
  247. ///
  248. /// @throw BadValue if the provided values are invalid. In particular,
  249. /// if the identifier is invalid.
  250. Host(const std::string& identifier, const std::string& identifier_name,
  251. const SubnetID ipv4_subnet_id, const SubnetID ipv6_subnet_id,
  252. const asiolink::IOAddress& ipv4_reservation,
  253. const std::string& hostname = "",
  254. const std::string& dhcp4_client_classes = "",
  255. const std::string& dhcp6_client_classes = "",
  256. const asiolink::IOAddress& next_server = asiolink::IOAddress::IPV4_ZERO_ADDRESS(),
  257. const std::string& server_host_name = "",
  258. const std::string& boot_file_name = "");
  259. /// @brief Replaces currently used identifier with a new identifier.
  260. ///
  261. /// This method sets a new identifier type and value for a host.
  262. /// This method is called by the @c Host constructor.
  263. ///
  264. /// @param identifier Pointer to a buffer holding an identifier.
  265. /// @param len Length of the identifier that the @c identifier points to.
  266. /// @param type Identifier type.
  267. ///
  268. /// @throw BadValue if the identifier is invalid.
  269. void setIdentifier(const uint8_t* identifier, const size_t len,
  270. const IdentifierType& type);
  271. /// @brief Replaces currently used identifier with a new identifier.
  272. ///
  273. /// This method sets a new identifier type and value for a host.
  274. /// This method is called by the @c Host constructor.
  275. ///
  276. /// @param identifier Reference to a new identifier in the textual format.
  277. /// @param name One of the supported identifiers in the text form as
  278. /// described for @ref IdentifierType.
  279. ///
  280. /// @throw BadValue if the identifier is invalid.
  281. void setIdentifier(const std::string& identifier, const std::string& name);
  282. /// @brief Returns hardware address for which the reservations are made.
  283. ///
  284. /// @return Pointer to the @c HWAddr structure or null if the reservation
  285. /// is not associated with a hardware address.
  286. HWAddrPtr getHWAddress() const;
  287. /// @brief Returns DUID for which the reservations are made.
  288. ///
  289. /// @return Pointer to the @c DUID structure or null if the reservation
  290. /// is not associated with a DUID.
  291. DuidPtr getDuid() const;
  292. /// @brief Returns the identifier in a binary form.
  293. ///
  294. /// @return const reference to a vector<uint8_t> holding an identifier
  295. /// value.
  296. const std::vector<uint8_t>& getIdentifier() const;
  297. /// @brief Returns the identifier type.
  298. ///
  299. IdentifierType getIdentifierType() const;
  300. /// @brief Converts identifier name to identifier type.
  301. ///
  302. /// @param identifier_name Identifier name.
  303. /// @return Identifier type.
  304. static IdentifierType getIdentifierType(const std::string& identifier_name);
  305. /// @brief Returns host identifier in a textual form.
  306. ///
  307. /// @return Identifier in the form of type=value.
  308. std::string getIdentifierAsText() const;
  309. /// @brief Returns name of the identifier of a specified type.
  310. static std::string getIdentifierName(const IdentifierType& type);
  311. /// @brief Returns host identifier in textual form.
  312. ///
  313. /// @param type Identifier type.
  314. /// @param value Pointer to a buffer holding identifier.
  315. /// @param length Length of the identifier.
  316. /// @return Identifier in the form of type=value.
  317. static std::string getIdentifierAsText(const IdentifierType& type,
  318. const uint8_t* value,
  319. const size_t length);
  320. /// @brief Sets new IPv4 subnet identifier.
  321. ///
  322. /// @param ipv4_subnet_id New subnet identifier.
  323. void setIPv4SubnetID(const SubnetID ipv4_subnet_id) {
  324. ipv4_subnet_id_ = ipv4_subnet_id;
  325. }
  326. /// @brief Sets new IPv6 subnet identifier.
  327. ///
  328. /// @param ipv6_subnet_id New subnet identifier.
  329. void setIPv6SubnetID(const SubnetID ipv6_subnet_id) {
  330. ipv6_subnet_id_ = ipv6_subnet_id;
  331. }
  332. /// @brief Returns subnet identifier for IPv4 reservation.
  333. SubnetID getIPv4SubnetID() const {
  334. return (ipv4_subnet_id_);
  335. }
  336. /// @brief Returns subnet identifier for IPv6 reservations.
  337. SubnetID getIPv6SubnetID() const {
  338. return (ipv6_subnet_id_);
  339. }
  340. /// @brief Sets new IPv4 reservation.
  341. ///
  342. /// The new reservation removes a previous reservation.
  343. ///
  344. /// @param address Address to be reserved for the client.
  345. ///
  346. /// @throw isc::BadValue if the provided address is not an IPv4 address,
  347. /// is a 0 address or broadcast address.
  348. void setIPv4Reservation(const asiolink::IOAddress& address);
  349. /// @brief Removes the IPv4 reservation.
  350. ///
  351. /// Sets the IPv4 reserved address to 0.
  352. void removeIPv4Reservation();
  353. /// @brief Returns reserved IPv4 address.
  354. ///
  355. /// @return IPv4 address or 0.0.0.0 if no IPv4 reservation specified.
  356. const asiolink::IOAddress& getIPv4Reservation() const {
  357. return (ipv4_reservation_);
  358. }
  359. /// @brief Adds new IPv6 reservation.
  360. ///
  361. /// @param reservation New IPv6 reservation to be appended.
  362. void addReservation(const IPv6Resrv& reservation);
  363. /// @brief Returns IPv6 reservations of a specified type.
  364. ///
  365. /// @param type Type of the reservations to be returned (NA or PD).
  366. ///
  367. /// @return A range of iterators pointing to the reservations of
  368. /// the specified type.
  369. IPv6ResrvRange getIPv6Reservations(const IPv6Resrv::Type& type) const;
  370. /// @brief Returns all IPv6 reservations.
  371. ///
  372. /// @return A range of iterators pointing to the reservations of
  373. /// the specified type.
  374. IPv6ResrvRange getIPv6Reservations() const;
  375. /// @brief Checks if there is at least one IPv6 reservation for this host.
  376. ///
  377. /// @return true if there is a reservation for the host, false otherwise.
  378. bool hasIPv6Reservation() const;
  379. /// @brief Checks if specified IPv6 reservation exists for the host.
  380. ///
  381. /// @param reservation A reservation to be checked for the host.
  382. ///
  383. /// @return true if the reservation already exists for the host, false
  384. /// otherwise.
  385. bool hasReservation(const IPv6Resrv& reservation) const;
  386. /// @brief Sets new hostname.
  387. ///
  388. /// @param hostname New hostname.
  389. void setHostname(const std::string& hostname) {
  390. hostname_ = hostname;
  391. }
  392. /// @brief Returns reserved hostname.
  393. const std::string& getHostname() const {
  394. return (hostname_);
  395. }
  396. /// @brief Adds new client class for DHCPv4.
  397. ///
  398. /// @param class_name Class name.
  399. void addClientClass4(const std::string& class_name);
  400. /// @brief Returns classes which DHCPv4 client is associated with.
  401. const ClientClasses& getClientClasses4() const {
  402. return (dhcp4_client_classes_);
  403. }
  404. /// @brief Adds new client class for DHCPv6.
  405. ///
  406. /// @param class_name Class name.
  407. void addClientClass6(const std::string& class_name);
  408. /// @brief Returns classes which DHCPv6 client is associated with.
  409. const ClientClasses& getClientClasses6() const {
  410. return (dhcp6_client_classes_);
  411. }
  412. /// @brief Sets new value for next server field (siaddr).
  413. ///
  414. /// @param next_server New address of a next server.
  415. ///
  416. /// @throw isc::BadValue if the provided address is not an IPv4 address,
  417. /// is broadcast address.
  418. void setNextServer(const asiolink::IOAddress& next_server);
  419. /// @brief Returns value of next server field (siaddr).
  420. const asiolink::IOAddress& getNextServer() const {
  421. return (next_server_);
  422. }
  423. /// @brief Sets new value for server hostname (sname).
  424. ///
  425. /// @param server_host_name New value for server hostname.
  426. ///
  427. /// @throw BadValue if hostname is longer than 63 bytes.
  428. void setServerHostname(const std::string& server_host_name);
  429. /// @brief Returns value of server hostname (sname).
  430. const std::string& getServerHostname() const {
  431. return (server_host_name_);
  432. }
  433. /// @brief Sets new value for boot file name (file).
  434. ///
  435. /// @param boot_file_name New value of boot file name.
  436. ///
  437. /// @throw BadValue if boot file name is longer than 128 bytes.
  438. void setBootFileName(const std::string& boot_file_name);
  439. /// @brief Returns value of boot file name (file).
  440. const std::string& getBootFileName() const {
  441. return (boot_file_name_);
  442. }
  443. /// @brief Returns pointer to the DHCPv4 option data configuration for
  444. /// this host.
  445. ///
  446. /// Returned pointer can be used to add, remove and udate options
  447. /// reserved for a host.
  448. CfgOptionPtr getCfgOption4() {
  449. return (cfg_option4_);
  450. }
  451. /// @brief Returns const pointer to the DHCPv4 option data configuration for
  452. /// this host.
  453. ConstCfgOptionPtr getCfgOption4() const {
  454. return (cfg_option4_);
  455. }
  456. /// @brief Returns pointer to the DHCPv6 option data configuration for
  457. /// this host.
  458. ///
  459. /// Returned pointer can be used to add, remove and udate options
  460. /// reserved for a host.
  461. CfgOptionPtr getCfgOption6() {
  462. return (cfg_option6_);
  463. }
  464. /// @brief Returns const pointer to the DHCPv6 option data configuration for
  465. /// this host.
  466. ConstCfgOptionPtr getCfgOption6() const {
  467. return (cfg_option6_);
  468. }
  469. /// @brief Returns information about the host in the textual format.
  470. std::string toText() const;
  471. /// @brief Sets Host ID (primary key in MySQL and Postgres backends)
  472. /// @param id HostId value
  473. void setHostId(HostID id) {
  474. host_id_ = id;
  475. }
  476. /// @brief Returns Host ID (primary key in MySQL and Postgres backends)
  477. /// @return id HostId value (or 0 if not set)
  478. HostID getHostId() const {
  479. return (host_id_);
  480. }
  481. private:
  482. /// @brief Adds new client class for DHCPv4 or DHCPv6.
  483. ///
  484. /// This method is called internally by the @c addClientClass4 and
  485. /// @c addClientClass6 functions. It adds the class of the specified name
  486. /// to the supplied class set. The class names are trimmed before they are
  487. /// added. Empty class names are ignored.
  488. ///
  489. /// @param [out] classes Set of classes to which the new class should be
  490. /// inserted.
  491. /// @param class_name Class name.
  492. void addClientClassInternal(ClientClasses& classes,
  493. const std::string& class_name);
  494. /// @brief Identifier type.
  495. IdentifierType identifier_type_;
  496. /// @brief Vector holding identifier value.
  497. std::vector<uint8_t> identifier_value_;
  498. /// @brief Subnet identifier for the DHCPv4 client.
  499. SubnetID ipv4_subnet_id_;
  500. /// @brief Subnet identifier for the DHCPv6 client.
  501. SubnetID ipv6_subnet_id_;
  502. /// @brief Reserved IPv4 address.
  503. asiolink::IOAddress ipv4_reservation_;
  504. /// @brief Collection of IPv6 reservations for the host.
  505. IPv6ResrvCollection ipv6_reservations_;
  506. /// @brief Name reserved for the host.
  507. std::string hostname_;
  508. /// @brief Collection of classes associated with a DHCPv4 client.
  509. ClientClasses dhcp4_client_classes_;
  510. /// @brief Collection of classes associated with a DHCPv6 client.
  511. ClientClasses dhcp6_client_classes_;
  512. /// @brief Next server (a.k.a. siaddr, carried in DHCPv4 message).
  513. asiolink::IOAddress next_server_;
  514. /// @brief Server host name (a.k.a. sname, carried in DHCPv4 message).
  515. std::string server_host_name_;
  516. /// @brief Boot file name (a.k.a. file, carried in DHCPv4 message)
  517. std::string boot_file_name_;
  518. /// @brief HostID (a unique identifier assigned when the host is stored in
  519. /// MySQL or Pgsql)
  520. uint64_t host_id_;
  521. /// @brief Pointer to the DHCPv4 option data configuration for this host.
  522. CfgOptionPtr cfg_option4_;
  523. /// @brief Pointer to the DHCPv6 option data configuration for this host.
  524. CfgOptionPtr cfg_option6_;
  525. };
  526. /// @brief Pointer to the @c Host object.
  527. typedef boost::shared_ptr<Host> HostPtr;
  528. /// @brief Const pointer to the @c Host object.
  529. typedef boost::shared_ptr<const Host> ConstHostPtr;
  530. /// @brief Collection of the const Host objects.
  531. typedef std::vector<ConstHostPtr> ConstHostCollection;
  532. /// @brief Collection of the @c Host objects.
  533. typedef std::vector<HostPtr> HostCollection;
  534. }
  535. }
  536. #endif // HOST_H