ec_control_register_command3

March 26, 2020 Contributors

Name

ec_control_register_command3 — Register a command handler with the system

Synopsis

#include "control.h"

| int **ec_control_register_command3** ( | prefix, |   |
|   | closure, |   |
|   | func); |   |

const char * <var class="pdparam">prefix</var>;
ec_blobject * <var class="pdparam">closure</var>;
ec_control_function2 <var class="pdparam">func</var>;

Description

**Configuration Change. ** This feature is available starting from Momentum 3.2.

Register a command handler with the system.

The command handler is scoped to the generation of the configuration, meaning that the command will not be available if the module that registered it is removed from the configuration.

The control function that is dispatched by this function accepts a blobject as a closure, even though the prototype is defined as taking a void*. The blobject allows the command implementation to manage the lifetime of the closure.

This function may only be called from inside a configuration transaction, meaning that it should be called from within your module ext_init function.

Parameters

prefix

The command name.

closure

A void pointer to the closure. For a description of this data type see “ec_blobject”.

func

A void pointer to the command action.

Return Values

On success this function returns 1; on failure, 0.

Threading

It is legal to call this function in any thread.

See Also

See ec_control_register_command2.