2 * Copyright (c) 2019-2020 Apple Inc. All rights reserved.
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
8 * https://www.apache.org/licenses/LICENSE-2.0
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.
17 #undef MDNS_OBJECT_FORCE_NO_OBJC
18 #define MDNS_OBJECT_FORCE_NO_OBJC 0
19 #import "mdns_objects.h"
21 #import <CoreUtils/CoreUtils.h>
22 #import <Foundation/Foundation.h>
23 #import <os/object_private.h>
25 //======================================================================================================================
26 // MARK: - Class Definitions
28 #define MDNS_CLASS(NAME) OS_OBJECT_CLASS(mdns_ ## NAME)
30 @implementation OS_OBJECT_CLASS(mdns_object)
33 mdns_object_finalize(self);
34 arc_safe_super_dealloc();
37 - (NSString *)description
39 NSString * const nsstr = (NSString *)CFBridgingTransfer(mdns_object_copy_description_as_cfstring(self));
40 return arc_safe_autorelease(nsstr);
43 - (NSString *)debugDescription
45 NSString * const nsstr = (NSString *)CFBridgingTransfer(mdns_object_copy_debug_description_as_cfstring(self));
46 return arc_safe_autorelease(nsstr);
49 - (NSString *)redactedDescription
51 NSString * const nsstr = (NSString *)CFBridgingTransfer(mdns_object_copy_redacted_description_as_cfstring(self));
52 return arc_safe_autorelease(nsstr);
55 - (BOOL)isEqual:(id)other
60 if (![other isKindOfClass:[MDNS_CLASS(object) class]]) {
63 return (mdns_equal(self, (mdns_object_t)other) ? YES : NO);
67 #define MDNS_OBJECT_CLASS_DEFINE(NAME) \
68 _OS_OBJECT_DECL_SUBCLASS_INTERFACE(mdns_ ## NAME, mdns_object) \
70 @implementation MDNS_CLASS(NAME) \
74 mdns_ ## NAME ## _object_alloc(const size_t size) \
76 return (mdns_ ## NAME ## _t)_os_object_alloc([MDNS_CLASS(NAME) class], size); \
78 extern int _mdns_dummy_variable
80 MDNS_OBJECT_CLASS_DEFINE(address);
81 MDNS_OBJECT_CLASS_DEFINE(dns_service);
82 MDNS_OBJECT_CLASS_DEFINE(dns_service_manager);
83 MDNS_OBJECT_CLASS_DEFINE(interface_monitor);
84 MDNS_OBJECT_CLASS_DEFINE(message);
85 MDNS_OBJECT_CLASS_DEFINE(query_message);
86 MDNS_OBJECT_CLASS_DEFINE(querier);
87 MDNS_OBJECT_CLASS_DEFINE(resolver);
88 MDNS_OBJECT_CLASS_DEFINE(server);
89 MDNS_OBJECT_CLASS_DEFINE(session);
90 MDNS_OBJECT_CLASS_DEFINE(set);
91 MDNS_OBJECT_CLASS_DEFINE(trust);