mptcpd
Multipath TCP Daemon
Functions
sockaddr.h File Reference

mptcpd struct sockaddr related utility functions. More...

#include <stdbool.h>
#include <endian.h>
#include <byteswap.h>
#include <netinet/in.h>
#include <mptcpd/export.h>
Include dependency graph for sockaddr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

Swap host ordered bytes in an integer to network byte order.

These macros may be used in place of htons() or htonl() when initializing an IPv4 address or IP port constant at compile-time.

#define MPTCPD_CONSTANT_HTONS(hs)   __bswap_constant_16(hs)
 
#define MPTCPD_CONSTANT_HTONL(hl)   __bswap_constant_32(hl)
 

Functions

MPTCPD_API bool mptcpd_sockaddr_storage_init (in_addr_t const *addr4, struct in6_addr const *addr6, in_port_t port, struct sockaddr_storage *addr)
 Initialize sockaddr_storage instance. More...
 

Detailed Description

mptcpd struct sockaddr related utility functions.

Copyright (c) 2019-2022, Intel Corporation

Function Documentation

◆ mptcpd_sockaddr_storage_init()

MPTCPD_API bool mptcpd_sockaddr_storage_init ( in_addr_t const *  addr4,
struct in6_addr const *  addr6,
in_port_t  port,
struct sockaddr_storage *  addr 
)

Initialize sockaddr_storage instance.

Initialize a sockaddr_storage instance with the provided IPv4 or IPv6 address. Only one is required and used. The port may be zero in cases where it is optional.

Parameters
[in]addr4IPv4 internet address (network byte order).
[in]addr6IPv6 internet address.
[in]portIP port (network byte order).
[in,out]addrmptcpd network address information.
Returns
true on success. false otherwise.