| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 <sys/types.h>
    00023 #include <sys/time.h>
    00024 #include <kstaticdeleter.h>
    00025 #include <kdelibs_export.h>
    00026
    00027 #ifdef Q_OS_UNIX
    00028
    00029 class KSocksTable;
    00030 class KSocksPrivate;
    00031 class KLibrary;
    00032 class KConfigBase;
    00033 struct sockaddr;
    00034
    00035 typedef unsigned ksocklen_t;
    00036
    00037
    00048 class KDECORE_EXPORT KSocks {
    00049    friend class KStaticDeleter<KSocks>;
    00050
    00051 public:
    00052
    00058    static KSocks *self();
    00059
    00064    static bool activated();
    00065
    00069    void disableSocks();
    00070
    00074    void enableSocks();
    00075
    00080    bool usingSocks();
    00081
    00086    bool hasSocks();
    00087
    00092    bool hasWorkingAsyncConnect();
    00093
    00094    /*
    00095     **     REIMPLEMENTATIONS OF LIBC SOCKET FUNCTIONS
    00096     **/
    00101     int     connect     (int sockfd, const sockaddr *serv_addr,
    00102                                 ksocklen_t addrlen);
    00107     signed long int read  (int fd, void *buf, unsigned long int count);
    00112     signed long int write (int fd, const void *buf, unsigned long int count);
    00117     int     recvfrom    (int s, void *buf, unsigned long int len, int flags,
    00118                                 sockaddr *from, ksocklen_t *fromlen);
    00123     int     sendto      (int s, const void *msg, unsigned long int len, int flags,
    00124                              const sockaddr *to, ksocklen_t tolen);
    00129     int     recv        (int s, void *buf, unsigned long int len, int flags);
    00134     int     send        (int s, const void *msg, unsigned long int len, int flags);
    00139     int     getsockname (int s, sockaddr *name, ksocklen_t *namelen);
    00144     int     getpeername (int s, sockaddr *name, ksocklen_t *namelen);
    00149     int     accept      (int s, sockaddr *addr, ksocklen_t *addrlen);
    00154     int     select      (int n, fd_set *readfds, fd_set *writefds,
    00155                                 fd_set *exceptfds, struct timeval *timeout);
    00160     int     listen      (int s, int backlog);
    00161
    00166     int     bind        (int sockfd, sockaddr *my_addr,
    00167                                      ksocklen_t addrlen);
    00168     int     bind        (int sockfd, const sockaddr *my_addr,
    00169                                      ksocklen_t addrlen);
    00170
    00176    void die();
    00177
    00182    static void disable();
    00183
    00188    static void setConfig(KConfigBase *config);
    00189
    00190 private:
    00191    KSocks(KConfigBase *config);
    00192    ~KSocks();
    00193
    00194    void stopSocks();
    00195
    00196    static KSocks *_me;
    00197    static bool _disabled;
    00198    QStringList _libNames;
    00199    QStringList _libPaths;
    00200    bool _useSocks, _hasSocks;
    00201    KLibrary* _socksLib;
    00202
    00203
    00204    KSocksTable *_st;
    00205    KSocksPrivate *d;
    00206 };
    00207
    00208 #endif //Q_OS_UNIX
    00209
    00210 #endif //_KSOCKS_H_

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:11 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003