ariba::Node Class Reference

#include <source/ariba/Node.h>

Inheritance diagram for ariba::Node:

Inheritance graph
[legend]
Collaboration diagram for ariba::Node:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Node (AribaModule &ariba_mod, const Name &node_name=Name::UNSPECIFIED)
 ~Node ()
void join (const Name &name)
void initiate (const Name &name, const SpoVNetProperties &parm=SpoVNetProperties::DEFAULT)
void leave ()
bool bind (NodeListener *listener)
bool unbind (NodeListener *listener)
const SpoVNetPropertiesgetSpoVNetProperties () const
const SpoVNetIDgetSpoVNetId () const
bool isJoined () const
const NodeIDgetNodeId (const LinkID &lid=LinkID::UNSPECIFIED) const
NodeID generateNodeId (const Name &name) const
const Name getNodeName (const LinkID &lid=LinkID::UNSPECIFIED) const
vector< NodeIDgetNeighborNodes () const
LinkID establishLink (const NodeID &nid, const ServiceID &sid, const LinkProperties &req=LinkProperties::DEFAULT, const DataMessage &msg=DataMessage::UNSPECIFIED)
void dropLink (const LinkID &lnk)
seqnum_t sendMessage (const DataMessage &msg, const NodeID &nid, const ServiceID &sid, const LinkProperties &req=LinkProperties::DEFAULT)
seqnum_t sendMessage (const DataMessage &msg, const LinkID &lnk)
void sendBroadcastMessage (const DataMessage &msg, const ServiceID &sid)
bool bind (CommunicationListener *listener, const ServiceID &sid)
bool unbind (CommunicationListener *listener, const ServiceID &sid)
void initialize ()
void start ()
void stop ()
string getName () const
void setProperty (string key, string value)
const string getProperty (string key) const
const vector< string > getProperties () const

Protected Attributes

Name name
AribaModuleariba_mod
SpoVNetID spovnetId
NodeID nodeId
overlay::BaseOverlaybase_overlay

Friends

class AribaModule


Detailed Description

This class should implement all ariba node functionality.

Author:
Sebastian Mies <mies@tm.uka.de>

Christoph Mayer <mayer@tm.uka.de>

Definition at line 73 of file Node.h.


Constructor & Destructor Documentation

ariba::Node::Node ( AribaModule ariba_mod,
const Name node_name = Name::UNSPECIFIED 
)

Constructs a new node using a given ariba module

Parameters:
ariba_mod The ariba module
name The canonical node name of the new node. When NULL a randomly chosen name is created.
len The length of the canonical node name or -1, if the name is a zero-terminated char-string.

Definition at line 49 of file Node.cpp.

References base_overlay.

ariba::Node::~Node (  ) 

Destroys the node. Before destruction some pre-conditions must be met:

1. The node is not part of any SpoVNet
2. All listeners must be unbound from this node
3. The module has been stopped

Definition at line 54 of file Node.cpp.

References base_overlay.


Member Function Documentation

void ariba::Node::join ( const Name name  ) 

This method instructs the node to join a particular spovnet. Callees may bind with a NodeListener to receive events, when a node has been successfully joined.

Parameters:
vnetId The SpoVNet name

Definition at line 59 of file Node.cpp.

References ariba_mod, ariba::AribaModule::base_comm, base_overlay, generateNodeId(), ariba::AribaModule::getBootstrapNode(), ariba::AribaModule::ip_addr, ariba::overlay::BaseOverlay::joinSpoVNet(), name, nodeId, spovnetId, ariba::overlay::BaseOverlay::start(), ariba::communication::BaseCommunication::start(), ariba::AribaModule::tcp_port, and ariba::Name::toSpoVNetId().

Referenced by ariba::application::pingpong::PingPong::startup().

void ariba::Node::initiate ( const Name name,
const SpoVNetProperties parm = SpoVNetProperties::DEFAULT 
)

void ariba::Node::leave (  ) 

bool ariba::Node::bind ( NodeListener listener  ) 

This method is used to bind a node listener to this node.

Parameters:
listener The node listener
Returns:
boolean indicating success of failure

Definition at line 143 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::bind().

Referenced by ariba::application::pingpong::PingPong::startup().

bool ariba::Node::unbind ( NodeListener listener  ) 

This method is used to unbind a node listener to this node.

Parameters:
listener The node listener
Returns:
boolean indicating success of failure

Definition at line 147 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::unbind().

Referenced by ariba::application::pingpong::PingPong::shutdown().

const SpoVNetProperties & ariba::Node::getSpoVNetProperties (  )  const

Returns the properties of the spovnet the node has joined.

Returns:
The properties of the spovnet the node has joined

Definition at line 99 of file Node.cpp.

References ariba::SpoVNetProperties::DEFAULT.

const SpoVNetID & ariba::Node::getSpoVNetId (  )  const

Returns the spovnet identifier

Returns:
The spovnet idenfifier

Definition at line 103 of file Node.cpp.

References spovnetId.

Referenced by ariba::application::pingpong::PingPong::startup().

bool ariba::Node::isJoined (  )  const

Returns true, if the node is part of a spovnet.

Returns:
True, if the node is part of a spovnet

const NodeID & ariba::Node::getNodeId ( const LinkID lid = LinkID::UNSPECIFIED  )  const

Returns the node id of this node if the link id is unspecified or the node id of the remote node.

Returns:
The local or the remote node identifier

Definition at line 107 of file Node.cpp.

References base_overlay, ariba::overlay::BaseOverlay::getNodeID(), nodeId, and ariba::utility::LinkID::UNSPECIFIED.

Referenced by ariba::application::pingpong::PingPong::startup().

NodeID ariba::Node::generateNodeId ( const Name name  )  const

Returns the node id to a node name according to the currently joined spovnet (usually derives a node identifier by hashing the name).

Returns:
The node identifier to the given name

Definition at line 112 of file Node.cpp.

References ariba::Name::random(), ariba::Name::toNodeId(), and ariba::Name::UNSPECIFIED.

Referenced by initiate(), and join().

const Name ariba::Node::getNodeName ( const LinkID lid = LinkID::UNSPECIFIED  )  const

Returns the name of this node if the link id is unspecified or the node name of the remote node, if known -- otherwise it returns an unspecified name.

TODO: RFE -- send request to remote node and inform service.

Returns:
A node's name or an unspecified name, if unknown

vector< NodeID > ariba::Node::getNeighborNodes (  )  const

Get a list of neighboring nodes in the overlay structure. The number and identities of nodes depends highly on the used overlay structure.

Returns:
a list of NodeIDs that are neighbors in the overlay structure
See also:
sendBroadcastMessage

Definition at line 117 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::getOverlayNeighbors().

Referenced by ariba::application::pingpong::PingPong::eventFunction().

LinkID ariba::Node::establishLink ( const NodeID nid,
const ServiceID sid,
const LinkProperties req = LinkProperties::DEFAULT,
const DataMessage msg = DataMessage::UNSPECIFIED 
)

Establishes a new link to another node and service with the given link properties. An optional message could be sent with the request.

Parameters:
nid The remote node identifier
sid The remote service identifier
req The required link properties
msg An optional message that is sent with the request
Returns:
A new link id

Definition at line 121 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::establishLink().

void ariba::Node::dropLink ( const LinkID lnk  ) 

This method drops an established link.

Parameters:
lnk The link identifier of an active link

Definition at line 126 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::dropLink().

seqnum_t ariba::Node::sendMessage ( const DataMessage msg,
const NodeID nid,
const ServiceID sid,
const LinkProperties req = LinkProperties::DEFAULT 
)

Sends a one-shot message to a service. If link properties are specified, the node tries to fulfill those requirements. This may cause the node to first establish a temporary link, second sending the message and last dropping the link. This would result in a small amount of extra latency until the message is delivered. If reliable transport was selected, the method returns a sequence number and a communication event is triggered on message delivery or loss.

Parameters:
msg The message to be sent
nid The remote node identifier
sid The remote service identifier
req The requirements associated with the message
Returns:
A sequence number

Definition at line 130 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::sendMessage().

Referenced by ariba::application::pingpong::PingPong::eventFunction().

seqnum_t ariba::Node::sendMessage ( const DataMessage msg,
const LinkID lnk 
)

Sends a message via an established link. If reliable transport was selected, the method returns a sequence number and a communication event is triggered on message delivery or loss.

Parameters:
msg The message to be sent
lnk The link to be used for sending the message

Definition at line 135 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::sendMessage().

void ariba::Node::sendBroadcastMessage ( const DataMessage msg,
const ServiceID sid 
)

Sends a message to all known hosts in the overlay structure the nodes that are reached here depend on the overlay structure.

Parameters:
msg The message to be send
sid The id of the service that should receive the message
See also:
getNeighborNodes

Definition at line 139 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::broadcastMessage().

bool ariba::Node::bind ( CommunicationListener listener,
const ServiceID sid 
)

Binds a listener to a specifed service identifier. Whenever a link is established/dropped or messages are received the events inside the interface are called.

Parameters:
listener The listener to be registered
sid The service identifier
Returns:
boolean indicating success of failure

Definition at line 151 of file Node.cpp.

References ariba_mod, base_overlay, ariba::overlay::BaseOverlay::bind(), ariba::CommunicationListener::onEnableSideportListener(), ariba::overlay::BaseOverlay::registerSidePort(), and ariba::AribaModule::sideport_sniffer.

bool ariba::Node::unbind ( CommunicationListener listener,
const ServiceID sid 
)

Un-binds a listener from this node.

Parameters:
The listener to be unbound
Returns:
boolean indicating success of failure

Definition at line 164 of file Node.cpp.

References base_overlay, and ariba::overlay::BaseOverlay::unbind().

void ariba::Node::initialize (  )  [virtual]

See also:
Module.h

Reimplemented from ariba::Module.

Definition at line 179 of file Node.cpp.

void ariba::Node::start (  )  [virtual]

See also:
Module.h

Reimplemented from ariba::Module.

Definition at line 184 of file Node.cpp.

Referenced by ariba::application::pingpong::PingPong::startup().

void ariba::Node::stop (  )  [virtual]

See also:
Module.h

Reimplemented from ariba::Module.

Definition at line 189 of file Node.cpp.

string ariba::Node::getName (  )  const [virtual]

See also:
Module.h

Reimplemented from ariba::Module.

Definition at line 194 of file Node.cpp.

void ariba::Node::setProperty ( string  key,
string  value 
) [virtual]

See also:
Module.h

Reimplemented from ariba::Module.

Definition at line 199 of file Node.cpp.

const string ariba::Node::getProperty ( string  key  )  const [virtual]

See also:
Module.h

Reimplemented from ariba::Module.

Definition at line 204 of file Node.cpp.

const vector< string > ariba::Node::getProperties (  )  const [virtual]

See also:
Module.h

Reimplemented from ariba::Module.

Definition at line 209 of file Node.cpp.


Friends And Related Function Documentation

friend class AribaModule [friend]

Definition at line 335 of file Node.h.


Member Data Documentation

Name ariba::Node::name [protected]

Definition at line 338 of file Node.h.

Referenced by initiate(), and join().

Definition at line 339 of file Node.h.

Referenced by bind(), initiate(), join(), and leave().

Definition at line 340 of file Node.h.

Referenced by getSpoVNetId(), initiate(), and join().

Definition at line 341 of file Node.h.

Referenced by getNodeId(), initiate(), and join().


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

Generated on Wed May 27 18:23:56 2009 for Ariba by  doxygen 1.5.6