mptcpd
Multipath TCP Daemon
Loading...
Searching...
No Matches
Macros | Functions
commands.h File Reference

mptcpd generic netlink command utilities. More...

#include <stdbool.h>
#include <stddef.h>
#include <assert.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <linux/netlink.h>
Include dependency graph for commands.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MPTCPD_NLA_ALIGN(v)   (NLA_HDRLEN + NLA_ALIGN(sizeof(v)))
 Return netlink aligned size of a variable or type.
 
#define MPTCPD_NLA_ALIGN_OPT(v)   ((v) == 0 ? 0 : (MPTCPD_NLA_ALIGN(v)))
 Return netlink aligned size of an optional variable.
 
#define MPTCPD_NLA_ALIGN_ADDR(v)    (NLA_HDRLEN + NLA_ALIGN(mptcpd_get_addr_size(v)))
 Return netlink aligned size of an IP address.
 

Functions

uint16_t mptcpd_get_port_number (struct sockaddr const *addr)
 Get TCP port number (host byte order).
 
struct mptcpd_pm_cmd_ops const * mptcpd_get_upstream_cmd_ops (void)
 Get upstream kernel MPTCP generic netlink command operations.
 
struct mptcpd_pm_cmd_ops const * mptcpd_get_mptcp_org_cmd_ops (void)
 Get multipath-tcp.org kernel MPTCP generic netlink command operations.
 
bool mptcpd_check_genl_error (struct l_genl_msg *msg, char const *fname)
 Check for genl operation failure.
 
void mptcpd_family_send_callback (struct l_genl_msg *msg, void *user_data)
 Generic error reporting callback.
 

Detailed Description

mptcpd generic netlink command utilities.

Copyright (c) 2017-2022, Intel Corporation

Macro Definition Documentation

◆ MPTCPD_NLA_ALIGN

#define MPTCPD_NLA_ALIGN (   v)    (NLA_HDRLEN + NLA_ALIGN(sizeof(v)))

Return netlink aligned size of a variable or type.

Parameters
[in]vVariable or type to be aligned.

◆ MPTCPD_NLA_ALIGN_ADDR

#define MPTCPD_NLA_ALIGN_ADDR (   v)     (NLA_HDRLEN + NLA_ALIGN(mptcpd_get_addr_size(v)))

Return netlink aligned size of an IP address.

Parameters
[in]vPointer to struct sockaddr containing an IP address (i.e., struct in_addr or struct in6_addr ) to be aligned.
Returns
The netlink aligned size of the IP address contained in the sockaddr pointed to by v.

◆ MPTCPD_NLA_ALIGN_OPT

#define MPTCPD_NLA_ALIGN_OPT (   v)    ((v) == 0 ? 0 : (MPTCPD_NLA_ALIGN(v)))

Return netlink aligned size of an optional variable.

Parameters
[in]vVariable to be aligned.
Returns
The netlink aligned size of the variable v or 0 if v is zero or implicitly convertible to zero (e.g. NULL).

Function Documentation

◆ mptcpd_check_genl_error()

bool mptcpd_check_genl_error ( struct l_genl_msg *  msg,
char const *  fname 
)

Check for genl operation failure.

Check for generic netlink operation failure, and log associated error message.

Parameters
[in]msgGeneric netlink message information.
[in]fnameName function from which the error check was initiated.
Returns
true if no error was found, and false otherwise.

◆ mptcpd_family_send_callback()

void mptcpd_family_send_callback ( struct l_genl_msg *  msg,
void *  user_data 
)

Generic error reporting callback.

Parameters
[in]msgGeneric netlink message information.
[in]user_dataFunction name.

◆ mptcpd_get_port_number()

uint16_t mptcpd_get_port_number ( struct sockaddr const *  addr)

Get TCP port number (host byte order).

Parameters
[in]addrNetwork address information.

Get TCP port suitably typed for use in MPTCP generic netlink API calls, or zero if no address was provided.

Returns
TCP port number in host byte order, or zero if no IP address was provided.