KDECore
k3socks.h
Go to the documentation of this file.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 #if defined(I_KNOW_KSOCKS_ISNT_PUBLIC)
00022
00023
00024 #include <kdecore_export.h>
00025
00026 #include <QtCore/QStringList>
00027 #include <sys/types.h>
00028 #include <sys/socket.h>
00029 #include <sys/time.h>
00030 #include <unistd.h>
00031
00032 #ifdef Q_OS_UNIX
00033
00034 class KConfigGroup;
00035 struct sockaddr;
00036
00037 #ifdef __CYGWIN__
00038 typedef unsigned ksocklen_t;
00039 #endif
00040
00051 class KDECORE_EXPORT KSocks {
00052 public:
00053
00059 static KSocks *self();
00060
00065 static bool activated();
00066
00070 void disableSocks();
00071
00075 void enableSocks();
00076
00081 bool usingSocks();
00082
00087 bool hasSocks();
00088
00093 bool hasWorkingAsyncConnect();
00094
00095
00096
00097
00102 int connect (int sockfd, const sockaddr *serv_addr,
00103 kde_socklen_t addrlen);
00108 signed long int read (int fd, void *buf, unsigned long int count);
00113 signed long int write (int fd, const void *buf, unsigned long int count);
00118 int recvfrom (int s, void *buf, unsigned long int len, int flags,
00119 sockaddr *from, kde_socklen_t *fromlen);
00124 int sendto (int s, const void *msg, unsigned long int len, int flags,
00125 const sockaddr *to, kde_socklen_t tolen);
00130 int recv (int s, void *buf, unsigned long int len, int flags);
00135 int send (int s, const void *msg, unsigned long int len, int flags);
00140 int getsockname (int s, sockaddr *name, kde_socklen_t *namelen);
00145 int getpeername (int s, sockaddr *name, kde_socklen_t *namelen);
00150 int accept (int s, sockaddr *addr, kde_socklen_t *addrlen);
00155 int select (int n, fd_set *readfds, fd_set *writefds,
00156 fd_set *exceptfds, struct timeval *timeout);
00161 int listen (int s, int backlog);
00162
00167 int bind (int sockfd, sockaddr *my_addr,
00168 kde_socklen_t addrlen);
00169 int bind (int sockfd, const sockaddr *my_addr,
00170 kde_socklen_t addrlen);
00171
00177 void die();
00178
00183 static void disable();
00184
00189 static void setConfig(const KConfigGroup *config);
00190
00191 private:
00192 explicit KSocks(const KConfigGroup *config);
00193 ~KSocks();
00194
00195 void stopSocks();
00196
00197 static KSocks *_me;
00198 static bool _disabled;
00199
00200
00201 class KSocksPrivate;
00202 KSocksPrivate * const d;
00203 };
00204
00205 #endif //Q_OS_UNIX
00206
00207 #endif
00208 #endif //_KSOCKS_H_