]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/dnssd_object.m
mDNSResponder-1310.40.42.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / dnssd_object.m
1 /*
2 * Copyright (c) 2019-2020 Apple Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #import "dnssd_object.h"
18
19 #import <stdlib.h>
20 #import <os/object_private.h>
21
22 //======================================================================================================================
23 // MARK: - Class Declarations
24
25 #define DNSSD_OBJECT_CLASS_DECLARE(NAME) \
26 _OS_OBJECT_DECL_SUBCLASS_INTERFACE(dnssd_ ## NAME, dnssd_object) \
27 extern int _dnssd_dummy_variable
28
29 _OS_OBJECT_DECL_SUBCLASS_INTERFACE(dnssd_object, object)
30
31 DNSSD_OBJECT_CLASS_DECLARE(getaddrinfo);
32 DNSSD_OBJECT_CLASS_DECLARE(getaddrinfo_result);
33 DNSSD_OBJECT_CLASS_DECLARE(cname_array);
34
35 //======================================================================================================================
36 // MARK: - Class Definitions
37
38 @implementation OS_OBJECT_CLASS(dnssd_object)
39 - (void)dealloc
40 {
41 dnssd_object_finalize(self);
42 [super dealloc];
43 }
44 @end
45
46 #define DNSSD_CLASS(NAME) OS_OBJECT_CLASS(dnssd_ ## NAME)
47 #define DNSSD_OBJECT_CLASS_DEFINE(NAME) \
48 @implementation DNSSD_CLASS(NAME) \
49 @end \
50 \
51 dnssd_ ## NAME ## _t \
52 dnssd_object_ ## NAME ## _alloc(const size_t size) \
53 { \
54 return (dnssd_## NAME ##_t)_os_object_alloc([DNSSD_CLASS(NAME) class], size); \
55 } \
56 extern int _dnssd_dummy_variable
57
58 DNSSD_OBJECT_CLASS_DEFINE(getaddrinfo);
59 DNSSD_OBJECT_CLASS_DEFINE(getaddrinfo_result);
60 DNSSD_OBJECT_CLASS_DEFINE(cname_array);