Skip to content

Commit

Permalink
update(userspace/plugin): support subtable state field type and bump …
Browse files Browse the repository at this point in the history
…API version

Co-authored-by: Gianmatteo Palmieri <[email protected]>
Signed-off-by: Jason Dellaluce <[email protected]>
  • Loading branch information
2 people authored and poiana committed May 14, 2024
1 parent e0fd864 commit bc8d95b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
14 changes: 11 additions & 3 deletions userspace/plugin/plugin_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ extern "C" {
//
// todo(jasondellaluce): when/if major changes to v4, check and solve all todos
#define PLUGIN_API_VERSION_MAJOR 3
#define PLUGIN_API_VERSION_MINOR 4
#define PLUGIN_API_VERSION_PATCH 1
#define PLUGIN_API_VERSION_MINOR 5
#define PLUGIN_API_VERSION_PATCH 0

//
// Just some not so smart defines to retrieve plugin api version as string
Expand Down Expand Up @@ -263,8 +263,16 @@ typedef struct
ss_plugin_table_fields_vtable fields;
//
// Vtable for controlling operations related to fields on the state tables
// registeted in the plugin's owner.
// registered in the plugin's owner.
ss_plugin_table_fields_vtable_ext* fields_ext;
//
// Vtable for controlling read operations on the state tables registered
// in the plugin's owner.
ss_plugin_table_reader_vtable_ext* reader_ext;
//
// Vtable for controlling write operations on the state tables registered
// in the plugin's owner.
ss_plugin_table_writer_vtable_ext* writer_ext;
} ss_plugin_init_tables_input;

// Function used by plugin for sending messages to the framework-provided logger
Expand Down
22 changes: 12 additions & 10 deletions userspace/plugin/plugin_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ typedef struct ss_plugin_extract_field
ss_plugin_bool flist;
} ss_plugin_extract_field;

// Opaque a pointer to a state table. The falcosecurity libs define stateful
// components in the form of tables.
typedef void ss_plugin_table_t;

// Opaque a pointer to an entry of a state table.
typedef void ss_plugin_table_entry_t;

// Opaque accessor to a data field available in the entries of a state table.
typedef void ss_plugin_table_field_t;

// Types supported by entry fields of state tables.
// The noncontinguous numbers are to maintain equality with underlying
// falcosecurity libs types.
Expand All @@ -212,6 +222,7 @@ typedef enum ss_plugin_state_type
SS_PLUGIN_ST_UINT32 = 7,
SS_PLUGIN_ST_UINT64 = 8,
SS_PLUGIN_ST_STRING = 9,
SS_PLUGIN_ST_TABLE = 10,
SS_PLUGIN_ST_BOOL = 25
} ss_plugin_state_type;

Expand All @@ -229,6 +240,7 @@ typedef union ss_plugin_state_data
uint64_t u64;
const char* str;
ss_plugin_bool b;
ss_plugin_table_t* table;
} ss_plugin_state_data;

// Info about a state table.
Expand All @@ -246,16 +258,6 @@ typedef struct ss_plugin_table_fieldinfo
ss_plugin_bool read_only;
} ss_plugin_table_fieldinfo;

// Opaque a pointer to a state table. The falcosecurity libs define stateful
// components in the form of tables.
typedef void ss_plugin_table_t;

// Opaque a pointer to an entry of a state table.
typedef void ss_plugin_table_entry_t;

// Opaque accessor to a data field available in the entries of a state table.
typedef void ss_plugin_table_field_t;

// Opaque pointer to the owner of a plugin. It can be used to invert the
// control and invoke functions of the plugin's owner from within the plugin.
typedef void ss_plugin_owner_t;
Expand Down

0 comments on commit bc8d95b

Please sign in to comment.