]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
plugin: Add macro to define plugin version and constructor
authorTobias Brunner <tobias@strongswan.org>
Mon, 11 Aug 2025 14:28:14 +0000 (16:28 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 22 Aug 2025 13:32:39 +0000 (15:32 +0200)
src/libstrongswan/plugins/plugin.h

index a6387a46b5c46885a8077304c7c1f6e96f59fdbd..dbb8f7b6f42b0bfc96a7f535771fdd01eb58fef3 100644 (file)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (C) 2010-2025 Tobias Brunner
  * Copyright (C) 2008 Martin Willi
  *
  * Copyright (C) secunet Security Networks AG
@@ -63,7 +64,6 @@ struct plugin_t {
        void (*destroy)(plugin_t *this);
 };
 
-
 /**
  * Plugin constructor function definition.
  *
@@ -75,4 +75,11 @@ struct plugin_t {
  */
 typedef plugin_t *(*plugin_constructor_t)(void);
 
+/**
+ * Macro to simplify defining a plugin version and constructor.
+ */
+#define PLUGIN_DEFINE(name) \
+       const char *name##_plugin_version = VERSION; \
+       plugin_t *name##_plugin_create()
+
 #endif /** PLUGIN_H_ @}*/