close Warning: Can't use blame annotator:
No changeset 2312 in the repository

source: sample/pingpong/PingPong.h@ 5785

Last change on this file since 5785 was 5316, checked in by Christoph Mayer, 15 years ago

merge from bootstrap branch

File size: 2.0 KB
RevLine 
1#ifndef __PINGPONG_H_
2#define __PINGPONG_H_
3
4#include "ariba/ariba.h"
5#include "PingPongMessage.h"
6#include "ariba/utility/system/StartupInterface.h"
7#include "ariba/utility/system/Timer.h"
8
9#include <vector>
10
11using namespace ariba;
12using ariba::utility::StartupInterface;
13using ariba::utility::Timer;
14
15namespace ariba {
16namespace application {
17namespace pingpong {
18
19using namespace std;
20
21/**
22 /* The PingPong main class
23 /* This class implements an example service for demonstration purposes
24 /* The pingpong class sends and receives messages between two SpoVNet
25 /* instances
26 **/
27class PingPong: public NodeListener,
28 public CommunicationListener,
29 public StartupInterface,
30 public Timer {
31
32 use_logging_h(PingPong);
33
34public:
35 PingPong();
36 virtual ~PingPong();
37
38protected:
39 // communication listener interface
40 virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg =
41 DataMessage::UNSPECIFIED);
42 virtual void onMessage(const DataMessage& msg, const NodeID& remote,
43 const LinkID& lnk = LinkID::UNSPECIFIED);
44 virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
45 virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
46 virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
47 virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
48
49 // node listener interface
50 virtual void onJoinCompleted(const SpoVNetID& vid);
51 virtual void onJoinFailed(const SpoVNetID& vid);
52 virtual void onLeaveCompleted(const SpoVNetID& vid);
53 virtual void onLeaveFailed(const SpoVNetID& vid);
54
55 // startup wrapper interface
56 virtual void startup();
57 virtual void shutdown();
58
59 // timer events
60 virtual void eventFunction();
61
62private:
63 // the ariba module and a node
64 AribaModule* ariba;
65 Node* node;
66 string name;
67 int counter;
68 vector<string> names;
69
70 // the ping pong service id
71 static ServiceID PINGPONG_SERVICEID;
72
73 // the current ping id
74 unsigned long pingId;
75
76};
77
78// needed for simulation support
79ARIBA_SIMULATION_SERVICE(PingPong);
80
81}}} // namespace ariba, application, pingpong
82
83#endif // __PINGPONG_H_
Note: See TracBrowser for help on using the repository browser.