return (offset);
}
-void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) {
- string classes = "";
-
+void Dhcpv4Srv::classifyByVendor(const Pkt4Ptr& pkt, std::string& classes) {
// Built-in vendor class processing
boost::shared_ptr<OptionString> vendor_class =
boost::dynamic_pointer_cast<OptionString>(pkt->getOption(DHO_VENDOR_CLASS_IDENTIFIER));
if (!vendor_class) {
- goto vendor_class_done;
+ return;
}
// DOCSIS specific section
pkt->addClass(VENDOR_CLASS_PREFIX + vendor_class->getValue());
classes += VENDOR_CLASS_PREFIX + vendor_class->getValue();
}
+}
+
+void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) {
+ string classes = "";
-vendor_class_done:
+ // First phase: built-in vendor class processing
+ classifyByVendor(pkt, classes);
// Run match expressions
// Note getClientClassDictionary() cannot be null
/// @brief Assigns incoming packet to zero or more classes.
///
/// @note It is done in two phases: first the content of the
- /// vendor-class-identifier option is used as a class. Second
- /// classification match expressions are evaluated. The resulting
- /// class will be stored in packet (see @ref isc::dhcp::Pkt4::classes_
- /// and @ref isc::dhcp::Pkt4::inClass).
+ /// vendor-class-identifier option is used as a class, by
+ /// calling @ref classifyByVendor(). Second classification match
+ /// expressions are evaluated. The resulting class will be stored
+ /// in packet (see @ref isc::dhcp::Pkt4::classes_ and
+ /// @ref isc::dhcp::Pkt4::inClass).
///
/// @param pkt packet to be classified
void classifyPacket(const Pkt4Ptr& pkt);
private:
+ /// @brief Assign class using vendor-class-identifier option
+ ///
+ /// @note This is the first part of @ref classifyPacket
+ ///
+ /// @param pkt packet to be classified
+ /// @param classes a reference to added class names for logging
+ void classifyByVendor(const Pkt4Ptr& pkt, std::string& classes);
+
/// @brief Constructs netmask option based on subnet4
/// @param subnet subnet for which the netmask will be calculated
///