ArbCmd objects

ArbCmd objects are created using dqcs_cmd_new():

dqcs_cmd_new()

Creates a new ArbCmd object.

dqcs_handle_t dqcs_cmd_new(
    const char *iface,
    const char *oper
)

Returns the handle of the newly created ArbCmd. The ArbCmd is initialized with the given interface and operation IDs, JSON object {}, and an empty binary argument list. Upon failure, returns 0.

ArbCmd objects support the handle, arb, and cmd interfaces.

The interface and operation IDs are immutable after construction. They can be matched and read using the following functions.

dqcs_cmd_iface_cmp()

Compares the interface ID of an ArbCmd with the given string.

dqcs_bool_return_t dqcs_cmd_iface_cmp(
    dqcs_handle_t cmd,
    const char *iface
)

Returns -1 for failure, 0 for no match, or 1 for a match.

dqcs_cmd_iface_get()

Returns the interface ID of an ArbCmd.

char *dqcs_cmd_iface_get(dqcs_handle_t cmd)

On success, this returns a newly allocated string containing the JSON string. Free it with free() when you're done with it to avoid memory leaks. On failure, this returns NULL.

dqcs_cmd_oper_cmp()

Compares the operation ID of an ArbCmd with the given string.

dqcs_bool_return_t dqcs_cmd_oper_cmp(
    dqcs_handle_t cmd,
    const char *oper
)

Returns -1 for failure, 0 for no match, or 1 for a match.

dqcs_cmd_oper_get()

Returns the operation ID of an ArbCmd.

char *dqcs_cmd_oper_get(dqcs_handle_t cmd)

On success, this returns a newly allocated string containing the JSON string. Free it with free() when you're done with it to avoid memory leaks. On failure, this returns NULL.

In addition to the IDs, ArbCmd objects carry an ArbData object along with them as an argument. This object is accessed by applying dqcs_arb_*() functions directly to the ArbCmd handle.