barrier/lib/synergy/CInputPacketStream.h
crs fee4095624 Reorganized source tree. Moved client.cpp into cmd/synergy as
synergy.cpp and server.cpp into cmd/synergyd as synergyd.cpp.
Moved and renamed related files.  Moved remaining source files
into lib/....  Modified and added makefiles as appropriate.
Result is that library files are under lib with each library
in its own directory and program files are under cmd with each
command in its own directory.
2002-07-30 16:52:46 +00:00

38 lines
876 B
C++

#ifndef CINPUTPACKETSTREAM_H
#define CINPUTPACKETSTREAM_H
#include "CInputStreamFilter.h"
#include "CBufferedInputStream.h"
#include "CMutex.h"
//! Packetizing input stream filter
/*!
Filters an input stream to extract packet by packet.
*/
class CInputPacketStream : public CInputStreamFilter {
public:
CInputPacketStream(IInputStream*, bool adoptStream = true);
~CInputPacketStream();
// IInputStream overrides
virtual void close();
virtual UInt32 read(void*, UInt32 maxCount, double timeout);
virtual UInt32 getSize() const;
private:
enum EResult { kData, kHungup, kTimedout };
UInt32 getSizeNoLock() const;
EResult waitForFullMessage(double timeout) const;
EResult getMoreMessage(double timeout) const;
bool hasFullMessage() const;
private:
CMutex m_mutex;
mutable UInt32 m_size;
mutable CBufferedInputStream m_buffer;
};
#endif