void (*destroy)(PMX_ENGINE e);
destroy()method should be called to release all resources held by the
PMX_ENGINEobject. This destroys the embedded Perl interpreter. If the engine has been used to instantiate any
PMX_WEIGHTobjects, then those must be destroyed prior to the destruction of the
Creates an instance of the default implementation of the
PMX_ERROR (*create_message)(PMX_ENGINE e, PMX_MESSAGE *m);
pmx_append_to_message()function can be used to add the actual message content to the object.
Adds an attribute that is used to configure the engine and its plug-ins. The
PMX_ERROR (*add_attribute)(PMX_ENGINE e, const char *name, PMX_TYPE t, const void *value, size_t sz, int replace);
replaceparameter indicates that all previous values for this parameter should be discarded. If the
0and the attribute is already set, the value will be added to a list of values for that attribute. (Certain attributes can have multiple values).
Deletes the specified attribute. If the
PMX_ERROR (*del_attribute)(PMX_ENGINE e, const char *name, int all);
allflag is set to
0, then only the first entry in the list of attribute values is deleted. If the
allflag is set to a non-zero value, then all the values for that attribute will be deleted.
The engine (and its plug-ins) can be configured using attributes. Some attributes can have multiple values (all of the same
int (*enumerate_attributes)(PMX_ENGINE e, const char *name, PMX_ATTRIBUTE_CB cb, void *host);
add_attribute()indicates that all previous values for this parameter should be discarded.
del_attribute()is 0, then only the first entry in the list of attribute values is deleted.
If an attribute of type
PMX_TYPE_WEIGHTSis added to the engine, then that object becomes owned by the engine and should no longer be accessed by the hosting application. The
del_attribute()method invokes the destructors as necessary.
Loads the specified spam detection plug-in, enabling it for use.
PMX_ERROR (*load_plugin)(PMX_ENGINE e, const char *plugin);
Invokes the callback
int (*enumerate_loaded_plugins)(PMX_ENGINE e, PMX_PLUGIN_CB cb, void *host);
cbfor each plug-in that has been loaded.
The engine library includes a number of spam detection plug-ins. Only the plug-ins loaded into the engine are used to determine spam features and probabilities. A feature group must be loaded before its attributes are set or modified.
int (*enumerate_plugins)(PMX_ENGINE e, PMX_PLUGIN_CB cb, void *host);
Load antispam data from
PMX_ERROR (*load_antispam_data)(PMX_ENGINE e);
core.datadir. This auto-loads all plug-ins required to run the data, declaring their attributes immediately. The application must set the
core.datadirattribute before calling this method, so that the engine can find the
PMX_ERROR (*scan_message)(PMX_ENGINE e, PMX_MESSAGE m, PMX_WEIGHTS w, PMX_SCAN_CB cb, void *host);
scan_message()method parses the message in the
PMX_MESSAGEobject, detecting spam features using the loaded plug-ins. Found features are reported to the
PMX_SCAN_CBcallback. They are accumulated with weights from
PMX_WEIGHTSto determine a final spam probability rating, which is also reported to the callback. The callback can record these events for future use after
PMX_ERROR (*compile)(PMX_ENGINE e);
compile()method reloads all plug-ins and clears or refreshes any internally cached values. If any plug-in fails to initialize correctly, compile generates log messages describing the failure. If the
core.compileattribute is set to
scan_message()causes the engine to automatically call this method; failures are ignored internally.
PMX_ERROR (*create_hash)(PMX_ENGINE e, PMX_HASH *h, const char *file, int readonly);
create_hash()method creates an instance of the default implementation of the
PMX_HASHobject. The current implementation uses a file to store the table.NoteIt is not safe to update the table while other processes or threads may be reading the same table.