subnet_selector.h 2.3 KB

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