knet_host_enable_status_change_notify3
Install a callback to get host status change events.
Usage
#include <libknet.h>
int knet_host_enable_status_change_notify(
knet_handle_t knet_h,
void *host_status_change_notify_fn_private_data,
void(*)(void *private_data, knet_node_id_t host_id, uint8_t reachable, uint8_t remote, uint8_t external) host_status_change_notify_fn
);
Overview
knet_host_enable_status_change_notify
knet_h - pointer to knet_handle_t
host_status_change_notify_fn_private_data - void pointer to data that can be used to identify the callback
host_status_change_notify_fn - is a callback function that is invoked every time there is a change in the host status. host status is identified by:reachable, this host can send/receive data to/from host_id
remote, 0 if the host_id is connected locally or 1 if the there is one or more knet host(s) in between. NOTE: re-switching is NOT currently implemented, but this is ready for future and can avoid an API/ABI breakage later on.
external, 0 if the host_id is configured locally or 1 if it has been added from remote nodes config. NOTE: dynamic topology is NOT currently implemented, but this is ready for future and can avoid an API/ABI breakage later on. This function MUST NEVER block or add substantial delays.
Return value
knet_host_status_change_notify returns 0 on success -1 on error and errno is set.
Releases
4 releases since Debian 10 (Buster); the text changed 3 times.