|
EHS Embedded HTTP Server
1.5.0.132
|
plain socket implementation of NetworkAbstraction More...
#include <socket.h>
Inheritance diagram for Socket:
Collaboration diagram for Socket:Public Member Functions | |
| Socket () | |
| Default constructor. | |
| virtual void | RegisterBindHelper (PrivilegedBindHelper *helper) |
| Registers a PrivilegedBindHelper for use by this instance. | |
| virtual void | Init (int port) |
| Initializes a listening socket. | |
| virtual void | SetBindAddress (const char *bindAddress) |
| Sets the bind address of the socket. | |
| virtual ehs_socket_t | GetFd () const |
| Retrieves the underlying file descriptor. | |
| virtual int | Read (void *buf, int bufsize) |
| Performs a read from the underlying socket. | |
| virtual int | Send (const void *buf, size_t buflen, int flags=0) |
| Performs a send on the underlying socket. | |
| virtual void | Close () |
| Closes the underlying socket. | |
| virtual NetworkAbstraction * | Accept () |
| Waits for an incoming connection. | |
| virtual bool | IsSecure () const |
| Determines, whether the underlying socket is secure. | |
| virtual void | ThreadCleanup () |
| Handles thread specific clean up (used by OpenSSL). | |
Protected Member Functions | |
| Socket (ehs_socket_t fd, sockaddr_in *peer) | |
| Constructs a new Socket, connected to a client. | |
| int | GetLocalPort () const |
| Retrieves the peer's port of a connection. | |
| int | GetRemotePort () const |
| Retrieves the peer's port of a connection. | |
| std::string | GetLocalAddress () const |
| Retrieves the peer address. | |
| std::string | GetRemoteAddress () const |
| Retrieves the peer address. | |
| std::string | GetPeer () const |
| Combination of GetRemoteAddress and GetRemotePort. | |
Protected Attributes | |
| ehs_socket_t | m_fd |
| The file descriptor of the socket on which this connection came in. | |
| sockaddr_in | m_peer |
| Stores the peer address of the current connection. | |
| sockaddr_in | m_bindaddr |
| Stores the bind address. | |
| PrivilegedBindHelper * | m_pBindHelper |
| Our bind helper. | |
plain socket implementation of NetworkAbstraction
| Socket | ( | ehs_socket_t | fd, |
| sockaddr_in * | peer | ||
| ) | [protected] |
Constructs a new Socket, connected to a client.
| fd | The socket descriptor of this connection. |
| peer | The peer address of this socket |
| virtual NetworkAbstraction* Accept | ( | ) | [virtual] |
Waits for an incoming connection.
| A | std:runtime_error on failure. |
Implements NetworkAbstraction.
| virtual ehs_socket_t GetFd | ( | ) | const [inline, virtual] |
Retrieves the underlying file descriptor.
Implements NetworkAbstraction.
Definition at line 111 of file socket.h.
References m_fd.
| std::string GetLocalAddress | ( | ) | const [protected, virtual] |
Retrieves the peer address.
Implements NetworkAbstraction.
| int GetLocalPort | ( | ) | const [protected, virtual] |
| std::string GetPeer | ( | ) | const [protected, virtual] |
Combination of GetRemoteAddress and GetRemotePort.
Implements NetworkAbstraction.
| std::string GetRemoteAddress | ( | ) | const [protected, virtual] |
Retrieves the peer address.
Implements NetworkAbstraction.
| int GetRemotePort | ( | ) | const [protected, virtual] |
| virtual void Init | ( | int | port | ) | [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. |
Implements NetworkAbstraction.
| virtual bool IsSecure | ( | ) | const [inline, virtual] |
Determines, whether the underlying socket is secure.
Implements NetworkAbstraction.
| virtual int Read | ( | void * | buf, |
| int | bufsize | ||
| ) | [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. |
Implements NetworkAbstraction.
| virtual void RegisterBindHelper | ( | PrivilegedBindHelper * | helper | ) | [virtual] |
Registers a PrivilegedBindHelper for use by this instance.
| helper | The PrivilegedBindHelper to be used by this instance. |
Implements NetworkAbstraction.
| virtual int Send | ( | const void * | buf, |
| size_t | buflen, | ||
| int | flags = 0 |
||
| ) | [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. |
Implements NetworkAbstraction.
| virtual void SetBindAddress | ( | const char * | bindAddress | ) | [virtual] |
Sets the bind address of the socket.
| bindAddress | The address to bind to in quad-dotted format. |
Implements NetworkAbstraction.