dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / cmd-inet / usr.lib / mdnsd / mDNSPosix.h
blobd3d413eb3cb729c33b089d79f4830d6dbf417429
1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef __mDNSPlatformPosix_h
19 #define __mDNSPlatformPosix_h
21 #include <signal.h>
22 #include <sys/time.h>
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 // PosixNetworkInterface is a record extension of the core NetworkInterfaceInfo
29 // type that supports extra fields needed by the Posix platform.
31 // IMPORTANT: coreIntf must be the first field in the structure because
32 // we cast between pointers to the two different types regularly.
34 typedef struct PosixNetworkInterface PosixNetworkInterface;
36 struct PosixNetworkInterface
38 NetworkInterfaceInfo coreIntf; // MUST be the first element in this structure
39 mDNSs32 LastSeen;
40 const char * intfName;
41 PosixNetworkInterface * aliasIntf;
42 int index;
43 int multicastSocket4;
44 #if HAVE_IPV6
45 int multicastSocket6;
46 #endif
49 // This is a global because debugf_() needs to be able to check its value
50 extern int gMDNSPlatformPosixVerboseLevel;
52 struct mDNS_PlatformSupport_struct
54 int unicastSocket4;
55 #if HAVE_IPV6
56 int unicastSocket6;
57 #endif
60 #define uDNS_SERVERS_FILE "/etc/resolv.conf"
61 extern int ParseDNSServers(mDNS *m, const char *filePath);
62 extern mStatus mDNSPlatformPosixRefreshInterfaceList(mDNS *const m);
63 // See comment in implementation.
65 // Call mDNSPosixGetFDSet before calling select(), to update the parameters
66 // as may be necessary to meet the needs of the mDNSCore code.
67 // The timeout pointer MUST NOT be NULL.
68 // Set timeout->tv_sec to 0x3FFFFFFF if you want to have effectively no timeout
69 // After calling mDNSPosixGetFDSet(), call select(nfds, &readfds, NULL, NULL, &timeout); as usual
70 // After select() returns, call mDNSPosixProcessFDSet() to let mDNSCore do its work
71 extern void mDNSPosixGetFDSet(mDNS *m, int *nfds, fd_set *readfds, struct timeval *timeout);
72 extern void mDNSPosixProcessFDSet(mDNS *const m, fd_set *readfds);
74 typedef void (*mDNSPosixEventCallback)(int fd, short filter, void *context);
76 extern mStatus mDNSPosixAddFDToEventLoop( int fd, mDNSPosixEventCallback callback, void *context);
77 extern mStatus mDNSPosixRemoveFDFromEventLoop( int fd);
78 extern mStatus mDNSPosixListenForSignalInEventLoop( int signum);
79 extern mStatus mDNSPosixIgnoreSignalInEventLoop( int signum);
80 extern mStatus mDNSPosixRunEventLoopOnce( mDNS *m, const struct timeval *pTimeout, sigset_t *pSignalsReceived, mDNSBool *pDataDispatched);
82 #ifdef __cplusplus
84 #endif
86 #endif