ksocks.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _KSOCKS_H_
00019 #define _KSOCKS_H_
00020
00021 #include <qstringlist.h>
00022 #include <ksockaddr.h>
00023 #include <sys/types.h>
00024 #include <sys/time.h>
00025 #include <kstaticdeleter.h>
00026
00027 class KSocksTable;
00028 class KSocksPrivate;
00029 class KLibrary;
00030 class KConfigBase;
00031 struct sockaddr;
00032
00033
00044 class KSocks {
00045 friend class KStaticDeleter<KSocks>;
00046
00047 public:
00048
00054 static KSocks *self();
00055
00060 static bool activated();
00061
00065 void disableSocks();
00066
00070 void enableSocks();
00071
00076 bool usingSocks();
00077
00082 bool hasSocks();
00083
00088 bool hasWorkingAsyncConnect();
00089
00090
00091
00092
00097 int connect (int sockfd, const sockaddr *serv_addr,
00098 ksocklen_t addrlen);
00103 signed long int read (int fd, void *buf, unsigned long int count);
00108 signed long int write (int fd, const void *buf, unsigned long int count);
00113 int recvfrom (int s, void *buf, unsigned long int len, int flags,
00114 sockaddr *from, ksocklen_t *fromlen);
00119 int sendto (int s, const void *msg, unsigned long int len, int flags,
00120 const sockaddr *to, ksocklen_t tolen);
00125 int recv (int s, void *buf, unsigned long int len, int flags);
00130 int send (int s, const void *msg, unsigned long int len, int flags);
00135 int getsockname (int s, sockaddr *name, ksocklen_t *namelen);
00140 int getpeername (int s, sockaddr *name, ksocklen_t *namelen);
00145 int accept (int s, sockaddr *addr, ksocklen_t *addrlen);
00150 int select (int n, fd_set *readfds, fd_set *writefds,
00151 fd_set *exceptfds, struct timeval *timeout);
00156 int listen (int s, int backlog);
00161 int bind (int sockfd, sockaddr *my_addr,
00162 ksocklen_t addrlen);
00163
00169 void die();
00170
00175 static void disable();
00176
00181 static void setConfig(KConfigBase *config);
00182
00183 private:
00184 KSocks(KConfigBase *config);
00185 ~KSocks();
00186
00187 void stopSocks();
00188
00189 static KSocks *_me;
00190 static bool _disabled;
00191 QStringList _libNames;
00192 QStringList _libPaths;
00193 bool _useSocks, _hasSocks;
00194 KLibrary* _socksLib;
00195
00196
00197 KSocksTable *_st;
00198 KSocksPrivate *d;
00199 };
00200
00201
00202
00203
00204 #endif
This file is part of the documentation for kdelibs Version 3.1.5.