IBR-DTNSuite  0.10
dtn::net::DatagramService Class Referenceabstract

#include <DatagramService.h>

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

Classes

class  Parameter
 

Public Types

enum  FLOWCONTROL { FLOW_NONE = 0, FLOW_STOPNWAIT = 1 }
 
enum  HEADER_FLAGS { SEGMENT_FIRST = 0x02, SEGMENT_LAST = 0x01, SEGMENT_MIDDLE = 0x00 }
 

Public Member Functions

virtual ~DatagramService ()=0
 
virtual void bind ()=0 throw (DatagramException)
 
virtual void shutdown ()=0
 
virtual void send (const char &type, const char &flags, const unsigned int &seqno, const std::string &address, const char *buf, size_t length)=0 throw (DatagramException)
 
virtual void send (const char &type, const char &flags, const unsigned int &seqno, const char *buf, size_t length)=0 throw (DatagramException)
 
virtual size_t recvfrom (char *buf, size_t length, char &type, char &flags, unsigned int &seqno, std::string &address)=0 throw (DatagramException)
 
virtual const std::string getServiceTag () const =0
 
virtual const std::string getServiceDescription () const =0
 
virtual const
ibrcommon::vinterface
getInterface () const =0
 
virtual dtn::core::Node::Protocol getProtocol () const =0
 
virtual const ParametergetParameter () const =0
 

Detailed Description

Definition at line 40 of file DatagramService.h.

Member Enumeration Documentation

Enumerator
FLOW_NONE 
FLOW_STOPNWAIT 

Definition at line 43 of file DatagramService.h.

Enumerator
SEGMENT_FIRST 
SEGMENT_LAST 
SEGMENT_MIDDLE 

Definition at line 49 of file DatagramService.h.

Constructor & Destructor Documentation

dtn::net::DatagramService::~DatagramService ( )
pure virtual

Definition at line 14 of file DatagramService.cpp.

Member Function Documentation

virtual void dtn::net::DatagramService::bind ( ) throw (DatagramException)
pure virtual

Bind to the local socket.

Exceptions
Ifthe bind fails, an DatagramException is thrown.

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

Referenced by dtn::net::DatagramConvergenceLayer::componentUp().

virtual const ibrcommon::vinterface& dtn::net::DatagramService::getInterface ( ) const
pure virtual

The used interface as vinterface object.

Returns
A vinterface object.

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

Referenced by dtn::net::DatagramConvergenceLayer::componentUp().

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

Returns the parameter for the connection.

Returns

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

Referenced by dtn::net::DatagramConvergenceLayer::componentRun().

virtual dtn::core::Node::Protocol dtn::net::DatagramService::getProtocol ( ) const
pure virtual
virtual const std::string dtn::net::DatagramService::getServiceDescription ( ) const
pure virtual

Get the service description for this convergence layer. This data is used to contact this node.

Returns
The service description as string.

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

virtual const std::string dtn::net::DatagramService::getServiceTag ( ) const
pure virtual

Get the tag for this service used in discovery messages.

Returns
The tag as string.

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

virtual size_t dtn::net::DatagramService::recvfrom ( char *  buf,
size_t  length,
char &  type,
char &  flags,
unsigned int &  seqno,
std::string &  address 
) throw (DatagramException)
pure 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.

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

Referenced by dtn::net::DatagramConvergenceLayer::componentRun().

virtual void dtn::net::DatagramService::send ( const char &  type,
const char &  flags,
const unsigned int &  seqno,
const std::string &  address,
const char *  buf,
size_t  length 
) throw (DatagramException)
pure 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.
Exceptions
Ifthe transmission wasn't successful this method will throw an exception.

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

Referenced by dtn::net::DatagramConvergenceLayer::sendAnnoucement().

virtual void dtn::net::DatagramService::send ( const char &  type,
const char &  flags,
const unsigned int &  seqno,
const char *  buf,
size_t  length 
) throw (DatagramException)
pure virtual

Send the payload as datagram to all neighbors (broadcast)

Parameters
bufThe buffer to send.
lengthThe number of available bytes in the buffer.
Exceptions
Ifthe transmission wasn't successful this method will throw an exception.

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

virtual void dtn::net::DatagramService::shutdown ( )
pure virtual

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

Implemented in dtn::net::LOWPANDatagramService, and dtn::net::UDPDatagramService.

Referenced by dtn::net::DatagramConvergenceLayer::__cancellation().


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