• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
ksocks.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2001 George Staikos <staikos@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18#ifndef _KSOCKS_H_
19#define _KSOCKS_H_
20
21#include <tqstringlist.h>
22#include <sys/types.h>
23#include <sys/time.h>
24#include <kstaticdeleter.h>
25#include <tdelibs_export.h>
26
27#ifdef Q_OS_UNIX
28
29class KSocksTable;
30class KSocksPrivate;
31class KLibrary;
32class TDEConfigBase;
33struct sockaddr;
34
35typedef unsigned ksocklen_t;
36
37
48class TDECORE_EXPORT KSocks {
49 friend class KStaticDeleter<KSocks>;
50
51public:
52
58 static KSocks *self();
59
64 static bool activated();
65
69 void disableSocks();
70
74 void enableSocks();
75
80 bool usingSocks();
81
86 bool hasSocks();
87
92 bool hasWorkingAsyncConnect();
93
94 /*
95 ** REIMPLEMENTATIONS OF LIBC SOCKET FUNCTIONS
96 **/
101 int connect (int sockfd, const sockaddr *serv_addr,
102 ksocklen_t addrlen);
107 signed long int read (int fd, void *buf, unsigned long int count);
112 signed long int write (int fd, const void *buf, unsigned long int count);
117 int recvfrom (int s, void *buf, unsigned long int len, int flags,
118 sockaddr *from, ksocklen_t *fromlen);
123 int sendto (int s, const void *msg, unsigned long int len, int flags,
124 const sockaddr *to, ksocklen_t tolen);
129 int recv (int s, void *buf, unsigned long int len, int flags);
134 int send (int s, const void *msg, unsigned long int len, int flags);
139 int getsockname (int s, sockaddr *name, ksocklen_t *namelen);
144 int getpeername (int s, sockaddr *name, ksocklen_t *namelen);
149 int accept (int s, sockaddr *addr, ksocklen_t *addrlen);
154 int select (int n, fd_set *readfds, fd_set *writefds,
155 fd_set *exceptfds, struct timeval *timeout);
160 int listen (int s, int backlog);
161
166 int bind (int sockfd, sockaddr *my_addr,
167 ksocklen_t addrlen);
168 int bind (int sockfd, const sockaddr *my_addr,
169 ksocklen_t addrlen);
170
176 void die();
177
182 static void disable();
183
188 static void setConfig(TDEConfigBase *config);
189
190private:
191 KSocks(TDEConfigBase *config);
192 ~KSocks();
193
194 void stopSocks();
195
196 static KSocks *_me;
197 static bool _disabled;
198 TQStringList _libNames;
199 TQStringList _libPaths;
200 bool _useSocks, _hasSocks;
201 KLibrary* _socksLib;
202
203
204 KSocksTable *_st;
205 KSocksPrivate *d;
206};
207
208#endif //Q_OS_UNIX
209
210#endif //_KSOCKS_H_
KLibrary
Represents a dynamically loaded library.
Definition klibloader.h:51
KSocks::getpeername
int getpeername(int s, sockaddr *name, ksocklen_t *namelen)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:548
KSocks::write
signed long int write(int fd, const void *buf, unsigned long int count)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:494
KSocks::self
static KSocks * self()
Return an instance of class KSocks *.
Definition ksocks.cpp:212
KSocks::listen
int listen(int s, int backlog)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:580
KSocks::recvfrom
int recvfrom(int s, void *buf, unsigned long int len, int flags, sockaddr *from, ksocklen_t *fromlen)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:501
KSocks::getsockname
int getsockname(int s, sockaddr *name, ksocklen_t *namelen)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:536
KSocks::die
void die()
If you're using this, you're probably doing something wrong.
Definition ksocks.cpp:425
KSocks::hasWorkingAsyncConnect
bool hasWorkingAsyncConnect()
Returns whether asynchronous connects work with the selected SOCKS impementation.
Definition ksocks.cpp:468
KSocks::setConfig
static void setConfig(TDEConfigBase *config)
Set this before the first call to KSocks::self() and it will use config to read its configuration fro...
Definition ksocks.cpp:226
KSocks::sendto
int sendto(int s, const void *msg, unsigned long int len, int flags, const sockaddr *to, ksocklen_t tolen)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:514
KSocks::read
signed long int read(int fd, void *buf, unsigned long int count)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:487
KSocks::disableSocks
void disableSocks()
Disable the use of SOCKS immediately.
Definition ksocks.cpp:458
KSocks::enableSocks
void enableSocks()
Enable the use of SOCKS immediately if hasSocks() is true.
Definition ksocks.cpp:463
KSocks::recv
int recv(int s, void *buf, unsigned long int len, int flags)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:522
KSocks::send
int send(int s, const void *msg, unsigned long int len, int flags)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:529
KSocks::hasSocks
bool hasSocks()
Checks whether SOCKS is available for use.
Definition ksocks.cpp:453
KSocks::bind
int bind(int sockfd, sockaddr *my_addr, ksocklen_t addrlen)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:593
KSocks::select
int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:572
KSocks::disable
static void disable()
Set this before the first call to KSocks::self() and it will fail to initialize SOCKS.
Definition ksocks.cpp:206
KSocks::accept
int accept(int s, sockaddr *addr, ksocklen_t *addrlen)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:560
KSocks::connect
int connect(int sockfd, const sockaddr *serv_addr, ksocklen_t addrlen)
This is the re-implementation of libc's function of the same name.
Definition ksocks.cpp:479
KSocks::activated
static bool activated()
Checks whether KSocks has been started (ie someone called self()).
Definition ksocks.cpp:239
KSocks::usingSocks
bool usingSocks()
Checks whether SOCKS is currently being used.
Definition ksocks.cpp:448
KStaticDeleter
Little helper class to clean up static objects that are held as pointer.
Definition kstaticdeleter.h:74
TDEConfigBase
KDE Configuration Management abstract base class.
Definition tdeconfigbase.h:71

tdecore

Skip menu "tdecore"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.15.0
This website is maintained by Timothy Pearson.