id_manager.c File Reference

Map of network address to MPTCP address ID. More...

`#include <assert.h>`
`#include <stdint.h>`
`#include <sys/socket.h>`
`#include <netinet/in.h>`
`#include <ell/hashmap.h>`
`#include <ell/uintset.h>`
`#include <ell/util.h>`
`#include <mptcpd/private/id_manager.h>`
`#include <mptcpd/id_manager.h>`
Include dependency graph for id_manager.c:

## Classes

struct | mptcpd_idm
| Internal mptcpd address ID manager data. More...

## Macros

#define | MPTCPD_INVALID_ID 0
| Invalid MPTCP address ID.
#define | MPTCPD_MIN_ID 1
| Minimum MPTCP address ID.
#define | MPTCPD_MAX_ID UINT8_MAX
| Maximum MPTCP address ID.

## Functions

struct mptcpd_idm * | mptcpd_idm_create (void)
| Create MPTCP address ID manager. More...
void | mptcpd_idm_destroy (struct mptcpd_idm *idm)
| Destroy MPTCP address ID manager. More...
bool | mptcpd_idm_map_id (struct mptcpd_idm *idm, struct sockaddr const *sa, mptcpd_aid_t id)
| Map an IP address to a MPTCP address ID. More...
mptcpd_aid_t | mptcpd_idm_get_id (struct mptcpd_idm *idm, struct sockaddr const *sa)
| Get MPTCP address ID. More...
mptcpd_aid_t | mptcpd_idm_remove_id (struct mptcpd_idm *idm, struct sockaddr const *sa)
| Remove MPTCP address ID. More...

## Detailed Description

Map of network address to MPTCP address ID.

Copyright (c) 2020, 2021, Intel Corporation

## Function Documentation

## mptcpd_idm_create()

struct mptcpd_idm* mptcpd_idm_create | ( | void |  | ) |

Create MPTCP address ID manager.

Returns
  Pointer to MPTCP address ID manager on success. `NULL` on failure.

## mptcpd_idm_destroy()

void mptcpd_idm_destroy | ( | struct mptcpd_idm * | idm | ) |

Destroy MPTCP address ID manager.

Parameters

  [in,out] | idm | The mptcpd address ID manager object.

## mptcpd_idm_get_id()

mptcpd_aid_t mptcpd_idm_get_id | ( | struct mptcpd_idm * | idm,
|  | struct sockaddr const * | sa
| ) |  |

Get MPTCP address ID.

Map an IP address to a MPTCP address ID, and return that ID.

Parameters

  [in] | idm | The mptcpd address ID manager object.
  [in] | sa | IP address information.

Returns
  MPTCP address ID associated with the address sa, or zero on error.

## mptcpd_idm_map_id()

bool mptcpd_idm_map_id | ( | struct mptcpd_idm * | idm,
|  | struct sockaddr const * | sa,
|  | mptcpd_aid_t | id
| ) |  |

Map an IP address to a MPTCP address ID.

Map an IP address to a MPTCP address ID. The MPTCP addresses ID for an existing IP address will be updated with the new ID.

Note
  This function is only meant for internal use by mptcpd.

Parameters

  [in] | idm | The mptcpd address ID manager object.
  [in] | sa | IP address information.
  [in] | id | MPTCP address ID.

Returns
  `true` if mapping succeeded, and `false` otherwise.

## mptcpd_idm_remove_id()

mptcpd_aid_t mptcpd_idm_remove_id | ( | struct mptcpd_idm * | idm,
|  | struct sockaddr const * | sa
| ) |  |

Remove MPTCP address ID.

Stop associating the MPTCP address ID with the given IP address.

Parameters

  [in] | idm | The mptcpd address ID manager object.
  [in] | sa | IP address information.

Returns
  MPTCP address ID that was removed, or zero if no such ID is associated with the IP address sa. Zero will also be returned if either of the arguments are NULL.