mptcpd
Multipath TCP Daemon
Loading...
Searching...
No Matches
include
mptcpd
private
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
#include <linux/swab.h>
// For __constant_swab*.
19
20
#include <
mptcpd/export.h
>
21
29
#if __BYTE_ORDER == __LITTLE_ENDIAN
30
# define MPTCPD_CONSTANT_HTONS(hs) __swab16(hs)
31
# define MPTCPD_CONSTANT_HTONL(hl) __swab32(hl)
32
#else
33
// No need to swap bytes on big endian platforms.
34
// host byte order == network byte order
35
# define MPTCPD_CONSTANT_HTONS(hs) hs
36
# define MPTCPD_CONSTANT_HTONL(hl) hl
37
#endif
// __BYTE_ORDER == __LITTLE_ENDIAN
39
40
41
#ifdef __cplusplus
42
extern
"C"
{
43
#endif
44
45
struct
in6_addr;
46
struct
sockaddr_storage;
47
62
MPTCPD_API
bool
63
mptcpd_sockaddr_storage_init
(in_addr_t
const
*addr4,
64
struct
in6_addr
const
*addr6,
65
in_port_t port,
66
struct
sockaddr_storage *addr);
67
81
MPTCPD_API
struct
sockaddr *
82
mptcpd_sockaddr_copy
(
struct
sockaddr
const
*sa);
83
84
#ifdef __cplusplus
85
}
86
#endif
87
88
89
#endif
/* MPTCPD_PRIVATE_SOCKADDR_H */
90
91
92
/*
93
Local Variables:
94
c-file-style: "linux"
95
End:
96
*/
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
Generated by
1.9.8