IBR-DTNSuite
0.8
|
#include <UDPDatagramService.h>
Public Member Functions | |
UDPDatagramService (const ibrcommon::vinterface &iface, int port, size_t mtu=1280) | |
virtual | ~UDPDatagramService () |
virtual void | bind () throw (DatagramException) |
virtual void | shutdown () |
virtual void | send (const char &type, const char &flags, const unsigned int &seqno, const std::string &address, const char *buf, size_t length) throw (DatagramException) |
virtual void | send (const char &type, const char &flags, const unsigned int &seqno, const char *buf, size_t length) throw (DatagramException) |
virtual size_t | recvfrom (char *buf, size_t length, char &type, char &flags, unsigned int &seqno, std::string &address) throw (DatagramException) |
virtual const std::string | getServiceTag () const |
virtual const std::string | getServiceDescription () const |
virtual const ibrcommon::vinterface & | getInterface () const |
virtual dtn::core::Node::Protocol | getProtocol () const |
virtual const DatagramConnectionParameter & | getParameter () const |
Definition at line 20 of file UDPDatagramService.h.
dtn::net::UDPDatagramService::UDPDatagramService | ( | const ibrcommon::vinterface & | iface, |
int | port, | ||
size_t | mtu = 1280 |
||
) |
dtn::net::UDPDatagramService::~UDPDatagramService | ( | ) | [virtual] |
Definition at line 27 of file UDPDatagramService.cpp.
void dtn::net::UDPDatagramService::bind | ( | ) | throw (DatagramException) [virtual] |
Bind to the local socket.
If | the bind fails, an DatagramException is thrown. |
Implements dtn::net::DatagramService.
Definition at line 35 of file UDPDatagramService.cpp.
References ibrcommon::udpsocket::_socket, and ibrcommon::vsocket::bind().
const ibrcommon::vinterface & dtn::net::UDPDatagramService::getInterface | ( | ) | const [virtual] |
The used interface as vinterface object.
Implements dtn::net::DatagramService.
Definition at line 194 of file UDPDatagramService.cpp.
const DatagramConnectionParameter & dtn::net::UDPDatagramService::getParameter | ( | ) | const [virtual] |
Returns the parameter for the connection.
Implements dtn::net::DatagramService.
Definition at line 208 of file UDPDatagramService.cpp.
dtn::core::Node::Protocol dtn::net::UDPDatagramService::getProtocol | ( | ) | const [virtual] |
The protocol identifier for this type of service.
Implements dtn::net::DatagramService.
Definition at line 203 of file UDPDatagramService.cpp.
References dtn::core::Node::CONN_DGRAM_UDP.
const std::string dtn::net::UDPDatagramService::getServiceDescription | ( | ) | const [virtual] |
Get the service description for this convergence layer. This data is used to contact this node.
Implements dtn::net::DatagramService.
Definition at line 169 of file UDPDatagramService.cpp.
References ibrcommon::vinterface::getAddresses(), ibrcommon::vaddress::VADDRESS_INET, and ibrcommon::vaddress::VADDRESS_INET6.
const std::string dtn::net::UDPDatagramService::getServiceTag | ( | ) | const [virtual] |
Get the tag for this service used in discovery messages.
Implements dtn::net::DatagramService.
Definition at line 159 of file UDPDatagramService.cpp.
size_t dtn::net::UDPDatagramService::recvfrom | ( | char * | buf, |
size_t | length, | ||
char & | type, | ||
char & | flags, | ||
unsigned int & | seqno, | ||
std::string & | address | ||
) | throw (DatagramException) [virtual] |
Receive an incoming datagram.
buf | A buffer to catch the incoming data. |
length | The length of the buffer. |
address | A buffer for the address of the sender. |
If | the receive call failed for any reason, an DatagramException is thrown. |
Implements dtn::net::DatagramService.
Definition at line 127 of file UDPDatagramService.cpp.
References IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.
void dtn::net::UDPDatagramService::send | ( | const char & | type, |
const char & | flags, | ||
const unsigned int & | seqno, | ||
const std::string & | identifier, | ||
const char * | buf, | ||
size_t | length | ||
) | throw (DatagramException) [virtual] |
Send the payload as datagram to a defined destination
address | The destination address encoded as string. |
buf | The buffer to send. |
length | The number of available bytes in the buffer. |
Implements dtn::net::DatagramService.
Definition at line 60 of file UDPDatagramService.cpp.
References IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.
void dtn::net::UDPDatagramService::send | ( | const char & | type, |
const char & | flags, | ||
const unsigned int & | seqno, | ||
const char * | buf, | ||
size_t | length | ||
) | throw (DatagramException) [virtual] |
Send the payload as datagram to all neighbors (broadcast)
buf | The buffer to send. |
length | The number of available bytes in the buffer. |
Implements dtn::net::DatagramService.
Definition at line 95 of file UDPDatagramService.cpp.
References IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, and ibrcommon::vaddress::VADDRESS_INET6.
void dtn::net::UDPDatagramService::shutdown | ( | ) | [virtual] |
Shutdown the socket. Unblock all calls on the socket (recv, send, etc.)
Reimplemented from ibrcommon::udpsocket.
Definition at line 48 of file UDPDatagramService.cpp.