00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef SERVERVIS_H__
00040 #define SERVERVIS_H__
00041
00042 #include <string>
00043 #include <sstream>
00044 #include <boost/utility.hpp>
00045 #include <boost/asio.hpp>
00046 #include "ariba/utility/logging/Logging.h"
00047 #include "ariba/utility/types/NodeID.h"
00048
00049 using ariba::utility::NodeID;
00050 using std::ostringstream;
00051 using std::string;
00052 using boost::asio::ip::tcp;
00053
00054 namespace ariba {
00055 namespace utility {
00056
00057 class ServerVis {
00058 use_logging_h(ServerVis);
00059 public:
00060 void configure(string ip, unsigned int port, unsigned int _color = 0);
00061 static unsigned int nodecolor;
00062
00063 typedef enum _NETWORK_ID {
00064 NETWORK_ID_BASE_COMMUNICATION = 1,
00065 NETWORK_ID_BASE_OVERLAY = 2,
00066 NETWORK_ID_EONSON = 3,
00067 NETWORK_ID_MCPO = 4,
00068 NETWORK_ID_CLIO = 5,
00069 NETWORK_ID_VIDEOSTREAM = 6,
00070 NETWORK_ID_GAME = 7,
00071 NETWORK_ID_SECURITY = 8,
00072 } NETWORK_ID;
00073
00074
00075 string getNetworkName(NETWORK_ID network) const;
00076
00078 virtual void visCreate (NETWORK_ID network, NodeID& node, string nodename, string info) = 0;
00079
00081 virtual void visShutdown (NETWORK_ID network, NodeID& node, string info) = 0;
00082
00084 virtual void visConnect (NETWORK_ID network, NodeID& srcnode, NodeID& destnode, string info) = 0;
00085
00087 virtual void visDisconnect (NETWORK_ID network, NodeID& srcnode, NodeID& destnode, string info) = 0;
00088
00090 typedef enum _NODE_COLORS {
00091 NODE_COLORS_GREY,
00092 NODE_COLORS_GREEN,
00093 NODE_COLORS_RED,
00094 } NODE_COLORS;
00095
00097 virtual void visChangeNodeColor (NETWORK_ID network, NodeID& node, unsigned char r, unsigned char g, unsigned char b) = 0;
00098
00100 virtual void visChangeNodeColor (NETWORK_ID network, NodeID& node, NODE_COLORS color) = 0;
00101
00103 virtual void visChangeLinkColor (NETWORK_ID network, NodeID& srcnode, NodeID& destnode, unsigned char r, unsigned char g, unsigned char b) = 0;
00104
00106 virtual void visChangeLinkColor (NETWORK_ID network, NodeID& srcnode, NodeID& destnode, NODE_COLORS color) = 0;
00107
00109 virtual void visShowNodeLabel (NETWORK_ID network, NodeID& node, string label) = 0;
00110
00111 protected:
00112 ServerVis();
00113 virtual ~ServerVis();
00114 void sendSocket( const string& msg );
00115
00116 private:
00117 boost::asio::io_service io_service;
00118 tcp::socket socket;
00119 volatile bool socketOpened;
00120 };
00121
00122 }}
00123
00124 #endif // SERVERVIS_H__