\section{KSocks Class Reference}
\label{classKSocks}\index{KSocks@{KSocks}}
This class provides you with an interface to a {\tt SOCKS} Proxy server. Access to a SOCKS Proxy.  


{\tt \#include $<$ksocks.h$>$}

Collaboration diagram for KSocks:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=234pt]{classKSocks__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
void {\bf disable\-Socks} ()
\begin{CompactList}\small\item\em Disable the use of SOCKS immediately. \item\end{CompactList}\item 
void {\bf enable\-Socks} ()
\begin{CompactList}\small\item\em Enable the use of SOCKS immediately if {\bf has\-Socks()}{\rm (p.\,\pageref{classKSocks_a3})} is true. \item\end{CompactList}\item 
bool {\bf using\-Socks} ()
\begin{CompactList}\small\item\em Checks whether SOCKS is currently being used. \item\end{CompactList}\item 
bool {\bf has\-Socks} ()
\begin{CompactList}\small\item\em Checks whether SOCKS is available for use. \item\end{CompactList}\item 
bool {\bf has\-Working\-Async\-Connect} ()
\begin{CompactList}\small\item\em Returns whether asynchronous connects work with the selected SOCKS impementation. \item\end{CompactList}\item 
int {\bf connect} (int sockfd, const  sockaddr $\ast$serv\_\-addr, ksocklen\_\-t addrlen)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
signed long int {\bf read} (int fd, void $\ast$buf, unsigned long int count)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
signed long int {\bf write} (int fd, const  void $\ast$buf, unsigned long int count)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf recvfrom} (int s, void $\ast$buf, unsigned long int len, int flags, sockaddr $\ast$from, ksocklen\_\-t $\ast$fromlen)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf sendto} (int s, const  void $\ast$msg, unsigned long int len, int flags, const  sockaddr $\ast$to, ksocklen\_\-t tolen)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf recv} (int s, void $\ast$buf, unsigned long int len, int flags)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf send} (int s, const  void $\ast$msg, unsigned long int len, int flags)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf getsockname} (int s, sockaddr $\ast$name, ksocklen\_\-t $\ast$namelen)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf getpeername} (int s, sockaddr $\ast$name, ksocklen\_\-t $\ast$namelen)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf accept} (int s, sockaddr $\ast$addr, ksocklen\_\-t $\ast$addrlen)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf select} (int n, fd\_\-set $\ast$readfds, fd\_\-set $\ast$writefds, fd\_\-set $\ast$exceptfds, struct timeval $\ast$timeout)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf listen} (int s, int backlog)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
int {\bf bind} (int sockfd, sockaddr $\ast$my\_\-addr, ksocklen\_\-t addrlen)
\begin{CompactList}\small\item\em This is the re-implementation of libc's function of the same name. \item\end{CompactList}\item 
void {\bf die} ()
\begin{CompactList}\small\item\em If you're using this, you're probably doing something wrong. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KSocks} $\ast$ {\bf self} ()
\begin{CompactList}\small\item\em Return an instance of class KSocks $\ast$. \item\end{CompactList}\item 
bool {\bf activated} ()
\begin{CompactList}\small\item\em Checks whether KSocks has been started (ie someone called {\bf self()}{\rm (p.\,\pageref{classKSocks_e0})}). \item\end{CompactList}\item 
void {\bf disable} ()
\begin{CompactList}\small\item\em Set this before the first call to {\bf KSocks::self()}{\rm (p.\,\pageref{classKSocks_e0})} and it will fail to initialize SOCKS. \item\end{CompactList}\item 
void {\bf set\-Config} ({\bf KConfig\-Base} $\ast$config)
\begin{CompactList}\small\item\em Set this before the first call to {\bf KSocks::self()}{\rm (p.\,\pageref{classKSocks_e0})} and it will use {\tt config} to read its configuration from. \item\end{CompactList}\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KStatic\-Deleter$<$ KSocks $>$}\label{classKSocks_n0}

\end{CompactItemize}


\subsection{Detailed Description}
This class provides you with an interface to a {\tt SOCKS} Proxy server. Access to a SOCKS Proxy. 

A SOCKS server is able to provide full internet access behind a firewall. KSocks is a singleton; there can only be one instance at any given time. To obtain a reference to that instance, use {\bf self}{\rm (p.\,\pageref{classKSocks_e0})}().



Definition at line 44 of file ksocks.h.

\subsection{Member Function Documentation}
\index{KSocks@{KSocks}!self@{self}}
\index{self@{self}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KSocks} $\ast$ KSocks::self ()\hspace{0.3cm}{\tt  [static]}}\label{classKSocks_e0}


Return an instance of class KSocks $\ast$. 

You cannot delete this object. It is a singleton class. \begin{Desc}
\item[Returns:]the KSock instance \end{Desc}


Definition at line 207 of file ksocks.cpp.

Referenced by KExtended\-Socket::accept(), KExtended\-Socket::connect(), KExtended\-Socket::flush(), KSocket::KSocket(), KExtended\-Socket::listen(), KExtended\-Socket::local\-Address(), KExtended\-Socket::peer\-Address(), KExtended\-Socket::read\-Block(), KExtended\-Socket::wait\-For\-More(), and KExtended\-Socket::write\-Block().\index{KSocks@{KSocks}!activated@{activated}}
\index{activated@{activated}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocks::activated ()\hspace{0.3cm}{\tt  [static]}}\label{classKSocks_e1}


Checks whether KSocks has been started (ie someone called {\bf self()}{\rm (p.\,\pageref{classKSocks_e0})}). 

\begin{Desc}
\item[Returns:]true if activated \end{Desc}


Definition at line 234 of file ksocks.cpp.\index{KSocks@{KSocks}!disableSocks@{disableSocks}}
\index{disableSocks@{disableSocks}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSocks::disable\-Socks ()}\label{classKSocks_a0}


Disable the use of SOCKS immediately. 



Definition at line 447 of file ksocks.cpp.\index{KSocks@{KSocks}!enableSocks@{enableSocks}}
\index{enableSocks@{enableSocks}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSocks::enable\-Socks ()}\label{classKSocks_a1}


Enable the use of SOCKS immediately if {\bf has\-Socks()}{\rm (p.\,\pageref{classKSocks_a3})} is true. 



Definition at line 452 of file ksocks.cpp.\index{KSocks@{KSocks}!usingSocks@{usingSocks}}
\index{usingSocks@{usingSocks}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocks::using\-Socks ()}\label{classKSocks_a2}


Checks whether SOCKS is currently being used. 

\begin{Desc}
\item[Returns:]true if SOCKS is currently being used. \end{Desc}


Definition at line 437 of file ksocks.cpp.\index{KSocks@{KSocks}!hasSocks@{hasSocks}}
\index{hasSocks@{hasSocks}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocks::has\-Socks ()}\label{classKSocks_a3}


Checks whether SOCKS is available for use. 

\begin{Desc}
\item[Returns:]true if SOCKS is available for use. \end{Desc}


Definition at line 442 of file ksocks.cpp.\index{KSocks@{KSocks}!hasWorkingAsyncConnect@{hasWorkingAsyncConnect}}
\index{hasWorkingAsyncConnect@{hasWorkingAsyncConnect}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KSocks::has\-Working\-Async\-Connect ()}\label{classKSocks_a4}


Returns whether asynchronous connects work with the selected SOCKS impementation. 



Definition at line 457 of file ksocks.cpp.

Referenced by KExtended\-Socket::connect().\index{KSocks@{KSocks}!connect@{connect}}
\index{connect@{connect}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::connect (int {\em sockfd}, const sockaddr $\ast$ {\em serv\_\-addr}, ksocklen\_\-t {\em addrlen})}\label{classKSocks_a5}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 468 of file ksocks.cpp.

Referenced by KExtended\-Socket::connect().\index{KSocks@{KSocks}!read@{read}}
\index{read@{read}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}signed long int KSocks::read (int {\em fd}, void $\ast$ {\em buf}, unsigned long int {\em count})}\label{classKSocks_a6}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 476 of file ksocks.cpp.

Referenced by KExtended\-Socket::read\-Block().\index{KSocks@{KSocks}!write@{write}}
\index{write@{write}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}signed long int KSocks::write (int {\em fd}, const void $\ast$ {\em buf}, unsigned long int {\em count})}\label{classKSocks_a7}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 483 of file ksocks.cpp.

Referenced by KExtended\-Socket::flush(), and KExtended\-Socket::write\-Block().\index{KSocks@{KSocks}!recvfrom@{recvfrom}}
\index{recvfrom@{recvfrom}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::recvfrom (int {\em s}, void $\ast$ {\em buf}, unsigned long int {\em len}, int {\em flags}, sockaddr $\ast$ {\em from}, ksocklen\_\-t $\ast$ {\em fromlen})}\label{classKSocks_a8}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 490 of file ksocks.cpp.\index{KSocks@{KSocks}!sendto@{sendto}}
\index{sendto@{sendto}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::sendto (int {\em s}, const void $\ast$ {\em msg}, unsigned long int {\em len}, int {\em flags}, const sockaddr $\ast$ {\em to}, ksocklen\_\-t {\em tolen})}\label{classKSocks_a9}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 503 of file ksocks.cpp.\index{KSocks@{KSocks}!recv@{recv}}
\index{recv@{recv}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::recv (int {\em s}, void $\ast$ {\em buf}, unsigned long int {\em len}, int {\em flags})}\label{classKSocks_a10}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 511 of file ksocks.cpp.\index{KSocks@{KSocks}!send@{send}}
\index{send@{send}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::send (int {\em s}, const void $\ast$ {\em msg}, unsigned long int {\em len}, int {\em flags})}\label{classKSocks_a11}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 518 of file ksocks.cpp.\index{KSocks@{KSocks}!getsockname@{getsockname}}
\index{getsockname@{getsockname}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::getsockname (int {\em s}, sockaddr $\ast$ {\em name}, ksocklen\_\-t $\ast$ {\em namelen})}\label{classKSocks_a12}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 525 of file ksocks.cpp.

References KStd\-Action::name().

Referenced by KSocket::KSocket(), and KExtended\-Socket::local\-Address().\index{KSocks@{KSocks}!getpeername@{getpeername}}
\index{getpeername@{getpeername}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::getpeername (int {\em s}, sockaddr $\ast$ {\em name}, ksocklen\_\-t $\ast$ {\em namelen})}\label{classKSocks_a13}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 537 of file ksocks.cpp.

References KStd\-Action::name().

Referenced by KExtended\-Socket::peer\-Address().\index{KSocks@{KSocks}!accept@{accept}}
\index{accept@{accept}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::accept (int {\em s}, sockaddr $\ast$ {\em addr}, ksocklen\_\-t $\ast$ {\em addrlen})}\label{classKSocks_a14}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 549 of file ksocks.cpp.

Referenced by KExtended\-Socket::accept().\index{KSocks@{KSocks}!select@{select}}
\index{select@{select}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::select (int {\em n}, fd\_\-set $\ast$ {\em readfds}, fd\_\-set $\ast$ {\em writefds}, fd\_\-set $\ast$ {\em exceptfds}, struct timeval $\ast$ {\em timeout})}\label{classKSocks_a15}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 561 of file ksocks.cpp.

Referenced by KExtended\-Socket::accept(), KExtended\-Socket::connect(), and KExtended\-Socket::wait\-For\-More().\index{KSocks@{KSocks}!listen@{listen}}
\index{listen@{listen}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::listen (int {\em s}, int {\em backlog})}\label{classKSocks_a16}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 569 of file ksocks.cpp.

Referenced by KExtended\-Socket::listen().\index{KSocks@{KSocks}!bind@{bind}}
\index{bind@{bind}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KSocks::bind (int {\em sockfd}, sockaddr $\ast$ {\em my\_\-addr}, ksocklen\_\-t {\em addrlen})}\label{classKSocks_a17}


This is the re-implementation of libc's function of the same name. 

Read the appropriate man page. 

Definition at line 576 of file ksocks.cpp.

Referenced by KExtended\-Socket::connect(), and KExtended\-Socket::listen().\index{KSocks@{KSocks}!die@{die}}
\index{die@{die}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSocks::die ()}\label{classKSocks_a18}


If you're using this, you're probably doing something wrong. 

Please don't use it. 

Definition at line 414 of file ksocks.cpp.\index{KSocks@{KSocks}!disable@{disable}}
\index{disable@{disable}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSocks::disable ()\hspace{0.3cm}{\tt  [static]}}\label{classKSocks_e2}


Set this before the first call to {\bf KSocks::self()}{\rm (p.\,\pageref{classKSocks_e0})} and it will fail to initialize SOCKS. 



Definition at line 201 of file ksocks.cpp.\index{KSocks@{KSocks}!setConfig@{setConfig}}
\index{setConfig@{setConfig}!KSocks@{KSocks}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KSocks::set\-Config ({\bf KConfig\-Base} $\ast$ {\em config})\hspace{0.3cm}{\tt  [static]}}\label{classKSocks_e3}


Set this before the first call to {\bf KSocks::self()}{\rm (p.\,\pageref{classKSocks_e0})} and it will use {\tt config} to read its configuration from. 



Definition at line 221 of file ksocks.cpp.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
ksocks.h\item 
ksocks.cpp\end{CompactItemize}
