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

IArchNetwork.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2002 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 IARCHNETWORK_H
00016 #define IARCHNETWORK_H
00017 
00018 #include "IInterface.h"
00019 #include "stdstring.h"
00020 
00021 class CArchThreadImpl;
00022 typedef CArchThreadImpl* CArchThread;
00023 
00029 class CArchSocketImpl;
00030 
00036 typedef CArchSocketImpl* CArchSocket;
00037 
00044 class CArchNetAddressImpl;
00045 
00051 typedef CArchNetAddressImpl* CArchNetAddress;
00052 
00054 
00058 class IArchNetwork : public IInterface {
00059 public:
00061     enum EAddressFamily {
00062         kUNKNOWN,
00063         kINET,
00064     };
00065 
00067     enum ESocketType {
00068         kDGRAM,
00069         kSTREAM
00070     };
00071 
00073 
00077     enum {
00078         kPOLLIN   = 1,      
00079         kPOLLOUT  = 2,      
00080         kPOLLERR  = 4,      
00081         kPOLLNVAL = 8       
00082     };
00083 
00085     class CPollEntry {
00086     public:
00088         CArchSocket     m_socket;
00089 
00091 
00095         unsigned short  m_events;
00096 
00098         unsigned short  m_revents;
00099     };
00100 
00102 
00103 
00105 
00108     virtual CArchSocket newSocket(EAddressFamily, ESocketType) = 0;
00109 
00111 
00114     virtual CArchSocket copySocket(CArchSocket s) = 0;
00115 
00117 
00122     virtual void        closeSocket(CArchSocket s) = 0;
00123 
00125 
00128     virtual void        closeSocketForRead(CArchSocket s) = 0;
00129 
00131 
00134     virtual void        closeSocketForWrite(CArchSocket s) = 0;
00135 
00137 
00140     virtual void        bindSocket(CArchSocket s, CArchNetAddress addr) = 0;
00141 
00143 
00146     virtual void        listenOnSocket(CArchSocket s) = 0;
00147 
00149 
00158     virtual CArchSocket acceptSocket(CArchSocket s, CArchNetAddress* addr) = 0;
00159 
00161 
00169     virtual bool        connectSocket(CArchSocket s, CArchNetAddress addr) = 0;
00170 
00172 
00186     virtual int         pollSocket(CPollEntry[], int num, double timeout) = 0;
00187 
00189 
00194     virtual void        unblockPollSocket(CArchThread thread) = 0;
00195 
00197 
00203     virtual size_t      readSocket(CArchSocket s, void* buf, size_t len) = 0;
00204 
00206 
00212     virtual size_t      writeSocket(CArchSocket s,
00213                             const void* buf, size_t len) = 0;
00214 
00216 
00220     virtual void        throwErrorOnSocket(CArchSocket s) = 0;
00221 
00223 
00227     virtual bool        setNoDelayOnSocket(CArchSocket, bool noDelay) = 0;
00228 
00230 
00234     virtual bool        setReuseAddrOnSocket(CArchSocket, bool reuse) = 0;
00235 
00237     virtual std::string     getHostName() = 0;
00238 
00240     virtual CArchNetAddress newAnyAddr(EAddressFamily) = 0;
00241 
00243     virtual CArchNetAddress copyAddr(CArchNetAddress) = 0;
00244 
00246     virtual CArchNetAddress nameToAddr(const std::string&) = 0;
00247 
00249     virtual void            closeAddr(CArchNetAddress) = 0;
00250 
00252     virtual std::string     addrToName(CArchNetAddress) = 0;
00253 
00255     virtual std::string     addrToString(CArchNetAddress) = 0;
00256 
00258     virtual EAddressFamily  getAddrFamily(CArchNetAddress) = 0;
00259 
00261     virtual void            setAddrPort(CArchNetAddress, int port) = 0;
00262 
00264     virtual int             getAddrPort(CArchNetAddress) = 0;
00265 
00267     virtual bool            isEqualAddr(CArchNetAddress, CArchNetAddress) = 0;
00268 
00270 
00274     virtual bool            isAnyAddr(CArchNetAddress addr) = 0;
00275 
00277 };
00278 
00279 #endif

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