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>
Go to the source code of this file.
|
#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.
|
|
|
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.
|
|
mptcpd generic netlink command utilities.
Copyright (c) 2017-2022, Intel Corporation
◆ 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] | v | Variable 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] | v | Pointer 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
Return netlink aligned size of an optional variable.
- Parameters
-
[in] | v | Variable 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
).
◆ 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] | msg | Generic netlink message information. |
[in] | fname | Name 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] | msg | Generic netlink message information. |
[in] | user_data | Function name. |
◆ mptcpd_get_port_number()
uint16_t mptcpd_get_port_number |
( |
struct sockaddr const * |
addr | ) |
|
Get TCP port number (host byte order).
- Parameters
-
[in] | addr | Network 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.