xref: /titanic_51/usr/src/cmd/cmd-inet/usr.lib/mdnsd/uds_daemon.h (revision 5ffb0c9b03b5149ff4f5821a62be4a52408ada2a)
14b22b933Srs200217 /* -*- Mode: C; tab-width: 4 -*-
24b22b933Srs200217  *
34b22b933Srs200217  * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
44b22b933Srs200217  *
54b22b933Srs200217  * Licensed under the Apache License, Version 2.0 (the "License");
64b22b933Srs200217  * you may not use this file except in compliance with the License.
74b22b933Srs200217  * You may obtain a copy of the License at
84b22b933Srs200217  *
94b22b933Srs200217  *     http://www.apache.org/licenses/LICENSE-2.0
104b22b933Srs200217  *
114b22b933Srs200217  * Unless required by applicable law or agreed to in writing, software
124b22b933Srs200217  * distributed under the License is distributed on an "AS IS" BASIS,
134b22b933Srs200217  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
144b22b933Srs200217  * See the License for the specific language governing permissions and
154b22b933Srs200217  * limitations under the License.
164b22b933Srs200217 
174b22b933Srs200217     File:		uds_daemon.h
184b22b933Srs200217 
194b22b933Srs200217     Contains:	Interfaces necessary to talk to uds_daemon.c.
204b22b933Srs200217 
214b22b933Srs200217     Version:	1.0
224b22b933Srs200217 
234b22b933Srs200217  */
244b22b933Srs200217 
254b22b933Srs200217 #include "mDNSEmbeddedAPI.h"
264b22b933Srs200217 #include "dnssd_ipc.h"
274b22b933Srs200217 
284b22b933Srs200217 /* Client interface: */
294b22b933Srs200217 
304b22b933Srs200217 #define SRS_PORT(S) mDNSVal16((S)->RR_SRV.resrec.rdata->u.srv.port)
314b22b933Srs200217 
32*5ffb0c9bSToomas Soome extern int udsserver_init(dnssd_sock_t skts[], mDNSu32 count);
334b22b933Srs200217 extern mDNSs32 udsserver_idle(mDNSs32 nextevent);
344b22b933Srs200217 extern void udsserver_info(mDNS *const m);  // print out info about current state
35*5ffb0c9bSToomas Soome extern void udsserver_handle_configchange(mDNS *const m);
364b22b933Srs200217 extern int udsserver_exit(void);    // should be called prior to app exit
37*5ffb0c9bSToomas Soome extern void LogMcastStateInfo(mDNS *const m, mDNSBool mflag, mDNSBool start, mDNSBool mstatelog);
38*5ffb0c9bSToomas Soome #define LogMcastQ       (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMcastQuestion
39*5ffb0c9bSToomas Soome #define LogMcastS       (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMcastService
40*5ffb0c9bSToomas Soome #define LogMcast        (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMsg
41*5ffb0c9bSToomas Soome #define LogMcastNoIdent (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMsgNoIdent
424b22b933Srs200217 
434b22b933Srs200217 /* Routines that uds_daemon expects to link against: */
444b22b933Srs200217 
45*5ffb0c9bSToomas Soome typedef void (*udsEventCallback)(int fd, short filter, void *context);
46*5ffb0c9bSToomas Soome extern mStatus udsSupportAddFDToEventLoop(dnssd_sock_t fd, udsEventCallback callback, void *context, void **platform_data);
47*5ffb0c9bSToomas Soome extern int     udsSupportReadFD(dnssd_sock_t fd, char* buf, int len, int flags, void *platform_data);
48*5ffb0c9bSToomas Soome extern mStatus udsSupportRemoveFDFromEventLoop(dnssd_sock_t fd, void *platform_data); // Note: This also CLOSES the file descriptor as well
494b22b933Srs200217 
504b22b933Srs200217 extern void RecordUpdatedNiceLabel(mDNS *const m, mDNSs32 delay);
514b22b933Srs200217 
524b22b933Srs200217 // Globals and functions defined in uds_daemon.c and also shared with the old "daemon.c" on OS X
53*5ffb0c9bSToomas Soome 
544b22b933Srs200217 extern mDNS mDNSStorage;
55*5ffb0c9bSToomas Soome extern DNameListElem *AutoRegistrationDomains;
56*5ffb0c9bSToomas Soome extern DNameListElem *AutoBrowseDomains;
57*5ffb0c9bSToomas Soome 
58*5ffb0c9bSToomas Soome extern mDNSs32 ChopSubTypes(char *regtype, char **AnonData);
59*5ffb0c9bSToomas Soome extern AuthRecord *AllocateSubTypes(mDNSs32 NumSubTypes, char *p, char **AnonData);
604b22b933Srs200217 extern int CountExistingRegistrations(domainname *srv, mDNSIPPort port);
614b22b933Srs200217 extern void FreeExtraRR(mDNS *const m, AuthRecord *const rr, mStatus result);
624b22b933Srs200217 extern int CountPeerRegistrations(mDNS *const m, ServiceRecordSet *const srs);
63*5ffb0c9bSToomas Soome 
64*5ffb0c9bSToomas Soome #if APPLE_OSX_mDNSResponder
65*5ffb0c9bSToomas Soome 
66*5ffb0c9bSToomas Soome extern void machserver_automatic_browse_domain_changed(const domainname *d, mDNSBool add);
67*5ffb0c9bSToomas Soome extern void machserver_automatic_registration_domain_changed(const domainname *d, mDNSBool add);
68*5ffb0c9bSToomas Soome // D2D interface support
69*5ffb0c9bSToomas Soome extern void external_start_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags);
70*5ffb0c9bSToomas Soome extern void external_stop_browsing_for_service(mDNSInterfaceID InterfaceID, const domainname *const type, DNS_TypeValues qtype, DNSServiceFlags flags);
71*5ffb0c9bSToomas Soome extern void external_start_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags);
72*5ffb0c9bSToomas Soome extern void external_stop_advertising_service(const ResourceRecord *const resourceRecord, DNSServiceFlags flags);
73*5ffb0c9bSToomas Soome extern void external_start_resolving_service(mDNSInterfaceID InterfaceID, const domainname *const fqdn, DNSServiceFlags flags);
74*5ffb0c9bSToomas Soome extern void external_stop_resolving_service(mDNSInterfaceID InterfaceID, const domainname *const fqdn, DNSServiceFlags flags);
75*5ffb0c9bSToomas Soome extern void external_connection_release(const domainname *instance);
76*5ffb0c9bSToomas Soome 
77*5ffb0c9bSToomas Soome #else   // APPLE_OSX_mDNSResponder
78*5ffb0c9bSToomas Soome 
79*5ffb0c9bSToomas Soome #define external_start_browsing_for_service(A,B,C,D) (void)(A)
80*5ffb0c9bSToomas Soome #define external_stop_browsing_for_service(A,B,C,D)  (void)(A)
81*5ffb0c9bSToomas Soome #define external_start_advertising_service(A,B)      (void)(A)
82*5ffb0c9bSToomas Soome #define external_stop_advertising_service(A,B)       (void)(A)
83*5ffb0c9bSToomas Soome #define external_start_resolving_service(A,B,C)      (void)(A)
84*5ffb0c9bSToomas Soome #define external_stop_resolving_service(A,B,C)       (void)(A)
85*5ffb0c9bSToomas Soome #define external_connection_release(A)               (void)(A)
86*5ffb0c9bSToomas Soome 
87*5ffb0c9bSToomas Soome #endif // APPLE_OSX_mDNSResponder
88*5ffb0c9bSToomas Soome 
89*5ffb0c9bSToomas Soome extern const char mDNSResponderVersionString_SCCS[];
90*5ffb0c9bSToomas Soome #define mDNSResponderVersionString (mDNSResponderVersionString_SCCS+5)
91