kdecore Library API Documentation

ksocks.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001 George Staikos <staikos@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 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 ** REIMPLEMENTATIONS OF LIBC SOCKET FUNCTIONS 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); 00157 00162 int bind (int sockfd, sockaddr *my_addr, 00163 ksocklen_t addrlen); 00164 int bind (int sockfd, const sockaddr *my_addr, 00165 ksocklen_t addrlen); 00166 00172 void die(); 00173 00178 static void disable(); 00179 00184 static void setConfig(KConfigBase *config); 00185 00186 private: 00187 KSocks(KConfigBase *config); 00188 ~KSocks(); 00189 00190 void stopSocks(); 00191 00192 static KSocks *_me; 00193 static bool _disabled; 00194 QStringList _libNames; 00195 QStringList _libPaths; 00196 bool _useSocks, _hasSocks; 00197 KLibrary* _socksLib; 00198 00199 00200 KSocksTable *_st; 00201 KSocksPrivate *d; 00202 }; 00203 00204 00205 00206 00207 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 20 09:48:27 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003