Loading...
Searching...
No Matches
sockaddr.h
Go to the documentation of this file.
// SPDX-License-Identifier: BSD-3-Clause
#ifndef MPTCPD_PRIVATE_SOCKADDR_H
#define MPTCPD_PRIVATE_SOCKADDR_H
#include <stdbool.h>
#include <endian.h>
#include <byteswap.h>
#include <netinet/in.h> // For in_addr_t.
#include <mptcpd/export.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define MPTCPD_CONSTANT_HTONS(hs) __bswap_constant_16(hs)
# define MPTCPD_CONSTANT_HTONL(hl) __bswap_constant_32(hl)
#else
// No need to swap bytes on big endian platforms.
// host byte order == network byte order
# define MPTCPD_CONSTANT_HTONS(hs) hs
# define MPTCPD_CONSTANT_HTONL(hl) hl
#endif // __BYTE_ORDER == __LITTLE_ENDIAN
#ifdef __cplusplus
extern "C" {
#endif
struct in6_addr;
struct sockaddr_storage;
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);
MPTCPD_API struct sockaddr *
mptcpd_sockaddr_copy(struct sockaddr const *sa);
#ifdef __cplusplus
}
#endif
#endif /* MPTCPD_PRIVATE_SOCKADDR_H */
/*
Local Variables:
c-file-style: "linux"
End:
*/
export.h
mptcpd shared library symbol export/import macros.
mptcpd_sockaddr_copy
MPTCPD_API struct sockaddr * mptcpd_sockaddr_copy(struct sockaddr const *sa)
Deep copy a sockaddr.
Definition sockaddr.c:47
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.
Definition sockaddr.c:19