]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSPosix/mDNSPosix.h
mDNSResponder-66.3.tar.gz
[apple/mdnsresponder.git] / mDNSPosix / mDNSPosix.h
1 /*
2 * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
13 * file.
14 *
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24
25 Change History (most recent first):
26
27 $Log: mDNSPosix.h,v $
28 Revision 1.15 2004/02/06 01:19:51 cheshire
29 Conditionally exclude IPv6 code unless HAVE_IPV6 is set
30
31 Revision 1.14 2004/01/28 21:12:15 cheshire
32 Reconcile mDNSIPv6Support & HAVE_IPV6 into a single flag (HAVE_IPV6)
33
34 Revision 1.13 2004/01/24 05:12:03 cheshire
35 <rdar://problem/3534352>: Need separate socket for issuing unicast queries
36
37 Revision 1.12 2004/01/23 21:37:08 cheshire
38 For consistency, rename multicastSocket to multicastSocket4, and multicastSocketv6 to multicastSocket6
39
40 Revision 1.11 2003/12/11 03:03:51 rpantos
41 Clean up mDNSPosix so that it builds on OS X again.
42
43 Revision 1.10 2003/12/08 20:47:02 rpantos
44 Add support for mDNSResponder on Linux.
45
46 Revision 1.9 2003/10/30 19:25:19 cheshire
47 Fix warning on certain compilers
48
49 Revision 1.8 2003/08/12 19:56:26 cheshire
50 Update to APSL 2.0
51
52 Revision 1.7 2003/07/02 21:19:59 cheshire
53 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
54
55 Revision 1.6 2003/03/13 03:46:21 cheshire
56 Fixes to make the code build on Linux
57
58 Revision 1.5 2003/03/08 00:35:56 cheshire
59 Switched to using new "mDNS_Execute" model (see "mDNSCore/Implementer Notes.txt")
60
61 Revision 1.4 2002/12/23 22:13:31 jgraessl
62
63 Reviewed by: Stuart Cheshire
64 Initial IPv6 support for mDNSResponder.
65
66 Revision 1.3 2002/09/21 20:44:53 zarzycki
67 Added APSL info
68
69 Revision 1.2 2002/09/19 04:20:44 cheshire
70 Remove high-ascii characters that confuse some systems
71
72 Revision 1.1 2002/09/17 06:24:34 cheshire
73 First checkin
74
75 */
76
77 #ifndef __mDNSPlatformPosix_h
78 #define __mDNSPlatformPosix_h
79
80 #include <signal.h>
81 #include <sys/time.h>
82
83 #ifdef __cplusplus
84 extern "C" {
85 #endif
86
87 // PosixNetworkInterface is a record extension of the core NetworkInterfaceInfo
88 // type that supports extra fields needed by the Posix platform.
89 //
90 // IMPORTANT: coreIntf must be the first field in the structure because
91 // we cast between pointers to the two different types regularly.
92
93 typedef struct PosixNetworkInterface PosixNetworkInterface;
94
95 struct PosixNetworkInterface
96 {
97 NetworkInterfaceInfo coreIntf;
98 const char * intfName;
99 PosixNetworkInterface * aliasIntf;
100 int index;
101 int multicastSocket4;
102 #if HAVE_IPV6
103 int multicastSocket6;
104 #endif
105 };
106
107 // This is a global because debugf_() needs to be able to check its value
108 extern int gMDNSPlatformPosixVerboseLevel;
109
110 struct mDNS_PlatformSupport_struct
111 {
112 int unicastSocket4;
113 #if HAVE_IPV6
114 int unicastSocket6;
115 #endif
116 };
117
118 extern mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m);
119 // See comment in implementation.
120
121 // Call mDNSPosixGetFDSet before calling select(), to update the parameters
122 // as may be necessary to meet the needs of the mDNSCore code.
123 // The timeout pointer MUST NOT be NULL.
124 // Set timeout->tv_sec to 0x3FFFFFFF if you want to have effectively no timeout
125 // After calling mDNSPosixGetFDSet(), call select(nfds, &readfds, NULL, NULL, &timeout); as usual
126 // After select() returns, call mDNSPosixProcessFDSet() to let mDNSCore do its work
127 extern void mDNSPosixGetFDSet(mDNS *m, int *nfds, fd_set *readfds, struct timeval *timeout);
128 extern void mDNSPosixProcessFDSet(mDNS *const m, fd_set *readfds);
129
130 typedef void (*mDNSPosixEventCallback)( void *context);
131
132 extern mStatus mDNSPosixAddFDToEventLoop( int fd, mDNSPosixEventCallback callback, void *context);
133 extern mStatus mDNSPosixRemoveFDFromEventLoop( int fd);
134 extern mStatus mDNSPosixListenForSignalInEventLoop( int signum);
135 extern mStatus mDNSPosixIgnoreSignalInEventLoop( int signum);
136 extern mStatus mDNSPosixRunEventLoopOnce( mDNS *m, const struct timeval *pTimeout, sigset_t *pSignalsReceived, mDNSBool *pDataDispatched);
137
138 #ifdef __cplusplus
139 }
140 #endif
141
142 #endif