2 * Copyright (c) 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 #ifndef __MDNS_MANAGED_DEFAUTS_H__
18 #define __MDNS_MANAGED_DEFAUTS_H__
20 #include "mdns_base.h"
22 #include <CoreFoundation/CoreFoundation.h>
26 MDNS_ASSUME_NONNULL_BEGIN
32 * Creates a defaults dictionary based on a managed defaults domain.
35 * The managed defaults domain as a UTF-8 C string.
38 * Gets set to an error code that indicates the error that was encountered, if any.
41 * A reference to a dictionary if successful. Otherwise, NULL.
43 CFDictionaryRef _Nullable
44 mdns_managed_defaults_create(const char *domain
, OSStatus
* _Nullable out_error
);
48 * Gets the integer value of a key from a defaults dictionary.
51 * The defaults dictionary.
56 * @param fallback_value
57 * A fallback value to return if the key is not present in the dictionary, or if the key's value is not an
61 * Gets set to an error code that indicates the error that was encountered, if any.
64 * If the key is present in the dictionary and the key's value is an integer, then the value is returned
65 * after clamping it in the [INT_MIN, INT_MAX] range. Otherwise, the specified fallback value is returned.
69 mdns_managed_defaults_get_int_clamped(CFDictionaryRef defaults
, CFStringRef key
, int fallback_value
,
70 OSStatus
* _Nullable out_error
);
74 MDNS_ASSUME_NONNULL_END
76 #endif // __MDNS_MANAGED_DEFAUTS_H__