]> git.saurik.com Git - apple/mdnsresponder.git/blame - mDNSCore/uDNS.h
mDNSResponder-108.6.tar.gz
[apple/mdnsresponder.git] / mDNSCore / uDNS.h
CommitLineData
c9d2d929 1/*
8e92c31c
A
2 * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
3 *
c9d2d929 4 * @APPLE_LICENSE_HEADER_START@
8e92c31c 5 *
c9d2d929
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
8e92c31c 12 *
c9d2d929
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
8e92c31c 19 * limitations under the License.
c9d2d929
A
20 *
21 * @APPLE_LICENSE_HEADER_END@
8e92c31c
A
22
23 Change History (most recent first):
24
25$Log: uDNS.h,v $
05292456
A
26Revision 1.32 2005/07/29 19:46:10 ksekar
27<rdar://problem/4191860> reduce polling period on failed LLQs to 15 minutes
28
f5e6e86c
A
29Revision 1.31 2005/03/31 02:19:56 cheshire
30<rdar://problem/4021486> Fix build warnings
31Reviewed by: Scott Herscher
32
7cb34e5c
A
33Revision 1.30 2005/03/04 03:00:03 ksekar
34<rdar://problem/4026546> Retransmissions happen too early, causing registrations to conflict with themselves
35
283ee3ff
A
36Revision 1.29 2005/01/11 22:50:53 ksekar
37Fixed constant naming (was using kLLQ_DefLease for update leases)
38
39Revision 1.28 2004/12/22 00:13:49 ksekar
40<rdar://problem/3873993> Change version, port, and polling interval for LLQ
41
7f0064bd
A
42Revision 1.27 2004/11/23 04:06:50 cheshire
43Get rid of floating point constant -- in a small embedded device, bringing in all
44the floating point libraries just to halve an integer value is a bit too heavyweight.
45
46Revision 1.26 2004/11/22 17:49:15 ksekar
47Changed INIT_REFRESH from fraction to decimal
48
49Revision 1.25 2004/11/22 17:16:20 ksekar
50<rdar://problem/3854298> Unicast services don't disappear when you disable all networking
51
52Revision 1.24 2004/11/19 04:24:08 ksekar
53<rdar://problem/3682609> Security: Enforce a "window" on one-shot wide-area queries
54
55Revision 1.23 2004/11/18 18:04:21 ksekar
56Add INIT_REFRESH constant
57
58Revision 1.22 2004/11/15 20:09:24 ksekar
59<rdar://problem/3719050> Wide Area support for Add/Remove record
60
61Revision 1.21 2004/11/11 20:14:55 ksekar
62<rdar://problem/3719574> Wide-Area registrations not deregistered on sleep
63
64Revision 1.20 2004/10/16 00:16:59 cheshire
65<rdar://problem/3770558> Replace IP TTL 255 check with local subnet source address check
66
67Revision 1.19 2004/09/17 01:08:49 cheshire
68Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
69 The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
70 declared in that file are ONLY appropriate to single-address-space embedded applications.
71 For clients on general-purpose computers, the interfaces defined in dns_sd.h should be used.
72
73Revision 1.18 2004/09/03 19:23:05 ksekar
74<rdar://problem/3788460>: Need retransmission mechanism for wide-area service registrations
75
76Revision 1.17 2004/09/01 03:59:29 ksekar
77<rdar://problem/3783453>: Conditionally compile out uDNS code on Windows
78
79Revision 1.16 2004/08/25 00:37:27 ksekar
80<rdar://problem/3774635>: Cleanup DynDNS hostname registration code
81
82Revision 1.15 2004/07/30 17:40:06 ksekar
83<rdar://problem/3739115>: TXT Record updates not available for wide-area services
84
85Revision 1.14 2004/07/29 19:27:15 ksekar
cc340f17 86NAT-PMP Support - minor fixes and cleanup
7f0064bd
A
87
88Revision 1.13 2004/07/29 02:03:35 ksekar
89Delete unused #define and structure field
90
91Revision 1.12 2004/07/26 22:49:30 ksekar
cc340f17 92<rdar://problem/3651409>: Feature #9516: Need support for NAT-PMP in client
7f0064bd 93
8e92c31c
A
94Revision 1.11 2004/06/17 01:13:11 ksekar
95<rdar://problem/3696616>: polling interval too short
96
97Revision 1.10 2004/06/11 05:45:03 ksekar
98<rdar://problem/3682397>: Change SRV names for LLQ/Update port lookups
99
100Revision 1.9 2004/06/01 23:46:50 ksekar
101<rdar://problem/3675149>: DynDNS: dynamically look up LLQ/Update ports
102
103Revision 1.8 2004/05/28 23:42:37 ksekar
104<rdar://problem/3258021>: Feature: DNS server->client notification on record changes (#7805)
105
106Revision 1.7 2004/05/18 23:51:25 cheshire
107Tidy up all checkin comments to use consistent "<rdar://problem/xxxxxxx>" format for bug numbers
108
109Revision 1.6 2004/03/13 01:57:33 ksekar
110<rdar://problem/3192546>: DynDNS: Dynamic update of service records
111
112Revision 1.5 2004/02/21 08:56:58 bradley
113Wrap prototypes with extern "C" for C++ builds.
114
115Revision 1.4 2004/02/06 23:04:19 ksekar
116Basic Dynamic Update support via mDNS_Register (dissabled via
117UNICAST_REGISTRATION #define)
118
119Revision 1.3 2004/01/24 03:38:27 cheshire
120Fix minor syntactic error: Headers should use "extern" declarations, not "mDNSexport"
121
122Revision 1.2 2004/01/23 23:23:15 ksekar
123Added TCP support for truncated unicast messages.
124
125Revision 1.1 2003/12/13 03:05:27 ksekar
126<rdar://problem/3192548>: DynDNS: Unicast query of service records
127
128
129 */
130
131#ifndef __UDNS_H_
132#define __UDNS_H_
133
7f0064bd 134#include "mDNSEmbeddedAPI.h"
8e92c31c
A
135#include "DNSCommon.h"
136
137#ifdef __cplusplus
138 extern "C" {
139#endif
140
7cb34e5c
A
141#define RESTART_GOODBYE_DELAY (6 * mDNSPlatformOneSecond) // delay after restarting LLQ before nuking previous known answers (avoids flutter if we restart before we have networking up)
142#define MIN_UCAST_PERIODIC_EXEC (5 * mDNSPlatformOneSecond)
143#define INIT_UCAST_POLL_INTERVAL (3 * mDNSPlatformOneSecond) // this interval is used after send failures on network transitions
144 // which typically heal quickly, so we start agressively and exponentially back off
283ee3ff 145#define MAX_UCAST_POLL_INTERVAL (60 * 60 * mDNSPlatformOneSecond)
05292456 146#define LLQ_POLL_INTERVAL (15 * 60 * mDNSPlatformOneSecond) // Polling interval for zones w/ an advertised LLQ port (ie not static zones) if LLQ fails due to NAT, etc.
7cb34e5c 147#define RESPONSE_WINDOW (60 * mDNSPlatformOneSecond) // require server responses within one minute of request
8e92c31c
A
148#define UPDATE_PORT_NAME "_dns-update._udp."
149#define LLQ_PORT_NAME "_dns-llq._udp"
283ee3ff 150#define DEFAULT_UPDATE_LEASE 7200
8e92c31c
A
151
152// Entry points into unicast-specific routines
153
8e92c31c 154extern mStatus uDNS_StartQuery(mDNS *const m, DNSQuestion *const question);
7f0064bd 155extern mDNSBool uDNS_IsActiveQuery(DNSQuestion *const question, uDNS_GlobalInfo *u); // returns true if OK to call StopQuery
8e92c31c 156extern mStatus uDNS_StopQuery(mDNS *const m, DNSQuestion *const question);
7f0064bd 157
f5e6e86c
A
158extern void uDNS_Init(mDNS *const m);
159extern void uDNS_Sleep(mDNS *const m);
160extern void uDNS_Wake(mDNS *const m);
7f0064bd
A
161#define uDNS_Close uDNS_Sleep
162
163// uDNS_UpdateRecord
164// following fields must be set, and the update validated, upon entry.
165// rr->NewRData
166// rr->newrdlength
167// rr->UpdateCallback
168
169extern mStatus uDNS_AddRecordToService(mDNS *const m, ServiceRecordSet *sr, ExtraResourceRecord *extra);
170extern mStatus uDNS_UpdateRecord(mDNS *m, AuthRecord *rr);
8e92c31c
A
171
172extern mStatus uDNS_RegisterRecord(mDNS *const m, AuthRecord *const rr);
173extern mStatus uDNS_DeregisterRecord(mDNS *const m, AuthRecord *const rr);
174
175extern mStatus uDNS_RegisterService(mDNS *const m, ServiceRecordSet *srs);
176extern mStatus uDNS_DeregisterService(mDNS *const m, ServiceRecordSet *srs);
8e92c31c
A
177
178// integer fields of msg header must be in HOST byte order before calling this routine
179extern void uDNS_ReceiveMsg(mDNS *const m, DNSMessage *const msg, const mDNSu8 *const end,
7f0064bd
A
180 const mDNSAddr *const srcaddr, const mDNSIPPort srcport, const mDNSAddr *const dstaddr,
181 const mDNSIPPort dstport, const mDNSInterfaceID InterfaceID);
8e92c31c 182
7f0064bd
A
183extern void uDNS_ReceiveNATMap(mDNS *m, mDNSu8 *pkt, mDNSu16 len);
184
8e92c31c
A
185// returns time of next scheduled event
186extern void uDNS_Execute(mDNS *const m);
187
8e92c31c
A
188
189#ifdef __cplusplus
190 }
191#endif
192
193#endif // __UDNS_H_