Loading...
Searching...
No Matches
hash_sockaddr.c File Reference

`struct` `sockaddr` hash related functions. More...

`#include <assert.h>`
`#include <stdint.h>`
`#include <string.h>`
`#include <netinet/in.h>`
`#include <ell/ell.h>`
`#include <mptcpd/private/murmur_hash.h>`
`#include "hash_sockaddr.h"`
Include dependency graph for hash_sockaddr.c:

## Functions

int | mptcpd_hash_sockaddr_compare (void const *a, void const *b)
| Compare hash map keys based on IP address alone.
void * | mptcpd_hash_sockaddr_key_copy (void const *p)
| Deep copy the hash map key p.
void | mptcpd_hash_sockaddr_key_free (void *p)

## Detailed Description

`struct` `sockaddr` hash related functions.

Copyright (c) 2022, Intel Corporation

## Function Documentation

## mptcpd_hash_sockaddr_compare()

int mptcpd_hash_sockaddr_compare | ( | void const * | a,
|  | void const * | b )

Compare hash map keys based on IP address alone.

Parameters

  [in] | a | Pointer `struct` `sockaddr` (left hand side).
  [in] | b | Pointer `struct` `sockaddr` (right hand side).

Returns
  0 if the IP addresses are equal, and -1 or 1 otherwise, depending on IP address family and comparisons of IP addresses of the same type.

Note
  Ports are not compared.

## mptcpd_hash_sockaddr_key_copy()

void * mptcpd_hash_sockaddr_key_copy | ( | void const * | p | ) |

Deep copy the hash map key p.

Returns
  The dynamically allocated deep copy of the hash map key p. Deallocate with `l_free()`.