vlib: add cgo-friendly plugin registration support
[vpp.git] / src / vlib / unix / plugin.h
index c9a33cc..4beae43 100644 (file)
@@ -67,6 +67,33 @@ typedef CLIB_PACKED(struct {
 }) vlib_plugin_registration_t;
 /* *INDENT-ON* */
 
+/*
+ * Plugins may also use this registration format, which is
+ * easy enough to emit from e.g. a golang compiler.
+ */
+typedef struct
+{
+  uword data_segment_offset;
+  uword length;
+} vlib_r2_string_t;
+
+typedef struct
+{
+  int default_disabled;
+  vlib_r2_string_t version;
+  vlib_r2_string_t version_required;
+  vlib_r2_string_t overrides;
+  vlib_r2_string_t early_init;
+  vlib_r2_string_t description;
+} vlib_plugin_r2_t;
+
+#define foreach_r2_string_field                 \
+_(version)                                      \
+_(version_required)                             \
+_(overrides)                                    \
+_(early_init)                                   \
+_(description)
+
 typedef struct
 {
   u8 *name;