Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
fc2b2f8f
Commit
fc2b2f8f
authored
Sep 09, 2013
by
Marcin Siodelski
Browse files
[3035] Added a function to return the number of labels in the FQDN.
parent
1d58f76d
Changes
3
Show whitespace changes
Inline
Side-by-side
src/lib/dhcp/option_custom.h
View file @
fc2b2f8f
...
...
@@ -105,7 +105,6 @@ public:
template
<
typename
T
>
void
addArrayDataField
(
const
T
value
)
{
checkArrayType
();
OptionDataType
data_type
=
definition_
.
getType
();
if
(
OptionDataTypeTraits
<
T
>::
type
!=
data_type
)
{
isc_throw
(
isc
::
dhcp
::
InvalidDataType
,
...
...
src/lib/dhcp/option_data_types.cc
View file @
fc2b2f8f
...
...
@@ -227,6 +227,16 @@ OptionDataTypeUtil::writeFqdn(const std::string& fqdn,
}
}
unsigned
int
OptionDataTypeUtil
::
getLabelCount
(
const
std
::
string
&
text_name
)
{
try
{
isc
::
dns
::
Name
name
(
text_name
);
return
(
name
.
getLabelCount
());
}
catch
(
const
isc
::
Exception
&
ex
)
{
isc_throw
(
BadDataTypeCast
,
ex
.
what
());
}
}
std
::
string
OptionDataTypeUtil
::
readString
(
const
std
::
vector
<
uint8_t
>&
buf
)
{
std
::
string
value
;
...
...
src/lib/dhcp/option_data_types.h
View file @
fc2b2f8f
...
...
@@ -375,6 +375,14 @@ public:
std
::
vector
<
uint8_t
>&
buf
,
const
bool
downcase
=
false
);
/// @brief Return the number of labels in the Name.
///
/// @param text_name A text representation of the name.
///
/// @return A number of labels in the provided name.
/// @throw isc::BadCast if provided name is malformed.
static
unsigned
int
getLabelCount
(
const
std
::
string
&
text_name
);
/// @brief Read string value from a buffer.
///
/// @param buf input buffer.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment