1 /*
2  * Copyright (C) 2019 The Android Open Source Project
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  *      http://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 package android.net;
18 
19 import android.net.ResolverOptionsParcel;
20 import android.net.resolv.aidl.DohParamsParcel;
21 
22 /**
23  * Configuration for a resolver parameters.
24  *
25  * {@hide}
26  */
27 @JavaDerive(equals=true, toString=true)
28 parcelable ResolverParamsParcel {
29     /**
30      * The network ID of the network for which information should be configured.
31      */
32     int netId;
33 
34     /**
35      * Sample lifetime in seconds.
36      */
37     int sampleValiditySeconds;
38 
39     /**
40      * Use to judge if the server is considered broken.
41      */
42     int successThreshold;
43 
44     /**
45      * Min. # samples.
46      */
47     int minSamples;
48 
49     /**
50      * Max # samples.
51      */
52     int maxSamples;
53 
54     /**
55      * Retransmission interval in milliseconds.
56      */
57     int baseTimeoutMsec;
58 
59     /**
60      * Number of retries.
61      */
62     int retryCount;
63 
64     /**
65      * The DNS servers to configure for the network.
66      */
67     @utf8InCpp String[] servers;
68 
69     /**
70      * The search domains to configure.
71      */
72     @utf8InCpp String[] domains;
73 
74     /**
75      * The TLS subject name to require for all servers, or empty if there is none.
76      */
77     @utf8InCpp String   tlsName;
78 
79     /**
80      * The DNS servers to configure for strict mode Private DNS.
81      */
82     @utf8InCpp String[] tlsServers;
83 
84     /**
85      * An array containing TLS public key fingerprints (pins) of which each server must match
86      * at least one, or empty if there are no pinned keys.
87      */
88     // DEPRECATED:Superseded by caCertificate below.
89     @utf8InCpp String[] tlsFingerprints = {};
90 
91     /**
92      * Certificate authority that signed the certificate; only used by DNS-over-TLS tests.
93      *
94      */
95     @utf8InCpp String caCertificate = "";
96 
97     /**
98      * The timeout for the connection attempt to a Private DNS server.
99      * It's initialized to 0 to use the predefined default value.
100      * Setting a non-zero value to it takes no effect anymore. The timeout is configurable only
101      * by the experiement flag.
102      */
103     int tlsConnectTimeoutMs = 0;
104 
105     /**
106      * Knobs for OEM to control alternative behavior.
107      */
108     @nullable
109     ResolverOptionsParcel resolverOptions;
110 
111     /**
112      * The transport types associated to a given network.
113      * The valid value is defined in one of the IDnsResolver.TRANSPORT_* constants.
114      * If there are multiple transport types but can't be identified to a
115      * reasonable network type by DnsResolver, it would be considered as unknown.
116      */
117     int[] transportTypes = {};
118 
119     /**
120      * Whether the network is metered or not.
121      */
122     boolean meteredNetwork = false;
123 
124     /**
125      * Information about DNS-over-HTTPS servers to use
126      */
127     @nullable
128     DohParamsParcel dohParams;
129 
130     /**
131      * The interface names associated with this netId. Interface names instead of indices because
132      * the caller is not aware of interface indices and looking up ifindices for interface names is
133      * fast.
134      */
135     @utf8InCpp String[] interfaceNames = {};
136 }
137