Began refactoring the entire source tree.
[aesalon.git] / include / monitor / vcommunication / NetworkSink.h
blob17e5ec78153ca049f73be7541239ade48c704890
1 /**
2 Aesalon, a tool to visualize a program's behaviour at run-time.
3 Copyright (C) 2010, Aesalon Development Team.
5 Aesalon is distributed under the terms of the GNU GPLv3. For more
6 licensing information, see the file LICENSE included with the distribution.
8 @file include/monitor/vcommunication/NetworkSink.h
12 #ifndef AesalonMonitor_VCommunication_NetworkSink_H
13 #define AesalonMonitor_VCommunication_NetworkSink_H
15 #include <vector>
17 #include <semaphore.h>
19 #include "DataSink.h"
21 namespace Monitor {
22 namespace VCommunication {
24 class NetworkSink : public DataSink {
25 private:
26 sem_t m_accessLock;
27 int m_serverFd;
28 int m_sockType;
30 typedef std::vector<int> ClientFdList;
31 ClientFdList m_clientFds;
32 public:
33 NetworkSink();
34 ~NetworkSink();
36 /** Sink a packet across a network socket.
38 virtual void sinkPacket(Common::VPacket *packet);
39 private:
40 void openSocket();
41 void closeSocket();
42 void waitForConnections(int connectionCount);
44 void sendPacket(Common::VPacket *packet, int fd);
47 } // namespace VCommunication
48 } // namespace Monitor
50 #endif