IBR-DTNSuite
0.12
|
#include <vsocket.h>
Public Member Functions | |
vsocket () | |
virtual | ~vsocket () |
void | add (basesocket *socket) |
void | add (basesocket *socket, const vinterface &iface) |
void | remove (basesocket *socket) |
size_t | size () const |
socketset | getAll () const |
socketset | get (const vinterface &iface) const |
void | destroy () |
void | clear () |
void | up () throw (socket_exception) |
void | down () throw () |
void | select (socketset *readset, socketset *writeset, socketset *errorset, struct timeval *tv=NULL) throw (socket_exception) |
ibrcommon::vsocket::vsocket | ( | ) |
Constructor
Definition at line 559 of file vsocket.cpp.
|
virtual |
Destructor
Definition at line 565 of file vsocket.cpp.
void ibrcommon::vsocket::add | ( | basesocket * | socket) |
Add a socket to the list monitored sockets. This socket instance will be adapted and destroyed on the destruction of the vsocket instance.
socket | Socket object to add |
Definition at line 573 of file vsocket.cpp.
Referenced by dtn::api::ApiServer::ApiServer(), dtn::net::UDPDatagramService::bind(), dtn::net::LOWPANDatagramService::bind(), dtn::net::IPNDAgent::componentUp(), dtn::net::UDPConvergenceLayer::componentUp(), dtn::net::LOWPANConvergenceLayer::componentUp(), dtn::net::UDPConvergenceLayer::eventNotify(), dtn::net::TCPConvergenceLayer::eventNotify(), ibrcommon::socketstream::socketstream(), and ibrcommon::tcpsocket::up().
void ibrcommon::vsocket::add | ( | basesocket * | socket, |
const vinterface & | iface | ||
) |
Add a socket to the list monitored sockets. This socket instance will be adapted and destroyed on the destruction of the vsocket instance. The socket will be shutdown if the state of the given interface changes.
socket | Socket object to add |
iface | The interface to connect this socket to |
Definition at line 579 of file vsocket.cpp.
void ibrcommon::vsocket::clear | ( | ) |
clear the socketset
Definition at line 604 of file vsocket.cpp.
void ibrcommon::vsocket::destroy | ( | ) |
delete all sockets in the socketset
Definition at line 611 of file vsocket.cpp.
References down().
Referenced by dtn::net::UDPDatagramService::bind(), dtn::net::LOWPANDatagramService::bind(), dtn::net::IPNDAgent::componentDown(), dtn::net::UDPConvergenceLayer::componentDown(), dtn::net::LOWPANConvergenceLayer::componentDown(), ibrcommon::tcpsocket::up(), dtn::api::ApiServer::~ApiServer(), dtn::net::IPNDAgent::~IPNDAgent(), dtn::net::LOWPANDatagramService::~LOWPANDatagramService(), ibrcommon::socketstream::~socketstream(), dtn::net::TCPConvergenceLayer::~TCPConvergenceLayer(), and dtn::net::UDPDatagramService::~UDPDatagramService().
void ibrcommon::vsocket::down | ( | ) | ||
throw | ( | |||
) |
Disable all sockets and turn into the down state.
Definition at line 669 of file vsocket.cpp.
Referenced by dtn::net::FileMonitor::__cancellation(), dtn::net::IPNDAgent::__cancellation(), dtn::api::ApiServer::__cancellation(), dtn::net::UDPConvergenceLayer::__cancellation(), dtn::net::LOWPANConvergenceLayer::__cancellation(), dtn::net::TCPConvergenceLayer::__cancellation(), ibrcommon::socketstream::close(), dtn::net::FileMonitor::componentDown(), dtn::api::ApiServer::componentDown(), dtn::net::TCPConvergenceLayer::componentDown(), destroy(), dtn::net::UDPDatagramService::shutdown(), and dtn::net::LOWPANDatagramService::shutdown().
socketset ibrcommon::vsocket::get | ( | const vinterface & | iface) | const |
Get all sockets bound to a specific interface
iface | The selected interface |
Definition at line 629 of file vsocket.cpp.
Referenced by dtn::net::UDPConvergenceLayer::eventNotify(), and dtn::net::TCPConvergenceLayer::eventNotify().
socketset ibrcommon::vsocket::getAll | ( | ) | const |
Definition at line 624 of file vsocket.cpp.
Referenced by dtn::net::UDPConvergenceLayer::eventNotify(), dtn::net::TCPConvergenceLayer::eventNotify(), dtn::net::LOWPANConvergenceLayer::send_cb(), and dtn::net::FileMonitor::watch().
void ibrcommon::vsocket::remove | ( | basesocket * | socket) |
Remove the socket from the socket list.
socket | Pointer to the socket in the list |
Definition at line 586 of file vsocket.cpp.
Referenced by dtn::net::UDPConvergenceLayer::eventNotify(), dtn::net::TCPConvergenceLayer::eventNotify(), and ibrcommon::tcpsocket::up().
void ibrcommon::vsocket::select | ( | socketset * | readset, |
socketset * | writeset, | ||
socketset * | errorset, | ||
struct timeval * | tv = NULL |
||
) | |||
throw | ( | socket_exception | |
) |
Execute a select on all associated sockets.
callback | |
tv |
Definition at line 711 of file vsocket.cpp.
References ibrcommon::__compat_select(), ibrcommon::ERROR_CLOSED, ibrcommon::basesocket::fd(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, and ibrcommon::basesocket::ready().
Referenced by dtn::net::FileMonitor::componentRun(), dtn::net::IPNDAgent::componentRun(), dtn::api::ApiServer::componentRun(), dtn::net::LOWPANConvergenceLayer::componentRun(), dtn::net::TCPConvergenceLayer::componentRun(), ibrcommon::socketstream::overflow(), ibrcommon::socketstream::underflow(), and ibrcommon::tcpsocket::up().
size_t ibrcommon::vsocket::size | ( | ) | const |
get the number of added sockets
Definition at line 599 of file vsocket.cpp.
Referenced by ibrcommon::tcpsocket::up().
void ibrcommon::vsocket::up | ( | ) | ||
throw | ( | socket_exception | ||
) |
Enable all sockets and turn into the up state.
Definition at line 641 of file vsocket.cpp.
Referenced by dtn::net::UDPDatagramService::bind(), dtn::net::LOWPANDatagramService::bind(), dtn::net::FileMonitor::componentUp(), dtn::net::IPNDAgent::componentUp(), dtn::net::UDPConvergenceLayer::componentUp(), dtn::api::ApiServer::componentUp(), dtn::net::LOWPANConvergenceLayer::componentUp(), dtn::net::TCPConvergenceLayer::componentUp(), ibrcommon::socketstream::socketstream(), and ibrcommon::tcpsocket::up().