1/*
2 * Copyright (C) 2020 Google LLC
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 */
16syntax = "proto2";
17
18package com.google.carrier;
19
20option java_multiple_files = true;
21option java_outer_classname = "CarrierSettingsProtos";
22
23// Settings of one carrier, including apns and configs
24// This is the payload to be delivered from server
25message CarrierSettings {
26  // A unique canonical carrier name
27  optional string canonical_name = 1;
28
29  // Version number of current carrier’s settings
30  optional int64 version = 2;
31
32  // Carrier APNs
33  optional CarrierApns apns = 3;
34
35  // Carrier configs
36  optional CarrierConfig configs = 4;
37
38  reserved 5;
39
40  // Vendor carrier configs
41  optional VendorConfigs vendor_configs = 6;
42}
43
44// A collection of multiple carriers’ settings
45message MultiCarrierSettings {
46  // Version number
47  optional int64 version = 1;
48
49  // List of CarrierSettings
50  repeated CarrierSettings setting = 2;
51}
52
53// An access point name (aka. APN) entry
54message ApnItem {
55  // The name of APN, map to xml apn "carrier" attribute
56  // eg. Verizon Internet, may visible to user in Settings
57  optional string name = 1;
58  // The value of APN, eg. send to modem for data call. map to xml
59  // "apn" attribute, eg. vzwinternet
60  optional string value = 2;
61
62  // Next two fields type and bearer_bitmask affect how APN is selected by
63  // platform. eg. type means APN capability and bearer_bitmask specifies
64  // which RATs apply.
65  // Note mcc/mnc and mvno data doesn't belong to this proto because they
66  // define a carrier.
67  // APN types as defined in Android code PhoneConstants.java
68  enum ApnType {
69    ALL = 0;      // this APN can serve all kinds of data connections
70    DEFAULT = 1;  // internet data
71    MMS = 2;
72    SUPL = 3;
73    DUN = 4;
74    HIPRI = 5;
75    FOTA = 6;
76    IMS = 7;
77    CBS = 8;
78    IA = 9;  // Initial attach
79    EMERGENCY = 10;
80    XCAP = 11;
81    UT = 12;
82  }
83  repeated ApnType type = 3;
84
85  // Network types that this APN applies to, separated by "|". A network type
86  // is represented as an integer defined in TelephonyManager.NETWORK_TYPE_*.
87  // Default value "0" means all network types.
88  optional string bearer_bitmask = 4 [default = "0"];
89
90  // Below are all parameters for the APN
91  // APN server / auth parameters.
92  optional string server = 5;
93  optional string proxy = 6;
94  optional string port = 7;
95  optional string user = 8;
96  optional string password = 9;
97  optional int32 authtype = 10 [default = -1];
98
99  // MMS configuration.
100  optional string mmsc = 11;
101  optional string mmsc_proxy = 12;
102  optional string mmsc_proxy_port = 13;
103
104  // Protocols allowed to connect to the APN.
105  enum Protocol {
106    IP = 0;
107    IPV6 = 1;
108    IPV4V6 = 2;
109    PPP = 3;
110  }
111  optional Protocol protocol = 14 [default = IP];
112  optional Protocol roaming_protocol = 15 [default = IP];
113
114  // MTU for the connections.
115  optional int32 mtu = 16 [default = 0];
116  // An ID used to sync the APN in modem.
117  optional int32 profile_id = 17;
118  // Max connections.
119  optional int32 max_conns = 18 [default = 0];
120  // The wait time required between disconnecting and connecting, in seconds.
121  optional int32 wait_time = 19 [default = 0];
122  // The time to limit max connection, in seconds.
123  optional int32 max_conns_time = 20 [default = 0];
124  reserved 21;
125  // Whether to be persisted to modem.
126  optional bool modem_cognitive = 22 [default = false];
127  // Whether visible in APN settings.
128  optional bool user_visible = 23 [default = true];
129  // Whether editable in APN settings.
130  optional bool user_editable = 24 [default = true];
131
132  // If > 0: when an APN becomes a preferred APN on user/framework
133  // selection, other APNs with the same apn_set_id will also be preferred
134  // by framework when selecting APNs.
135  optional int32 apn_set_id = 25 [default = 0];
136
137  // The skip 464xlat flag. Flag works as follows.
138  // SKIP_464XLAT_DEFAULT: the APN will skip 464xlat only if the APN has type
139  //                       IMS and does not support INTERNET which has type
140  //                       DEFAULT or HIPRI.
141  // SKIP_464XLAT_DISABLE: the APN will NOT skip 464xlat
142  // SKIP_464XLAT_ENABLE: the APN will skip 464xlat
143  enum Xlat {
144    SKIP_464XLAT_DEFAULT = 0;
145    SKIP_464XLAT_DISABLE = 1;
146    SKIP_464XLAT_ENABLE = 2;
147  }
148  optional Xlat skip_464xlat = 26 [default = SKIP_464XLAT_DEFAULT];
149}
150
151// A collection of all APNs for a carrier
152message CarrierApns {
153  reserved 1;
154
155  // APNs belong to this carrier
156  repeated ApnItem apn = 2;
157}
158
159// An array of text
160message TextArray {
161  repeated string item = 1;
162}
163
164// An array of int
165message IntArray {
166  repeated int32 item = 1;
167}
168
169// Carrier configs
170message CarrierConfig {
171  reserved 1, 3;
172
173  // Key-Value pair as a config entry
174  message Config {
175    optional string key = 1;
176
177    oneof value {
178      string text_value = 2;
179      int32 int_value = 3;
180      int64 long_value = 4;
181      bool bool_value = 5;
182      TextArray text_array = 6;
183      IntArray int_array = 7;
184    }
185  }
186
187  // Key-value pairs, holding all config entries
188  repeated Config config = 2;
189}
190
191// The configs of one vendor client.
192message VendorConfigClient {
193  // Name of the client for which the configuration items need to
194  // be stored
195  required string name = 1;
196
197  // Binary blob containing the configuration. The format
198  // of the configuration depends on the specific client.
199  // For some clients, the proto representation of {@link VendorConfigData}
200  // defined in vendorconfigdata.proto is used.
201  optional bytes value = 2;
202
203  // Range of extensions. The extensions from 100 to 1000 are reserved for
204  // Google's internal usage.
205  extensions 100 to 5000;
206}
207
208// A collection of configs from vendor clients.
209message VendorConfigs {
210  reserved 1;
211
212  // Configuration
213  repeated VendorConfigClient client = 2;
214}
215