1//
2// Copyright (C) 2014 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
17syntax = "proto2";
18option optimize_for = LITE_RUNTIME;
19
20package shill.mobile_operator_db;
21
22message Filter {
23  // A filter can be one of the following types.
24  enum Type {
25    IMSI = 1;
26    ICCID = 2;
27    SID = 3;
28    OPERATOR_NAME = 4;
29    MCCMNC = 5;
30  };
31  required Type type = 1;
32  // A regular expression specifying the values that are *accepted* by this
33  // filter. The field to be tested is chosen by the |type|.
34  // The regular expression should be specified as an extended POSIX regular
35  // expression.
36  required string regex = 2;
37}
38
39message LocalizedName {
40  required string name = 1;
41  // Language is specified with two letter language codes. See xml:lang.
42  // If missing, language is assumed to be "en".
43  optional string language = 2;
44}
45
46message MobileAPN {
47  required string apn = 1;
48
49  enum Plan {
50    PREPAID = 1;
51    POSTPAID = 2;
52  }
53  repeated Plan plan = 2;
54
55  repeated LocalizedName localized_name = 3;
56  optional string gateway = 4;
57  optional string username = 5;
58  optional string password = 6;
59  repeated string dns = 7;
60}
61
62message OnlinePortal {
63  enum Method {
64    GET = 1;
65    POST = 2;
66  }
67  // Some OnlinePortals are only valid for a restricted set of SIDs/MCCMNCs etc.
68  // Use this filter to restrict when the OnlinePortal is valid.
69  // The OnlinePortal is assumed to be valid if the filter is not provided.
70  optional Filter olp_filter = 1;
71  required Method method = 2;
72  required string url = 3;
73  optional string post_data = 4;
74}
75
76message Data {
77  // A unique identifier for this M[V]NO.
78  required string uuid = 1;
79
80  enum ProviderType {
81    GSM = 1;
82    CDMA = 2;
83  }
84  optional ProviderType provider_type = 2;
85
86  optional string country = 3;
87  // List of localized names for this provider.
88  // If provided, the first is chosen as the default.
89  repeated LocalizedName localized_name = 4;
90  // Indicates that this provider requires roaming and the customer is not
91  // charged additional for roaming. This is particularly useful for some MVNOs.
92  optional bool requires_roaming = 5 [default = false];
93  repeated OnlinePortal olp = 6;
94
95  // ///////////////////////////////////////////////////////////////////////////
96  // GSM specific properties [21 - 40]
97
98  // MCCMNC is the concatenation of MCC and MNC.
99  // MCC is a three digit ITU E.212 Mobile Country Code (e.g. '310' or '409')
100  // and MNC is a two or three digit GSM Mobile Network Code.
101  repeated string mccmnc = 21;
102  repeated MobileAPN mobile_apn = 22;
103
104  // ///////////////////////////////////////////////////////////////////////////
105  // CDMA specific properties [41-60]
106
107  repeated string sid = 41;
108  repeated string nid = 42;
109  optional string activation_code = 43;
110}
111
112message MobileVirtualNetworkOperator {
113  repeated Filter mvno_filter = 1;
114  // The data provided in an MVNO is used to augment the data provided by its
115  // MNO.
116  // - All provided top-level fields in |MobileVirtualNetworkOperator::data|
117  //   *replace* the corresponding top-level fields in
118  //   |MobileNetworkOperator::data|. No attempt is made to merge lists etc.
119  // - |international_mvno| is handled in the same way. The base MNO is
120  //   determined by the particular mccmnc value.
121  required Data data = 2;
122}
123
124message MobileNetworkOperator {
125  required Data data = 1;
126  repeated MobileVirtualNetworkOperator mvno = 2;
127  // The database inevitably contains some duplicate MobileNetworkOperators that
128  // are impossible to distinguish using MCCMNC/name. In such a case, this bool
129  // may be set to pick out one of the duplicates as the intended operator.
130  // Note that if you're using this property, you should DTRT, and find out why
131  // there is an ambiguous entry in the database.
132  // TODO(pprabhu): Add a presubmit-hook to ensure that no more than one of the
133  // duplicates is earmarked.
134  optional bool earmarked = 3;
135}
136
137message InternationalMobileVirtualNetworkOperator {
138  // An InternationalMobileVirtualNetworkOperator is provided for mere
139  // convenience. When the database is loaded, an MVNO is added to each of the
140  // MNO this international MVNO belongs to.
141  // - |mccmnc| values are used to add the MVNO under corresponding MNOs.
142  // - Additionally, the |mccmnc| value is used to create a Filter that is
143  // applied *before* any other filters in the MVNOs.
144  //
145  // Currently, we do not support associating the IMVNO with different MNOs
146  // through any other data (like the operator name).
147  repeated string mccmnc = 1;
148  required MobileVirtualNetworkOperator mvno = 15;
149}
150
151// Top-level message.
152// The Database is a single message of type |MobileOperatorDB|.
153message MobileOperatorDB {
154  repeated MobileNetworkOperator mno = 1;
155  repeated InternationalMobileVirtualNetworkOperator imvno = 2;
156}
157