gloox  1.0.20
Public Member Functions | List of all members
SOCKS5BytestreamServer Class Reference

#include <socks5bytestreamserver.h>

Inheritance diagram for SOCKS5BytestreamServer:
Inheritance graph

Public Member Functions

 SOCKS5BytestreamServer (const LogSink &logInstance, int port, const std::string &ip=EmptyString)
 ~SOCKS5BytestreamServer ()
ConnectionError listen ()
ConnectionError recv (int timeout)
void stop ()
int localPort () const
const std::string localInterface () const
int serverSocket () 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)
- Public Member Functions inherited from ConnectionHandler
virtual ~ConnectionHandler ()
- Public Member Functions inherited from ConnectionDataHandler
virtual ~ConnectionDataHandler ()

Detailed Description

A server listening for SOCKS5 bytestreams.

You can use a single SOCKS5BytestreamServer instance with multiple Client objects.
It is safe to put a SOCKS5BytestreamServer instance into a separate thread.
Jakob Schröter

Definition at line 36 of file socks5bytestreamserver.h.

Constructor & Destructor Documentation

◆ SOCKS5BytestreamServer()

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

Constructs a new SOCKS5BytestreamServer.

logInstanceA LogSink to use.
portThe local port to listen on.
ipThe local IP to bind to. If empty, the server will listen on all local interfaces.

Definition at line 21 of file socks5bytestreamserver.cpp.

◆ ~SOCKS5BytestreamServer()


Definition at line 28 of file socks5bytestreamserver.cpp.

Member Function Documentation

◆ handleConnect()

void handleConnect ( const ConnectionBase connection)

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

connectionThe connection.

Implements ConnectionDataHandler.

Definition at line 233 of file socks5bytestreamserver.cpp.

◆ handleDisconnect()

void handleDisconnect ( const ConnectionBase connection,
ConnectionError  reason 

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

connectionThe connection.
reasonThe reason for the disconnect.

Implements ConnectionDataHandler.

Definition at line 238 of file socks5bytestreamserver.cpp.

◆ handleIncomingConnection()

void handleIncomingConnection ( ConnectionBase server,
ConnectionBase connection 

This function is called to receive an incoming connection.

serverThe server that the connection was made to.
connectionThe incoming connection.

Implements ConnectionHandler.

Definition at line 139 of file socks5bytestreamserver.cpp.

◆ handleReceivedData()

void handleReceivedData ( const ConnectionBase connection,
const std::string &  data 

This function is called for received from the underlying transport.

connectionThe connection that received the data.
dataThe data received.

Implements ConnectionDataHandler.

Definition at line 150 of file socks5bytestreamserver.cpp.

◆ listen()

ConnectionError listen ( )

Starts listening on the specified interface and port.

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

Definition at line 43 of file socks5bytestreamserver.cpp.

◆ localInterface()

const std::string localInterface ( ) const

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

The locally bound IP address.

Definition at line 100 of file socks5bytestreamserver.cpp.

◆ localPort()

int localPort ( ) const

Expose our TCP Connection localPort Returns the local port.

The local port.

Definition at line 92 of file socks5bytestreamserver.cpp.

◆ recv()

ConnectionError recv ( int  timeout)

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

timeoutThe timeout to use for select in microseconds.
The state of the listening socket.

Definition at line 51 of file socks5bytestreamserver.cpp.

◆ serverSocket()

int serverSocket ( ) const

Exposes the local socket.

The local socket.

Definition at line 93 of file socks5bytestreamserver.h.

◆ stop()

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: