EHS Embedded HTTP Server
1.5.0.132
|
Abstracts different socket types. More...
#include <networkabstraction.h>
Public Member Functions | |
virtual void | RegisterBindHelper (PrivilegedBindHelper *helper)=0 |
Registers a PrivilegedBindHelper for use by this instance. | |
virtual void | SetBindAddress (const char *bindAddress)=0 |
Sets the bind address of the socket. | |
virtual std::string | GetRemoteAddress () const =0 |
Retrieves the peer address. | |
virtual int | GetRemotePort () const =0 |
Retrieves the peer's port of a connection. | |
virtual std::string | GetLocalAddress () const =0 |
Retrieves the peer address. | |
virtual int | GetLocalPort () const =0 |
Retrieves the peer's port of a connection. | |
virtual std::string | GetAddress () const |
Retrieves the peer address. | |
virtual int | GetPort () const |
Retrieves the peer's port of a connection. | |
virtual std::string | GetPeer () const =0 |
Combination of GetRemoteAddress and GetRemotePort. | |
virtual void | Init (int port)=0 |
Initializes a listening socket. | |
virtual | ~NetworkAbstraction () |
Destructor. | |
virtual ehs_socket_t | GetFd () const =0 |
Retrieves the underlying file descriptor. | |
virtual int | Read (void *buf, int bufsize)=0 |
Performs a read from the underlying socket. | |
virtual int | Send (const void *buf, size_t buflen, int flags=0)=0 |
Performs a send on the underlying socket. | |
virtual void | Close ()=0 |
Closes the underlying socket. | |
virtual NetworkAbstraction * | Accept ()=0 |
Waits for an incoming connection. | |
virtual bool | IsSecure () const =0 |
Determines, whether the underlying socket is socure. | |
virtual void | ThreadCleanup ()=0 |
Handles thread specific clean up (used by OpenSSL). |
Abstracts different socket types.
This interface abstracts the differences between normal sockets and SSL sockets. There are two implementations:
virtual NetworkAbstraction* Accept | ( | ) | [pure virtual] |
Waits for an incoming connection.
A | std:runtime_error on failure. |
Implemented in Socket.
virtual std::string GetAddress | ( | ) | const [inline, virtual] |
Retrieves the peer address.
Definition at line 95 of file networkabstraction.h.
References GetRemoteAddress().
virtual ehs_socket_t GetFd | ( | ) | const [pure virtual] |
Retrieves the underlying file descriptor.
Implemented in Socket.
virtual std::string GetLocalAddress | ( | ) | const [pure virtual] |
Retrieves the peer address.
Implemented in Socket.
virtual int GetLocalPort | ( | ) | const [pure virtual] |
virtual std::string GetPeer | ( | ) | const [pure virtual] |
Combination of GetRemoteAddress and GetRemotePort.
Implemented in Socket.
virtual int GetPort | ( | ) | const [inline, virtual] |
Retrieves the peer's port of a connection.
Definition at line 103 of file networkabstraction.h.
References GetRemotePort().
virtual std::string GetRemoteAddress | ( | ) | const [pure virtual] |
Retrieves the peer address.
Implemented in Socket.
Referenced by GetAddress().
virtual int GetRemotePort | ( | ) | const [pure virtual] |
virtual void Init | ( | int | port | ) | [pure virtual] |
Initializes a listening socket.
If listening should be restricted to a specific address, SetBindAddress has to be called in advance.
port | The port to listen on. |
A | std:runtime_error if initialization fails. |
Implemented in Socket.
virtual bool IsSecure | ( | ) | const [pure virtual] |
Determines, whether the underlying socket is socure.
Implemented in Socket.
virtual int Read | ( | void * | buf, |
int | bufsize | ||
) | [pure virtual] |
Performs a read from the underlying socket.
buf | Pointer to a buffer that receives the incoming data. |
bufsize | The maximum number of bytes to read. |
Implemented in Socket.
virtual void RegisterBindHelper | ( | PrivilegedBindHelper * | helper | ) | [pure virtual] |
Registers a PrivilegedBindHelper for use by this instance.
helper | The PrivilegedBindHelper to be used by this instance. |
Implemented in Socket.
virtual int Send | ( | const void * | buf, |
size_t | buflen, | ||
int | flags = 0 |
||
) | [pure virtual] |
Performs a send on the underlying socket.
buf | Pointer to the data to be sent. |
buflen | The number of bytes to send. |
flags | Additional flags for the system call. |
Implemented in Socket.
virtual void SetBindAddress | ( | const char * | bindAddress | ) | [pure virtual] |
Sets the bind address of the socket.
bindAddress | The address to bind to in quad-dotted format. |
Implemented in Socket.