Commit 9fd4bd1b authored by Razvan Becheriu's avatar Razvan Becheriu

[#889,!591] use defines instead of hardcoded values

parent f388d1c1
......@@ -13,17 +13,23 @@
#include <stdint.h>
#include <string>
#define DHCP4_OPTION_SPACE "dhcp4"
#define DHCP6_OPTION_SPACE "dhcp6"
#define DOCSIS3_V4_OPTION_SPACE "docsis3-v4"
#define DOCSIS3_V6_OPTION_SPACE "docsis3-v6"
#define ISC_V6_OPTION_SPACE "4o6"
#define MAPE_V6_OPTION_SPACE "s46-cont-mape-options"
#define MAPT_V6_OPTION_SPACE "s46-cont-mapt-options"
#define LW_V6_OPTION_SPACE "s46-cont-lw-options"
#define V4V6_RULE_OPTION_SPACE "s46-rule-options"
#define V4V6_BIND_OPTION_SPACE "s46-v4v6bind-options"
#define LAST_RESORT_V4_OPTION_SPACE "last-resort-v4"
/// @brief global option spaces
#define DHCP4_OPTION_SPACE "dhcp4"
#define DHCP6_OPTION_SPACE "dhcp6"
#define DOCSIS3_V4_OPTION_SPACE "docsis3-v4"
#define DOCSIS3_V6_OPTION_SPACE "docsis3-v6"
#define ISC_V6_OPTION_SPACE "4o6"
#define MAPE_V6_OPTION_SPACE "s46-cont-mape-options"
#define MAPT_V6_OPTION_SPACE "s46-cont-mapt-options"
#define LW_V6_OPTION_SPACE "s46-cont-lw-options"
#define V4V6_RULE_OPTION_SPACE "s46-rule-options"
#define V4V6_BIND_OPTION_SPACE "s46-v4v6bind-options"
#define LAST_RESORT_V4_OPTION_SPACE "last-resort-v4"
/// @brief encapsulated option spaces
#define DHCP_AGENT_OPTION_SPACE "dhcp-agent-options-space"
#define VENDOR_OPTION_SPACE "vendor-opts-space"
#define VENDOR_ENCAPSULATED_OPTION_SPACE "vendor-encapsulated-options-space"
namespace isc {
namespace dhcp {
......
......@@ -208,7 +208,7 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
RECORD_DEF(SERVICE_SCOPE_RECORDS), "" },
{ "fqdn", DHO_FQDN, OPT_RECORD_TYPE, false, RECORD_DEF(FQDN_RECORDS), "" },
{ "dhcp-agent-options", DHO_DHCP_AGENT_OPTIONS,
OPT_EMPTY_TYPE, false, NO_RECORD_DEF, "dhcp-agent-options-space" },
OPT_EMPTY_TYPE, false, NO_RECORD_DEF, DHCP_AGENT_OPTION_SPACE },
{ "nds-servers", DHO_NDS_SERVERS, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
{ "nds-tree-name", DHO_NDS_TREE_NAME, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
{ "nds-context", DHO_NDS_CONTEXT, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
......@@ -279,7 +279,7 @@ const int STANDARD_V4_OPTION_DEFINITIONS_SIZE =
/// are applied in deferred unpacking when none is found).
const OptionDefParams LAST_RESORT_V4_OPTION_DEFINITIONS[] = {
{ "vendor-encapsulated-options", DHO_VENDOR_ENCAPSULATED_OPTIONS,
OPT_EMPTY_TYPE, false, NO_RECORD_DEF, "vendor-encapsulated-options-space" }
OPT_EMPTY_TYPE, false, NO_RECORD_DEF, VENDOR_ENCAPSULATED_OPTION_SPACE }
};
const int LAST_RESORT_V4_OPTION_DEFINITIONS_SIZE =
......@@ -367,7 +367,7 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
{ "vendor-class", D6O_VENDOR_CLASS, OPT_RECORD_TYPE, false,
RECORD_DEF(VENDOR_CLASS_RECORDS), "" },
{ "vendor-opts", D6O_VENDOR_OPTS, OPT_UINT32_TYPE, false,
NO_RECORD_DEF, "vendor-opts-space" },
NO_RECORD_DEF, VENDOR_OPTION_SPACE },
{ "interface-id", D6O_INTERFACE_ID, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
{ "reconf-msg", D6O_RECONF_MSG, OPT_UINT8_TYPE, false, NO_RECORD_DEF, "" },
{ "reconf-accept", D6O_RECONF_ACCEPT, OPT_EMPTY_TYPE, false,
......
......@@ -1667,7 +1667,7 @@ TEST_F(LibDhcpTest, stdOptionDefs6) {
LibDhcpTest::testStdOptionDefs6(D6O_VENDOR_OPTS, vopt_buf.begin(),
vopt_buf.end(),
typeid(OptionVendor),
"vendor-opts-space");
VENDOR_OPTION_SPACE);
LibDhcpTest::testStdOptionDefs6(D6O_INTERFACE_ID, begin, end,
typeid(Option));
......@@ -2141,7 +2141,7 @@ TEST_F(LibDhcpTest, option43) {
ASSERT_TRUE(def);
EXPECT_FALSE(def->getArrayType());
EXPECT_EQ(43, def->getCode());
EXPECT_EQ("vendor-encapsulated-options-space", def->getEncapsulatedSpace());
EXPECT_EQ(VENDOR_ENCAPSULATED_OPTION_SPACE, def->getEncapsulatedSpace());
EXPECT_EQ("vendor-encapsulated-options", def->getName());
EXPECT_EQ(0, def->getRecordFields().size());
EXPECT_EQ(OptionDataType::OPT_EMPTY_TYPE, def->getType());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment