]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/getifaddrs-internal.h
2 * getifaddrs definitions for CUPS.
4 * Copyright 2007-2018 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
11 #ifndef _CUPS_GETIFADDRS_INTERNAL_H_
12 # define _CUPS_GETIFADDRS_INTERNAL_H_
15 * Include necessary headers...
20 # define _WINSOCK_DEPRECATED_NO_WARNINGS 1
22 # include <winsock2.h>
23 # define CUPS_SOCAST (const char *)
27 # include <sys/socket.h>
31 # if defined(__APPLE__) && !defined(_SOCKLEN_T)
33 * macOS 10.2.x does not define socklen_t, and in fact uses an int instead of
34 * unsigned type for length values...
37 typedef int socklen_t
;
38 # endif /* __APPLE__ && !_SOCKLEN_T */
43 # ifdef HAVE_GETIFADDRS
46 # include <sys/ioctl.h>
47 # ifdef HAVE_SYS_SOCKIO_H
48 # include <sys/sockio.h>
49 # endif /* HAVE_SYS_SOCKIO_H */
50 # endif /* HAVE_GETIFADDRS */
60 # endif /* __cplusplus */
64 * Some OS's don't have getifaddrs() and freeifaddrs()...
67 # if !defined(_WIN32) && !defined(HAVE_GETIFADDRS)
70 # endif /* ifa_dstaddr */
72 # define ifr_netmask ifr_addr
73 # endif /* !ifr_netmask */
75 struct ifaddrs
/**** Interface Structure ****/
77 struct ifaddrs
*ifa_next
; /* Next interface in list */
78 char *ifa_name
; /* Name of interface */
79 unsigned int ifa_flags
; /* Flags (up, point-to-point, etc.) */
80 struct sockaddr
*ifa_addr
, /* Network address */
81 *ifa_netmask
; /* Address mask */
84 struct sockaddr
*ifu_broadaddr
; /* Broadcast address of this interface. */
85 struct sockaddr
*ifu_dstaddr
; /* Point-to-point destination address. */
88 void *ifa_data
; /* Interface statistics */
91 # ifndef ifa_broadaddr
92 # define ifa_broadaddr ifa_ifu.ifu_broadaddr
93 # endif /* !ifa_broadaddr */
95 # define ifa_dstaddr ifa_ifu.ifu_dstaddr
96 # endif /* !ifa_dstaddr */
98 extern int _cups_getifaddrs(struct ifaddrs
**addrs
) _CUPS_PRIVATE
;
99 # define getifaddrs _cups_getifaddrs
100 extern void _cups_freeifaddrs(struct ifaddrs
*addrs
) _CUPS_PRIVATE
;
101 # define freeifaddrs _cups_freeifaddrs
102 # endif /* !_WIN32 && !HAVE_GETIFADDRS */
111 # endif /* __cplusplus */
113 #endif /* !_CUPS_GETIFADDRS_INTERNAL_H_ */