.\" Automatically generated man page, do not edit .TH knet_handle_enable_filter 3 2020-04-23 "kronosnet" "Kronosnet Programmer's Manual" .SH NAME knet_handle_enable_filter \- install a filter to route packets .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_enable_filter\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBvoid *\fP\fIdst_host_filter_fn_private_data\fP, \fBint(*)(void *private_data, const unsigned char *outdata, ssize_t outdata_len, uint8_t tx_rx, knet_node_id_t this_host_id, knet_node_id_t src_host_id, int8_t *channel, knet_node_id_t *dst_host_ids, size_t *dst_host_ids_entries) \fP\fIdst_host_filter_fn\fP ); .fi .SH DESCRIPTION .PP knet_handle_enable_filter .PP knet_h - pointer to knet_handle_t .PP dst_host_filter_fn_private_data void pointer to data that can be used to identify the callback. .PP dst_host_filter_fn - is a callback function that is invoked every time a packet hits datafd (see knet_handle_new(3)). the function allows users to tell libknet where the packet has to be delivered. .PP const unsigned char *outdata - is a pointer to the current packet ssize_t outdata_len - length of the above data uint8_t tx_rx - filter is called on tx or rx (KNET_NOTIFY_TX, KNET_NOTIFY_RX) knet_node_id_t this_host_id - host_id processing the packet knet_node_id_t src_host_id - host_id that generated the packet knet_node_id_t *dst_host_ids - array of KNET_MAX_HOST knet_node_id_t where to store the destinations size_t *dst_host_ids_entries - number of hosts to send the message .PP dst_host_filter_fn should return -1 on error, packet is discarded. 0 packet is unicast and should be sent to dst_host_ids and there are dst_host_ids_entries in the buffer. 1 packet is broadcast/multicast and is sent all hosts. contents of dst_host_ids and dst_host_ids_entries are ignored. (see also kronosnetd/etherfilter.* for an example that filters based on ether protocol) .SH RETURN VALUE .PP knet_handle_enable_filter returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIknet_handle_remove_datafd(3), \fIknet_handle_get_stats(3), \fIknet_host_add(3), \fIknet_handle_pmtud_setfreq(3), \fIknet_handle_pmtud_get(3), \fIknet_host_get_id_by_host_name(3), \fIknet_host_get_status(3), \fIknet_link_add_acl(3), \fIknet_link_get_pong_count(3), \fIknet_link_get_priority(3), \fIknet_handle_free(3), \fIknet_handle_enable_sock_notify(3), \fIknet_handle_get_datafd(3), \fIknet_recv(3), \fIknet_link_get_ping_timers(3), \fIknet_log_get_subsystem_id(3), \fIknet_host_remove(3), \fIknet_host_enable_status_change_notify(3), \fIknet_strtoaddr(3), \fIknet_link_rm_acl(3), \fIknet_send(3), \fIknet_handle_enable_pmtud_notify(3), \fIknet_handle_get_transport_reconnect_interval(3), \fIknet_link_get_enable(3), \fIknet_link_set_priority(3), \fIknet_log_set_loglevel(3), \fIknet_handle_get_channel(3), \fIknet_link_get_config(3), \fIknet_link_get_link_list(3), \fIknet_get_transport_list(3), \fIknet_get_transport_id_by_name(3), \fIknet_log_get_loglevel_id(3), \fIknet_handle_new_ex(3), \fIknet_host_set_name(3), \fIknet_addrtostr(3), \fIknet_handle_setfwd(3), \fIknet_get_compress_list(3), \fIknet_host_set_policy(3), \fIknet_get_transport_name_by_id(3), \fIknet_handle_compress(3), \fIknet_link_get_status(3), \fIknet_handle_add_datafd(3), \fIknet_send_sync(3), \fIknet_log_get_loglevel_name(3), \fIknet_handle_enable_access_lists(3), \fIknet_host_get_host_list(3), \fIknet_host_get_policy(3), \fIknet_link_set_enable(3), \fIknet_link_set_pong_count(3), \fIknet_log_get_subsystem_name(3), \fIknet_host_get_name_by_host_id(3), \fIknet_link_clear_config(3), \fIknet_log_get_loglevel(3), \fIknet_handle_new(3), \fIknet_handle_pmtud_getfreq(3), \fIknet_handle_pmtud_set(3), \fIknet_handle_clear_stats(3), \fIknet_link_set_config(3), \fIknet_handle_crypto(3), \fIknet_get_crypto_list(3), \fIknet_handle_set_transport_reconnect_interval(3), \fIknet_link_clear_acl(3), \fIknet_link_set_ping_timers(3), \fIknet_link_insert_acl(3) .ad .hy .SH "COPYRIGHT" .PP Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.