Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

SOCKS5BytestreamServer Class Reference

A server listening for SOCKS5 bytestreams. More...

#include <socks5bytestreamserver.h>

Inherits ConnectionHandler, and ConnectionDataHandler.

Inheritance diagram for SOCKS5BytestreamServer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 SOCKS5BytestreamServer (const LogSink &logInstance, int port, const std::string &ip=EmptyString)
 ~SOCKS5BytestreamServer ()
void setServerImpl (ConnectionBase *server)
void removeServerImpl ()
ConnectionError listen ()
ConnectionError recv (int timeout)
void stop ()
int localPort () const
const std::string localInterface () const
ConnectionBaseserver () const
virtual void handleIncomingConnection (ConnectionBase *server, ConnectionBase *connection)
virtual void handleReceivedData (const ConnectionBase *connection, const std::string &data)
virtual void handleConnect (const ConnectionBase *connection)
virtual void handleDisconnect (const ConnectionBase *connection, ConnectionError reason)

Detailed Description

A server listening for SOCKS5 bytestreams.

Note:
You can use a single SOCKS5BytestreamServer instance with multiple Client objects.

It is safe to put a SOCKS5BytestreamServer instance into a separate thread.

Author:
Jakob Schroeter <js@camaya.net>
Since:
0.9

Definition at line 36 of file socks5bytestreamserver.h.


Constructor & Destructor Documentation

SOCKS5BytestreamServer const LogSink logInstance,
int  port,
const std::string &  ip = EmptyString
 

Constructs a new SOCKS5BytestreamServer.

Parameters:
logInstance A LogSink to use.
port The local port to listen on.
ip The local IP to bind to. If empty, the server will listen on all local interfaces.

Definition at line 21 of file socks5bytestreamserver.cpp.

~SOCKS5BytestreamServer  ) 
 

Destructor.

Definition at line 27 of file socks5bytestreamserver.cpp.


Member Function Documentation

void handleConnect const ConnectionBase connection  )  [virtual]
 

This function is called when e.g. the raw TCP connection was established.

Parameters:
connection The connection.

Implements ConnectionDataHandler.

Definition at line 223 of file socks5bytestreamserver.cpp.

void handleDisconnect const ConnectionBase connection,
ConnectionError  reason
[virtual]
 

This connection is called when e.g. the raw TCP connection was closed.

Parameters:
connection The connection.
reason The reason for the disconnect.

Implements ConnectionDataHandler.

Definition at line 228 of file socks5bytestreamserver.cpp.

void handleIncomingConnection ConnectionBase server,
ConnectionBase connection
[virtual]
 

This function is called to receive an incoming connection.

Parameters:
server The server that the connection was made to.
connection The incoming connection.

Implements ConnectionHandler.

Definition at line 139 of file socks5bytestreamserver.cpp.

void handleReceivedData const ConnectionBase connection,
const std::string &  data
[virtual]
 

This function is called for received from the underlying transport.

Parameters:
connection The connection that received the data.
data The data received.

Implements ConnectionDataHandler.

Definition at line 147 of file socks5bytestreamserver.cpp.

ConnectionError listen  ) 
 

Starts listening on the specified interface and port.

Returns:
Returns ConnNoError on success, ConnIoError on failure (e.g. if the port is already in use).

Definition at line 54 of file socks5bytestreamserver.cpp.

const std::string localInterface  )  const
 

Expose our TCP Connection localInterface Returns the locally bound IP address.

Returns:
The locally bound IP address.

Definition at line 100 of file socks5bytestreamserver.cpp.

int localPort  )  const
 

Expose our TCP Connection localPort Returns the local port.

Returns:
The local port.

Definition at line 92 of file socks5bytestreamserver.cpp.

ConnectionError recv int  timeout  ) 
 

Call this function repeatedly to check for incoming connections and to negotiate them.

Parameters:
timeout The timeout to use for select in microseconds.
Returns:
The state of the listening socket.

Definition at line 62 of file socks5bytestreamserver.cpp.

void removeServerImpl  ) 
 

Removes the current server implementation.

Definition at line 45 of file socks5bytestreamserver.cpp.

ConnectionBase* server  )  const [inline]
 

Exposes the local server.

Returns:
The local server.

Definition at line 105 of file socks5bytestreamserver.h.

void setServerImpl ConnectionBase server  ) 
 

Use this function to use a different server implementation. The default is a ConnectionTCPServer.

Parameters:
An alternate server.

Definition at line 37 of file socks5bytestreamserver.cpp.

void stop  ) 
 

Stops listening and unbinds from the interface and port.

Definition at line 83 of file socks5bytestreamserver.cpp.


The documentation for this class was generated from the following files:
Generated on Tue May 4 16:35:19 2010 for gloox by  doxygen 1.4.1