1 ////////////////////////////////////////////////////////////////////////////////
3 // Author: Artur Szostak
4 // Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
6 ////////////////////////////////////////////////////////////////////////////////
8 #ifndef dHLT_BCMP_EVENT_HANDLER_HPP
9 #define dHLT_BCMP_EVENT_HANDLER_HPP
11 #include "BCMP/EventQueue.hpp"
27 /* Called whenever a new sender or receiver has connected.
29 virtual void OnConnect(const System::Address& address) {};
31 /* Called whenever a sender or receiver has disconnected.
33 virtual void OnDisconnect(const System::Address& address) {};
35 /* Called whenever a connection timed out and was lost.
37 virtual void OnConnectionLost(const System::Address& address) {};
39 /* Called when a message has been received.
41 virtual void OnMessage(
42 const char* message, const UInt length,
43 const System::Address& from
46 /* Called when a protocol error message has been received.
47 The default behaviour is to write the message to standard output.
50 const char* message, const Int errorcode,
51 const System::Address& from
54 cerr << "Error: [" << errorcode << "] from " << from << endl;
55 cerr << " " << message << endl;
63 #endif // dHLT_BCMP_EVENT_HANDLER_HPP