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
Sebastian Schrader
Kea
Commits
e7237625
Commit
e7237625
authored
Feb 13, 2015
by
Marcin Siodelski
Browse files
[3604] Addressed remaining review comments.
parent
5cae53ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcpsrv/cfg_iface.cc
View file @
e7237625
...
...
@@ -202,6 +202,20 @@ CfgIface::socketTypeToText() const {
isc_throw
(
Unexpected
,
"unsupported socket type "
<<
socket_type_
);
}
CfgIface
::
SocketType
CfgIface
::
textToSocketType
(
const
std
::
string
&
socket_type_name
)
const
{
if
(
socket_type_name
==
"udp"
)
{
return
(
SOCKET_UDP
);
}
else
if
(
socket_type_name
==
"raw"
)
{
return
(
SOCKET_RAW
);
}
else
{
isc_throw
(
InvalidSocketType
,
"unsupported socket type '"
<<
socket_type_name
<<
"'"
);
}
}
void
CfgIface
::
use
(
const
uint16_t
family
,
const
std
::
string
&
iface_name
)
{
// The interface name specified may have two formats, e.g.:
...
...
@@ -363,18 +377,7 @@ CfgIface::useSocketType(const uint16_t family,
void
CfgIface
::
useSocketType
(
const
uint16_t
family
,
const
std
::
string
&
socket_type_name
)
{
SocketType
socket_type
;
if
(
socket_type_name
==
"udp"
)
{
socket_type
=
SOCKET_UDP
;
}
else
if
(
socket_type_name
==
"raw"
)
{
socket_type
=
SOCKET_RAW
;
}
else
{
isc_throw
(
InvalidSocketType
,
"unsupported socket type '"
<<
socket_type_name
<<
"'"
);
}
useSocketType
(
family
,
socket_type
);
useSocketType
(
family
,
textToSocketType
(
socket_type_name
));
}
}
// end of isc::dhcp namespace
...
...
src/lib/dhcpsrv/cfg_iface.h
View file @
e7237625
...
...
@@ -174,6 +174,10 @@ public:
/// @brief Sets the specified socket type to be used by the server.
///
/// Supported socket types for DHCPv4 are:
/// - @c SOCKET_RAW
/// - @c SOCKET_UDP
///
/// @param family Address family (AF_INET or AF_INET6).
/// @param socket_type Socket type.
///
...
...
@@ -201,6 +205,13 @@ public:
/// @brief Returns the socket type in the textual format.
std
::
string
socketTypeToText
()
const
;
/// @brief Converts the socket type in the textual format to the type
/// represented by the @c SocketType.
///
/// @throw InvalidSocketType if the specified value of the @c socket_type_name
/// is invalid.
SocketType
textToSocketType
(
const
std
::
string
&
socket_type_name
)
const
;
/// @brief Equality operator.
///
/// @param other Object to be compared with this object.
...
...
src/lib/dhcpsrv/parsers/ifaces_config_parser.cc
View file @
e7237625
...
...
@@ -25,7 +25,7 @@ using namespace isc::data;
namespace
isc
{
namespace
dhcp
{
InterfaceListConfigParser
::
InterfaceListConfigParser
(
const
int
protocol
)
InterfaceListConfigParser
::
InterfaceListConfigParser
(
const
u
int
16_t
protocol
)
:
protocol_
(
protocol
)
{
}
...
...
@@ -50,7 +50,7 @@ InterfaceListConfigParser::commit() {
// Nothing to do.
}
IfacesConfigParser
::
IfacesConfigParser
(
const
int
protocol
)
IfacesConfigParser
::
IfacesConfigParser
(
const
u
int
16_t
protocol
)
:
protocol_
(
protocol
)
{
}
...
...
src/lib/dhcpsrv/parsers/ifaces_config_parser.h
View file @
e7237625
...
...
@@ -34,9 +34,7 @@ public:
/// @brief Constructor
///
/// @param protocol AF_INET for DHCPv4 and AF_INET6 for DHCPv6.
///
/// @throw BadValue if supplied parameter name is not "interface"
InterfaceListConfigParser
(
const
int
protocol
);
InterfaceListConfigParser
(
const
uint16_t
protocol
);
/// @brief Parses a list of interface names.
///
...
...
@@ -59,7 +57,7 @@ public:
private:
/// @brief AF_INET for DHCPv4 and AF_INET6 for DHCPv6.
int
protocol_
;
u
int
16_t
protocol_
;
};
...
...
@@ -82,7 +80,7 @@ public:
/// @brief Constructor
///
/// @param protocol AF_INET for DHCPv4 and AF_INET6 for DHCPv6.
IfacesConfigParser
(
const
int
protocol
);
IfacesConfigParser
(
const
u
int
16_t
protocol
);
/// @brief Parses generic parameters in "interfaces-config".
///
...
...
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