Index: sample/pingpong/PingPong.h
===================================================================
--- sample/pingpong/PingPong.h	(revision 12775)
+++ sample/pingpong/PingPong.h	(revision 2378)
@@ -2,77 +2,99 @@
 #define __PINGPONG_H_
 
-#include "ariba/ariba.h"
+#include <map>
+#include <iostream>
+#include <vector>
+#include "ariba/utility/types.h"
+#include "ariba/utility/system/Timer.h"
+#include "ariba/utility/misc/Helper.h"
+#include "ariba/utility/messages.h"
+#include "ariba/utility/measurement/PathloadMeasurement.h"
+#include "ariba/utility/configuration/Configuration.h"
+#include "ariba/utility/logging/Logging.h"
+#include "ariba/utility/measurement/PathloadMeasurement.h"
+#include "ariba/utility/system/StartupInterface.h"
+#include "ariba/interface/UnderlayAbstraction.h"
+#include "ariba/interface/AribaContext.h"
+#include "ariba/interface/ServiceInterface.h"
 #include "PingPongMessage.h"
-#include "ariba/utility/system/StartupInterface.h"
-#include "ariba/utility/system/Timer.h"
 
-#include <vector>
-
-using namespace ariba;
+using std::vector;
+using std::map;
+using std::cout;
+using ariba::application::pingpong::PingPongMessage;
+using ariba::interface::ServiceInterface;
+using ariba::interface::UnderlayAbstraction;
+using ariba::interface::AribaContext;
+using ariba::utility::NodeID;
+using ariba::utility::LinkID;
 using ariba::utility::StartupInterface;
 using ariba::utility::Timer;
+using ariba::utility::Configuration;
+using ariba::utility::NodeID;
+using ariba::utility::Identifier;
+using ariba::utility::ServiceID;
+using ariba::utility::PathloadMeasurement;
+using ariba::utility::PathloadMeasurementListener;
 
 namespace ariba {
-namespace application {
+namespace appplication {
 namespace pingpong {
 
-using namespace std;
-
 /**
- * The PingPong main class
- * This class implements an example service for demonstration purposes
- * The pingpong class sends and receives messages between two SpoVNet
- * instances
- */
-class PingPong: public NodeListener,
-	public CommunicationListener,
+/* The PingPong main class
+/* This class implements an example service for demonstration purposes
+/* The pingpong class sends and receives messages between two SpoVNet
+/* instances
+**/
+class PingPong :
+	public ServiceInterface,
 	public StartupInterface,
-	public Timer {
+	public Timer,
+	public PathloadMeasurementListener {
 
 	use_logging_h(PingPong);
 
 public:
-	PingPong( string config );
+	PingPong();
 	virtual ~PingPong();
+	void setMode( bool startingNode );
+
+
+	virtual void onOverlayCreate( const SpoVNetID& id );
+	virtual void onOverlayDestroy( const SpoVNetID& id );
+	virtual bool isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeJoin( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid );
+	virtual void onJoinSuccess( const SpoVNetID& spovnetid );
+	virtual void onJoinFail( const SpoVNetID& spovnetid );
+	virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkChanged( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkFail(const LinkID& id, const NodeID& local, const NodeID& remote);
+	virtual void onLinkQoSChanged(const LinkID& id, const NodeID& local, const NodeID& remote , const QoSParameterSet& qos);
+
+	virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node );
 
 protected:
-	// communication listener interface
-	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);
-
-	// node listener interface
-	virtual void onJoinCompleted(const SpoVNetID& vid);
-	virtual void onJoinFailed(const SpoVNetID& vid);
-	virtual void onLeaveCompleted(const SpoVNetID& vid);
-	virtual void onLeaveFailed(const SpoVNetID& vid);
-
-	// startup wrapper interface
 	virtual void startup();
 	virtual void shutdown();
 
-	// timer events
-	virtual void eventFunction();
+	virtual void eventFunction(); // timer event function
+	virtual void onMeasurement(NodeID node, double mbps); // measurement event function
 
 private:
-	Node node;
-	string name;
-	int counter;
-	vector<string> names;
-
-	// the ping pong service id
-	static ServiceID PINGPONG_SERVICEID;
-
-	// the current ping id
-	unsigned long pingId;
-
-	string config_file;
+	bool startping;
+	UnderlayAbstraction* abstraction;
+	AribaContext* context;
+	BaseOverlay* overlay;
+	static ServiceID PINGPONG_ID;
+	unsigned long pingid;
+	typedef map<NodeID, LinkID> RemoteNodes;
+	RemoteNodes remoteNodes;
 };
 
-}}} // namespace ariba, application, pingpong
+ARIBA_SIMULATION_SERVICE(PingPong);
+
+}}} // namespace ariba, appplication, pingpong
 
 #endif // __PINGPONG_H_
