xref: /titanic_51/usr/src/cmd/cmd-inet/usr.lib/mdnsd/uds_daemon.h (revision 80c8f7fad26095c315669ecdfbb0e9c09527c506)
1 /* -*- Mode: C; tab-width: 4 -*-
2  *
3  * Copyright (c) 2002-2003 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     File:		uds_daemon.h
18 
19     Contains:	Interfaces necessary to talk to uds_daemon.c.
20 
21     Version:	1.0
22 
23  */
24 
25 #include "mDNSEmbeddedAPI.h"
26 #include "dnssd_ipc.h"
27 
28 /* Client interface: */
29 
30 #define SRS_PORT(S) mDNSVal16((S)->RR_SRV.resrec.rdata->u.srv.port)
31 
32 extern int udsserver_init(dnssd_sock_t skts[], mDNSu32 count);
33 extern mDNSs32 udsserver_idle(mDNSs32 nextevent);
34 extern void udsserver_info(mDNS *const m);  // print out info about current state
35 extern void udsserver_handle_configchange(mDNS *const m);
36 extern int udsserver_exit(void);    // should be called prior to app exit
37 extern void LogMcastStateInfo(mDNS *const m, mDNSBool mflag, mDNSBool start, mDNSBool mstatelog);
38 #define LogMcastQ       (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMcastQuestion
39 #define LogMcastS       (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMcastService
40 #define LogMcast        (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMsg
41 #define LogMcastNoIdent (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMsgNoIdent
42 
43 /* Routines that uds_daemon expects to link against: */
44 
45 typedef void (*udsEventCallback)(int fd, short filter, void *context);
46 extern mStatus udsSupportAddFDToEventLoop(dnssd_sock_t fd, udsEventCallback callback, void *context, void **platform_data);
47 extern int     udsSupportReadFD(dnssd_sock_t fd, char* buf, int len, int flags, void *platform_data);
48 extern mStatus udsSupportRemoveFDFromEventLoop(dnssd_sock_t fd, void *platform_data); // Note: This also CLOSES the file descriptor as well
49 
50 extern void RecordUpdatedNiceLabel(mDNS *const m, mDNSs32 delay);
51 
52 // Globals and functions defined in uds_daemon.c and also shared with the old "daemon.c" on OS X
53 
54 extern mDNS mDNSStorage;
55 extern DNameListElem *AutoRegistrationDomains;
56 extern DNameListElem *AutoBrowseDomains;
57 
58 extern mDNSs32 ChopSubTypes(char *regtype, char **AnonData);
59 extern AuthRecord *AllocateSubTypes(mDNSs32 NumSubTypes, char *p, char **AnonData);
60 extern int CountExistingRegistrations(domainname *srv, mDNSIPPort port);
61 extern void FreeExtraRR(mDNS *const m, AuthRecord *const rr, mStatus result);
62 extern int CountPeerRegistrations(mDNS *const m, ServiceRecordSet *const srs);
63 
64 #if APPLE_OSX_mDNSResponder
65 
66 extern void machserver_automatic_browse_domain_changed(const domainname *d, mDNSBool add);
67 extern void machserver_automatic_registration_domain_changed(const domainname *d, mDNSBool add);
68 // D2D interface support
69 extern void external_start_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags);
70 extern void external_stop_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags);
71 extern void external_start_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags);
72 extern void external_stop_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags);
73 extern void external_start_resolving_service(mDNSInterfaceID InterfaceID, const domainname *const fqdn, DNSServiceFlags flags);
74 extern void external_stop_resolving_service(mDNSInterfaceID InterfaceID, const domainname *const fqdn, DNSServiceFlags flags);
75 extern void external_connection_release(const domainname *instance);
76 
77 #else   // APPLE_OSX_mDNSResponder
78 
79 #define external_start_browsing_for_service(A,B,C,D) (void)(A)
80 #define external_stop_browsing_for_service(A,B,C,D)  (void)(A)
81 #define external_start_advertising_service(A,B)      (void)(A)
82 #define external_stop_advertising_service(A,B)       (void)(A)
83 #define external_start_resolving_service(A,B,C)      (void)(A)
84 #define external_stop_resolving_service(A,B,C)       (void)(A)
85 #define external_connection_release(A)               (void)(A)
86 
87 #endif // APPLE_OSX_mDNSResponder
88 
89 extern const char mDNSResponderVersionString_SCCS[];
90 #define mDNSResponderVersionString (mDNSResponderVersionString_SCCS+5)
91