#include <sample/pingpong/PingPong.h>
Inherits ariba::NodeListener, ariba::CommunicationListener, ariba::utility::StartupInterface, and ariba::utility::Timer.
Public Member Functions | |
PingPong () | |
virtual | ~PingPong () |
Protected Member Functions | |
virtual bool | onLinkRequest (const NodeID &remote) |
virtual void | onMessage (const DataMessage &msg, const NodeID &remote, const LinkID &lnk=LinkID::UNSPECIFIED) |
virtual void | onLinkUp (const LinkID &lnk, const NodeID &remote) |
virtual void | onLinkDown (const LinkID &lnk, const NodeID &remote) |
virtual void | onLinkChanged (const LinkID &lnk, const NodeID &remote) |
virtual void | onLinkFail (const LinkID &lnk, const NodeID &remote) |
virtual void | onJoinCompleted (const SpoVNetID &vid) |
virtual void | onJoinFailed (const SpoVNetID &vid) |
virtual void | onLeaveCompleted (const SpoVNetID &vid) |
virtual void | onLeaveFailed (const SpoVNetID &vid) |
virtual void | startup () |
virtual void | shutdown () |
virtual void | eventFunction () |
Private Member Functions | |
use_logging_h (PingPong) | |
Private Attributes | |
AribaModule * | ariba |
Node * | node |
string | name |
int | counter |
vector< string > | names |
unsigned long | pingId |
Static Private Attributes | |
static ServiceID | PINGPONG_SERVICEID = ServiceID( 111 ) |
/* The PingPong main class /* This class implements an example service for demonstration purposes /* The pingpong class sends and receives messages between two SpoVNet /* instances
Definition at line 27 of file PingPong.h.
ariba::application::pingpong::PingPong::PingPong | ( | ) |
Definition at line 19 of file PingPong.cpp.
References ariba::utility::Timer::setInterval().
ariba::application::pingpong::PingPong::~PingPong | ( | ) | [virtual] |
Definition at line 24 of file PingPong.cpp.
void ariba::application::pingpong::PingPong::eventFunction | ( | ) | [protected, virtual] |
Reimplemented from ariba::utility::Timer.
Definition at line 125 of file PingPong.cpp.
References counter, ariba::Node::getNeighborNodes(), logging_info, name, names, node, pingId, PINGPONG_SERVICEID, ariba::Node::sendMessage(), and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onJoinCompleted | ( | const SpoVNetID & | vid | ) | [protected, virtual] |
This event method is called, when a node has completed its join procedure.
vid | The spovnet id | |
nid | The node id |
Reimplemented from ariba::NodeListener.
Definition at line 168 of file PingPong.cpp.
References logging_info, ariba::utility::Timer::start(), and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onJoinFailed | ( | const SpoVNetID & | vid | ) | [protected, virtual] |
This event method is called, when a node failed to join a spovnet.
vid | The spovnet id | |
nid | The node id |
Reimplemented from ariba::NodeListener.
Definition at line 175 of file PingPong.cpp.
References logging_error, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onLeaveCompleted | ( | const SpoVNetID & | vid | ) | [protected, virtual] |
This event method is called, when a node succeeded to leave a spovnet.
vid | The spovnet id | |
nid | The node id |
Reimplemented from ariba::NodeListener.
Definition at line 179 of file PingPong.cpp.
References logging_info, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onLeaveFailed | ( | const SpoVNetID & | vid | ) | [protected, virtual] |
This event method is called, when a node failed to leave a spovnet.
vid | The spovnet id | |
nid | The node id |
Reimplemented from ariba::NodeListener.
Definition at line 183 of file PingPong.cpp.
References logging_error, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onLinkChanged | ( | const LinkID & | lnk, | |
const NodeID & | remote | |||
) | [protected, virtual] |
Event called when a link has changed, e.g. through mobility
lnk | The id of the link | |
remote | The remote node where the link ends |
Reimplemented from ariba::CommunicationListener.
Definition at line 208 of file PingPong.cpp.
References logging_info, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onLinkDown | ( | const LinkID & | lnk, | |
const NodeID & | remote | |||
) | [protected, virtual] |
Event called when a link goes down
lnk | The id of the link | |
remote | The remote node where the link ends |
Reimplemented from ariba::CommunicationListener.
Definition at line 203 of file PingPong.cpp.
References logging_info, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onLinkFail | ( | const LinkID & | lnk, | |
const NodeID & | remote | |||
) | [protected, virtual] |
Event called when a link has failed
lnk | The id of the link | |
remote | The remote node where the link ends |
Reimplemented from ariba::CommunicationListener.
Definition at line 218 of file PingPong.cpp.
References logging_info, and ariba::utility::Identifier::toString().
bool ariba::application::pingpong::PingPong::onLinkRequest | ( | const NodeID & | remote | ) | [protected, virtual] |
Request from remote node to open up a link
remote | The remote node that requests the new link |
Reimplemented from ariba::CommunicationListener.
Definition at line 213 of file PingPong.cpp.
References logging_info, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onLinkUp | ( | const LinkID & | lnk, | |
const NodeID & | remote | |||
) | [protected, virtual] |
Event called when a link goes up
lnk | The id of the link | |
remote | The remote node where the link ends |
Reimplemented from ariba::CommunicationListener.
Definition at line 198 of file PingPong.cpp.
References logging_info, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::onMessage | ( | const DataMessage & | msg, | |
const NodeID & | remote, | |||
const LinkID & | lnk = LinkID::UNSPECIFIED | |||
) | [protected, virtual] |
Called when a message is incoming
msg | The data message that is received | |
remote | The remote node that sent the message | |
lnk | The link id of the link where the message is received |
Reimplemented from ariba::CommunicationListener.
Definition at line 187 of file PingPong.cpp.
References Message::convert(), ariba::DataMessage::getMessage(), ariba::application::pingpong::PingPongMessage::getName(), ariba::application::pingpong::PingPongMessage::info(), logging_info, names, and ariba::utility::Identifier::toString().
void ariba::application::pingpong::PingPong::shutdown | ( | ) | [protected, virtual] |
Implements ariba::utility::StartupInterface.
Definition at line 99 of file PingPong.cpp.
References ariba, ariba::Node::leave(), logging_info, node, PINGPONG_SERVICEID, ariba::AribaModule::stop(), ariba::utility::Timer::stop(), and ariba::Node::unbind().
void ariba::application::pingpong::PingPong::startup | ( | ) | [protected, virtual] |
Implements ariba::utility::StartupInterface.
Definition at line 28 of file PingPong.cpp.
References ariba, ariba::Node::bind(), protlib::log::color, ariba::utility::Configuration::exists(), ariba::Node::getNodeId(), ariba::Node::getSpoVNetId(), ariba::Node::initiate(), ariba::utility::DddVis::instance(), ariba::Node::join(), logging_debug, logging_info, name, ariba::CommunicationListener::Node, node, PINGPONG_SERVICEID, ariba::utility::Configuration::read(), ariba::AribaModule::setProperty(), ariba::Module::start(), ariba::AribaModule::start(), ariba::utility::Identifier::toString(), and ariba::Name::UNSPECIFIED.
ariba::application::pingpong::PingPong::use_logging_h | ( | PingPong | ) | [private] |
Reimplemented from ariba::utility::Timer.
Definition at line 63 of file PingPong.h.
Referenced by shutdown(), and startup().
int ariba::application::pingpong::PingPong::counter [private] |
Definition at line 66 of file PingPong.h.
Referenced by eventFunction().
string ariba::application::pingpong::PingPong::name [private] |
Definition at line 65 of file PingPong.h.
Referenced by eventFunction(), and startup().
vector<string> ariba::application::pingpong::PingPong::names [private] |
Definition at line 67 of file PingPong.h.
Referenced by eventFunction(), and onMessage().
Node* ariba::application::pingpong::PingPong::node [private] |
Definition at line 64 of file PingPong.h.
Referenced by eventFunction(), shutdown(), and startup().
unsigned long ariba::application::pingpong::PingPong::pingId [private] |
Definition at line 73 of file PingPong.h.
Referenced by eventFunction().
ServiceID ariba::application::pingpong::PingPong::PINGPONG_SERVICEID = ServiceID( 111 ) [static, private] |
Definition at line 70 of file PingPong.h.
Referenced by eventFunction(), shutdown(), and startup().