xref: /titanic_44/usr/src/cmd/cmd-inet/usr.lib/mdnsd/uds_daemon.h (revision 4b22b9337f359bfd063322244f5336cc7c6ffcfa)
1*4b22b933Srs200217 /* -*- Mode: C; tab-width: 4 -*-
2*4b22b933Srs200217  *
3*4b22b933Srs200217  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
4*4b22b933Srs200217  *
5*4b22b933Srs200217  * Licensed under the Apache License, Version 2.0 (the "License");
6*4b22b933Srs200217  * you may not use this file except in compliance with the License.
7*4b22b933Srs200217  * You may obtain a copy of the License at
8*4b22b933Srs200217  *
9*4b22b933Srs200217  *     http://www.apache.org/licenses/LICENSE-2.0
10*4b22b933Srs200217  *
11*4b22b933Srs200217  * Unless required by applicable law or agreed to in writing, software
12*4b22b933Srs200217  * distributed under the License is distributed on an "AS IS" BASIS,
13*4b22b933Srs200217  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*4b22b933Srs200217  * See the License for the specific language governing permissions and
15*4b22b933Srs200217  * limitations under the License.
16*4b22b933Srs200217 
17*4b22b933Srs200217  	File:		uds_daemon.h
18*4b22b933Srs200217 
19*4b22b933Srs200217  	Contains:	Interfaces necessary to talk to uds_daemon.c.
20*4b22b933Srs200217 
21*4b22b933Srs200217  	Version:	1.0
22*4b22b933Srs200217 
23*4b22b933Srs200217     Change History (most recent first):
24*4b22b933Srs200217 
25*4b22b933Srs200217 $Log: uds_daemon.h,v $
26*4b22b933Srs200217 Revision 1.15  2006/08/14 23:24:57  cheshire
27*4b22b933Srs200217 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
28*4b22b933Srs200217 
29*4b22b933Srs200217 Revision 1.14  2005/01/27 17:48:39  cheshire
30*4b22b933Srs200217 Added comment about CFSocketInvalidate closing the underlying socket
31*4b22b933Srs200217 
32*4b22b933Srs200217 Revision 1.13  2004/12/10 05:27:26  cheshire
33*4b22b933Srs200217 <rdar://problem/3909147> Guard against multiple autoname services of the same type on the same machine
34*4b22b933Srs200217 
35*4b22b933Srs200217 Revision 1.12  2004/12/10 04:28:28  cheshire
36*4b22b933Srs200217 <rdar://problem/3914406> User not notified of name changes for services using new UDS API
37*4b22b933Srs200217 
38*4b22b933Srs200217 Revision 1.11  2004/12/06 21:15:23  ksekar
39*4b22b933Srs200217 <rdar://problem/3884386> mDNSResponder crashed in CheckServiceRegistrations
40*4b22b933Srs200217 
41*4b22b933Srs200217 Revision 1.10  2004/10/26 04:31:44  cheshire
42*4b22b933Srs200217 Rename CountSubTypes() as ChopSubTypes()
43*4b22b933Srs200217 
44*4b22b933Srs200217 Revision 1.9  2004/09/30 00:25:00  ksekar
45*4b22b933Srs200217 <rdar://problem/3695802> Dynamically update default registration domains on config change
46*4b22b933Srs200217 
47*4b22b933Srs200217 Revision 1.8  2004/09/21 21:05:11  cheshire
48*4b22b933Srs200217 Move duplicate code out of mDNSMacOSX/daemon.c and mDNSPosix/PosixDaemon.c,
49*4b22b933Srs200217 into mDNSShared/uds_daemon.c
50*4b22b933Srs200217 
51*4b22b933Srs200217 Revision 1.7  2004/09/17 01:08:55  cheshire
52*4b22b933Srs200217 Renamed mDNSClientAPI.h to mDNSEmbeddedAPI.h
53*4b22b933Srs200217   The name "mDNSClientAPI.h" is misleading to new developers looking at this code. The interfaces
54*4b22b933Srs200217   declared in that file are ONLY appropriate to single-address-space embedded applications.
55*4b22b933Srs200217   For clients on general-purpose computers, the interfaces defined in dns_sd.h should be used.
56*4b22b933Srs200217 
57*4b22b933Srs200217 Revision 1.6  2004/08/11 01:58:49  cheshire
58*4b22b933Srs200217 Remove "mDNS *globalInstance" parameter from udsserver_init()
59*4b22b933Srs200217 
60*4b22b933Srs200217 Revision 1.5  2004/06/18 04:44:58  rpantos
61*4b22b933Srs200217 Use platform layer for socket types
62*4b22b933Srs200217 
63*4b22b933Srs200217 Revision 1.4  2004/06/12 00:51:58  cheshire
64*4b22b933Srs200217 Changes for Windows compatibility
65*4b22b933Srs200217 
66*4b22b933Srs200217 Revision 1.3  2004/01/25 00:03:21  cheshire
67*4b22b933Srs200217 Change to use mDNSVal16() instead of private PORT_AS_NUM() macro
68*4b22b933Srs200217 
69*4b22b933Srs200217 Revision 1.2  2004/01/24 08:46:26  bradley
70*4b22b933Srs200217 Added InterfaceID<->Index platform interfaces since they are now used by all platforms for the DNS-SD APIs.
71*4b22b933Srs200217 
72*4b22b933Srs200217 Revision 1.1  2003/12/08 21:11:42  rpantos;
73*4b22b933Srs200217 Changes necessary to support mDNSResponder on Linux.
74*4b22b933Srs200217 
75*4b22b933Srs200217 */
76*4b22b933Srs200217 
77*4b22b933Srs200217 #pragma ident	"%Z%%M%	%I%	%E% SMI"
78*4b22b933Srs200217 
79*4b22b933Srs200217 #include "mDNSEmbeddedAPI.h"
80*4b22b933Srs200217 #include "dnssd_ipc.h"
81*4b22b933Srs200217 
82*4b22b933Srs200217 
83*4b22b933Srs200217 /* Client interface: */
84*4b22b933Srs200217 
85*4b22b933Srs200217 #define SRS_PORT(S) mDNSVal16((S)->RR_SRV.resrec.rdata->u.srv.port)
86*4b22b933Srs200217 
87*4b22b933Srs200217 extern int udsserver_init(void);
88*4b22b933Srs200217 
89*4b22b933Srs200217 // takes the next scheduled event time, does idle work, and returns the updated nextevent time
90*4b22b933Srs200217 extern mDNSs32 udsserver_idle(mDNSs32 nextevent);
91*4b22b933Srs200217 
92*4b22b933Srs200217 extern void udsserver_info(mDNS *const m);	// print out info about current state
93*4b22b933Srs200217 
94*4b22b933Srs200217 extern void udsserver_handle_configchange(void);
95*4b22b933Srs200217 
96*4b22b933Srs200217 extern int udsserver_exit(void);	// should be called prior to app exit
97*4b22b933Srs200217 
98*4b22b933Srs200217 extern void udsserver_default_reg_domain_changed(const domainname *d, mDNSBool add);
99*4b22b933Srs200217 extern void udsserver_default_browse_domain_changed(const domainname *d, mDNSBool add);
100*4b22b933Srs200217 
101*4b22b933Srs200217 /* Routines that uds_daemon expects to link against: */
102*4b22b933Srs200217 
103*4b22b933Srs200217 typedef	void (*udsEventCallback)(void *context);
104*4b22b933Srs200217 
105*4b22b933Srs200217 extern mStatus udsSupportAddFDToEventLoop(dnssd_sock_t fd, udsEventCallback callback, void *context);
106*4b22b933Srs200217 extern mStatus udsSupportRemoveFDFromEventLoop(dnssd_sock_t fd); // Note: This also CLOSES the file descriptor as well
107*4b22b933Srs200217 
108*4b22b933Srs200217 // RecordUpdatedNiceLabel() can be a no-op on platforms that don't care about updating the machine's
109*4b22b933Srs200217 // global default service name (was OS X calls the "Computer Name") in response to name conflicts.
110*4b22b933Srs200217 extern void RecordUpdatedNiceLabel(mDNS *const m, mDNSs32 delay);
111*4b22b933Srs200217 
112*4b22b933Srs200217 // Globals and functions defined in uds_daemon.c and also shared with the old "daemon.c" on OS X
113*4b22b933Srs200217 extern mDNS mDNSStorage;
114*4b22b933Srs200217 extern mDNSs32 ChopSubTypes(char *regtype);
115*4b22b933Srs200217 extern AuthRecord *AllocateSubTypes(mDNSs32 NumSubTypes, char *p);
116*4b22b933Srs200217 extern int CountExistingRegistrations(domainname *srv, mDNSIPPort port);
117*4b22b933Srs200217 extern void FreeExtraRR(mDNS *const m, AuthRecord *const rr, mStatus result);
118*4b22b933Srs200217 extern int CountPeerRegistrations(mDNS *const m, ServiceRecordSet *const srs);
119