ksocks.h
/* This file is part of the KDE libraries
Copyright (C) 2001 George Staikos <staikos@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KSOCKS_H_
#define _KSOCKS_H_
#include <qstringlist.h>
#include <sys/types.h>
#include <sys/time.h>
#include <kstaticdeleter.h>
#include <kdelibs_export.h>
#ifdef Q_OS_UNIX
class KSocksTable;
class KSocksPrivate;
class KLibrary;
class KConfigBase;
struct sockaddr;
typedef unsigned ksocklen_t;
class KDECORE_EXPORT KSocks {
friend class KStaticDeleter<KSocks>;
public:
static KSocks *self();
static bool activated();
void disableSocks();
void enableSocks();
bool usingSocks();
bool hasSocks();
bool hasWorkingAsyncConnect();
/*
** REIMPLEMENTATIONS OF LIBC SOCKET FUNCTIONS
**/
int connect (int sockfd, const sockaddr *serv_addr,
ksocklen_t addrlen);
signed long int read (int fd, void *buf, unsigned long int count);
signed long int write (int fd, const void *buf, unsigned long int count);
int recvfrom (int s, void *buf, unsigned long int len, int flags,
sockaddr *from, ksocklen_t *fromlen);
int sendto (int s, const void *msg, unsigned long int len, int flags,
const sockaddr *to, ksocklen_t tolen);
int recv (int s, void *buf, unsigned long int len, int flags);
int send (int s, const void *msg, unsigned long int len, int flags);
int getsockname (int s, sockaddr *name, ksocklen_t *namelen);
int getpeername (int s, sockaddr *name, ksocklen_t *namelen);
int accept (int s, sockaddr *addr, ksocklen_t *addrlen);
int select (int n, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
int listen (int s, int backlog);
int bind (int sockfd, sockaddr *my_addr,
ksocklen_t addrlen);
int bind (int sockfd, const sockaddr *my_addr,
ksocklen_t addrlen);
void die();
static void disable();
static void setConfig(KConfigBase *config);
private:
KSocks(KConfigBase *config);
~KSocks();
void stopSocks();
static KSocks *_me;
static bool _disabled;
QStringList _libNames;
QStringList _libPaths;
bool _useSocks, _hasSocks;
KLibrary* _socksLib;
KSocksTable *_st;
KSocksPrivate *d;
};
#endif //Q_OS_UNIX
#endif //_KSOCKS_H_
KStaticDeleter
Little helper class to clean up static objects that are held as pointer.
Definition: kstaticdeleter.h:74
KLibrary
Represents a dynamically loaded library.
Definition: klibloader.h:50
KConfigBase
KDE Configuration Management abstract base class.
Definition: kconfigbase.h:70
KSocks
This class provides you with an interface to a SOCKS Proxy server.
Definition: ksocks.h:48

KDE Home | KDE Accessibility Home | Description of Access Keys