1 /*
2  * Copyright (C) 2018 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 @JavaDerive(equals=true, toString=true)
20 parcelable PrivateDnsConfigParcel {
21     /**
22      * The hostname of private DNS provider.
23      */
24     String hostname;
25 
26     /**
27      * The DoT server IP addresses of `hostname`. They are not sorted.
28      */
29     String[] ips;
30 
31     /**
32      * The private DNS mode associated with this PrivateDnsConfigParcel.
33      * If it's set, the value must be one of the following constants defined in
34      * ConnectivitySettingsManager.
35      *   - PRIVATE_DNS_MODE_OFF (1)
36      *   - PRIVATE_DNS_MODE_OPPORTUNISTIC (2)
37      *   - PRIVATE_DNS_MODE_PROVIDER_HOSTNAME (3)
38      *
39      * For compatibility with old PrivateDnsConfigParcel, set the default value to -1 to indicate
40      * that the sender is using an old version of PrivateDnsConfigParcel and that the receiver
41      * cannot determine the private DNS mode by reading this field.
42      */
43     int privateDnsMode = -1;
44 
45     /**
46      * The following fields with the prefix "doh" store the DoH3 information discovered from
47      * DDR. The similar fields are defined in DnsResolver as well. Although duplicating code
48      * is not a good idea, it avoids the complexity and confusion of having a parcelable
49      * containing a nested parcelable where the client and server could have a different version
50      * of the nested parcelable.
51      */
52 
53     /**
54      * The DoH server hostname derived from TargetName field of a DNS SVCB response.
55      */
56     String dohName = "";
57 
58     /**
59      * The DoH server IP addresses of `dohName`. They are not sorted.
60      */
61     String[] dohIps = {};
62 
63     /**
64      * A part of the URI template used to construct the URL for DNS resolution.
65      * It's derived only from DNS SVCB SvcParamKey "dohpath".
66      * The URI template for DNS resolution is as follows:
67      *     https://<dohName>/<dohPath>
68      */
69     String dohPath = "";
70 
71     /**
72      * The port used to reach the DoH servers.
73      */
74     int dohPort = -1;
75 }
76