diff --git a/doc/guide/classify.xml b/doc/guide/classify.xml index b501cc64ca..1100b50f57 100644 --- a/doc/guide/classify.xml +++ b/doc/guide/classify.xml @@ -202,7 +202,7 @@ --> Option existence - option[123].exist + option[123].exists 'true' If the option with given code is present in the packet "true" else "false" @@ -294,7 +294,7 @@ Vendor option existence (any vendor) - vendor[*].exist + vendor[*].exists true Returns whether a vendor option from any vendor is present ('true') or absent ('false'). @@ -335,7 +335,7 @@ Vendor class option existence (any vendor) - vendor-class[*].exist + vendor-class[*].exists true Returns whether a vendor class option from any vendor is present ('true') or absent ('false'). @@ -359,7 +359,7 @@ First data chunk from vendor class option vendor-class[4491].data - true + docsis3.0 Returns content of the first data chunk from the vendor class option with specified enterprise-id. Returns '' if missing. @@ -399,7 +399,7 @@ - "option[code].exist" checks if an option with the code "code" is present + "option[code].exists" checks if an option with the code "code" is present in the incoming packet. It can be used with empty options. diff --git a/src/lib/eval/eval_context.h b/src/lib/eval/eval_context.h index e7049b723b..4984554ec4 100644 --- a/src/lib/eval/eval_context.h +++ b/src/lib/eval/eval_context.h @@ -101,20 +101,20 @@ public: uint16_t convertOptionName(const std::string& option_name, const isc::eval::location& loc); - /// @brief Attempts to convert string to unsinged 32bit integer + /// @brief Attempts to convert string to unsigned 32bit integer /// /// @param number string to be converted /// @param loc the location of the token - /// @return the option code + /// @return the integer value /// @throw EvalParseError if conversion fails or the value is out of range. uint32_t convertUint32(const std::string& number, const isc::eval::location& loc); - /// @brief Attempts to convert string to unsinged 8bit integer + /// @brief Attempts to convert string to unsigned 8bit integer /// /// @param number string to be converted /// @param loc the location of the token - /// @return the option code + /// @return the integer value /// @throw EvalParseError if conversion fails or the value is out of range. uint8_t convertUint8(const std::string& number, const isc::eval::location& loc); @@ -123,7 +123,7 @@ public: /// /// @param nest_level a string representing the integer nesting level /// @param loc the location of the token - /// @result the nesting level + /// @return the nesting level /// @throw calls the syntax error function if the value is not in /// the range 0..31 uint8_t convertNestLevelNumber(const std::string& nest_level, diff --git a/src/lib/eval/eval_messages.mes b/src/lib/eval/eval_messages.mes index 6b7d1d1792..539ebac4b6 100644 --- a/src/lib/eval/eval_messages.mes +++ b/src/lib/eval/eval_messages.mes @@ -156,7 +156,7 @@ client classification expressions. % EVAL_DEBUG_VENDOR_CLASS_DATA Data %1 (out of %2 received) in vendor class found, pushing result '%3' This debug message indicates that vendor class option was found and passed -enterprise-id checks and has sufficient number of data chunks. Total numer +enterprise-id checks and has sufficient number of data chunks. The total number of chunks and value pushed are reported as debugging aid. % EVAL_DEBUG_VENDOR_CLASS_DATA_NOT_FOUND Requested data index %1, but option with enterprise-id %2 has only %3 data tuple(s), pushing result '%4' diff --git a/src/lib/eval/tests/context_unittest.cc b/src/lib/eval/tests/context_unittest.cc index cb5752fc0b..6e82e53c51 100644 --- a/src/lib/eval/tests/context_unittest.cc +++ b/src/lib/eval/tests/context_unittest.cc @@ -462,8 +462,8 @@ public: /// /// This test checks if EXISTS representation is set correctly. /// It covers cases like: - /// - vendor-class[4491].exist - /// - vendor-class[*].exist + /// - vendor-class[4491].exists + /// - vendor-class[*].exists /// /// @param expr expression to be parsed /// @param u universe (V4 or V6) @@ -481,7 +481,7 @@ public: /// @brief Tests if specified token vendor class expression can be parsed /// - /// This test assumes the first token will be token vendor. Any additional + /// This test assumes the first token will be token vendor-class. Any additional /// tokens are ignored. Tests experssions: /// - vendor-class[4491].exists /// - vendor-class[*].exists diff --git a/src/lib/eval/tests/token_unittest.cc b/src/lib/eval/tests/token_unittest.cc index 712ec610c4..23745989c6 100644 --- a/src/lib/eval/tests/token_unittest.cc +++ b/src/lib/eval/tests/token_unittest.cc @@ -429,7 +429,7 @@ public: evaluate(u, expected_result); } - /// @brief Tests if vendor class token can handle sub-options properly. + /// @brief Tests if vendor token can handle sub-options properly. /// /// @param u universe (V4 or V6) /// @param token_vendor_id enterprise-id used in the token @@ -1917,7 +1917,7 @@ TEST_F(TokenTest, pkt6Fields) { EXPECT_TRUE(checkFile()); } -// This test verifies if expression vendor[4491].exist works properly in DHCPv4. +// This test verifies if expression vendor[4491].exists works properly in DHCPv4. TEST_F(TokenTest, vendor4SpecificVendorExists) { // Case 1: no option, should evaluate to false testVendorExists(Option::V4, 4491, 0, "false"); @@ -1925,7 +1925,7 @@ TEST_F(TokenTest, vendor4SpecificVendorExists) { // Case 2: option present, but uses different enterprise-id, should fail testVendorExists(Option::V4, 4491, 1234, "false"); - // Case 3: option present and has matchin enterprise-id, should suceed + // Case 3: option present and has matchin enterprise-id, should succeed testVendorExists(Option::V4, 4491, 4491, "true"); // Check if the logged messages are correct. @@ -1938,7 +1938,7 @@ TEST_F(TokenTest, vendor4SpecificVendorExists) { EXPECT_TRUE(checkFile()); } -// This test verifies if expression vendor[4491].exist works properly in DHCPv6. +// This test verifies if expression vendor[4491].exists works properly in DHCPv6. TEST_F(TokenTest, vendor6SpecificVendorExists) { // Case 1: no option, should evaluate to false testVendorExists(Option::V6, 4491, 0, "false"); @@ -2406,7 +2406,8 @@ TEST_F(TokenTest, vendorClass4AnyVendorData) { testVendorClassData(Option::V4, 0, 0, 4491, 0, ""); // Case 4: Expression looks for any vendor-id (0), data[0], there is - // vendor-class with vendor-id 1234 and 1 data tuple, expected result is empty string + // vendor-class with vendor-id 1234 and 1 data tuple, expected result is + // content of that data ("alpha") testVendorClassData(Option::V4, 0, 0, 1234, 1, "alpha"); // Case 5: Expression looks for any vendor-id (0), data[0], there is @@ -2444,7 +2445,8 @@ TEST_F(TokenTest, vendorClass6AnyVendorData) { testVendorClassData(Option::V6, 0, 0, 4491, 0, ""); // Case 4: Expression looks for any vendor-id (0), data[0], there is - // vendor-class with vendor-id 1234 and 1 data tuple, expected result is empty string + // vendor-class with vendor-id 1234 and 1 data tuple, expected result is + // content of that data ("alpha") testVendorClassData(Option::V6, 0, 0, 1234, 1, "alpha"); // Case 5: Expression looks for any vendor-id (0), data[0], there is @@ -2484,11 +2486,11 @@ TEST_F(TokenTest, vendorClass4DataIndex) { testVendorClassData(Option::V4, 4491, 3, 4491, 0, ""); // Case 4: Expression looks for vendor-id 4491, data[3], there is - // vendor-class with vendor-id 1234 and 2 data tuples, expected result is empty string. + // vendor-class with vendor-id 1234 and 1 data tuples, expected result is empty string. testVendorClassData(Option::V4, 4491, 3, 1234, 1, ""); // Case 5: Expression looks for vendor-id 4491, data[3], there is - // vendor-class with vendor-id 4491, but has only 2 data tuples, expected + // vendor-class with vendor-id 4491, but has only 3 data tuples, expected // result is empty string. testVendorClassData(Option::V4, 4491, 3, 4491, 3, ""); diff --git a/src/lib/eval/token.cc b/src/lib/eval/token.cc index 7963a52e34..a130c35715 100644 --- a/src/lib/eval/token.cc +++ b/src/lib/eval/token.cc @@ -810,7 +810,7 @@ void TokenVendorClass::evaluate(Pkt& pkt, ValueStack& values) { { size_t max = vendor->getTuplesNum(); if (index_ + 1 > max) { - // The index specified if out of bound, e.g. there are only + // The index specified is out of bounds, e.g. there are only // 2 tuples and index specified is 5. LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_DATA_NOT_FOUND) .arg(index_) diff --git a/src/lib/eval/token.h b/src/lib/eval/token.h index 28c444c617..ea6c9cbdf7 100644 --- a/src/lib/eval/token.h +++ b/src/lib/eval/token.h @@ -698,10 +698,10 @@ private: /// In particular, it allows retrieving enterprise-id. /// /// It can represent the following expressions: -/// vendor[4491].exist - if vendor option with enterprise-id = 4491 exists -/// vendor[*].exist - if any vendor option exists +/// vendor[4491].exists - if vendor option with enterprise-id = 4491 exists +/// vendor[*].exists - if any vendor option exists /// vendor.enterprise - returns enterprise-id from vendor option -/// vendor[4491].option[1].exist - check if suboption 1 exists for vendor 4491 +/// vendor[4491].option[1].exists - check if suboption 1 exists for vendor 4491 /// vendor[4491].option[1].hex - return content of suboption 1 for vendor 4491 class TokenVendor : public TokenOption { public: @@ -793,7 +793,7 @@ protected: /// @brief Enterprise-id value /// - /// Yeah, I know it's technically should be called enterprise-id, but that's + /// Yeah, I know it technically should be called enterprise-id, but that's /// too long and everyone calls it vendor-id. uint32_t vendor_id_; @@ -813,8 +813,8 @@ protected: /// enterprise handling field and field type. /// /// It can represent the following expressions: -/// vendor-class[4491].exist -/// vendor-class[*].exist +/// vendor-class[4491].exists +/// vendor-class[*].exists /// vendor-class[*].enterprise /// vendor-class[4491].data - content of the opaque-data of the first tuple /// vendor-class[4491].data[3] - content of the opaque-data of the 4th tuple @@ -860,7 +860,7 @@ protected: /// /// If FieldType is DATA, get specified data chunk represented by index_. /// - /// If FieldType is EXISTS, return true of vendor-id matches. + /// If FieldType is EXISTS, return true if vendor-id matches. /// /// @throw EvalTypeError for any other FieldType values. ///