IBR-DTNSuite  0.10
dtn::net::UDPDatagramService Class Reference

#include <UDPDatagramService.h>

Inheritance diagram for dtn::net::UDPDatagramService:
Inheritance graph
Collaboration diagram for dtn::net::UDPDatagramService:
Collaboration graph

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 }
 

Detailed Description

Definition at line 34 of file UDPDatagramService.h.

Constructor & Destructor Documentation

dtn::net::UDPDatagramService::~UDPDatagramService ( )
virtual

Definition at line 46 of file UDPDatagramService.cpp.

References ibrcommon::vsocket::destroy().

Here is the call graph for this function:

Member Function Documentation

const ibrcommon::vinterface & dtn::net::UDPDatagramService::getInterface ( ) const
virtual

The used interface as vinterface object.

Returns
A vinterface object.

Implements dtn::net::DatagramService.

Definition at line 276 of file UDPDatagramService.cpp.

const DatagramService::Parameter & dtn::net::UDPDatagramService::getParameter ( ) const
virtual

Returns the parameter for the connection.

Returns

Implements dtn::net::DatagramService.

Definition at line 290 of file UDPDatagramService.cpp.

dtn::core::Node::Protocol dtn::net::UDPDatagramService::getProtocol ( ) const
virtual

The protocol identifier for this type of service.

Returns

Implements dtn::net::DatagramService.

Definition at line 285 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.

Returns
The service description as string.

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().

Here is the call graph for this function:

const std::string dtn::net::UDPDatagramService::getServiceTag ( ) const
virtual

Get the tag for this service used in discovery messages.

Returns
The tag as string.

Implements dtn::net::DatagramService.

Definition at line 235 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.

Parameters
bufA buffer to catch the incoming data.
lengthThe length of the buffer.
addressA buffer for the address of the sender.
Exceptions
Ifthe receive call failed for any reason, an DatagramException is thrown.
Returns
The number of received bytes.

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().

Here is the call graph for this function:

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

Parameters
addressThe destination address encoded as string.
bufThe buffer to send.
lengthThe number of available bytes in the buffer.

Implements dtn::net::DatagramService.

Definition at line 126 of file UDPDatagramService.cpp.

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)

Parameters
bufThe buffer to send.
lengthThe number of available bytes in the buffer.

Implements dtn::net::DatagramService.

Definition at line 141 of file UDPDatagramService.cpp.

void dtn::net::UDPDatagramService::shutdown ( )
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().

Here is the call graph for this function:


The documentation for this class was generated from the following files: