diff options
| author | Stefan Boberg <[email protected]> | 2023-10-11 14:59:25 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-11 14:59:25 +0200 |
| commit | 11f7f70b825c5b6784f5e2609463a1a9d1a0dabc (patch) | |
| tree | 98f65537f52327c354193afa98a29f9f838b42ff /src/zenhttp/include | |
| parent | hide HttpAsioServer interface behind factory function (#463) (diff) | |
| download | zen-11f7f70b825c5b6784f5e2609463a1a9d1a0dabc.tar.xz zen-11f7f70b825c5b6784f5e2609463a1a9d1a0dabc.zip | |
pluggable asio transport (#460)
added pluggable transport based on asio. This is in an experimental state and is not yet a replacement for httpasio even though that is the ultimate goal
also moved plugin API header into dedicated part of the tree to clarify that it is meant to be usable in isolation, without any dependency on zencore et al
moved transport implementations into dedicated source directory in zenhttp
note that this adds code to the build but nothing should change at runtime since the instantiation of the new code is conditional and is inactive by default
Diffstat (limited to 'src/zenhttp/include')
| -rw-r--r-- | src/zenhttp/include/zenhttp/transportplugin.h | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/src/zenhttp/include/zenhttp/transportplugin.h b/src/zenhttp/include/zenhttp/transportplugin.h deleted file mode 100644 index fe17680de..000000000 --- a/src/zenhttp/include/zenhttp/transportplugin.h +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#pragma once - -#include <stdint.h> - -// Important note: this header is meant to compile standalone -// and should therefore not depend on anything from the Zen codebase - -class TransportConnection; -class TransportPlugin; -class TransportServerConnection; -class TransportServer; - -/************************************************************************* - - The following interfaces are implemented on the server side, and instances - are provided to the plugins. - -*************************************************************************/ - -/** Plugin-server interface for connection - * - * This is how the transport feeds data to the connection handler - * which will parse the incoming messages and dispatch to - * appropriate request handlers and ultimately call into functions - * which write data back to the client. - */ -class TransportServerConnection -{ -public: - virtual uint32_t AddRef() const = 0; - virtual uint32_t Release() const = 0; - virtual void OnBytesRead(const void* Buffer, size_t DataSize) = 0; -}; - -/** Plugin-server interface - * - * There will be one instance of this per plugin, and the plugin - * should use this to manage lifetimes of connections and any - * other resources. - */ -class TransportServer -{ -public: - virtual TransportServerConnection* CreateConnectionHandler(TransportConnection* Connection) = 0; -}; - -/************************************************************************* - - The following interfaces are to be implemented by transport plugins. - -*************************************************************************/ - -/** Interface which needs to be implemented by a transport plugin - * - * This is responsible for setting up and running the communication - * for a given transport. - */ -class TransportPlugin -{ -public: - virtual uint32_t AddRef() const = 0; - virtual uint32_t Release() const = 0; - virtual void Initialize(TransportServer* ServerInterface) = 0; - virtual void Shutdown() = 0; - - /** Check whether this transport is usable. - */ - virtual bool IsAvailable() = 0; -}; - -/** A transport plugin provider needs to implement this interface - * - * There will be one instance of this per established connection and - * this interface is used to write response data back to the client. - */ -class TransportConnection -{ -public: - virtual int64_t WriteBytes(const void* Buffer, size_t DataSize) = 0; - virtual void Shutdown(bool Receive, bool Transmit) = 0; - virtual void CloseConnection() = 0; -}; - -#if defined(_MSC_VER) -# define DLL_TRANSPORT_API __declspec(dllexport) -#else -# define DLL_TRANSPORT_API -#endif - -extern "C" -{ - DLL_TRANSPORT_API TransportPlugin* CreateTransportPlugin(); -} - -typedef TransportPlugin* (*PfnCreateTransportPlugin)(); |