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);
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
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:56 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001