IDataSocket.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 IDATASOCKET_H
00016 #define IDATASOCKET_H
00017 
00018 #include "ISocket.h"
00019 #include "IStream.h"
00020 
00022 
00026 class IDataSocket : public ISocket, public IStream {
00027 public:
00028     class CConnectionFailedInfo {
00029     public:
00030         // pointer to a string describing the failure
00031         char            m_what[1];
00032     };
00033 
00035 
00036 
00038 
00044     virtual void        connect(const CNetworkAddress&) = 0;
00045 
00047 
00048 
00049 
00051 
00055     static CEvent::Type getConnectedEvent();
00056 
00058 
00063     static CEvent::Type getConnectionFailedEvent();
00064 
00066 
00067     // ISocket overrides
00068     // close() and getEventTarget() aren't pure to work around a bug
00069     // in VC++6.  it claims the methods are unused locals and warns
00070     // that it's removing them.  it's presumably tickled by inheriting
00071     // methods with identical signatures from both superclasses.
00072     virtual void        bind(const CNetworkAddress&) = 0;
00073     virtual void        close();
00074     virtual void*       getEventTarget() const;
00075 
00076     // IStream overrides
00077     virtual UInt32      read(void* buffer, UInt32 n) = 0;
00078     virtual void        write(const void* buffer, UInt32 n) = 0;
00079     virtual void        flush() = 0;
00080     virtual void        shutdownInput() = 0;
00081     virtual void        shutdownOutput() = 0;
00082     virtual bool        isReady() const = 0;
00083     virtual UInt32      getSize() const = 0;
00084 
00085 private:
00086     static CEvent::Type s_connectedEvent;
00087     static CEvent::Type s_failedEvent;
00088 };
00089 
00090 #endif

Generated on Fri Nov 6 00:18:46 2009 for synergy-plus by  doxygen 1.4.7