• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
38 /* Routines that uds_daemon expects to link against: */
39 
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
44 
45 extern void RecordUpdatedNiceLabel(mDNS *const m, mDNSs32 delay);
46 
47 // Globals and functions defined in uds_daemon.c and also shared with the old "daemon.c" on OS X
48 
49 extern mDNS mDNSStorage;
50 extern DNameListElem *AutoRegistrationDomains;
51 extern DNameListElem *AutoBrowseDomains;
52 
53 extern mDNSs32 ChopSubTypes(char *regtype);
54 extern AuthRecord *AllocateSubTypes(mDNSs32 NumSubTypes, char *p);
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);
58 
59 #if APPLE_OSX_mDNSResponder
60 extern void machserver_automatic_browse_domain_changed(const domainname *d, mDNSBool add);
61 extern void machserver_automatic_registration_domain_changed(const domainname *d, mDNSBool add);
62 // External support
63 extern void mDNSInitPacketFilter(void);
64 extern void external_start_browsing_for_service(mDNS *const m, const domainname *const type, DNS_TypeValues qtype);
65 extern void external_stop_browsing_for_service(mDNS *const m, const domainname *const type, DNS_TypeValues qtype);
66 extern void external_start_advertising_service(const ResourceRecord *const resourceRecord);
67 extern void external_stop_advertising_service(const ResourceRecord *const resourceRecord);
68 extern void external_start_resolving_service(const domainname *const fqdn);
69 extern void external_stop_resolving_service(const domainname *const fqdn);
70 #else
71 #define external_start_browsing_for_service(A,B,C) (void)(A)
72 #define external_stop_browsing_for_service(A,B,C)  (void)(A)
73 #define external_start_advertising_service(A)      (void)(A)
74 #define external_stop_advertising_service(A)       (void)(A)
75 #define external_start_resolving_service(A)        (void)(A)
76 #define external_stop_resolving_service(A)         (void)(A)
77 #endif // APPLE_OSX_mDNSResponder
78 
79 extern const char mDNSResponderVersionString_SCCS[];
80 #define mDNSResponderVersionString (mDNSResponderVersionString_SCCS+5)
81