1#include <sys/param.h>
2#include <sys/socket.h>
3
4// Since the cmsg(3) macros are macros instead of functions, they aren't
5// available to FFI.  libc must reimplement them, which is error-prone.  This
6// file provides FFI access to the actual macros so they can be tested against
7// the Rust reimplementations.
8
9struct cmsghdr *cmsg_firsthdr(struct msghdr *msgh) {
10	return CMSG_FIRSTHDR(msgh);
11}
12
13struct cmsghdr *cmsg_nxthdr(struct msghdr *msgh, struct cmsghdr *cmsg) {
14	return CMSG_NXTHDR(msgh, cmsg);
15}
16
17size_t cmsg_space(size_t length) {
18	return CMSG_SPACE(length);
19}
20
21size_t cmsg_len(size_t length) {
22	return CMSG_LEN(length);
23}
24
25unsigned char *cmsg_data(struct cmsghdr *cmsg) {
26	return CMSG_DATA(cmsg);
27}
28
29