IBR-DTNSuite
0.10
|
#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 DatagramService::Parameter & | getParameter () const |
Public Member Functions inherited from dtn::net::DatagramService | |
virtual | ~DatagramService ()=0 |
Additional Inherited Members | |
Public Types inherited from dtn::net::DatagramService | |
enum | FLOWCONTROL { FLOW_NONE = 0, FLOW_STOPNWAIT = 1 } |
enum | HEADER_FLAGS { SEGMENT_FIRST = 0x02, SEGMENT_LAST = 0x01, SEGMENT_MIDDLE = 0x00 } |
Definition at line 34 of file UDPDatagramService.h.
dtn::net::UDPDatagramService::UDPDatagramService | ( | const ibrcommon::vinterface & | iface, |
int | port, | ||
size_t | mtu = 1280 |
||
) |
Definition at line 35 of file UDPDatagramService.cpp.
References dtn::net::DatagramService::FLOW_STOPNWAIT, dtn::net::DatagramService::Parameter::flowcontrol, dtn::net::DatagramService::Parameter::initial_timeout, dtn::net::DatagramService::Parameter::max_msg_length, dtn::net::DatagramService::Parameter::max_seq_numbers, and dtn::net::DatagramService::Parameter::seq_check.
|
virtual |
Definition at line 46 of file UDPDatagramService.cpp.
References ibrcommon::vsocket::destroy().
|
virtual |
Bind to the local socket.
If | the bind fails, an DatagramException is thrown. |
Implements dtn::net::DatagramService.
Definition at line 56 of file UDPDatagramService.cpp.
References ibrcommon::vsocket::add(), ibrcommon::vsocket::destroy(), ibrcommon::vinterface::empty(), ibrcommon::socket_raw_error::error(), ibrcommon::LogLevel::error, ibrcommon::vaddress::family(), ibrcommon::vinterface::getAddresses(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::multicastsocket::join(), ibrcommon::vaddress::setService(), ibrcommon::vinterface::toString(), ibrcommon::vaddress::toString(), ibrcommon::vsocket::up(), ibrcommon::Exception::what(), and ibrcommon::socket_raw_error::what().
|
virtual |
The used interface as vinterface object.
Implements dtn::net::DatagramService.
Definition at line 276 of file UDPDatagramService.cpp.
|
virtual |
Returns the parameter for the connection.
Implements dtn::net::DatagramService.
Definition at line 290 of file UDPDatagramService.cpp.
|
virtual |
The protocol identifier for this type of service.
Implements dtn::net::DatagramService.
Definition at line 285 of file UDPDatagramService.cpp.
References dtn::core::Node::CONN_DGRAM_UDP.
|
virtual |
Get the service description for this convergence layer. This data is used to contact this node.
Implements dtn::net::DatagramService.
Definition at line 245 of file UDPDatagramService.cpp.
References ibrcommon::vaddress::family(), ibrcommon::vinterface::getAddresses(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, and ibrcommon::Exception::what().
|
virtual |
Get the tag for this service used in discovery messages.
Implements dtn::net::DatagramService.
Definition at line 235 of file UDPDatagramService.cpp.
|
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 190 of file UDPDatagramService.cpp.
References IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::datagramsocket::recvfrom(), and ibrcommon::vaddress::toString().
|
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 126 of file UDPDatagramService.cpp.
|
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 141 of file UDPDatagramService.cpp.
|
virtual |
Shutdown the socket. Unblock all calls on the socket (recv, send, etc.)
Implements dtn::net::DatagramService.
Definition at line 114 of file UDPDatagramService.cpp.
References ibrcommon::vsocket::down().