]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/mDNSWin32.h
mDNSResponder-379.38.1.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / mDNSWin32.h
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18 #ifndef __MDNS_WIN32__
19 #define __MDNS_WIN32__
20
21 #include "CommonServices.h"
22
23 #if( !defined( _WIN32_WCE ) )
24 #include <mswsock.h>
25 #endif
26
27 #include "mDNSEmbeddedAPI.h"
28 #include "uDNS.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34
35 typedef void ( *TCPUserCallback )();
36
37 struct TCPSocket_struct
38 {
39 TCPSocketFlags flags; // MUST BE FIRST FIELD -- mDNSCore expects every TCPSocket_struct to begin with TCPSocketFlags flags
40 SOCKET fd;
41 BOOL connected;
42 TCPUserCallback userCallback;
43 void * userContext;
44 BOOL closed;
45 mDNS * m;
46 };
47
48
49 struct UDPSocket_struct
50 {
51 mDNSIPPort port; // MUST BE FIRST FIELD -- mDNSCoreReceive expects every UDPSocket_struct to begin with mDNSIPPort port
52 mDNSAddr addr; // This is initialized by our code. If we don't get the
53 // dstAddr from WSARecvMsg we use this value instead.
54 SOCKET fd;
55 LPFN_WSARECVMSG recvMsgPtr;
56 DNSMessage packet;
57 struct mDNSInterfaceData *ifd;
58 UDPSocket *next;
59 mDNS *m;
60 };
61
62
63 //---------------------------------------------------------------------------------------------------------------------------
64 /*! @struct mDNSInterfaceData
65
66 @abstract Structure containing interface-specific data.
67 */
68
69 typedef struct mDNSInterfaceData mDNSInterfaceData;
70 struct mDNSInterfaceData
71 {
72 char name[ 128 ];
73 uint32_t index;
74 uint32_t scopeID;
75 struct UDPSocket_struct sock;
76 NetworkInterfaceInfo interfaceInfo;
77 mDNSBool hostRegistered;
78 mDNSInterfaceData * next;
79 };
80
81
82 //---------------------------------------------------------------------------------------------------------------------------
83 /*! @typedef ReportStatusFunc
84 */
85 typedef void (*ReportStatusFunc)(int inType, const char *inFormat, ...);
86
87
88 //---------------------------------------------------------------------------------------------------------------------------
89 /*! @struct mDNS_PlatformSupport_struct
90
91 @abstract Structure containing platform-specific data.
92 */
93
94 struct mDNS_PlatformSupport_struct
95 {
96 HANDLE mainThread;
97 HANDLE checkFileSharesTimer;
98 mDNSs32 checkFileSharesTimeout;
99 ReportStatusFunc reportStatusFunc;
100 time_t nextDHCPLeaseExpires;
101 char nbname[ 32 ];
102 char nbdomain[ 32 ];
103 mDNSBool smbFileSharing;
104 mDNSBool smbPrintSharing;
105 ServiceRecordSet smbSRS;
106 AuthRecord smbSubTypes[ 2 ];
107 mDNSBool registeredLoopback4;
108 int interfaceCount;
109 mDNSInterfaceData * interfaceList;
110 mDNSInterfaceData * inactiveInterfaceList;
111 struct UDPSocket_struct unicastSock4;
112 struct UDPSocket_struct unicastSock6;
113 DWORD osMajorVersion;
114 DWORD osMinorVersion;
115 };
116
117 //---------------------------------------------------------------------------------------------------------------------------
118 /*! @struct ifaddrs
119
120 @abstract Interface information
121 */
122
123 struct ifaddrs
124 {
125 struct ifaddrs * ifa_next;
126 char * ifa_name;
127 u_int ifa_flags;
128 struct sockaddr * ifa_addr;
129 struct sockaddr * ifa_netmask;
130 struct sockaddr * ifa_broadaddr;
131 struct sockaddr * ifa_dstaddr;
132 BYTE ifa_physaddr[6];
133 BOOL ifa_dhcpEnabled;
134 time_t ifa_dhcpLeaseExpires;
135 mDNSu8 ifa_womp;
136 void * ifa_data;
137
138 struct
139 {
140 uint32_t index;
141
142 } ifa_extra;
143 };
144
145
146 extern void InterfaceListDidChange( mDNS * const inMDNS );
147 extern void ComputerDescriptionDidChange( mDNS * const inMDNS );
148 extern void TCPIPConfigDidChange( mDNS * const inMDNS );
149 extern void DynDNSConfigDidChange( mDNS * const inMDNS );
150 extern void FileSharingDidChange( mDNS * const inMDNS );
151 extern void FirewallDidChange( mDNS * const inMDNS );
152 extern mStatus TCPAddSocket( mDNS * const inMDNS, TCPSocket *sock );
153 extern mStatus SetupInterfaceList( mDNS * const inMDNS );
154 extern mStatus TearDownInterfaceList( mDNS * const inMDNS );
155 extern BOOL IsWOMPEnabled();
156 extern void DispatchSocketEvents( mDNS * const inMDNS );
157
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #endif // __MDNS_WIN32__