2 * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 Change History (most recent first):
28 Revision 1.8 2003/08/12 19:56:26 cheshire
31 Revision 1.7 2003/08/06 18:20:51 cheshire
34 Revision 1.6 2003/07/02 21:19:59 cheshire
35 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
37 Revision 1.5 2003/03/13 03:46:21 cheshire
38 Fixes to make the code build on Linux
40 Revision 1.4 2002/12/23 22:13:32 jgraessl
42 Reviewed by: Stuart Cheshire
43 Initial IPv6 support for mDNSResponder.
45 Revision 1.3 2002/09/21 20:44:53 zarzycki
48 Revision 1.2 2002/09/19 04:20:44 cheshire
49 Remove high-ascii characters that confuse some systems
51 Revision 1.1 2002/09/17 06:24:35 cheshire
59 #include <sys/types.h>
60 #include <sys/socket.h>
62 #include <netinet/in.h>
68 #ifdef NOT_HAVE_SOCKLEN_T
69 typedef unsigned int socklen_t
;
72 #if !defined(_SS_MAXSIZE)
73 #define sockaddr_storage sockaddr
76 #ifndef NOT_HAVE_SA_LEN
77 #define GET_SA_LEN(X) (sizeof(struct sockaddr) > ((struct sockaddr*)&(X))->sa_len ? \
78 sizeof(struct sockaddr) : ((struct sockaddr*)&(X))->sa_len )
80 #define GET_SA_LEN(X) (((struct sockaddr*)&(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : \
81 ((struct sockaddr*)&(X))->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr))
83 #define GET_SA_LEN(X) ((X).sa_family == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr))
86 #define IFI_NAME 16 /* same as IFNAMSIZ in <net/if.h> */
87 #define IFI_HADDR 8 /* allow for 64-bit EUI-64 in future */
89 // Renamed from my_in_pktinfo because in_pktinfo is used by Linux.
91 struct my_in_pktinfo
{
92 struct sockaddr_storage ipi_addr
;
93 int ipi_ifindex
; /* received interface index */
94 char ipi_ifname
[IFI_NAME
]; /* received interface name */
97 extern ssize_t
recvfrom_flags(int fd
, void *ptr
, size_t nbytes
, int *flagsp
,
98 struct sockaddr
*sa
, socklen_t
*salenptr
, struct my_in_pktinfo
*pktp
);
101 char ifi_name
[IFI_NAME
]; /* interface name, null terminated */
102 u_char ifi_haddr
[IFI_HADDR
]; /* hardware address */
103 u_short ifi_hlen
; /* #bytes in hardware address: 0, 6, 8 */
104 short ifi_flags
; /* IFF_xxx constants from <net/if.h> */
105 short ifi_myflags
; /* our own IFI_xxx flags */
106 int ifi_index
; /* interface index */
107 struct sockaddr
*ifi_addr
; /* primary address */
108 struct sockaddr
*ifi_brdaddr
;/* broadcast address */
109 struct sockaddr
*ifi_dstaddr
;/* destination address */
110 struct ifi_info
*ifi_next
; /* next of these structures */
113 #define IFI_ALIAS 1 /* ifi_addr is an alias */
115 extern struct ifi_info
*get_ifi_info(int family
, int doaliases
);
116 extern void free_ifi_info(struct ifi_info
*);