ksockssocketdevice.h

00001 /*  -*- C++ -*-
00002  *  Copyright (C) 2004 Thiago Macieira <thiago.macieira@kdemail.net>
00003  *
00004  *  This library is free software; you can redistribute it and/or
00005  *  modify it under the terms of the GNU Library General Public
00006  *  License as published by the Free Software Foundation; either
00007  *  version 2 of the License, or (at your option) any later version.
00008  *
00009  *  This library 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 GNU
00012  *  Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this library; see the file COPYING.LIB.  If not, write to
00016  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KSOCKSSOCKETDEVICE_H
00021 #define KSOCKSSOCKETDEVICE_H
00022 
00023 #include "ksocketdevice.h"
00024 
00025 namespace KNetwork {
00026 
00040 class KDECORE_EXPORT KSocksSocketDevice: public KSocketDevice
00041 {
00042 public:
00046   KSocksSocketDevice(const KSocketBase* = 0L);
00047 
00051   explicit KSocksSocketDevice(int fd);
00052 
00056   virtual ~KSocksSocketDevice();
00057 
00061   virtual int capabilities() const;
00062 
00066   virtual bool bind(const KResolverEntry& address);
00067 
00071   virtual bool listen(int backlog);
00072 
00076   virtual bool connect(const KResolverEntry& address);
00077 
00081   virtual KSocksSocketDevice* accept();
00082 
00086   virtual Q_LONG readBlock(char *data, Q_ULONG maxlen);
00087   virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from);
00088 
00092   virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen);
00093   virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from);
00094 
00098   virtual Q_LONG writeBlock(const char *data, Q_ULONG len);
00099   virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to);
00100 
00104   virtual KSocketAddress localAddress() const;
00105 
00109   virtual KSocketAddress peerAddress() const;
00110 
00114   virtual KSocketAddress externalAddress() const;
00115 
00119   virtual bool poll(bool* input, bool* output, bool* exception = 0L,
00120             int timeout = -1, bool* timedout = 0L);
00121 
00122 private:
00123   static void initSocks();
00124   friend class KSocketDevice;
00125 };
00126 
00127 }               // namespace KNetwork
00128 
00129 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys