IBR-DTNSuite
0.12
|
#include <socket.h>
Public Member Functions | |
udpsocket () | |
udpsocket (const vaddress &address) | |
virtual | ~udpsocket () |
virtual void | up () throw (socket_exception) |
virtual void | down () throw (socket_exception) |
const vaddress & | get_address () const |
Public Member Functions inherited from ibrcommon::datagramsocket | |
virtual | ~datagramsocket ()=0 |
virtual ssize_t | recvfrom (char *buf, size_t buflen, int flags, ibrcommon::vaddress &addr) throw (socket_exception) |
virtual void | sendto (const char *buf, size_t buflen, int flags, const ibrcommon::vaddress &addr) throw (socket_exception) |
Public Member Functions inherited from ibrcommon::basesocket | |
virtual | ~basesocket ()=0 |
virtual int | fd () const throw (socket_exception) |
virtual int | release () throw (socket_exception) |
void | close () throw (socket_exception) |
void | shutdown (int how) throw (socket_exception) |
bool | ready () const |
sa_family_t | get_family () const throw (socket_exception) |
Protected Member Functions | |
void | bind (const vaddress &addr) throw (socket_exception) |
Protected Member Functions inherited from ibrcommon::datagramsocket | |
datagramsocket () | |
datagramsocket (int fd) | |
Protected Member Functions inherited from ibrcommon::basesocket | |
basesocket () | |
basesocket (int fd) | |
void | check_socket_error (const int err) const throw (socket_exception) |
void | check_bind_error (const int err, const std::string &msg="") const throw (socket_exception) |
void | set_blocking_mode (bool val, int fd=-1) const throw (socket_exception) |
void | set_keepalive (bool val, int fd=-1) const throw (socket_exception) |
void | set_linger (bool val, int l=1, int fd=-1) const throw (socket_exception) |
void | set_reuseaddr (bool val, int fd=-1) const throw (socket_exception) |
void | set_nodelay (bool val, int fd=-1) const throw (socket_exception) |
void | init_socket (const vaddress &addr, int type, int protocol) throw (socket_exception) |
void | init_socket (int domain, int type, int protocol) throw (socket_exception) |
void | bind (int fd, struct sockaddr *addr, socklen_t len) throw (socket_exception) |
Protected Attributes | |
const vaddress | _address |
Additional Inherited Members | |
Static Public Member Functions inherited from ibrcommon::basesocket | |
static sa_family_t | get_family (int fd) throw (socket_exception) |
static bool | hasSupport (const sa_family_t family, const int type=SOCK_DGRAM, const int protocol=0) throw () |
Static Public Attributes inherited from ibrcommon::basesocket | |
static int | DEFAULT_SOCKET_FAMILY = AF_INET6 |
static int | DEFAULT_SOCKET_FAMILY_ALTERNATIVE = AF_INET |
Protected Types inherited from ibrcommon::basesocket | |
enum | socketstate { SOCKET_DOWN, SOCKET_UP, SOCKET_UNMANAGED, SOCKET_DESTROYED } |
A udpsocket allows to send and receive UDP datagrams with a bound or non-bound file descriptor.
ibrcommon::udpsocket::udpsocket | ( | ) |
Definition at line 972 of file socket.cpp.
ibrcommon::udpsocket::udpsocket | ( | const vaddress & | address) |
Definition at line 976 of file socket.cpp.
|
virtual |
Definition at line 981 of file socket.cpp.
References down().
|
protected |
Definition at line 1029 of file socket.cpp.
References ibrcommon::basesocket::bind().
Referenced by up().
|
virtual |
Close and destroy the file descriptor of this socket assignment.
socket_exception | if the action has failed |
Implements ibrcommon::datagramsocket.
Reimplemented in ibrcommon::multicastsocket.
Definition at line 1021 of file socket.cpp.
References ibrcommon::basesocket::_state, ibrcommon::basesocket::close(), ibrcommon::basesocket::SOCKET_DESTROYED, and ibrcommon::basesocket::SOCKET_DOWN.
Referenced by ibrcommon::multicastsocket::down(), dtn::net::UDPConvergenceLayer::eventNotify(), ibrcommon::multicastsocket::up(), and ~udpsocket().
const vaddress & ibrcommon::udpsocket::get_address | ( | ) | const |
Definition at line 988 of file socket.cpp.
References _address.
Referenced by dtn::net::UDPConvergenceLayer::eventNotify(), and dtn::net::IPNDAgent::onAdvertiseBeacon().
|
virtual |
Create the file descriptor for this socket and bind to the interface if necessary.
socket_exception | if the action has failed |
Implements ibrcommon::datagramsocket.
Reimplemented in ibrcommon::multicastsocket.
Definition at line 993 of file socket.cpp.
References __close, _address, ibrcommon::basesocket::_fd, ibrcommon::basesocket::_state, bind(), ibrcommon::basesocket::init_socket(), ibrcommon::vaddress::service(), ibrcommon::basesocket::set_reuseaddr(), ibrcommon::basesocket::SOCKET_DOWN, and ibrcommon::basesocket::SOCKET_UP.
Referenced by dtn::net::UDPConvergenceLayer::eventNotify(), and ibrcommon::multicastsocket::up().
|
protected |
Definition at line 372 of file socket.h.
Referenced by get_address(), and up().