summaryrefslogtreecommitdiffstats
path: root/src/bin/perfdhcp/perf_socket.h
diff options
context:
space:
mode:
authorMichal Nowikowski <godfryd@isc.org>2019-02-12 15:55:51 +0100
committerMichal Nowikowski <godfryd@isc.org>2019-02-19 21:54:31 +0100
commitad43417ae266171b7d68585ab60729506b032be0 (patch)
tree29633f679394c8238ea2e133209e9b000878ea08 /src/bin/perfdhcp/perf_socket.h
parent[448-update-cb-cmds-to-handle-parameter-types] Extended SimpleRequiredKeyword... (diff)
downloadkea-ad43417ae266171b7d68585ab60729506b032be0.tar.xz
kea-ad43417ae266171b7d68585ab60729506b032be0.zip
added avalanche scenario to perfdhcp
Diffstat (limited to 'src/bin/perfdhcp/perf_socket.h')
-rw-r--r--src/bin/perfdhcp/perf_socket.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/bin/perfdhcp/perf_socket.h b/src/bin/perfdhcp/perf_socket.h
index de593d317f..a49cc92e32 100644
--- a/src/bin/perfdhcp/perf_socket.h
+++ b/src/bin/perfdhcp/perf_socket.h
@@ -25,19 +25,13 @@ namespace perfdhcp {
struct PerfSocket : public dhcp::SocketInfo {
/// Interface index.
uint16_t ifindex_;
- /// Is socket valid. It will not be valid if the provided socket
- /// descriptor does not point to valid socket.
- bool valid_;
/// \brief Constructor of socket wrapper class.
///
/// This constructor uses provided socket descriptor to
/// find the name of the interface where socket has been
- /// bound to. If provided socket descriptor is invalid then
- /// valid_ field is set to false;
- ///
- /// \param socket socket descriptor.
- PerfSocket(const int socket);
+ /// bound to.
+ PerfSocket();
/// \brief Destructor of the socket wrapper class.
///
@@ -53,6 +47,26 @@ private:
/// \throw isc::BadValue if interface for specified socket
/// descriptor does not exist.
void initSocketData();
+
+ /// \brief Open socket to communicate with DHCP server.
+ ///
+ /// Method opens socket and binds it to local address. Function will
+ /// use either interface name, local address or server address
+ /// to create a socket, depending on what is available (specified
+ /// from the command line). If socket can't be created for any
+ /// reason, exception is thrown.
+ /// If destination address is broadcast (for DHCPv4) or multicast
+ /// (for DHCPv6) than broadcast or multicast option is set on
+ /// the socket. Opened socket is registered and managed by IfaceMgr.
+ ///
+ /// \throw isc::BadValue if socket can't be created for given
+ /// interface, local address or remote address.
+ /// \throw isc::InvalidOperation if broadcast option can't be
+ /// set for the v4 socket or if multicast option can't be set
+ /// for the v6 socket.
+ /// \throw isc::Unexpected if internal unexpected error occurred.
+ /// \return socket descriptor.
+ int openSocket() const;
};
}