Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
Kea
Commits
d831b49b
Commit
d831b49b
authored
Jan 03, 2013
by
Marcin Siodelski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2315] Add more comments in new functions.
parent
c6981a0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
src/lib/dhcpsrv/cfgmgr.cc
src/lib/dhcpsrv/cfgmgr.cc
+12
-0
src/lib/dhcpsrv/cfgmgr.h
src/lib/dhcpsrv/cfgmgr.h
+3
-0
No files found.
src/lib/dhcpsrv/cfgmgr.cc
View file @
d831b49b
...
...
@@ -45,27 +45,39 @@ CfgMgr::addOptionDef(const OptionDefinitionPtr& def,
const
OptionDefContainer
&
CfgMgr
::
getOptionDefs
(
const
std
::
string
&
option_space
)
const
{
// Get all option definitions for the particular option space.
const
std
::
map
<
std
::
string
,
OptionDefContainer
>::
const_iterator
&
defs
=
option_def_spaces_
.
find
(
option_space
);
// If there are no option definitions for the particular option space
// then return empty container.
if
(
defs
==
option_def_spaces_
.
end
())
{
static
OptionDefContainer
empty_container
;
return
(
empty_container
);
}
// If option definitions found, return them.
return
(
defs
->
second
);
}
OptionDefinitionPtr
CfgMgr
::
getOptionDef
(
const
std
::
string
&
option_space
,
const
uint16_t
option_code
)
const
{
// Get a reference to option definitions for a particular option space.
const
OptionDefContainer
&
defs
=
getOptionDefs
(
option_space
);
// If there are no matching option definitions then return the empty pointer.
if
(
defs
.
empty
())
{
return
(
OptionDefinitionPtr
());
}
// If there are some option definitions for a particular option space
// use an option code to get the one we want.
const
OptionDefContainerTypeIndex
&
idx
=
defs
.
get
<
1
>
();
const
OptionDefContainerTypeRange
&
range
=
idx
.
equal_range
(
option_code
);
// If there is no definition that matches option code, return empty pointer.
if
(
std
::
distance
(
range
.
first
,
range
.
second
)
==
0
)
{
return
(
OptionDefinitionPtr
());
}
// If there is more than one definition matching an option code, return
// the first one. This should not happen because we check for duplicates
// when addOptionDef is called.
return
(
*
range
.
first
);
}
...
...
src/lib/dhcpsrv/cfgmgr.h
View file @
d831b49b
...
...
@@ -84,6 +84,9 @@ public:
///
/// @throw isc::dhcp::DuplicateOptionDefinition when the particular
/// option definition already exists.
/// @throw isc::dhcp::MalformedOptionDefinition when the pointer to
/// an option definition is NULL.
/// @throw isc::BadValue when the option space name is empty.
void
addOptionDef
(
const
OptionDefinitionPtr
&
def
,
const
std
::
string
&
option_space
);
...
...
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