ariba::communication::BaseCommunication Class Reference

#include <source/ariba/communication/BaseCommunication.h>

Inherits ariba::communication::NetworkChangeInterface, ariba::utility::SystemEventListener, and ariba::transport::transport_listener.

Collaboration diagram for ariba::communication::BaseCommunication:

Collaboration graph
[legend]

List of all members.

Classes

class  endpoint_reference
 list of all remote addresses of links to end-points More...
class  LinkDescriptor

Public Member Functions

 BaseCommunication ()
 Default ctor that just creates an non-functional base communication.
virtual ~BaseCommunication ()
 Default dtor that does nothing.
void start ()
 Startup the base communication, start modules etc.
void stop ()
 Stops the base communication, stop modules etc.
void setEndpoints (string &endpoints)
 Sets the endpoints.
bool isStarted ()
 Check whether the base communication has been started up.
const LinkID establishLink (const EndpointDescriptor &descriptor, const LinkID &linkid=LinkID::UNSPECIFIED, const QoSParameterSet &qos=QoSParameterSet::DEFAULT, const SecurityParameterSet &sec=SecurityParameterSet::DEFAULT)
 Establishes a link to another end-point.
void dropLink (const LinkID link)
 Drops a link.
seqnum_t sendMessage (const LinkID lid, const Message *message)
const EndpointDescriptorgetEndpointDescriptor (const LinkID link=LinkID::UNSPECIFIED) const
LinkIDs getLocalLinks (const address_v *addr) const
void registerMessageReceiver (MessageReceiver *receiver)
void unregisterMessageReceiver (MessageReceiver *receiver)
void registerEventListener (CommunicationEvents *_events)
void unregisterEventListener (CommunicationEvents *_events)
virtual void handleSystemEvent (const SystemEvent &event)
 called when a system event is emitted by system queue
virtual void receive_message (transport_protocol *transport, const address_vf local, const address_vf remote, const uint8_t *data, size_t size)
 called when a message is received form transport_peer

Protected Member Functions

void receiveMessage (const Message *message, const address_v *local, const address_v *remote)
 handle received message from a transport module
virtual void onNetworkChange (const NetworkChangeInterface::NetworkChangeInfo &info)
 called when a network interface change happens

Private Types

typedef vector< LinkDescriptor * > LinkSet
 Link management: list of links.
typedef set
< CommunicationEvents * > 
EventListenerSet
 event listener

Private Member Functions

 use_logging_h (BaseCommunication)
void addLink (LinkDescriptor *link)
 Link management: add a link.
void removeLink (const LinkID &localLink)
 Link management: remove a link.
LinkDescriptorqueryLocalLink (const LinkID &localLink) const
 Link management: get link information using the local link.
LinkDescriptorqueryRemoteLink (const LinkID &remoteLink) const
 Link management: get link information using the remote link.
void add_endpoint (const address_v *endpoint)
 adds an end-point to the list
void remove_endpoint (const address_v *endpoint)
 removes an end-point from the list
void send (Message *message, const EndpointDescriptor &endpoint)
 convenience: send message to peer
void send (Message *message, const LinkDescriptor &descriptor)
 sends a message to the remote locator inside the link descriptor

Private Attributes

LinkSet linkSet
 Link management: the set of currently managed links.
EndpointDescriptor localDescriptor
 The local end-point descriptor.
NetworkChangeDetection networkMonitor
 network change detector
vector< endpoint_referenceremote_endpoints
EventListenerSet eventListener
seqnum_t currentSeqnum
 sequence numbers
transport_peertransport
 transport peer
MessageReceiver * messageReceiver
 the base overlay message receiver
bool started
 state of the base communication

Friends

class ariba::SideportListener


Detailed Description

This class implements the Ariba Base Communication

Its primary task is to provide an abstraction to existing protocols and addressing schemes.

Author:
Sebastian Mies, Christoph Mayer

Definition at line 105 of file BaseCommunication.h.


Member Typedef Documentation

event listener

Definition at line 294 of file BaseCommunication.h.

Link management: list of links.

Definition at line 255 of file BaseCommunication.h.


Constructor & Destructor Documentation

ariba::communication::BaseCommunication::BaseCommunication (  ) 

Default ctor that just creates an non-functional base communication.

Definition at line 90 of file BaseCommunication.cpp.

References started, and transport.

ariba::communication::BaseCommunication::~BaseCommunication (  )  [virtual]

Default dtor that does nothing.

Definition at line 95 of file BaseCommunication.cpp.


Member Function Documentation

void ariba::communication::BaseCommunication::add_endpoint ( const address_v endpoint  )  [private]

void ariba::communication::BaseCommunication::addLink ( LinkDescriptor link  )  [private]

Link management: add a link.

add a newly allocated link to the set of links

Definition at line 518 of file BaseCommunication.cpp.

References linkSet.

Referenced by establishLink(), and receiveMessage().

void ariba::communication::BaseCommunication::dropLink ( const LinkID  link  ) 

const LinkID ariba::communication::BaseCommunication::establishLink ( const EndpointDescriptor descriptor,
const LinkID linkid = LinkID::UNSPECIFIED,
const QoSParameterSet qos = QoSParameterSet::DEFAULT,
const SecurityParameterSet sec = SecurityParameterSet::DEFAULT 
)

const EndpointDescriptor & ariba::communication::BaseCommunication::getEndpointDescriptor ( const LinkID  link = LinkID::UNSPECIFIED  )  const

LinkIDs ariba::communication::BaseCommunication::getLocalLinks ( const address_v addr  )  const

Get local links to the given endpoint of all local link using the default parameter EndpointDescriptor::UNSPECIFIED

Parameters:
ep The remote endpoint to get all links to.
Returns:
List of LinkID

Definition at line 549 of file BaseCommunication.cpp.

References linkSet.

void ariba::communication::BaseCommunication::handleSystemEvent ( const SystemEvent event  )  [virtual]

bool ariba::communication::BaseCommunication::isStarted (  ) 

Check whether the base communication has been started up.

Definition at line 142 of file BaseCommunication.cpp.

References started.

Referenced by ariba::Node::initiate(), and ariba::Node::join().

void ariba::communication::BaseCommunication::onNetworkChange ( const NetworkChangeInterface::NetworkChangeInfo info  )  [protected, virtual]

called when a network interface change happens

Implements ariba::communication::NetworkChangeInterface.

Definition at line 562 of file BaseCommunication.cpp.

BaseCommunication::LinkDescriptor & ariba::communication::BaseCommunication::queryLocalLink ( const LinkID localLink  )  const [private]

Link management: get link information using the local link.

query a descriptor by local link id

Definition at line 534 of file BaseCommunication.cpp.

References linkSet, and ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::UNSPECIFIED().

Referenced by dropLink(), getEndpointDescriptor(), ariba::SideportListener::getReachabilityProtocol(), receiveMessage(), and sendMessage().

BaseCommunication::LinkDescriptor & ariba::communication::BaseCommunication::queryRemoteLink ( const LinkID remoteLink  )  const [private]

Link management: get link information using the remote link.

query a descriptor by remote link id

Definition at line 542 of file BaseCommunication.cpp.

References linkSet, and ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::UNSPECIFIED().

Referenced by receiveMessage().

void ariba::communication::BaseCommunication::receive_message ( transport_protocol transport,
const address_vf  local,
const address_vf  remote,
const uint8_t *  data,
size_t  size 
) [virtual]

void ariba::communication::BaseCommunication::receiveMessage ( const Message message,
const address_v local,
const address_v remote 
) [protected]

handle received message from a transport module

handles a message from the underlay transport

decapsulate message

only answer the first request

create link ids

Definition at line 310 of file BaseCommunication.cpp.

References ariba::addressing::endpoint_set::add(), add_endpoint(), addLink(), ariba::addressing::address_v::clone(), ariba::utility::LinkID::create(), eventListener, ariba::communication::EndpointDescriptor::getEndpoints(), ariba::communication::AribaBaseMsg::getLocalDescriptor(), ariba::communication::AribaBaseMsg::getLocalLink(), ariba::communication::AribaBaseMsg::getRemoteDescriptor(), ariba::communication::AribaBaseMsg::getRemoteLink(), ariba::communication::AribaBaseMsg::getType(), ariba::communication::AribaBaseMsg::getTypeString(), ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::isUnspecified(), ariba::addressing::endpoint_set::Layer1_3, localDescriptor, ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::localLink, ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::localLocator, logging_debug, logging_warn, messageReceiver, ariba::communication::CommunicationEvents::onLinkChanged(), ariba::communication::CommunicationEvents::onLinkDown(), ariba::communication::CommunicationEvents::onLinkRequest(), ariba::communication::CommunicationEvents::onLinkUp(), queryLocalLink(), queryRemoteLink(), ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::remoteEndpoint, ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::remoteLink, ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::remoteLocator, removeLink(), send(), ariba::addressing::address_v::to_string(), ariba::utility::Identifier::toString(), ariba::communication::AribaBaseMsg::typeData, ariba::communication::AribaBaseMsg::typeLinkClose, ariba::communication::AribaBaseMsg::typeLinkReply, ariba::communication::AribaBaseMsg::typeLinkRequest, ariba::communication::AribaBaseMsg::typeLinkUpdate, ariba::utility::NodeID::UNSPECIFIED, and ariba::communication::BaseCommunication::BaseCommunication::LinkDescriptor::up.

Referenced by handleSystemEvent().

void ariba::communication::BaseCommunication::registerEventListener ( CommunicationEvents _events  ) 

Definition at line 252 of file BaseCommunication.cpp.

References eventListener.

Referenced by ariba::overlay::BaseOverlay::start().

void ariba::communication::BaseCommunication::registerMessageReceiver ( MessageReceiver *  receiver  )  [inline]

Registers a receiver.

Parameters:
_receiver The receiving side

Definition at line 172 of file BaseCommunication.h.

References messageReceiver.

Referenced by ariba::overlay::BaseOverlay::start().

void ariba::communication::BaseCommunication::remove_endpoint ( const address_v endpoint  )  [private]

removes an end-point from the list

removes an endpoint from the list

Definition at line 73 of file BaseCommunication.cpp.

References logging_info, remote_endpoints, ariba::transport::transport_peer::terminate(), transport, and ariba::addressing::address_v::type_id().

Referenced by removeLink().

void ariba::communication::BaseCommunication::removeLink ( const LinkID localLink  )  [private]

Link management: remove a link.

remove a link from set

Definition at line 523 of file BaseCommunication.cpp.

References linkSet, and remove_endpoint().

Referenced by dropLink(), and receiveMessage().

void ariba::communication::BaseCommunication::send ( Message message,
const LinkDescriptor descriptor 
) [private]

void ariba::communication::BaseCommunication::send ( Message message,
const EndpointDescriptor endpoint 
) [private]

seqnum_t ariba::communication::BaseCommunication::sendMessage ( const LinkID  lid,
const Message message 
)

Sends a message though an existing link to an end-point.

Parameters:
lid The link identifier
message The message to be sent
Returns:
A sequence number for this message

Definition at line 212 of file BaseCommunication.cpp.

References currentSeqnum, logging_debug, logging_error, queryLocalLink(), send(), ariba::utility::Identifier::toString(), and ariba::communication::AribaBaseMsg::typeData.

Referenced by ariba::overlay::BaseOverlay::handleJoinRequest(), ariba::overlay::BaseOverlay::onLinkUp(), and ariba::overlay::BaseOverlay::send().

void ariba::communication::BaseCommunication::setEndpoints ( string &  endpoints  ) 

void ariba::communication::BaseCommunication::start (  ) 

void ariba::communication::BaseCommunication::stop (  ) 

Stops the base communication, stop modules etc.

Definition at line 132 of file BaseCommunication.cpp.

References logging_info, started, ariba::transport::transport_peer::stop(), and transport.

Referenced by ariba::Node::leave().

void ariba::communication::BaseCommunication::unregisterEventListener ( CommunicationEvents _events  ) 

Definition at line 257 of file BaseCommunication.cpp.

References eventListener.

Referenced by ariba::overlay::BaseOverlay::stop().

void ariba::communication::BaseCommunication::unregisterMessageReceiver ( MessageReceiver *  receiver  )  [inline]

Unregister a receiver.

Parameters:
_receiver The receiving side

Definition at line 181 of file BaseCommunication.h.

References messageReceiver.

Referenced by ariba::overlay::BaseOverlay::stop().

ariba::communication::BaseCommunication::use_logging_h ( BaseCommunication   )  [private]


Friends And Related Function Documentation

friend class ariba::SideportListener [friend]

Definition at line 111 of file BaseCommunication.h.


Member Data Documentation

sequence numbers

Definition at line 298 of file BaseCommunication.h.

Referenced by sendMessage(), and start().

Link management: the set of currently managed links.

Definition at line 258 of file BaseCommunication.h.

Referenced by addLink(), getLocalLinks(), queryLocalLink(), queryRemoteLink(), and removeLink().

The local end-point descriptor.

Definition at line 273 of file BaseCommunication.h.

Referenced by establishLink(), getEndpointDescriptor(), receiveMessage(), setEndpoints(), and start().

the base overlay message receiver

Definition at line 304 of file BaseCommunication.h.

Referenced by receiveMessage(), registerMessageReceiver(), and unregisterMessageReceiver().

network change detector

Definition at line 277 of file BaseCommunication.h.

Referenced by start().

Definition at line 285 of file BaseCommunication.h.

Referenced by add_endpoint(), and remove_endpoint().

state of the base communication

Definition at line 313 of file BaseCommunication.h.

Referenced by BaseCommunication(), isStarted(), start(), and stop().

transport peer

Definition at line 301 of file BaseCommunication.h.

Referenced by BaseCommunication(), remove_endpoint(), send(), start(), and stop().


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

Generated on Fri Aug 14 23:39:18 2009 for Ariba by  doxygen 1.5.8