mptcpd
Multipath TCP Daemon
sockaddr.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
10#ifndef MPTCPD_PRIVATE_SOCKADDR_H
11#define MPTCPD_PRIVATE_SOCKADDR_H
12
13#include <stdbool.h>
14#include <endian.h>
15#include <byteswap.h>
16
17#include <netinet/in.h> // For in_addr_t.
18
19#include <mptcpd/export.h>
20
28#if __BYTE_ORDER == __LITTLE_ENDIAN
29# define MPTCPD_CONSTANT_HTONS(hs) __bswap_constant_16(hs)
30# define MPTCPD_CONSTANT_HTONL(hl) __bswap_constant_32(hl)
31#else
32// No need to swap bytes on big endian platforms.
33// host byte order == network byte order
34# define MPTCPD_CONSTANT_HTONS(hs) hs
35# define MPTCPD_CONSTANT_HTONL(hl) hl
36#endif // __BYTE_ORDER == __LITTLE_ENDIAN
38
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44struct in6_addr;
45struct sockaddr_storage;
46
61MPTCPD_API bool
62mptcpd_sockaddr_storage_init(in_addr_t const *addr4,
63 struct in6_addr const *addr6,
64 in_port_t port,
65 struct sockaddr_storage *addr);
66
67#ifdef __cplusplus
68}
69#endif
70
71
72#endif /* MPTCPD_PRIVATE_SOCKADDR_H */
73
74
75/*
76 Local Variables:
77 c-file-style: "linux"
78 End:
79*/
mptcpd shared library symbol export/import macros.
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:17