Header file dealing with the corsaro plugin manager. More...

Go to the source code of this file.
Data Structures | |
| struct | corsaro_plugin |
| An corsaro packet processing plugin. More... | |
| struct | corsaro_plugin_manager |
| Holds the metadata for the plugin manager. More... | |
Macros | |
| #define | CORSARO_PLUGIN_GENERATE_PROTOS(plugin) |
| Convenience macro that defines all the function prototypes for the corsaro plugin API. | |
| #define | CORSARO_PLUGIN_GENERATE_PTRS(plugin) |
| Convenience macro that defines all the function pointers for the corsaro plugin API. | |
| #define | CORSARO_PLUGIN_STATE(corsaro, type, id) |
| Convenience macro to cast the state pointer in the plugin. | |
| #define | CORSARO_PLUGIN_PLUGIN(corsaro, id) ((corsaro)->plugin_manager->plugins[(id)-1]) |
| Convenience macro to get this plugin from corsaro. | |
Typedefs | |
| typedef enum corsaro_plugin_id | corsaro_plugin_id_t |
| A unique identifier for a plugin, used when writing binary data. | |
| typedef struct corsaro_plugin | corsaro_plugin_t |
| An corsaro packet processing plugin. | |
| typedef struct corsaro_plugin_manager | corsaro_plugin_manager_t |
| Holds the metadata for the plugin manager. | |
Enumerations | |
| enum | corsaro_plugin_id { CORSARO_PLUGIN_ID_PCAP = 1, CORSARO_PLUGIN_ID_FLOWTUPLE = 20, CORSARO_PLUGIN_ID_DOS = 30, CORSARO_PLUGIN_ID_MAX = CORSARO_PLUGIN_ID_DOS } |
| A unique identifier for a plugin, used when writing binary data. More... | |
Functions | |
| corsaro_plugin_manager_t * | corsaro_plugin_manager_init () |
| Initialize the plugin manager and all in-use plugins. | |
| int | corsaro_plugin_manager_start (corsaro_plugin_manager_t *manager) |
| Start the plugin manager. | |
| void | corsaro_plugin_manager_free (corsaro_plugin_manager_t *manager) |
| Free the plugin manager and all in-use plugins. | |
| corsaro_plugin_t * | corsaro_plugin_get_by_id (corsaro_plugin_manager_t *manager, int id) |
| Attempt to retrieve a plugin by id. | |
| corsaro_plugin_t * | corsaro_plugin_get_by_name (corsaro_plugin_manager_t *manager, const char *name) |
| Attempt to retrieve a plugin by name. | |
| corsaro_plugin_t * | corsaro_plugin_next (corsaro_plugin_manager_t *manager, corsaro_plugin_t *plugin) |
| Retrieve the next plugin in the list. | |
| void | corsaro_plugin_register_state (corsaro_plugin_manager_t *manager, corsaro_plugin_t *plugin, void *state) |
| Register the state for a plugin. | |
| void | corsaro_plugin_free_state (corsaro_plugin_manager_t *manager, corsaro_plugin_t *plugin) |
| Free the state for a plugin. | |
| int | corsaro_plugin_probe_filename (const char *fname, corsaro_plugin_t *plugin) |
| Check a filename to see if it contains a plugin's name. | |
| const char * | corsaro_plugin_get_name (corsaro_plugin_manager_t *manager, int id) |
| Get the name of a plugin given it's ID number. | |
| int | corsaro_plugin_is_enabled (corsaro_plugin_manager_t *manager, corsaro_plugin_t *plugin) |
| Determine whether this plugin is enabled for use. | |
| int | corsaro_plugin_enable_plugin (corsaro_plugin_manager_t *manager, const char *plugin_name) |
| Attempt to enable a plugin by its name. | |
Header file dealing with the corsaro plugin manager.
Definition in file corsaro_plugin.h.
| #define CORSARO_PLUGIN_GENERATE_PROTOS | ( | plugin | ) |
Convenience macro that defines all the function prototypes for the corsaro plugin API.
Definition at line 44 of file corsaro_plugin.h.
| #define CORSARO_PLUGIN_GENERATE_PTRS | ( | plugin | ) |
Convenience macro that defines all the function pointers for the corsaro plugin API.
Definition at line 70 of file corsaro_plugin.h.
Convenience macro to get this plugin from corsaro.
Plugins should use extend this macro to provide access to themself
Definition at line 95 of file corsaro_plugin.h.
| #define CORSARO_PLUGIN_STATE | ( | corsaro, | |
| type, | |||
| id | |||
| ) |
Convenience macro to cast the state pointer in the plugin.
Plugins should use extend this macro to provide access to their state
Definition at line 87 of file corsaro_plugin.h.
| typedef enum corsaro_plugin_id corsaro_plugin_id_t |
A unique identifier for a plugin, used when writing binary data.
| typedef struct corsaro_plugin_manager corsaro_plugin_manager_t |
Holds the metadata for the plugin manager.
This allows both corsaro_t and corsaro_in_t objects to use the plugin infrastructure without needing to pass references to themselves
| typedef struct corsaro_plugin corsaro_plugin_t |
An corsaro packet processing plugin.
| enum corsaro_plugin_id |
A unique identifier for a plugin, used when writing binary data.
Definition at line 106 of file corsaro_plugin.h.
| int corsaro_plugin_enable_plugin | ( | corsaro_plugin_manager_t * | manager, |
| const char * | plugin_name | ||
| ) |
Attempt to enable a plugin by its name.
| manager | The plugin manager associated with the state |
| plugin_name | The name of the plugin to enable |
See corsaro_enable_plugin for more details.
Definition at line 445 of file corsaro_plugin.c.
References corsaro_plugin::id, corsaro_plugin_manager::plugins_enabled, and corsaro_plugin_manager::plugins_enabled_cnt.
| void corsaro_plugin_free_state | ( | corsaro_plugin_manager_t * | manager, |
| corsaro_plugin_t * | plugin | ||
| ) |
Free the state for a plugin.
| manager | The plugin manager associated with the state |
| plugin | The plugin to free state for |
Definition at line 389 of file corsaro_plugin.c.
References corsaro_plugin::id, and corsaro_plugin_manager::plugins_state.
| corsaro_plugin_t* corsaro_plugin_get_by_id | ( | corsaro_plugin_manager_t * | manager, |
| int | id | ||
| ) |
Attempt to retrieve a plugin by id.
| manager | The plugin manager to search with |
| id | The id of the plugin to get |
Definition at line 332 of file corsaro_plugin.c.
References CORSARO_PLUGIN_ID_MAX, and corsaro_plugin_manager::plugins.
| corsaro_plugin_t* corsaro_plugin_get_by_name | ( | corsaro_plugin_manager_t * | manager, |
| const char * | name | ||
| ) |
Attempt to retrieve a plugin by name.
| manager | The plugin manager to search with |
| name | The name of the plugin to get |
Definition at line 344 of file corsaro_plugin.c.
References corsaro_plugin::name.
| const char* corsaro_plugin_get_name | ( | corsaro_plugin_manager_t * | manager, |
| int | id | ||
| ) |
Get the name of a plugin given it's ID number.
| manager | The plugin manager associated with the state |
| id | The plugin id to retrieve the name for |
Definition at line 411 of file corsaro_plugin.c.
References corsaro_plugin::name.
| int corsaro_plugin_is_enabled | ( | corsaro_plugin_manager_t * | manager, |
| corsaro_plugin_t * | plugin | ||
| ) |
Determine whether this plugin is enabled for use.
| manager | The plugin manager associated with the state |
| plugin | The plugin to check the status of |
A plugin is enabled either explicitly by the corsaro_enable_plugin() function, or implicitly because all plugins are enabled.
Definition at line 422 of file corsaro_plugin.c.
References corsaro_plugin::id, corsaro_plugin_manager::plugins_enabled, and corsaro_plugin_manager::plugins_enabled_cnt.
| void corsaro_plugin_manager_free | ( | corsaro_plugin_manager_t * | manager | ) |
Free the plugin manager and all in-use plugins.
| manager | The plugin manager to free |
Definition at line 290 of file corsaro_plugin.c.
References CORSARO_PLUGIN_ID_MAX, corsaro_plugin_manager::first_plugin, corsaro_plugin_manager::plugins, corsaro_plugin_manager::plugins_cnt, and corsaro_plugin_manager::plugins_state.
| corsaro_plugin_manager_t* corsaro_plugin_manager_init | ( | ) |
Initialize the plugin manager and all in-use plugins.
| int corsaro_plugin_manager_start | ( | corsaro_plugin_manager_t * | manager | ) |
Start the plugin manager.
| manager | The manager to start |
Definition at line 230 of file corsaro_plugin.c.
References corsaro_plugin_manager::first_plugin, corsaro_plugin::id, corsaro_plugin::next, corsaro_plugin_manager::plugins, corsaro_plugin_manager::plugins_enabled, and corsaro_plugin_manager::plugins_enabled_cnt.
| corsaro_plugin_t* corsaro_plugin_next | ( | corsaro_plugin_manager_t * | manager, |
| corsaro_plugin_t * | plugin | ||
| ) |
Retrieve the next plugin in the list.
| manager | The plugin manager to get the next plugin for |
| plugin | The current plugin |
Definition at line 359 of file corsaro_plugin.c.
References corsaro_plugin_manager::first_plugin, corsaro_plugin::next, corsaro_plugin_manager::plugins, and corsaro_plugin_manager::plugins_cnt.
| int corsaro_plugin_probe_filename | ( | const char * | fname, |
| corsaro_plugin_t * | plugin | ||
| ) |
Check a filename to see if it contains a plugin's name.
| fname | The file name to check |
| plugin | The plugin to check for |
Definition at line 399 of file corsaro_plugin.c.
References corsaro_plugin::name.
| void corsaro_plugin_register_state | ( | corsaro_plugin_manager_t * | manager, |
| corsaro_plugin_t * | plugin, | ||
| void * | state | ||
| ) |
Register the state for a plugin.
| manager | The plugin manager to register state with |
| plugin | The plugin to register state for |
| state | A pointer to the state object to register |
Definition at line 378 of file corsaro_plugin.c.
References corsaro_plugin::id, and corsaro_plugin_manager::plugins_state.