diff options
Diffstat (limited to 'src/lib/dhcp/pkt6.h')
-rw-r--r-- | src/lib/dhcp/pkt6.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/dhcp/pkt6.h b/src/lib/dhcp/pkt6.h index 702c424864..db80fb9996 100644 --- a/src/lib/dhcp/pkt6.h +++ b/src/lib/dhcp/pkt6.h @@ -23,6 +23,7 @@ #include <boost/shared_ptr.hpp> #include <iostream> +#include <set> #include <time.h> @@ -47,6 +48,9 @@ public: TCP = 1 // there are TCP DHCPv6 packets (bulk leasequery, failover) }; + /// Container for storing client classes + typedef std::set<std::string> Classes; + /// @brief defines relay search pattern /// /// Defines order in which options are searched in a message that @@ -426,6 +430,35 @@ public: /// data format change etc. OptionBuffer data_; + /// @brief Checks whether a client belongs to a given class + /// + /// @param client_class name of the class + /// @return true if belongs + bool inClass(const std::string& client_class); + + /// @brief Adds packet to a specified class + /// + /// A packet can be added to the same class repeatedly. Any additional + /// attempts to add to a class the packet already belongs to, will be + /// ignored silently. + /// + /// @note It is a matter of naming convention. Conceptually, the server + /// processes a stream of packets, with some packets belonging to given + /// classes. From that perspective, this method adds a packet to specifed + /// class. Implementation wise, it looks the opposite - the class name + /// is added to the packet. Perhaps the most appropriate name for this + /// method would be associateWithClass()? But that seems overly long, + /// so I decided to stick with addClass(). + /// + /// @param client_class name of the class to be added + void addClass(const std::string& client_class); + + /// @brief Classes this packet belongs to. + /// + /// This field is public, so code can iterate over existing classes. + /// Having it public also solves the problem of returned reference lifetime. + Classes classes_; + protected: /// Builds on wire packet for TCP transmission. /// |