Helium
Functions
plugin_chain.h File Reference

Creation, destruction, registration, and execution for a plugin chain. More...

#include <he.h>
Include dependency graph for plugin_chain.h:

Go to the source code of this file.

Functions

he_plugin_chain_the_plugin_create_chain (void)
 Creates a Helium plugin chain. More...
 
void he_plugin_destroy_chain (he_plugin_chain_t *chain)
 Releases all memory allocated by Helium for this plugin chain. More...
 
he_return_code_t he_plugin_register_plugin (he_plugin_chain_t *chain, plugin_struct_t *plugin)
 Register the plugin to the plugin chain. More...
 
he_return_code_t he_plugin_ingress (he_plugin_chain_t *chain, uint8_t *packet, size_t *length, size_t capacity)
 Execute the ingress function of each registered plugin. More...
 
he_return_code_t he_plugin_egress (he_plugin_chain_t *chain, uint8_t *packet, size_t *length, size_t capacity)
 Execute the egress function of each registered plugin. More...
 

Detailed Description

Creation, destruction, registration, and execution for a plugin chain.

Function Documentation

he_plugin_chain_t* he_plugin_create_chain ( void  )

Creates a Helium plugin chain.

Returns
he_plugin_chain_t* Returns a pointer to a valid plugin chain
Note
This function allocates memory

This function must be called to create the initial plugin chain for use with other functions

void he_plugin_destroy_chain ( he_plugin_chain_t chain)

Releases all memory allocated by Helium for this plugin chain.

Parameters
chainA pointer to a valid plugin chain
he_return_code_t he_plugin_egress ( he_plugin_chain_t chain,
uint8_t *  packet,
size_t *  length,
size_t  capacity 
)

Execute the egress function of each registered plugin.

Parameters
chainA pointer to a valid plugin chain
packetA pointer to the packet data
lengthThe length of the packet
capacityThe length of the underlying buffer for packet
Returns
HE_SUCCESS All plugins executed successfully
HE_ERR_PLUGIN_DROP A plugin marked this packet for a drop
HE_ERR_FAILED An error occurred processing this packet
Note
This MAY alter the contents of packet, depending on the registered plugins
he_return_code_t he_plugin_ingress ( he_plugin_chain_t chain,
uint8_t *  packet,
size_t *  length,
size_t  capacity 
)

Execute the ingress function of each registered plugin.

Parameters
chainA pointer to a valid plugin chain
packetA pointer to the packet data
lengthThe length of the packet
capacityThe length of the underlying buffer for packet
Returns
HE_SUCCESS All plugins executed successfully
HE_ERR_PLUGIN_DROP A plugin marked this packet for a drop
HE_ERR_FAILED An error occurred processing this packet
Note
This MAY alter the contents of packet, depending on the registered plugins
he_return_code_t he_plugin_register_plugin ( he_plugin_chain_t chain,
plugin_struct_t plugin 
)

Register the plugin to the plugin chain.

Parameters
chainA pointer to a valid plugin chain
pluginA pointer to the initialised plugin struct
Returns
HE_SUCCESS Plugin was successfully registered
HE_ERR_NULL_POINTER Either parameter was NULL
HE_ERR_INIT_FAILED Registering the plugin failed
Note
This function allocates memory