Function ndpi_flowv4_flow_hash
Defined in File ndpi_api.h
Function Documentation
-
int ndpi_flowv4_flow_hash(u_int8_t l4_proto, u_int32_t src_ip, u_int32_t dst_ip, u_int16_t src_port, u_int16_t dst_port, u_int8_t icmp_type, u_int8_t icmp_code, u_char *hash_buf, u_int8_t hash_buf_len)
Compute the Community ID hash for an IPv4 flow. Community ID is a standard for flow hashing that enables correlation of network traffic across different monitoring tools. Specification: https://github.com/corelight/community-id-spec
- Parameters:
l4_proto – Layer 4 protocol (e.g., IPPROTO_TCP, IPPROTO_UDP)
src_ip – Source IPv4 address in host byte order
dst_ip – Destination IPv4 address in host byte order
src_port – Source port (host byte order), or 0 for non-port protocols
dst_port – Destination port (host byte order), or 0 for non-port protocols
icmp_type – ICMP type (for ICMP), or 0 otherwise
icmp_code – ICMP code (for ICMP), or 0 otherwise
hash_buf – Buffer to store the resulting hash
hash_buf_len – Length of hash_buf (must be at least 20 bytes for SHA1)
- Returns:
0 on success, -1 on error