Commit d85d3428 authored by Francis Dupont's avatar Francis Dupont
Browse files

[master] Finished merge of trac5227 (adding easy missing option defs)

parents f3f0ef22 2509c77b
1300. [func] fdupont
Added some standard option definitions which are supported
by ISC DHCP but not (yet) by Kea.
(Trac #5227, git xxx)
1299. [doc] fdupont, tmark
Added an example stunnel configuration file to demonstrate
using kea-shell through https.
......
......@@ -1333,6 +1333,7 @@ This rather belong to the DDNS configuration
<row><entry>streettalk-server</entry><entry>75</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
<row><entry>streettalk-directory-assistance-server</entry><entry>76</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
<row><entry>user-class</entry><entry>77</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
<row><entry>slp-service-scope</entry><entry>79</entry><entry>record (boolean, string)</entry><entry>false</entry><entry>false</entry></row>
<!-- The Client FQDN option value is not explicitly configured.
It is a part of the DDNS/D2 configuration
<row><entry>fqdn</entry><entry>81</entry><entry>record</entry><entry>false</entry><entry>true</entry></row>
......@@ -1341,6 +1342,11 @@ It is a part of the DDNS/D2 configuration
It is merely echoed by the server
<row><entry>dhcp-agent-options</entry><entry>82</entry><entry>empty</entry><entry>false</entry><entry>false</entry></row>
-->
<row><entry>nds-server</entry><entry>85</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
<row><entry>nds-tree-name</entry><entry>86</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>nds-context</entry><entry>87</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>bcms-controller-names</entry><entry>88</entry><entry>fqdn</entry><entry>true</entry><entry>false</entry></row>
<row><entry>bcms-controller-address</entry><entry>89</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
<!-- Authentication option requires special processing
<row><entry>authenticate</entry><entry>90</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
-->
......@@ -1351,10 +1357,26 @@ It is merely echoed by the server
<row><entry>client-system</entry><entry>93</entry><entry>uint16</entry><entry>true</entry><entry>false</entry></row>
<row><entry>client-ndi</entry><entry>94</entry><entry>record (uint8, uint8, uint8)</entry><entry>false</entry><entry>false</entry></row>
<row><entry>uuid-guid</entry><entry>97</entry><entry>record (uint8, binary)</entry><entry>false</entry><entry>false</entry></row>
<row><entry>uap-servers</entry><entry>98</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>geoconf-civic</entry><entry>99</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
<row><entry>pcode</entry><entry>100</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>tcode</entry><entry>101</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>netinfo-server-address</entry><entry>112</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
<row><entry>netinfo-server-tag</entry><entry>113</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>default-url</entry><entry>114</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>auto-config</entry><entry>116</entry><entry>uint8</entry><entry>false</entry><entry>false</entry></row>
<row><entry>name-service-search</entry><entry>117</entry><entry>uint16</entry><entry>true</entry><entry>false</entry></row>
<row><entry>subnet-selection</entry><entry>118</entry><entry>ipv4-address</entry><entry>false</entry><entry>false</entry></row>
<row><entry>domain-search</entry><entry>119</entry><entry>fqdn</entry><entry>true</entry><entry>false</entry></row>
<row><entry>vivco-suboptions</entry><entry>124</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
<row><entry>vivso-suboptions</entry><entry>125</entry><entry>binary</entry><entry>false</entry><entry>false</entry></row>
<row><entry>pana-agent</entry><entry>136</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
<row><entry>v4-lost</entry><entry>137</entry><entry>fqdn</entry><entry>false</entry><entry>false</entry></row>
<row><entry>capwap-ac-v4</entry><entry>138</entry><entry>ipv4-address</entry><entry>true</entry><entry>false</entry></row>
<row><entry>sip-ua-cs-domains</entry><entry>142</entry><entry>fqdn</entry><entry>true</entry><entry>false</entry></row>
<row><entry>v4-portparams</entry><entry>159</entry><entry>record (uint8, uint8, uint16)</entry><entry>false</entry><entry>false</entry></row>
<row><entry>v4-captive-portal</entry><entry>160</entry><entry>string</entry><entry>false</entry><entry>false</entry></row>
<row><entry>v4-access-domain</entry><entry>213</entry><entry>fqdn</entry><entry>false</entry><entry>false</entry></row>
</tbody>
</tgroup>
</table>
......
......@@ -1284,6 +1284,11 @@ temporarily override a list of interface names and listen on all interfaces.
<row><entry>clt-time</entry><entry>46</entry><entry>uint32</entry><entry>false</entry></row>
<row><entry>lq-relay-data</entry><entry>47</entry><entry>record (ipv6-address, binary)</entry><entry>false</entry></row>
<row><entry>lq-client-link</entry><entry>48</entry><entry>ipv6-address</entry><entry>true</entry></row>
<row><entry>v6-lost</entry><entry>51</entry><entry>fqdn</entry><entry>false</entry></row>
<row><entry>capwap-ac-v6</entry><entry>52</entry><entry>ipv6-address</entry><entry>true</entry></row>
<row><entry>relay-id</entry><entry>53</entry><entry>binary</entry><entry>false</entry></row>
<row><entry>v6-access-domain</entry><entry>57</entry><entry>fqdn</entry><entry>false</entry></row>
<row><entry>sip-ua-cs-list</entry><entry>58</entry><entry>fqdn</entry><entry>true</entry></row>
<row><entry>bootfile-url</entry><entry>59</entry><entry>string</entry><entry>false</entry></row>
<row><entry>bootfile-param</entry><entry>60</entry><entry>tuple</entry><entry>true</entry></row>
<row><entry>client-arch-type</entry><entry>61</entry><entry>uint16</entry><entry>true</entry></row>
......@@ -1293,8 +1298,13 @@ temporarily override a list of interface names and listen on all interfaces.
<row><entry>rsoo</entry><entry>66</entry><entry>empty</entry><entry>false</entry></row>
<row><entry>pd-exclude</entry><entry>67</entry><entry>binary</entry><entry>false</entry></row>
<row><entry>client-linklayer-addr</entry><entry>79</entry><entry>binary</entry><entry>false</entry></row>
<row><entry>link-address</entry><entry>80</entry><entry>ipv6-address</entry><entry>false</entry></row>
<row><entry>solmax-rt</entry><entry>82</entry><entry>uint32</entry><entry>false</entry></row>
<row><entry>inf-max-rt</entry><entry>83</entry><entry>uint32</entry><entry>false</entry></row>
<!-- <row><entry>dhcpv4-message</entry><entry>87</entry><entry>binary</entry><entry>false</entry></row> -->
<row><entry>dhcp4o6-server-addr</entry><entry>88</entry><entry>ipv6-address</entry><entry>true</entry></row>
<row><entry>v6-captive-portal</entry><entry>103</entry><entry>string</entry><entry>false</entry></row>
<row><entry>ipv6-address-andsf</entry><entry>143</entry><entry>ipv6-address</entry><entry>true</entry></row>
</tbody>
</tgroup>
</table>
......
......@@ -2218,15 +2218,11 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
checkResult(status, 1);
EXPECT_TRUE(errorContainsPosition(status, "<string>"));
/// @todo The option 213 is a standard DHCPv4 option. However, at
/// this point there is no definition for this option in
/// libdhcp++, so it should be allowed to define it from the
/// configuration interface. This test will have to be removed
/// once definitions for remaining standard options are created.
/// There is no definition for unassigned option 170.
config =
"{ \"option-def\": [ {"
" \"name\": \"access-network-domain-name\","
" \"code\": 213,"
" \"name\": \"unassigned-option-170\","
" \"code\": 170,"
" \"type\": \"string\","
" \"space\": \"dhcp4\""
" } ]"
......@@ -2241,12 +2237,12 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
checkResult(status, 0);
def = CfgMgr::instance().getStagingCfg()->
getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 213);
getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 170);
ASSERT_TRUE(def);
// Check the option data.
EXPECT_EQ("access-network-domain-name", def->getName());
EXPECT_EQ(213, def->getCode());
EXPECT_EQ("unassigned-option-170", def->getName());
EXPECT_EQ(170, def->getCode());
EXPECT_EQ(OPT_STRING_TYPE, def->getType());
EXPECT_FALSE(def->getArrayType());
......
......@@ -533,8 +533,8 @@ const char* EXTRACTED_CONFIGS[] = {
"{\n"
" \"option-def\": [\n"
" {\n"
" \"code\": 213,\n"
" \"name\": \"access-network-domain-name\",\n"
" \"code\": 170,\n"
" \"name\": \"unassigned-option-170\",\n"
" \"space\": \"dhcp4\",\n"
" \"type\": \"string\"\n"
" }\n"
......@@ -3208,9 +3208,9 @@ const char* UNPARSED_CONFIGS[] = {
" \"option-def\": [\n"
" {\n"
" \"array\": false,\n"
" \"code\": 213,\n"
" \"code\": 170,\n"
" \"encapsulate\": \"\",\n"
" \"name\": \"access-network-domain-name\",\n"
" \"name\": \"unassigned-option-170\",\n"
" \"record-types\": \"\",\n"
" \"space\": \"dhcp4\",\n"
" \"type\": \"string\"\n"
......
/*
* Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2004-2017 Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* This Source Code Form is subject to the terms of the Mozilla Public
......@@ -145,17 +145,17 @@ enum DHCPOptionType {
DHO_STDASERVER = 76,
DHO_USER_CLASS = 77,
// DHO_DIRECTORY_AGENT = 78,
// DHO_SERVICE_SCOPE = 79,
// DHO_RAPID_COMMIT = 80,,
DHO_SERVICE_SCOPE = 79,
// DHO_RAPID_COMMIT = 80,
DHO_FQDN = 81,
DHO_DHCP_AGENT_OPTIONS = 82,
// DHO_ISNS = 83,
// 84 is removed/unassigned
// DHO_NDS_SERVERS = 85,
// DHO_NDS_TREE_NAME = 86,
// DHO_NDS_CONTEXT = 87,
// DHO_BCMCS_DOMAIN_NAME_LIST = 88,
// DHO_BCMCS_IPV4_ADDR = 89,
DHO_NDS_SERVERS = 85,
DHO_NDS_TREE_NAME = 86,
DHO_NDS_CONTEXT = 87,
DHO_BCMCS_DOMAIN_NAME_LIST = 88,
DHO_BCMCS_IPV4_ADDR = 89,
DHO_AUTHENTICATE = 90, /* RFC3118, was 210 */
DHO_CLIENT_LAST_TRANSACTION_TIME = 91,
DHO_ASSOCIATED_IP = 92,
......@@ -164,17 +164,17 @@ enum DHCPOptionType {
// DHO_LDAP = 95,
// 96 is removed/unassigned
DHO_UUID_GUID = 97, /* RFC4578 */
// DHO_USER_AUTH = 98,
// DHO_GEOCONF_CIVIC = 99,
// DHO_PCODE = 100,
// DHO_TCODE = 101,
DHO_USER_AUTH = 98,
DHO_GEOCONF_CIVIC = 99,
DHO_PCODE = 100,
DHO_TCODE = 101,
// 102-111 are removed/unassigned
// DHO_NETINFO_ADDR = 112,
// DHO_NETINFO_TAG = 113,
// DHO_URL = 114,
DHO_NETINFO_ADDR = 112,
DHO_NETINFO_TAG = 113,
DHO_URL = 114,
// 115 is removed/unassigned
// DHO_AUTO_CONFIG = 116,
// DHO_NAME_SERVICE_SEARCH = 117,
DHO_AUTO_CONFIG = 116,
DHO_NAME_SERVICE_SEARCH = 117,
DHO_SUBNET_SELECTION = 118, /* RFC3011 */
DHO_DOMAIN_SEARCH = 119, /* RFC3397 */
// DHO_SIP_SERVERS = 120,
......@@ -185,12 +185,12 @@ enum DHCPOptionType {
DHO_VIVSO_SUBOPTIONS = 125,
// 126-127 are removed/unassigned
// 128-135 have multiple definitions including PXE
// DHO_PANA_AGENT = 136,
// DHO_V4_LOST = 137,
// DHO_CAPWAP_AC_V4 = 138,
DHO_PANA_AGENT = 136,
DHO_V4_LOST = 137,
DHO_CAPWAP_AC_V4 = 138,
// DHO_IPV4_ADDR_MOS = 139,
// DHO_IPV4_FQDN_MOS = 140,
// DHO_SIP_UA_CONF_SERVICE_DOMAINS = 141,
DHO_SIP_UA_CONF_SERVICE_DOMAINS = 141,
// DHO_IPV4_ADDR_ANDSF = 142,
// 143 is removed/unassigned
// DHO_GEOLOC = 144,
......@@ -206,10 +206,13 @@ enum DHCPOptionType {
// DHO_DHCP_STATE = 156,
// DHO_DATA_SOURCE = 157,
// DHO_V4_PCP_SERVER = 158,
// DHO_V4_PORTPARAMS = 159,
// 160-211 are removed/unassigned
DHO_V4_PORTPARAMS = 159,
DHO_V4_CAPTIVE_PORTAL = 160,
// 161-209 are removed/unassigned
// DHO_PATH_PREFIX = 210,
// DHO_REBOOT_TIME = 211,
// DHO_6RD = 212,
// DHO_V4_ACCESS_DOMAIN = 213,
DHO_V4_ACCESS_DOMAIN = 213,
// 214-219 are removed/unassigned
// DHO_SUBNET_ALLOC = 220,
// DHO_VSS = 221,
......@@ -237,6 +240,9 @@ enum DHCPMessageType {
DHCPLEASEACTIVE = 13,
DHCPBULKLEASEQUERY = 14,
DHCPLEASEQUERYDONE = 15
// DHCPACTIVELEASEQUERY = 16,
// DHCPLEASEQUERYSTATUS = 17,
// DHCPTLS = 18
};
static const uint16_t DHCP4_CLIENT_PORT = 68;
......@@ -260,6 +266,12 @@ static const uint16_t RAI_OPTION_VSI = 9; // RFC4243
static const uint16_t RAI_OPTION_RELAY_FLAGS = 10; // RFC5010
static const uint16_t RAI_OPTION_SERVER_ID_OVERRIDE = 11; // RFC5107
static const uint16_t RAI_OPTION_RELAY_ID = 12; //RFC6925
static const uint16_t RAI_OPTION_ACCESS_TECHNO_TYPE = 13; // RFC7839
static const uint16_t RAI_OPTION_ACCESS_NETWORK_NAME = 14; // RFC7839
static const uint16_t RAI_OPTION_ACCESS_POINT_NAME = 15; // RFC7839
static const uint16_t RAI_OPTION_ACCESS_POINT_BSSID = 16; // RFC7839
static const uint16_t RAI_OPTION_OPERATOR_ID = 17; // RFC7839
static const uint16_t RAI_OPTION_OPERATOR_REALM = 18; // RFC7839
static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT = 151; //RFC6607
static const uint16_t RAI_OPTION_VIRTUAL_SUBNET_SELECT_CTRL = 152; //RFC6607
......
This diff is collapsed.
// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -6,8 +6,10 @@
#include <config.h>
#include <dhcp/dhcp4.h>
#include <dhcp/dhcp6.h>
#include <dhcp/option6_status_code.h>
#include <dhcp/option_data_types.h>
#include <util/io_utilities.h>
#include <iterator>
#include <sstream>
......@@ -19,6 +21,7 @@ namespace {
/// @brief Minimum length of the option (when status message is empty).
const size_t OPTION6_STATUS_CODE_MIN_LEN = sizeof(uint16_t);
const size_t OPTION4_SLP_SERVICE_SCOPEMIN_LEN = sizeof(uint8_t);
}; // end of anonymous namespace
......@@ -36,7 +39,7 @@ Option6StatusCode::Option6StatusCode(OptionBufferConstIter begin,
: Option(Option::V6, D6O_STATUS_CODE),
status_code_(STATUS_Success), status_message_() {
// Parse data
// Parse data
unpack(begin, end);
}
......@@ -135,5 +138,81 @@ Option6StatusCode::getStatusCodeName() const {
return ("(unknown status code)");
}
Option4SlpServiceScope::Option4SlpServiceScope(const bool mandatory_flag,
const std::string& scope_list)
: Option(Option::V4, DHO_SERVICE_SCOPE),
mandatory_flag_(mandatory_flag), scope_list_(scope_list) {
}
Option4SlpServiceScope::Option4SlpServiceScope(OptionBufferConstIter begin,
OptionBufferConstIter end)
: Option(Option::V4, DHO_SERVICE_SCOPE),
mandatory_flag_(false), scope_list_() {
// Parse data
unpack(begin, end);
}
OptionPtr
Option4SlpServiceScope::clone() const {
return (cloneInternal<Option4SlpServiceScope>());
}
void
Option4SlpServiceScope::pack(isc::util::OutputBuffer& buf) const {
// Pack option header.
packHeader(buf);
// Write mandatory flag.
buf.writeUint8(static_cast<uint8_t>(getMandatoryFlag() ? 1 : 0));
// If there is any scope list, write it.
if (!scope_list_.empty()) {
buf.writeData(&scope_list_[0], scope_list_.size());
}
// SLP service scope has no options, so leave here.
}
void
Option4SlpServiceScope::unpack(OptionBufferConstIter begin, OptionBufferConstIter end) {
// Make sure that the option is not truncated.
if (std::distance(begin, end) < OPTION4_SLP_SERVICE_SCOPEMIN_LEN) {
isc_throw(OutOfRange, "SLP Service Scope option ("
<< DHO_SERVICE_SCOPE << ") truncated");
}
if (*begin == 1) {
mandatory_flag_ = true;
} else if (*begin == 0) {
mandatory_flag_ = false;
} else {
isc_throw(BadDataTypeCast, "unable to read the buffer as boolean"
<< " value. Invalid value " << static_cast<int>(*begin));
}
begin += sizeof(uint8_t);
scope_list_.assign(begin, end);
}
uint16_t
Option4SlpServiceScope::len() const {
return (getHeaderLen() + sizeof(bool) + scope_list_.size());
}
std::string
Option4SlpServiceScope::toText(int indent) const {
std::ostringstream output;
output << headerToText(indent) << ": " << dataToText();
return (output.str());
}
std::string
Option4SlpServiceScope::dataToText() const {
std::ostringstream output;
output << "mandatory:" << getMandatoryFlag();
output << ", scope-list:\"" << scope_list_ << "\"";
return (output.str());
}
} // end of namespace isc::dhcp
} // end of namespace isc
// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -50,6 +50,8 @@ public:
/// @brief Parses received buffer.
///
/// @throw OutOfRange if specified option is truncated
///
/// @param begin Iterator to first byte of option data
/// @param end Iterator to end of option data (first byte after option end)
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
......@@ -107,6 +109,100 @@ private:
};
/// The SLP Service Scope option has a similar layout...
class Option4SlpServiceScope;
/// @brief Pointer to the @c isc::dhcp::Option4SlpServiceScope.
typedef boost::shared_ptr<Option4SlpServiceScope> Option4SlpServiceScopePtr;
/// @brief This class represents SLP Service Scope option (79) from RFC2610.
class Option4SlpServiceScope: public Option {
public:
/// @brief Constructor, used for options constructed (during transmission).
///
/// @param mandatory_flag Mandatory flag.
/// @param scope_list Textual scope list, may be empty
Option4SlpServiceScope(const bool mandatory_flag, const std::string& scope_list);
/// @brief Constructor, used for received options.
///
/// @throw OutOfRange if specified option is truncated
///
/// @param begin Iterator to first byte of option data
/// @param end Iterator to end of option data (first byte after option end).
Option4SlpServiceScope(OptionBufferConstIter begin, OptionBufferConstIter end);
/// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Writes option in wire-format.
///
/// Writes option in wire-format to buf, returns pointer to first unused
/// byte after stored option.
///
/// @param [out] buf Pointer to the output buffer.
virtual void pack(isc::util::OutputBuffer& buf) const;
/// @brief Parses received buffer.
///
/// @throw OutOfRange if specified option is truncated
/// @throw BadDataTypeCast if first byte is not 0 or 1
///
/// @param begin Iterator to first byte of option data
/// @param end Iterator to end of option data (first byte after option end)
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end);
/// @brief Returns total length of the option.
///
/// The returned length is a sum of the option header and data fields.
virtual uint16_t len() const;
/// @brief Returns textual representation of the option.
///
/// @param indent Number of spaces before printing text.
virtual std::string toText(int indent = 0) const;
/// @brief Returns textual representation of the option data.
///
/// This method returns only the status code and the status
/// message. It excludes the option header.
std::string dataToText() const;
/// @brief Returns mandatory flag
bool getMandatoryFlag() const {
return (mandatory_flag_);
}
/// @brief Sets new mandatory flag.
///
/// @param status_code New numeric status code.
void setMandatoryFlag(const bool mandatory_flag) {
mandatory_flag_ = mandatory_flag;
}
/// @brief Returns scope list.
const std::string& getScopeList() const {
return (scope_list_);
}
/// @brief Sets new scope list.
///
/// @param scope_list New scope list (empty string is allowed).
void setScopeList(std::string& scope_list) {
scope_list_ = scope_list;
}
private:
/// @brief Mandatory flag.
bool mandatory_flag_;
/// @brief Scope list.
std::string scope_list_;
};
} // isc::dhcp namespace
} // isc namespace
......
......@@ -441,6 +441,14 @@ OptionDefinition::haveStatusCodeFormat() const {
(record_fields_[1] == OPT_STRING_TYPE));
}
bool
OptionDefinition::haveServiceScopeFormat() const {
return (haveType(OPT_RECORD_TYPE) &&
(record_fields_.size() == 2) &&
(record_fields_[0] == OPT_BOOLEAN_TYPE) &&
(record_fields_[1] == OPT_STRING_TYPE));
}
bool
OptionDefinition::haveOpaqueDataTuplesFormat() const {
return (haveType(OPT_TUPLE_TYPE) && getArrayType());
......@@ -856,7 +864,9 @@ OptionDefinition::factorySpecialFormatOption(Option::Universe u,
return (OptionPtr(new Option6PDExclude(begin, end)));
}
} else {
if ((getCode() == DHO_FQDN) && haveFqdn4Format()) {
if ((getCode() == DHO_SERVICE_SCOPE) && haveServiceScopeFormat()) {
return (OptionPtr(new Option4SlpServiceScope(begin, end)));
} else if ((getCode() == DHO_FQDN) && haveFqdn4Format()) {
return (OptionPtr(new Option4ClientFqdn(begin, end)));
} else if (haveCompressedFqdnListFormat()) {
return (factoryFqdnList(Option::V4, begin, end));
......
......@@ -364,6 +364,15 @@ public:
/// @return true if option has the format of DHCPv6 Vendor Class option.
bool haveVendorClass6Format() const;
/// @brief Check if option has format of the SLP Service Scope
/// %Option.
///
/// The scope list in the SLP Service Scope option is optional
/// (i.e., as the error message in the DHCPv6 Status code option).
///
/// @return true if option has the format of SLP Service Scope %Option.
bool haveServiceScopeFormat() const;
/// @brief Check if the option has format of DHCPv6 Status Code option.
///
/// @return true if option has the format of DHCPv6 Status code option.
......
......@@ -37,6 +37,11 @@ namespace {
#define NO_RECORD_DEF 0, 0
#endif
// SLP Service Scope option.
//
// The scope list is optional.
RECORD_DECL(SERVICE_SCOPE_RECORDS, OPT_BOOLEAN_TYPE, OPT_STRING_TYPE);
// fqdn option record fields.
//
// Note that the flags field indicates the type of domain
......@@ -60,6 +65,11 @@ RECORD_DECL(CLIENT_NDI_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_UINT8_TYPE);
// A client identifier: a 1 byte type field followed by opaque data depending on the type
RECORD_DECL(UUID_GUID_RECORDS, OPT_UINT8_TYPE, OPT_BINARY_TYPE);
// RFC7618 DHCPv4 Port Parameter option.
//
// PSID offset, PSID-len and PSID
RECORD_DECL(V4_PORTPARAMS_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_UINT16_TYPE);
/// @brief Definitions of standard DHCPv4 options.
const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
{ "subnet-mask", DHO_SUBNET_MASK, OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
......@@ -174,10 +184,17 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
{ "streettalk-server", DHO_STREETTALK_SERVER, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
{ "streettalk-directory-assistance-server", DHO_STDASERVER, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
{ "user-class", DHO_USER_CLASS, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
{ "slp-service-scope", DHO_SERVICE_SCOPE, OPT_RECORD_TYPE, false,
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" },
// Unfortunately the AUTHENTICATE option contains a 64-bit
{ "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, "" },
{ "bcms-controller-names", DHO_BCMCS_DOMAIN_NAME_LIST, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" },
{ "bcms-controller-address", DHO_BCMCS_IPV4_ADDR, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
// Unfortunatelly the AUTHENTICATE option contains a 64-bit
// data field called 'replay-detection' that can't be added
// as a record field to a custom option. Also, there is no
// dedicated option class to handle it so we simply return
......@@ -190,6 +207,15 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
{ "client-system", DHO_SYSTEM, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
{ "client-ndi", DHO_NDI, OPT_RECORD_TYPE, false, RECORD_DEF(CLIENT_NDI_RECORDS), "" },
{ "uuid-guid", DHO_UUID_GUID, OPT_RECORD_TYPE, false, RECORD_DEF(UUID_GUID_RECORDS), "" },
{ "uap-servers", DHO_USER_AUTH, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
{ "geoconf-civic", DHO_GEOCONF_CIVIC, OPT_BINARY_TYPE, false, NO_RECORD_DEF, "" },
{ "pcode", DHO_PCODE, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
{ "tcode", DHO_TCODE, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
{ "netinfo-server-address", DHO_NETINFO_ADDR, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
{ "netinfo-server-tag", DHO_NETINFO_TAG, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
{ "default-url", DHO_URL, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
{ "auto-config", DHO_AUTO_CONFIG, OPT_UINT8_TYPE, false, NO_RECORD_DEF, "" },
{ "name-service-search", DHO_NAME_SERVICE_SEARCH, OPT_UINT16_TYPE, true, NO_RECORD_DEF, "" },
{ "subnet-selection", DHO_SUBNET_SELECTION,
OPT_IPV4_ADDRESS_TYPE, false, NO_RECORD_DEF, "" },
{ "domain-search", DHO_DOMAIN_SEARCH, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" },
......@@ -208,7 +234,15 @@ const OptionDefParams STANDARD_V4_OPTION_DEFINITIONS[] = {
/// ok to specify multiple instances of the "vivso-suboptions" which will be
/// combined in a single option by the server before responding to a client.
{ "vivso-suboptions", DHO_VIVSO_SUBOPTIONS, OPT_UINT32_TYPE,
false, NO_RECORD_DEF, "" }
false, NO_RECORD_DEF, "" },
{ "pana-agent", DHO_PANA_AGENT, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
{ "v4-lost", DHO_V4_LOST, OPT_FQDN_TYPE, false, NO_RECORD_DEF, "" },
{ "capwap-ac-v4", DHO_CAPWAP_AC_V4, OPT_IPV4_ADDRESS_TYPE, true, NO_RECORD_DEF, "" },
{ "sip-ua-cs-domains", DHO_SIP_UA_CONF_SERVICE_DOMAINS, OPT_FQDN_TYPE, true, NO_RECORD_DEF, "" },
{ "v4-portparams", DHO_V4_PORTPARAMS, OPT_RECORD_TYPE, false,
RECORD_DEF(V4_PORTPARAMS_RECORDS), "" },
{ "v4-captive-portal", DHO_V4_CAPTIVE_PORTAL, OPT_STRING_TYPE, false, NO_RECORD_DEF, "" },
{ "v4-access-domain", DHO_V4_ACCESS_DOMAIN, OPT_FQDN_TYPE, false, NO_RECORD_DEF, "" }
// @todo add definitions for all remaining options.
};
......@@ -349,6 +383,14 @@ const OptionDefParams STANDARD_V6_OPTION_DEFINITIONS[] = {
RECORD_DEF(LQ_RELAY_DATA_RECORDS), "" },
{ "lq-client-link", D6O_LQ_CLIENT_LINK, OPT_IPV6_ADDRESS_TYPE, true,
NO_RECORD_DEF, "" },
{ "v6-lost", D6O_V6_LOST, OPT_FQDN_TYPE, false, NO_RECORD_DEF, "" },
{ "capwap-ac-v6", D6O_CAPWAP_AC_V6, OPT_IPV6_ADDRESS_TYPE, true,