Skip to main content


ec_control_send_command — Send a command over an ec_console control connection


#include "control.h"

| int **ec_control_send_command** ( | fd, |   | |   | command, |   | |   | closure, |   | |   | consumer); |   |

int <var class="pdparam">fd</var>; const char * <var class="pdparam">command</var>; void * <var class="pdparam">closure</var>; int(*)(void *closure, char *buf, int len) <var class="pdparam">consumer</var>;



This reference page was automatically generated from functions found in the header files in the development branch. The function described here may not exist in generally available versions of Momentum, and may change in behavior when it is generally available. Consult your vendor for definitive advice on the use of this function.

Send a command over an ec_console control connection.



a connection established via cli_conn


the command string to run


a closure to be passed to consumer


a callback function to handle the result

CONSUMER is a callback to handle the results; CLOSURE is passed as the first argument to it. CONSUMER is called with the following values of BUF and LEN in the following situations:

BUF = NULL; LEN = positive. This indicates the total length of the control response to come.

BUF = NULL; LEN = negative. -LEN is equal the an errno encountered while reading the response.

BUF != NULL; LEN = 0. Indicates an EOF while reading the response.

BUF != LEN; LEN > 0. Indicates that LEN bytes are available in BUF.

CONSUMER should return 1 to continue the operation, or 0 if it wants to stop the read.

Return Values

If an error occurs during the write, or during the read of the response header, CONSUMER is not called and ec_control_send_command returns 0. Otherwise, ec_control_send_command returns 1.

See Also

Was this page helpful?