aboutsummaryrefslogtreecommitdiff
path: root/src/transports/transport-sdk/include/transportplugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transports/transport-sdk/include/transportplugin.h')
-rw-r--r--src/transports/transport-sdk/include/transportplugin.h42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/transports/transport-sdk/include/transportplugin.h b/src/transports/transport-sdk/include/transportplugin.h
index 4347868e6..a78a758bc 100644
--- a/src/transports/transport-sdk/include/transportplugin.h
+++ b/src/transports/transport-sdk/include/transportplugin.h
@@ -17,10 +17,14 @@
namespace zen {
+// Current API version, value will be incremented to represent breaking changes
+static const uint32_t kTransportApiVersion = 1;
+
class TransportConnection;
class TransportPlugin;
class TransportServerConnection;
class TransportServer;
+class TransportLogger;
/*************************************************************************
@@ -60,6 +64,29 @@ public:
virtual TransportServerConnection* CreateConnectionHandler(TransportConnection* Connection) = 0;
};
+/** Logger interface
+
+ There will be one instance of this provided by the system to the transport plugin
+
+ The plugin can use this to log messages back to zen server
+
+ */
+class TransportLogger
+{
+public:
+ enum class LogLevel : uint32_t
+ {
+ Trace = 0,
+ Debug = 1,
+ Info = 2,
+ Warn = 3,
+ Err = 4,
+ Critical = 5,
+ };
+
+ virtual void LogMessage(LogLevel Level, const char* Message) = 0;
+};
+
/*************************************************************************
The following interfaces are to be implemented by transport plugins.
@@ -116,7 +143,18 @@ public:
extern "C"
{
- DLL_TRANSPORT_API zen::TransportPlugin* CreateTransportPlugin();
+ /** Provide information about plugin version
+
+ Fills out API version (kTransportApiVersion) plugin was built against.
+ Fills out plugin own version ever increasing version number,
+ a copy of plugin with higher version will be used.
+ */
+ DLL_TRANSPORT_API void GetTransportPluginVersion(uint32_t* OutApiVersion, uint32_t* OutPluginVersion);
+
+ // Return nullptr if requested api version mismatches api version plugin was built against
+ DLL_TRANSPORT_API zen::TransportPlugin* CreateTransportPlugin(zen::TransportLogger* Logger);
}
-typedef zen::TransportPlugin* (*PfnCreateTransportPlugin)();
+typedef void (*PfnGetTransportPluginVersion)(uint32_t* OutApiVersion, uint32_t* OutPluginVersion);
+
+typedef zen::TransportPlugin* (*PfnCreateTransportPlugin)(zen::TransportLogger* Logger);