/*! * @file network_stream.h * implementation of a network pipe */ #ifndef _NETWORK_STREAM #define _NETWORK_STREAM #include #include #include "data_stream.h" #include "network_protocol.h" #include "server_socket.h" class Synchronizeable; class NetworkSocket; class ServerSocket; class ConnectionMonitor; class NetworkProtocol; typedef std::list SynchronizeableList; typedef std::vector NetworkSocketVector; class NetworkStream : public DataStream { public: NetworkStream(); NetworkStream(IPaddress& address); NetworkStream(unsigned int port); ~NetworkStream(); void init(); void connectSynchronizeable(Synchronizeable& sync); inline bool isServer() const { return (this->type == NET_SERVER)? true:false; } inline bool isActive() const { return this->bActive; } virtual void processData(); private: NetworkProtocol* networkProtocol; ConnectionMonitor* connectionMonitor; SynchronizeableList synchronizeables; NetworkSocketVector networkSockets; ServerSocket* serverSocket; int type; Header packetHeader; bool bActive; }; #endif /* _NETWORK_STREAM */