1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2004 Apple Computer, 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 // Define the required CFM Shared Library entry and exit points
19 #include <CodeFragments.h>
20 #include "mDNSEmbeddedAPI.h" // Defines the interface to the client layer above
21 #include "mDNSMacOS9.h" // Defines the specific types needed to run mDNS on this platform
24 static mDNS_PlatformSupport PlatformSupportStorage
;
25 // Start off with a default cache of 16K (about 100 records)
26 #define RR_CACHE_SIZE ((16*1024) / sizeof(CacheRecord))
27 static CacheEntity rrcachestorage
[RR_CACHE_SIZE
];
29 mDNSlocal
void mDNS_StatusCallback(mDNS
*const m
, mStatus result
)
31 if (result
== mStatus_GrowCache
)
33 // Allocate another chunk of cache storage
34 CacheEntity
*storage
= OTAllocMem(sizeof(CacheEntity
) * RR_CACHE_SIZE
);
35 if (storage
) mDNS_GrowCache(m
, storage
, RR_CACHE_SIZE
);
39 extern pascal OSErr
mDNS_CFMInit(const CFragInitBlock
*theInitBlock
);
40 pascal OSErr
mDNS_CFMInit(const CFragInitBlock
*theInitBlock
)
42 extern pascal OSErr
__initialize(const CFragInitBlock
*theInitBlock
);
43 __initialize(theInitBlock
); // MUST do this first!
46 THz oldZone
= GetZone();
47 SetZone(SystemZone());
48 LogMsg("mDNS/DNS-SD with Macsbug breaks -- do not ship this version to customers");
49 err
= mDNS_Init(&mDNSStorage
, &PlatformSupportStorage
, rrcachestorage
, RR_CACHE_SIZE
,
50 mDNS_Init_AdvertiseLocalAddresses
, mDNS_StatusCallback
, mDNS_Init_NoInitCallbackContext
);
56 extern void mDNS_CFMTerm(void);
57 void mDNS_CFMTerm(void)
59 extern pascal void __terminate(void);
60 LogMsg("mDNS_CFMTerm");
61 mDNS_Close(&mDNSStorage
);