Commit 0b6937d0 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[1238] IfaceMgr::openSocket() is now public method.

parent 5371b694
......@@ -229,7 +229,7 @@ IfaceMgr::getIface(const std::string& ifname) {
return (NULL); // not found
}
int
uint16_t
IfaceMgr::openSocket(const std::string& ifname,
const IOAddress& addr,
int port) {
......
......@@ -161,6 +161,21 @@ public:
boost::shared_ptr<Pkt4> receive4();
///
/// Opens UDP/IP socket and binds it to address, interface and port.
///
/// Specific type of socket (UDP/IPv4 or UDP/IPv6) depends on passed addr
/// family.
///
/// @param ifname name of the interface
/// @param addr address to be bound.
/// @param port UDP port.
///
/// @return socket descriptor, if socket creation, binding and multicast
/// group join were all successful. -1 otherwise.
uint16_t openSocket(const std::string& ifname,
const isc::asiolink::IOAddress& addr, int port);
/// Opens sockets on detected interfaces.
void openSockets();
......@@ -191,19 +206,6 @@ protected:
void
detectIfaces();
///
/// Opens UDP/IP socket and binds it to address, interface and port.
///
/// @param ifname name of the interface
/// @param addr address to be bound.
/// @param port UDP port.
///
/// @return socket descriptor, if socket creation, binding and multicast
/// group join were all successful. -1 otherwise.
int openSocket(const std::string& ifname,
const isc::asiolink::IOAddress& addr,
int port);
// TODO: having 2 maps (ifindex->iface and ifname->iface would)
// probably be better for performance reasons
......
......@@ -42,12 +42,6 @@ public:
IfaceCollection & getIfacesLst() { return ifaces_; }
void setSendSock(int sock) { sendsock_ = sock; }
void setRecvSock(int sock) { recvsock_ = sock; }
int openSocket(const std::string& ifname,
const isc::asiolink::IOAddress& addr,
int port) {
return IfaceMgr::openSocket(ifname, addr, port);
}
};
// dummy class for now, but this will be expanded when needed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment