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

source: sample/pingpong/PingPong.h@ 2482

Last change on this file since 2482 was 2473, checked in by Christoph Mayer, 16 years ago

-einige fixes im ablauf des neuen interface
-einige fehlende funktionalität implementiert

File size: 1.6 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
9using namespace ariba;
10using ariba::utility::StartupInterface;
11using ariba::utility::Timer;
12
13namespace ariba {
14namespace application {
15namespace pingpong {
16
17/**
18/* The PingPong main class
19/* This class implements an example service for demonstration purposes
20/* The pingpong class sends and receives messages between two SpoVNet
21/* instances
22**/
23class PingPong :
24 public NodeListener,
25 public CommunicationListener,
26 public StartupInterface,
27 public Timer {
28
29 use_logging_h(PingPong);
30
31public:
32 PingPong();
33 virtual ~PingPong();
34
35protected:
36 // communication listener interface
37 virtual bool onLinkRequest(const NodeID& remote, Message* msg);
38 virtual void onMessage(Message* msg, const NodeID& remote, const LinkID& lnk);
39
40 // node listener interface
41 virtual void onJoinCompleted( const SpoVNetID& vid );
42 virtual void onJoinFailed( const SpoVNetID& vid );
43
44 // startup wrapper interface
45 virtual void startup();
46 virtual void shutdown();
47
48 // timer events
49 virtual void eventFunction();
50
51private:
52 // the ariba module and a node
53 AribaModule* ariba;
54 Node* node;
55
56 // flag, wheter this node initiates or just joins the spovnet
57 bool isInitiator;
58
59 // the ping pong service id
60 static ServiceID PINGPONG_ID;
61
62 // the current ping id
63 unsigned long pingId;
64};
65
66// needed for simulation support
67ARIBA_SIMULATION_SERVICE(PingPong);
68
69}}} // namespace ariba, application, pingpong
70
71#endif // __PINGPONG_H_
Note: See TracBrowser for help on using the repository browser.