Function indy::api::agent::indy_agent_listen [] [src]

#[no_mangle]
pub extern "C" fn indy_agent_listen(
    command_handle: i32,
    endpoint: *const c_char,
    listener_cb: Option<extern "C" fn(_: i32, _: ErrorCode, _: i32)>,
    connection_cb: Option<extern "C" fn(_: i32, _: ErrorCode, _: i32, _: *const c_char, _: *const c_char)>,
    message_cb: Option<extern "C" fn(_: i32, _: ErrorCode, _: *const c_char)>
) -> ErrorCode

Starts listening of agent connections.

Listener will accept only connections to registered DIDs by indy_agent_add_identity call.

Information about sender Identity for incomming connection validation can be saved in the wallet with indy_store_their_did call before establishing of connection. If there is no corresponded wallet record for sender Identity than listener will lookup Identity Ledger and cache this information in the wallet.

Note that messages encryption/decryption will be performed automatically.

Params

command_handle: command handle to map callback to caller context. endpoint: endpoint to use in starting listener. listener_cb: Callback that will be called after listening started or on error. Will be called exactly once with result of start listen operation. connection_cb: Callback that will be called after establishing of incoming connection. Can be called multiply times: once for each incoming connection. message_cb: Callback that will be called on receiving of an incoming message. Can be called multiply times: once for each incoming message.

Returns

Error code listener_cb: - xcommand_handle: command handle to map callback to caller context. - err: Error code - listener_handle: Listener handle to use for mapping of incomming connections to this listener. connection_cb: - xlistener_handle: Listener handle. Identifies listener. - err: Error code - connection_handle: Connection handle to use for messages sending and mapping of incomming messages to to this connection. - sender_did: Id of sender Identity stored in secured Wallet. - receiver_did: Id of receiver Identity. message_cb: - xconnection_handle: Connection handle. Indetnifies connection. - err: Error code. - message: Received message.