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
00052 class KDECORE_EXPORT KSocks {
00053 public:
00054
00060 static KSocks *self();
00061
00066 static bool activated();
00067
00071 void disableSocks();
00072
00076 void enableSocks();
00077
00082 bool usingSocks();
00083
00088 bool hasSocks();
00089
00094 bool hasWorkingAsyncConnect();
00095
00096
00097
00098
00103 int connect (int sockfd, const sockaddr *serv_addr,
00104 kde_socklen_t addrlen);
00109 signed long int read (int fd, void *buf, unsigned long int count);
00114 signed long int write (int fd, const void *buf, unsigned long int count);
00119 int recvfrom (int s, void *buf, unsigned long int len, int flags,
00120 sockaddr *from, kde_socklen_t *fromlen);
00125 int sendto (int s, const void *msg, unsigned long int len, int flags,
00126 const sockaddr *to, kde_socklen_t tolen);
00131 int recv (int s, void *buf, unsigned long int len, int flags);
00136 int send (int s, const void *msg, unsigned long int len, int flags);
00141 int getsockname (int s, sockaddr *name, kde_socklen_t *namelen);
00146 int getpeername (int s, sockaddr *name, kde_socklen_t *namelen);
00151 int accept (int s, sockaddr *addr, kde_socklen_t *addrlen);
00156 int select (int n, fd_set *readfds, fd_set *writefds,
00157 fd_set *exceptfds, struct timeval *timeout);
00162 int listen (int s, int backlog);
00163
00168 int bind (int sockfd, sockaddr *my_addr,
00169 kde_socklen_t addrlen);
00170 int bind (int sockfd, const sockaddr *my_addr,
00171 kde_socklen_t addrlen);
00172
00178 void die();
00179
00184 static void disable();
00185
00190 static void setConfig(const KConfigGroup *config);
00191
00192 private:
00193 explicit KSocks(const KConfigGroup *config);
00194 ~KSocks();
00195
00196 void stopSocks();
00197
00198 static KSocks *_me;
00199 static bool _disabled;
00200
00201
00202 class KSocksPrivate;
00203 KSocksPrivate * const d;
00204 };
00205
00206 #endif //Q_OS_UNIX
00207
00208 #endif
00209 #endif //_KSOCKS_H_