mco_iot_replicator_enum_agents

Enumerate the active connections for this replicator.

For an overview see page ARF Applications in C

Prototype

    MCO_RET mco_iot_replicator_enum_agents(
        mco_iot_replicator_h repl,
        iot_agent_enumerator_t enumerator,
        void *context);

Arguments

repl
The replicator object.
enumerator

The iot_agent_enumerator_t callback function with signature:

    typedef mco_bool
        (*iot_agent_enumerator_t)
        (mco_iot_replicator_h repl, iot_connection_h iotc, void *context);
context
A user-defined context (a pointer to a structure containing application-specific data).

Description

The function enumerates the active connections for this replicator. For each active connection it calls the enumerator, passing the replicator repl, the current active connection and the context. If the enumerator callback returns MCO_NO, this function stops enumeration of the connections (and returns MCO_S_OK).

Return Codes

MCO_S_OK
Connections were successfully enumerated.
MCO_E_IOT_INVALID_HANDLE
Invalid replicator handle repl.

Example

    mco_bool print_iot_agent(mco_iot_replicator_h repl, mco_iot_connection_h iotc, void *context)
    {
        printf("Agent %llu is active\n", mco_iot_conn_get_agent_id(iotc));
        return MCO_YES;
    }

    mco_iot_replicator_enum_agents(repl, &print_iot_agent, 0);

Files

Header file:
mcoiot.h
Source file:
mcoiotrepl.c
Library:
libmcoiotrepl.a