subnet_selector.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright (C) 2014 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 SUBNET_SELECTOR_H
  15. #define SUBNET_SELECTOR_H
  16. #include <asiolink/io_address.h>
  17. #include <dhcp/classify.h>
  18. #include <dhcp/option.h>
  19. #include <string>
  20. namespace isc {
  21. namespace dhcp {
  22. /// @brief Subnet selector used to specify parameters used to select a subnet.
  23. ///
  24. /// This structure holds various parameters extracted from a packet sent
  25. /// by a DHCP client used to select the subnet for the client. This selector
  26. /// is common for IPv4 and IPv6 subnets.
  27. struct SubnetSelector {
  28. /// @name DHCPv4 specific parameters.
  29. //@{
  30. /// @brief ciaddr from the client's message.
  31. asiolink::IOAddress ciaddr_;
  32. /// @brief giaddr from the client's message.
  33. asiolink::IOAddress giaddr_;
  34. //@}
  35. /// @name DHCPv6 specific parameters.
  36. //@{
  37. /// @brief Interface id option.
  38. OptionPtr interface_id_;
  39. /// @brief First relay link address.
  40. asiolink::IOAddress first_relay_linkaddr_;
  41. //@}
  42. /// @brief Address on which the message was received.
  43. asiolink::IOAddress local_address_;
  44. /// @brief Source address of the message.
  45. asiolink::IOAddress remote_address_;
  46. /// @brief Classes that the client belongs to.
  47. ClientClasses client_classes_;
  48. /// @brief Name of the interface on which the message was received.
  49. std::string iface_name_;
  50. /// @brief Default constructor.
  51. ///
  52. /// Sets the default values for the @c Selector.
  53. SubnetSelector()
  54. : ciaddr_(asiolink::IOAddress("0.0.0.0")),
  55. giaddr_(asiolink::IOAddress("0.0.0.0")),
  56. interface_id_(),
  57. first_relay_linkaddr_(asiolink::IOAddress("::")),
  58. local_address_(asiolink::IOAddress("0.0.0.0")),
  59. remote_address_(asiolink::IOAddress("0.0.0.0")),
  60. client_classes_(), iface_name_(std::string()) {
  61. }
  62. };
  63. }
  64. }
  65. #endif // SUBNET_SELECTOR_H