|
@@ -26,6 +26,7 @@
|
|
|
|
|
|
#include <iostream>
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
+#include <set>
|
|
|
|
|
|
#include <time.h>
|
|
#include <time.h>
|
|
|
|
|
|
@@ -52,6 +53,9 @@ public:
|
|
/// to check whether client requested broadcast response.
|
|
/// to check whether client requested broadcast response.
|
|
const static uint16_t FLAG_BROADCAST_MASK = 0x8000;
|
|
const static uint16_t FLAG_BROADCAST_MASK = 0x8000;
|
|
|
|
|
|
|
|
+ /// Container for storing client classes
|
|
|
|
+ typedef std::set<std::string> Classes;
|
|
|
|
+
|
|
/// Constructor, used in replying to a message.
|
|
/// Constructor, used in replying to a message.
|
|
///
|
|
///
|
|
/// @param msg_type type of message (e.g. DHCPDISOVER=1)
|
|
/// @param msg_type type of message (e.g. DHCPDISOVER=1)
|
|
@@ -532,6 +536,27 @@ public:
|
|
/// performance).
|
|
/// performance).
|
|
std::vector<uint8_t> data_;
|
|
std::vector<uint8_t> 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.
|
|
|
|
+ ///
|
|
|
|
+ /// @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_;
|
|
|
|
+
|
|
private:
|
|
private:
|
|
|
|
|
|
/// @brief Generic method that validates and sets HW address.
|
|
/// @brief Generic method that validates and sets HW address.
|