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

#include <UDPDatagramService.h>

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

List of all members.

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

Detailed Description

Definition at line 20 of file UDPDatagramService.h.


Constructor & Destructor Documentation


Member Function Documentation

Bind to the local socket.

Exceptions:
Ifthe 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().

Here is the call graph for this function:

The used interface as vinterface object.

Returns:
A vinterface object.

Implements dtn::net::DatagramService.

Definition at line 194 of file UDPDatagramService.cpp.

Returns the parameter for the connection.

Returns:

Implements dtn::net::DatagramService.

Definition at line 208 of file UDPDatagramService.cpp.

The protocol identifier for this type of service.

Returns:

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.

Returns:
The service description as string.

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.

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

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 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

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

Parameters:
bufThe buffer to send.
lengthThe 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.

Shutdown the socket. Unblock all calls on the socket (recv, send, etc.)

Reimplemented from ibrcommon::udpsocket.

Definition at line 48 of file UDPDatagramService.cpp.


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