summaryrefslogtreecommitdiffstats
path: root/kdecore/network/ksockssocketdevice.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdecore/network/ksockssocketdevice.h
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/network/ksockssocketdevice.h')
-rw-r--r--kdecore/network/ksockssocketdevice.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/kdecore/network/ksockssocketdevice.h b/kdecore/network/ksockssocketdevice.h
new file mode 100644
index 000000000..62de23f05
--- /dev/null
+++ b/kdecore/network/ksockssocketdevice.h
@@ -0,0 +1,129 @@
+/* -*- C++ -*-
+ * Copyright (C) 2004 Thiago Macieira <thiago.macieira@kdemail.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KSOCKSSOCKETDEVICE_H
+#define KSOCKSSOCKETDEVICE_H
+
+#include "ksocketdevice.h"
+
+namespace KNetwork {
+
+/**
+ * @class KSocksSocketDevice ksockssocketdevice.h ksockssocketdevice.h
+ * @brief The low-level class for SOCKS proxying.
+ *
+ * This class reimplements several functions from @ref KSocketDevice in order
+ * to implement SOCKS support.
+ *
+ * This works by using KSocks.
+ *
+ * @author Thiago Macieira <thiago.macieira@kdemail.net>
+ *
+ * @warning This code is untested!
+ */
+class KDECORE_EXPORT KSocksSocketDevice: public KSocketDevice
+{
+public:
+ /**
+ * Constructor.
+ */
+ KSocksSocketDevice(const KSocketBase* = 0L);
+
+ /**
+ * Construct from a file descriptor.
+ */
+ explicit KSocksSocketDevice(int fd);
+
+ /**
+ * Destructor.
+ */
+ virtual ~KSocksSocketDevice();
+
+ /**
+ * Sets our capabilities.
+ */
+ virtual int capabilities() const;
+
+ /**
+ * Overrides binding.
+ */
+ virtual bool bind(const KResolverEntry& address);
+
+ /**
+ * Overrides listening.
+ */
+ virtual bool listen(int backlog);
+
+ /**
+ * Overrides connection.
+ */
+ virtual bool connect(const KResolverEntry& address);
+
+ /**
+ * Overrides accepting. The return type is specialised.
+ */
+ virtual KSocksSocketDevice* accept();
+
+ /**
+ * Overrides reading.
+ */
+ virtual Q_LONG readBlock(char *data, Q_ULONG maxlen);
+ virtual Q_LONG readBlock(char *data, Q_ULONG maxlen, KSocketAddress& from);
+
+ /**
+ * Overrides peeking.
+ */
+ virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen);
+ virtual Q_LONG peekBlock(char *data, Q_ULONG maxlen, KSocketAddress& from);
+
+ /**
+ * Overrides writing.
+ */
+ virtual Q_LONG writeBlock(const char *data, Q_ULONG len);
+ virtual Q_LONG writeBlock(const char *data, Q_ULONG len, const KSocketAddress& to);
+
+ /**
+ * Overrides getting socket address.
+ */
+ virtual KSocketAddress localAddress() const;
+
+ /**
+ * Overrides getting peer address.
+ */
+ virtual KSocketAddress peerAddress() const;
+
+ /**
+ * Overrides getting external address.
+ */
+ virtual KSocketAddress externalAddress() const;
+
+ /**
+ * Overrides polling.
+ */
+ virtual bool poll(bool* input, bool* output, bool* exception = 0L,
+ int timeout = -1, bool* timedout = 0L);
+
+private:
+ static void initSocks();
+ friend class KSocketDevice;
+};
+
+} // namespace KNetwork
+
+#endif