Started experimenting with perl/python scripts to auto rename incl guards etc.
[aesalon.git] / include / vcomm / NetworkSink.h
blob8a23869f982b8278524d3b9b8d68a3c9be7f8a7e
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/vcomm/NetworkSink.h
12 #ifndef AesalonVComm_NetworkSink_H
13 #define AesalonVComm_NetworkSink_H
15 #include <vector>
17 #include <semaphore.h>
19 #include "DataSink.h"
21 namespace VComm {
23 class NetworkSink : public DataSink {
24 private:
25 sem_t m_accessLock;
26 int m_serverFd;
27 int m_sockType;
29 typedef std::vector<int> ClientFdList;
30 ClientFdList m_clientFds;
31 public:
32 NetworkSink();
33 ~NetworkSink();
35 /** Sink a packet across a network socket.
37 virtual void sinkPacket(Common::VPacket *packet);
38 private:
39 void openSocket();
40 void closeSocket();
41 void waitForConnections(int connectionCount);
43 void sendPacket(Common::VPacket *packet, int fd);
46 } // namespace VComm
48 #endif