9#ifndef SQUID_COMPAT_CMSG_H
10#define SQUID_COMPAT_CMSG_H
18#include <sys/socket.h>
46#if defined(WSA_CMSG_DATA)
47# define SQUID_CMSG_DATA(cmsg) WSA_CMSG_DATA(cmsg)
48#elif defined(CMSG_DATA)
49# define SQUID_CMSG_DATA(cmsg) CMSG_DATA(cmsg)
51# define SQUID_CMSG_DATA(cmsg) ((cmsg)->cmsg_data)
55# define CMSG_NXTHDR(mhdr, X) __cmsg_nxthdr (mhdr, X)
59# define CMSG_FIRSTHDR(mhdr) \
60 ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
61 ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) nullptr)
65# define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
66 & ~(sizeof (size_t) - 1))
70# define CMSG_SPACE(len) (CMSG_ALIGN (len) \
71 + CMSG_ALIGN (sizeof (struct cmsghdr)))
72#undef HAVE_CONSTANT_CMSG_SPACE
73#define HAVE_CONSTANT_CMSG_SPACE 1
77# define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
113# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
114 + strlen ((ptr)->sun_path))
120#ifndef SCM_CREDENTIALS
121#define SCM_CREDENTIALS 2
124#define SCM_SECURITY 3
135#if HAVE_CONSTANT_CMSG_SPACE
136#define SQUID_CMSG_SPACE CMSG_SPACE
139#define SQUID_CMSG_SPACE(len) (sizeof(struct cmsghdr) + (len) + 16)
unsigned char cmsg_data[16]