#include <source/ariba/Node.h>
Definition at line 73 of file Node.h.
ariba::Node::Node | ( | AribaModule & | ariba_mod, | |
const Name & | node_name = Name::UNSPECIFIED | |||
) |
Constructs a new node using a given ariba module
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.
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.
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 | |||
) |
This method initiates a new SpoVNet with the given SpoVNetID and parameters.
name | The SpoVNet name | |
param | The SpoVNet properties |
Definition at line 74 of file Node.cpp.
References ariba::AribaModule::addBootstrapNode(), ariba_mod, ariba::AribaModule::base_comm, base_overlay, ariba::overlay::BaseOverlay::createSpoVNet(), generateNodeId(), ariba::SpoVNetProperties::getBaseOverlayType(), ariba::communication::BaseCommunication::getEndpointDescriptor(), ariba::AribaModule::ip_addr, name, nodeId, ariba::utility::OverlayParameterSet::setOverlayStructure(), 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::leave | ( | ) |
This method initiates the leave procedure of this node.
Definition at line 93 of file Node.cpp.
References ariba_mod, ariba::AribaModule::base_comm, base_overlay, ariba::overlay::BaseOverlay::leaveSpoVNet(), ariba::overlay::BaseOverlay::stop(), and ariba::communication::BaseCommunication::stop().
Referenced by ariba::application::pingpong::PingPong::shutdown().
bool ariba::Node::bind | ( | NodeListener * | listener | ) |
This method is used to bind a node listener to this node.
listener | The node listener |
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.
listener | The node listener |
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.
Definition at line 99 of file Node.cpp.
References ariba::SpoVNetProperties::DEFAULT.
const SpoVNetID & ariba::Node::getSpoVNetId | ( | ) | const |
Returns the spovnet identifier
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.
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.
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().
Returns the node id to a node name according to the currently joined spovnet (usually derives a node identifier by hashing the 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.
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.
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.
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 |
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.
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.
msg | The message to be sent | |
nid | The remote node identifier | |
sid | The remote service identifier | |
req | The requirements associated with the message |
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.
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.
msg | The message to be send | |
sid | The id of the service that should receive the message |
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.
listener | The listener to be registered | |
sid | The service identifier |
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.
The | listener to be unbound |
Definition at line 164 of file Node.cpp.
References base_overlay, and ariba::overlay::BaseOverlay::unbind().
void ariba::Node::initialize | ( | ) | [virtual] |
void ariba::Node::start | ( | ) | [virtual] |
Reimplemented from ariba::Module.
Definition at line 184 of file Node.cpp.
Referenced by ariba::application::pingpong::PingPong::startup().
void ariba::Node::stop | ( | ) | [virtual] |
string ariba::Node::getName | ( | ) | const [virtual] |
void ariba::Node::setProperty | ( | string | key, | |
string | value | |||
) | [virtual] |
const string ariba::Node::getProperty | ( | string | key | ) | const [virtual] |
const vector< string > ariba::Node::getProperties | ( | ) | const [virtual] |
friend class AribaModule [friend] |
Name ariba::Node::name [protected] |
AribaModule& ariba::Node::ariba_mod [protected] |
SpoVNetID ariba::Node::spovnetId [protected] |
NodeID ariba::Node::nodeId [protected] |
overlay::BaseOverlay* ariba::Node::base_overlay [protected] |
Definition at line 342 of file Node.h.
Referenced by bind(), dropLink(), establishLink(), getNeighborNodes(), getNodeId(), initiate(), join(), leave(), Node(), sendBroadcastMessage(), sendMessage(), unbind(), and ~Node().