Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

CPacketStreamFilter.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2004 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #ifndef CPACKETSTREAMFILTER_H
00016 #define CPACKETSTREAMFILTER_H
00017 
00018 #include "CStreamFilter.h"
00019 #include "CStreamBuffer.h"
00020 #include "CMutex.h"
00021 
00023 
00026 class CPacketStreamFilter : public CStreamFilter {
00027 public:
00028     CPacketStreamFilter(IStream* stream, bool adoptStream = true);
00029     ~CPacketStreamFilter();
00030 
00031     // IStream overrides
00032     virtual void        close();
00033     virtual UInt32      read(void* buffer, UInt32 n);
00034     virtual void        write(const void* buffer, UInt32 n);
00035     virtual void        shutdownInput();
00036     virtual bool        isReady() const;
00037     virtual UInt32      getSize() const;
00038 
00039 protected:
00040     // CStreamFilter overrides
00041     virtual void        filterEvent(const CEvent&);
00042 
00043 private:
00044     bool                isReadyNoLock() const;
00045     void                readPacketSize();
00046     bool                readMore();
00047 
00048 private:
00049     CMutex              m_mutex;
00050     UInt32              m_size;
00051     CStreamBuffer       m_buffer;
00052     bool                m_inputShutdown;
00053 };
00054 
00055 #endif

Generated on Fri Nov 6 00:21:14 2009 for synergy-plus by  doxygen 1.3.9.1