source: sample/pingpong/PingPong.h@ 12060

Last change on this file since 12060 was 12060, checked in by hock@…, 11 years ago

Reintegrate branch: 20130111-hock-message_classes

improvements:

  • new message classes (reboost, zero-copy)
  • "fast path" for direct links (skip overlay layer)
  • link-properties accessible from the application
  • SystemQueue can call boost::bind functions
  • protlib compatibility removed (32bit overhead saved in every message)
  • addressing2
  • AddressDiscovery discoveres only addresses on which we're actually listening
  • ariba serialization usage reduced (sill used in OverlayMsg)
  • Node::connect, easier and cleaner interface to start-up ariba from the application
  • ariba configs via JSON, XML, etc (boost::property_tree)
  • keep-alive overhead greatly reduced
  • (relayed) overlay links can actually be closed now
  • lost messages are detected in most cases
  • notification to the application when link is transformed into direct-link
  • overlay routing: send message to second best hop if it would be dropped otherwise
  • SequenceNumbers (only mechanisms, so for: upward compatibility)
  • various small fixes


regressions:

  • bluetooth is not yet working again
  • bootstrap modules deactivated
  • liblog4xx is not working (use cout-logging)

This patch brings great performance and stability improvements at cost of backward compatibility.
Also bluetooth and the bootstrap modules have not been ported to the new interfaces, yet.

File size: 2.0 KB
Line 
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( string config );
36 virtual ~PingPong();
37
38protected:
39 // communication listener interface
40 virtual bool onLinkRequest(const NodeID& remote);
41 virtual void onMessage(const DataMessage& msg, const NodeID& remote,
42 const LinkID& lnk = LinkID::UNSPECIFIED);
43 virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
44 virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
45 virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
46 virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
47
48 // node listener interface
49 virtual void onJoinCompleted(const SpoVNetID& vid);
50 virtual void onJoinFailed(const SpoVNetID& vid);
51 virtual void onLeaveCompleted(const SpoVNetID& vid);
52 virtual void onLeaveFailed(const SpoVNetID& vid);
53
54 // startup wrapper interface
55 virtual void startup();
56 virtual void shutdown();
57
58 // timer events
59 virtual void eventFunction();
60
61private:
62 // the ariba module and a node
63// AribaModule* ariba;
64 Node node;
65 string name;
66 int counter;
67 vector<string> names;
68
69 // the ping pong service id
70 static ServiceID PINGPONG_SERVICEID;
71
72 // the current ping id
73 unsigned long pingId;
74
75 string config_file;
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.