1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2002-2013 Apple Inc. All rights reserved.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include "mDNSEmbeddedAPI.h"
19 #include "dnssd_ipc.h"
21 /* Client interface: */
23 #define SRS_PORT(S) mDNSVal16((S)->RR_SRV.resrec.rdata->u.srv.port)
25 #define LogTimer(MSG,T) LogMsgNoIdent( MSG " %08X %11d %08X %11d", (T), (T), (T)-now, (T)-now)
27 extern int udsserver_init(dnssd_sock_t skts
[], mDNSu32 count
);
28 extern mDNSs32
udsserver_idle(mDNSs32 nextevent
);
29 extern void udsserver_info(mDNS
*const m
); // print out info about current state
30 extern void udsserver_handle_configchange(mDNS
*const m
);
31 extern int udsserver_exit(void); // should be called prior to app exit
32 extern void LogMcastStateInfo(mDNS
*const m
, mDNSBool mflag
, mDNSBool start
, mDNSBool mstatelog
);
33 #define LogMcastQ (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMcastQuestion
34 #define LogMcastS (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMcastService
35 #define LogMcast (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMsg
36 #define LogMcastNoIdent (mDNS_McastLoggingEnabled == 0) ? ((void)0) : LogMsgNoIdent
38 /* Routines that uds_daemon expects to link against: */
40 typedef void (*udsEventCallback
)(int fd
, short filter
, void *context
);
41 extern mStatus
udsSupportAddFDToEventLoop(dnssd_sock_t fd
, udsEventCallback callback
, void *context
, void **platform_data
);
42 extern int udsSupportReadFD(dnssd_sock_t fd
, char* buf
, int len
, int flags
, void *platform_data
);
43 extern mStatus
udsSupportRemoveFDFromEventLoop(dnssd_sock_t fd
, void *platform_data
); // Note: This also CLOSES the file descriptor as well
45 extern void RecordUpdatedNiceLabel(mDNS
*const m
, mDNSs32 delay
);
47 // Globals and functions defined in uds_daemon.c and also shared with the old "daemon.c" on OS X
49 extern mDNS mDNSStorage
;
50 extern DNameListElem
*AutoRegistrationDomains
;
51 extern DNameListElem
*AutoBrowseDomains
;
53 extern mDNSs32
ChopSubTypes(char *regtype
, char **AnonData
);
54 extern AuthRecord
*AllocateSubTypes(mDNSs32 NumSubTypes
, char *p
, char **AnonData
);
55 extern int CountExistingRegistrations(domainname
*srv
, mDNSIPPort port
);
56 extern void FreeExtraRR(mDNS
*const m
, AuthRecord
*const rr
, mStatus result
);
57 extern int CountPeerRegistrations(mDNS
*const m
, ServiceRecordSet
*const srs
);
59 #if APPLE_OSX_mDNSResponder
61 extern void machserver_automatic_browse_domain_changed(const domainname
*d
, mDNSBool add
);
62 extern void machserver_automatic_registration_domain_changed(const domainname
*d
, mDNSBool add
);
63 // D2D interface support
64 extern void external_start_browsing_for_service(mDNSInterfaceID InterfaceID
, const domainname
*const type
, DNS_TypeValues qtype
, DNSServiceFlags flags
);
65 extern void external_stop_browsing_for_service(mDNSInterfaceID InterfaceID
, const domainname
*const type
, DNS_TypeValues qtype
, DNSServiceFlags flags
);
66 extern void external_start_advertising_service(const ResourceRecord
*const resourceRecord
, DNSServiceFlags flags
);
67 extern void external_stop_advertising_service(const ResourceRecord
*const resourceRecord
, DNSServiceFlags flags
);
68 extern void external_start_resolving_service(mDNSInterfaceID InterfaceID
, const domainname
*const fqdn
, DNSServiceFlags flags
);
69 extern void external_stop_resolving_service(mDNSInterfaceID InterfaceID
, const domainname
*const fqdn
, DNSServiceFlags flags
);
70 extern void external_connection_release(const domainname
*instance
);
72 #else // APPLE_OSX_mDNSResponder
74 #define external_start_browsing_for_service(A,B,C,D) (void)(A)
75 #define external_stop_browsing_for_service(A,B,C,D) (void)(A)
76 #define external_start_advertising_service(A,B) (void)(A)
77 #define external_stop_advertising_service(A,B) (void)(A)
78 #define external_start_resolving_service(A,B,C) (void)(A)
79 #define external_stop_resolving_service(A,B,C) (void)(A)
80 #define external_connection_release(A) (void)(A)
82 #endif // APPLE_OSX_mDNSResponder
84 extern const char mDNSResponderVersionString_SCCS
[];
85 #define mDNSResponderVersionString (mDNSResponderVersionString_SCCS+5)