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.
mptcpd generic netlink command utilities.
Copyright (c) 2017-2021, 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
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_addr_family()
uint16_t mptcpd_get_addr_family |
( |
struct sockaddr const * |
addr | ) |
|
|
inline |
Get network address family.
- Parameters
-
[in] | addr | Network address information. |
Get network address family suitably typed for use in MPTCP generic netlink API calls, or zero if no address was provided.
- Returns
- Network address family, or zero if no address family was provided.
◆ mptcpd_get_addr_size()
size_t mptcpd_get_addr_size |
( |
struct sockaddr const * |
addr | ) |
|
|
inline |
Get the underlying internet address size.
- Parameters
-
[in] | addr | Network address information. |
- Returns
- Size of the underlying internet address (e.g.,
struct
in_addr6
).
◆ mptcpd_get_port_number()
uint16_t mptcpd_get_port_number |
( |
struct sockaddr const * |
addr | ) |
|
Get IP port number.
- Parameters
-
[in] | addr | Network address information. |
Get IP port suitably typed for use in MPTCP generic netlink API calls, or zero if no address was provided.
- Returns
- IP port number, or zero if no IP address was provided.
◆ mptcpd_is_inet_family()
bool mptcpd_is_inet_family |
( |
struct sockaddr const * |
addr | ) |
|
|
inline |
Check for internet address family.
- Parameters
-
[in] | addr | Network address information. |
- Returns
true
if the addr is an internet address, and false
otherwise.