2 * Copyright (c) 2019 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 * http://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 #import "dnssd_object.h"
20 #import <Foundation/Foundation.h>
21 #import <os/object_private.h>
24 //======================================================================================================================
25 #pragma mark - Class Declarations
28 #define DNSSD_OBJECT_CLASS_DECLARE(NAME) \
29 _OS_OBJECT_DECL_SUBCLASS_INTERFACE(dnssd_ ## NAME, dnssd_object) \
30 extern int _dnssd_dummy_variable
32 _OS_OBJECT_DECL_SUBCLASS_INTERFACE(dnssd_object, object)
34 DNSSD_OBJECT_CLASS_DECLARE(getaddrinfo);
35 DNSSD_OBJECT_CLASS_DECLARE(getaddrinfo_result);
38 //======================================================================================================================
39 #pragma mark - Class Definitions
42 @implementation OS_OBJECT_CLASS(dnssd_object)
45 dnssd_object_finalize(self);
49 - (NSString *)description
51 char * const desc = dnssd_object_copy_description(self, false, false);
53 NSString * const string = [NSString stringWithUTF8String:desc];
61 - (NSString *)debugDescription
63 char * const desc = dnssd_object_copy_description(self, true, false);
65 NSString * const string = [NSString stringWithUTF8String:desc];
73 - (NSString *)redactedDescription
75 char * const desc = dnssd_object_copy_description(self, false, true);
77 NSString * const string = [NSString stringWithUTF8String:desc];
86 #define DNSSD_CLASS(NAME) OS_OBJECT_CLASS(dnssd_ ## NAME)
87 #define DNSSD_OBJECT_CLASS_DEFINE(NAME) \
88 @implementation DNSSD_CLASS(NAME) \
91 dnssd_ ## NAME ## _t \
92 dnssd_object_ ## NAME ## _alloc(const size_t size) \
94 return (dnssd_## NAME ##_t)_os_object_alloc([DNSSD_CLASS(NAME) class], size); \
96 extern int _dnssd_dummy_variable
98 DNSSD_OBJECT_CLASS_DEFINE(getaddrinfo);
99 DNSSD_OBJECT_CLASS_DEFINE(getaddrinfo_result);