Struct PntosPreprocessorPlugin

Struct Documentation

struct PntosPreprocessorPlugin

An implementation of a preprocessor plugin. This plugin generates PntosPreprocessor instances which may be used to process incoming messages before being distributed to other plugins.

UNSTABLE: This feature is unstable and is not yet considered part of the stable pntOS API. Usage of this feature is highly discouraged in non-experimental code, and its definition may change at any time.

Public Members

PntosCommonPlugin common
size_t num_preprocessors

The number of different kinds of PntosPreprocessors that this PntosPreprocessorPlugin can create. This field describes the length of preprocessor_identifiers as well as the set of valid values for the preprocessor_index parameter to new_preprocessor.

char **preprocessor_identifiers

A list of identifying strings for each kind of PntosPreprocessor that this PntosPreprocessorPlugin can create instances of.

The field is a num_preprocessors sized array of pointers to \0 terminated C strings. The preprocessor_index parameter of new_preprocessor is an index into this array.

PntosPreprocessor *(*new_preprocessor)(struct PntosPreprocessorPlugin *self, size_t preprocessor_index, char *config_group)
Param preprocessor_index

Since the PntosPreprocessorPlugin can create num_preprocessors different kinds of PntosPreprocessor, the preprocessor_index parameter is used to select which kind of preprocessor to create a new instance of. The preprocessor_identifiers field contains identifying strings for the kinds of preprocessors. For example, if the plugin can create 45 different preprocessors, the identifier of the last preprocessor that can be created is found in preprocessor_identifiers[44]. An instance of this preprocessor can be created by calling new_preprocessor(self, 44, ...). Note that 0 <= preprocessor_index < num_preprocessors.

Param config_group

Indicates which (if any) parameter group in the registry may be used to obtain additional configuration values to generate the new preprocessor. If the preprocessor requires no outside configuration, config_group may be NULL.

Return

A newly created PntosPreprocessor. Returns NULL if preprocessor_index is greater than or equal to num_preprocessors or if config_group is invalid.