26 #ifndef NETWORK_ABSTRACTION_H 27 #define NETWORK_ABSTRACTION_H 35 typedef SOCKET ehs_socket_t;
37 typedef int ehs_socket_t;
89 DEPRECATED(
"Use GetRemoteAddress()")
97 DEPRECATED(
"Use GetRemotePort()")
110 virtual std::string
GetPeer()
const = 0;
119 virtual void Init(
int port) = 0;
128 virtual ehs_socket_t
GetFd()
const = 0;
136 virtual int Read(
void *buf,
int bufsize) = 0;
145 virtual int Send(
const void *buf,
size_t buflen,
int flags = 0) = 0;
148 virtual void Close() = 0;
164 #endif // NETWORK_ABSTRACTION_H virtual void Close()=0
Closes the underlying socket.
virtual void Init(int port)=0
Initializes a listening socket.
virtual int GetRemotePort() const =0
Retrieves the peer's port of a connection.
virtual int Send(const void *buf, size_t buflen, int flags=0)=0
Performs a send on the underlying socket.
virtual void SetBindAddress(const char *bindAddress)=0
Sets the bind address of the socket.
virtual std::string GetLocalAddress() const =0
Retrieves the peer address.
virtual ehs_socket_t GetFd() const =0
Retrieves the underlying file descriptor.
virtual void RegisterBindHelper(PrivilegedBindHelper *helper)=0
Registers a PrivilegedBindHelper for use by this instance.
virtual int GetLocalPort() const =0
Retrieves the peer's port of a connection.
virtual int GetPort() const
Retrieves the peer's port of a connection.
virtual bool IsSecure() const =0
Determines, whether the underlying socket is socure.
virtual std::string GetPeer() const =0
Combination of GetRemoteAddress and GetRemotePort.
virtual ~NetworkAbstraction()
Destructor.
virtual std::string GetRemoteAddress() const =0
Retrieves the peer address.
virtual NetworkAbstraction * Accept()=0
Waits for an incoming connection.
Helper class for binding of sockets to privileged ports.
virtual int Read(void *buf, int bufsize)=0
Performs a read from the underlying socket.
virtual void ThreadCleanup()=0
Handles thread specific clean up (used by OpenSSL).
Abstracts different socket types.
virtual std::string GetAddress() const
Retrieves the peer address.