mptcpd
Multipath TCP Daemon
Loading...
Searching...
No Matches
Classes | Macros | Functions
id_manager.c File Reference

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

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

Classes

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

Macros

#define _POSIX_C_SOURCE   200112L
 For XSI-compliant strerror_r().
 
#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_idmmptcpd_idm_create (void)
 Create MPTCP address ID manager.
 
void mptcpd_idm_destroy (struct mptcpd_idm *idm)
 Destroy MPTCP address ID manager.
 
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.
 
mptcpd_aid_t mptcpd_idm_get_id (struct mptcpd_idm *idm, struct sockaddr const *sa)
 Get MPTCP address ID.
 
mptcpd_aid_t mptcpd_idm_remove_id (struct mptcpd_idm *idm, struct sockaddr const *sa)
 Remove MPTCP address ID.
 

Detailed Description

Map of network address to MPTCP address ID.

Copyright (c) 2020-2022, 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]idmThe 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]idmThe mptcpd address ID manager object.
[in]saIP 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]idmThe mptcpd address ID manager object.
[in]saIP address information.
[in]idMPTCP 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]idmThe mptcpd address ID manager object.
[in]saIP 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.