IBR-DTNSuite
0.10
|
#include <socket.h>
Public Member Functions | |
tcpserversocket (const int port, int listen=0) | |
tcpserversocket (const vaddress &address, int listen=0) | |
virtual | ~tcpserversocket () |
virtual void | up () throw (socket_exception) |
virtual void | down () throw (socket_exception) |
const vaddress & | get_address () const |
virtual clientsocket * | accept (ibrcommon::vaddress &addr) throw (socket_exception) |
![]() | |
virtual | ~serversocket ()=0 |
void | listen (int connections) throw (socket_exception) |
void | set (SERVER_OPTION opt, bool val) |
![]() | |
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) |
![]() | |
serversocket () | |
serversocket (int fd) | |
int | _accept_fd (ibrcommon::vaddress &addr) throw (socket_exception) |
![]() | |
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) |
Additional Inherited Members | |
![]() | |
enum | SERVER_OPTION { BLOCKING = 0 } |
![]() | |
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 int | DEFAULT_SOCKET_FAMILY = AF_INET6 |
static int | DEFAULT_SOCKET_FAMILY_ALTERNATIVE = AF_INET |
![]() | |
enum | socketstate { SOCKET_DOWN, SOCKET_UP, SOCKET_UNMANAGED, SOCKET_DESTROYED } |
![]() | |
socketstate | _state |
int | _fd |
sa_family_t | _family |
A tcpserversocket is bound to a specific port and listen for incoming connections. It binds on the ANY or a specific address.
ibrcommon::tcpserversocket::tcpserversocket | ( | const int | port, |
int | listen = 0 |
||
) |
Definition at line 605 of file socket.cpp.
ibrcommon::tcpserversocket::tcpserversocket | ( | const vaddress & | address, |
int | listen = 0 |
||
) |
Definition at line 610 of file socket.cpp.
|
virtual |
Definition at line 615 of file socket.cpp.
References down().
|
virtual |
Implements ibrcommon::serversocket.
Definition at line 694 of file socket.cpp.
|
protected |
Definition at line 654 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::serversocket.
Definition at line 646 of file socket.cpp.
References ibrcommon::basesocket::_state, ibrcommon::basesocket::close(), ibrcommon::basesocket::SOCKET_DESTROYED, and ibrcommon::basesocket::SOCKET_DOWN.
Referenced by dtn::net::TCPConvergenceLayer::eventNotify(), and ~tcpserversocket().
const vaddress & ibrcommon::tcpserversocket::get_address | ( | ) | const |
Definition at line 699 of file socket.cpp.
Referenced by dtn::net::TCPConvergenceLayer::eventNotify().
|
virtual |
Create the file descriptor for this socket and bind to the interface if necessary.
socket_exception | if the action has failed |
Implements ibrcommon::serversocket.
Definition at line 622 of file socket.cpp.
References ibrcommon::basesocket::_fd, ibrcommon::basesocket::_state, bind(), ibrcommon::basesocket::close(), ibrcommon::basesocket::init_socket(), ibrcommon::serversocket::listen(), ibrcommon::basesocket::set_reuseaddr(), ibrcommon::basesocket::SOCKET_DOWN, and ibrcommon::basesocket::SOCKET_UP.
Referenced by dtn::net::TCPConvergenceLayer::eventNotify().