IBR-DTNSuite
0.8
|
#include <vsocket.h>
Classes | |
class | vbind |
Public Types | |
enum | Option { VSOCKET_REUSEADDR = 1 << 0, VSOCKET_LINGER = 1 << 1, VSOCKET_NODELAY = 1 << 2, VSOCKET_BROADCAST = 1 << 3, VSOCKET_NONBLOCKING = 1 << 4, VSOCKET_MULTICAST = 1 << 5, VSOCKET_MULTICAST_V6 = 1 << 6 } |
Public Member Functions | |
vsocket () | |
virtual | ~vsocket () |
int | bind (const vaddress &address, const int port, unsigned int socktype=SOCK_STREAM) |
void | bind (const vinterface &iface, const int port, unsigned int socktype=SOCK_STREAM) |
int | bind (const int port, unsigned int socktype=SOCK_STREAM) |
int | bind (const ibrcommon::File &file, unsigned int socktype=SOCK_STREAM) |
void | unbind (const vaddress &address, const int port) |
void | unbind (const vinterface &iface, const int port) |
void | unbind (const int port) |
void | unbind (const ibrcommon::File &file) |
void | add (const int fd) |
const std::list< int > | get (const ibrcommon::vinterface &iface, const ibrcommon::vaddress::Family f=vaddress::VADDRESS_UNSPEC) |
const std::list< int > | get (const ibrcommon::vaddress::Family f=vaddress::VADDRESS_UNSPEC) |
void | listen (int connections) |
void | relisten () |
void | set (const Option &o) |
void | unset (const Option &o) |
void | close () |
void | shutdown () |
int | fd () |
void | select (std::list< int > &fds, struct timeval *tv=NULL) |
int | sendto (const void *buf, size_t n, const ibrcommon::vaddress &address, const unsigned int port) |
void | eventNotify (const LinkManagerEvent &evt) |
void | setEventCallback (ibrcommon::LinkManager::EventCallback *cb) |
Static Public Member Functions | |
static void | set_non_blocking (int socket, bool nonblock=true) |
Definition at line 84 of file vsocket.cpp.
References IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, and set_non_blocking().
ibrcommon::vsocket::~vsocket | ( | ) | [virtual] |
Definition at line 99 of file vsocket.cpp.
References close(), ibrcommon::LinkManager::getInstance(), and ibrcommon::LinkManager::unregisterAllEvents().
void ibrcommon::vsocket::add | ( | const int | fd | ) |
Definition at line 229 of file vsocket.cpp.
References bind().
Referenced by dtn::net::FileMonitor::componentUp(), and ibrcommon::NetLinkManager::run().
int ibrcommon::vsocket::bind | ( | const vaddress & | address, |
const int | port, | ||
unsigned int | socktype = SOCK_STREAM |
||
) |
Definition at line 193 of file vsocket.cpp.
Referenced by add(), ibrcommon::UnicastSocket::bind(), dtn::net::UDPDatagramService::bind(), ibrcommon::tcpserver::bind(), bind(), close(), dtn::net::IPNDAgent::componentUp(), eventNotify(), get(), listen(), select(), sendto(), set(), shutdown(), ibrcommon::tcpserver::tcpserver(), and unset().
void ibrcommon::vsocket::bind | ( | const vinterface & | iface, |
const int | port, | ||
unsigned int | socktype = SOCK_STREAM |
||
) |
Definition at line 132 of file vsocket.cpp.
References bind(), ibrcommon::vinterface::empty(), ibrcommon::vinterface::getAddresses(), ibrcommon::LinkManager::getInstance(), and ibrcommon::LinkManager::registerInterfaceEvent().
int ibrcommon::vsocket::bind | ( | const int | port, |
unsigned int | socktype = SOCK_STREAM |
||
) |
Definition at line 181 of file vsocket.cpp.
References bind().
int ibrcommon::vsocket::bind | ( | const ibrcommon::File & | file, |
unsigned int | socktype = SOCK_STREAM |
||
) |
Definition at line 199 of file vsocket.cpp.
References bind().
void ibrcommon::vsocket::close | ( | ) |
Definition at line 282 of file vsocket.cpp.
References bind().
Referenced by dtn::net::FileMonitor::__cancellation(), dtn::net::IPNDAgent::__cancellation(), ibrcommon::NetLinkManager::__cancellation(), ibrcommon::tcpserver::close(), ibrcommon::udpsocket::shutdown(), ibrcommon::lowpansocket::shutdown(), ibrcommon::udpsocket::~udpsocket(), and ~vsocket().
void ibrcommon::vsocket::eventNotify | ( | const LinkManagerEvent & | evt | ) | [virtual] |
Implements ibrcommon::LinkManager::EventCallback.
Definition at line 315 of file vsocket.cpp.
References bind(), ibrcommon::LinkManagerEvent::EVENT_ADDRESS_ADDED, ibrcommon::LinkManagerEvent::EVENT_ADDRESS_REMOVED, ibrcommon::LinkManager::EventCallback::eventNotify(), ibrcommon::LinkManagerEvent::getAddress(), ibrcommon::LinkManagerEvent::getInterface(), ibrcommon::LinkManagerEvent::getType(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::vinterface::toString(), ibrcommon::vaddress::toString(), unbind(), and ibrcommon::Exception::what().
int ibrcommon::vsocket::fd | ( | ) |
Definition at line 309 of file vsocket.cpp.
Referenced by ibrcommon::UnicastSocketLowpan::bind().
const std::list< int > ibrcommon::vsocket::get | ( | const ibrcommon::vinterface & | iface, |
const ibrcommon::vaddress::Family | f = vaddress::VADDRESS_UNSPEC |
||
) |
Definition at line 358 of file vsocket.cpp.
References bind(), and ibrcommon::vaddress::VADDRESS_UNSPEC.
Referenced by ibrcommon::udpsocket::send().
const std::list< int > ibrcommon::vsocket::get | ( | const ibrcommon::vaddress::Family | f = vaddress::VADDRESS_UNSPEC | ) |
Definition at line 376 of file vsocket.cpp.
References bind(), and ibrcommon::vaddress::VADDRESS_UNSPEC.
void ibrcommon::vsocket::listen | ( | int | connections | ) |
Definition at line 235 of file vsocket.cpp.
References bind().
Referenced by ibrcommon::tcpserver::bind(), ibrcommon::tcpserver::listen(), and relisten().
void ibrcommon::vsocket::relisten | ( | ) |
Definition at line 248 of file vsocket.cpp.
References listen().
Referenced by select().
void ibrcommon::vsocket::select | ( | std::list< int > & | fds, |
struct timeval * | tv = NULL |
||
) |
Definition at line 452 of file vsocket.cpp.
References ibrcommon::__nonlinux_select(), bind(), ibrcommon::Queue< T >::empty(), ibrcommon::Queue< T >::exclusive(), ibrcommon::Queue< T >::Locked::front(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::Queue< T >::Locked::pop(), and relisten().
Referenced by ibrcommon::tcpserver::accept(), dtn::net::FileMonitor::componentRun(), dtn::net::IPNDAgent::componentRun(), ibrcommon::udpsocket::receive(), ibrcommon::lowpansocket::receive(), and ibrcommon::NetLinkManager::run().
int ibrcommon::vsocket::sendto | ( | const void * | buf, |
size_t | n, | ||
const ibrcommon::vaddress & | address, | ||
const unsigned int | port | ||
) |
Definition at line 391 of file vsocket.cpp.
References ibrcommon::vaddress::addrinfo(), bind(), ibrcommon::vaddress::getFamily(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, and ibrcommon::vaddress::toString().
void ibrcommon::vsocket::set | ( | const Option & | o | ) |
Definition at line 254 of file vsocket.cpp.
References bind().
Referenced by ibrcommon::tcpserver::bind(), and dtn::net::IPNDAgent::IPNDAgent().
void ibrcommon::vsocket::set_non_blocking | ( | int | socket, |
bool | nonblock = true |
||
) | [static] |
Definition at line 66 of file vsocket.cpp.
Referenced by ibrcommon::tcpstream::select(), ibrcommon::tcpstream::tcpstream(), and vsocket().
Definition at line 353 of file vsocket.cpp.
Referenced by dtn::net::IPNDAgent::componentDown(), and dtn::net::IPNDAgent::componentUp().
void ibrcommon::vsocket::shutdown | ( | ) |
Definition at line 296 of file vsocket.cpp.
References bind().
Referenced by dtn::net::IPNDAgent::componentDown(), and ibrcommon::tcpserver::shutdown().
void ibrcommon::vsocket::unbind | ( | const vaddress & | address, |
const int | port | ||
) |
Definition at line 205 of file vsocket.cpp.
References ibrcommon::Queue< T >::push().
Referenced by eventNotify(), and unbind().
void ibrcommon::vsocket::unbind | ( | const vinterface & | iface, |
const int | port | ||
) |
Definition at line 164 of file vsocket.cpp.
References ibrcommon::vinterface::getAddresses(), ibrcommon::LinkManager::getInstance(), unbind(), and ibrcommon::LinkManager::unregisterInterfaceEvent().
void ibrcommon::vsocket::unbind | ( | const int | port | ) |
Definition at line 187 of file vsocket.cpp.
References unbind().
void ibrcommon::vsocket::unbind | ( | const ibrcommon::File & | file | ) |
Definition at line 217 of file vsocket.cpp.
References ibrcommon::Queue< T >::push().
void ibrcommon::vsocket::unset | ( | const Option & | o | ) |
Definition at line 268 of file vsocket.cpp.
References bind().