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 * 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 #ifndef __DNSHeuristicsInternal_h
18 #define __DNSHeuristicsInternal_h
20 #import "DNSHeuristics.h"
21 #import <Foundation/Foundation.h>
23 #if (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST)
24 #import <MobileWiFi/WiFiTypes.h>
25 #import <MobileWiFi/WiFiManagerClient.h>
26 #import <MobileWiFi/WiFiDeviceClient.h>
27 #import <MobileWiFi/WiFiKeys.h>
28 #import <MobileWiFi/MobileWiFi.h>
29 #endif // TARGET_OS_IPHONE
31 extern const NSString
*DNSFailureStateKey
;
32 extern const NSString
*DNSHeuristicsLastFailureTimestamp
;
33 extern const NSString
*DNSHeuristicsFilterFlagKey
;
34 extern const NSString
*DNSHeuristicsLongCounterKey
;
35 extern const NSString
*DNSHeuristicsBurstCounterKey
;
37 extern NSUInteger DNSHeuristicDefaultLongCounterThreshold
;
38 extern NSUInteger DNSHeuristicDefaultLongCounterTimeWindow
;
39 extern NSUInteger DNSHeuristicsDefaultBurstTokenBucketCapacity
;
40 extern NSUInteger DNSHeuristicsDefaultBurstTokenBucketRefillTime
;
41 extern NSUInteger DNSHeuristicsDefaultBurstTokenBucketRefillCount
;
43 @interface DNSHeuristics
: NSObject
44 #if (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST)
45 + (BOOL
)getNetworkFilteredFlag
:(WiFiNetworkRef
)network
;
46 + (NSDictionary
*)copyNetworkSettings
:(WiFiNetworkRef
)network NS_RETURNS_RETAINED
;
47 + (BOOL
)setNetworkSettings
:(WiFiManagerClientRef
)manager
48 network
:(WiFiNetworkRef
)network
49 value
:(NSDictionary
*)value
;
50 + (BOOL
)setNetworkAsFiltered
:(WiFiManagerClientRef
)manager
51 network
:(WiFiNetworkRef
)network
;
52 + (BOOL
)clearNetworkAsFiltered
:(WiFiManagerClientRef
)manager
53 network
:(WiFiNetworkRef
)network
;
54 #endif // TARGET_OS_IPHONE
55 + (BOOL
)updateHeuristicState
:(BOOL
)success isTimeout
:(BOOL
)isTimeout
;
56 + (BOOL
)reportResolutionFailure
:(NSURL
*)url isTimeout
:(BOOL
)isTimeout
;
57 + (NSUInteger
)currentTimeMs
;
60 #endif /* DNSHeuristicsInternal_h */