• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DATA_STORAGE_PDP_PROFILE_DATA_H
17 #define DATA_STORAGE_PDP_PROFILE_DATA_H
18 
19 namespace OHOS {
20 namespace Telephony {
21 class PdpProfileData {
22 public:
23     /**
24      * @brief Operator id
25      */
26     static constexpr const char *PROFILE_ID = "profile_id";
27     /**
28      * @brief Operator name
29      */
30     static constexpr const char *PROFILE_NAME = "profile_name";
31     /**
32      * @brief Mobile country code
33      */
34     static constexpr const char *MCC = "mcc";
35     /**
36      * @brief Mobile network code
37      */
38     static constexpr const char *MNC = "mnc";
39     /**
40      * @brief Mobile country code and mobile network code
41      */
42     static constexpr const char *MCCMNC = "mccmnc";
43     /**
44      * @brief APN name
45      */
46     static constexpr const char *APN = "apn";
47     /**
48      * @brief Authentication type
49      */
50     static constexpr const char *AUTH_TYPE = "auth_type";
51     /**
52      * @brief Authentication user
53      */
54     static constexpr const char *AUTH_USER = "auth_user";
55     /**
56      * @brief Authentication password
57      */
58     static constexpr const char *AUTH_PWD = "auth_pwd";
59     /**
60      * @brief APN type
61      */
62     static constexpr const char *APN_TYPES = "apn_types";
63     /**
64      * @brief Roaming or not
65      */
66     static constexpr const char *IS_ROAMING_APN = "is_roaming_apn";
67     /**
68      * @brief Operator enable or not
69      */
70     static constexpr const char *PROFILE_ENABLE = "profile_enable";
71     /**
72      * @brief Mms center url
73      */
74     static constexpr const char *HOME_URL = "home_url";
75     /**
76      * @brief Mms proxy ip address and port
77      */
78     static constexpr const char *PROXY_IP_ADDRESS = "proxy_ip_address";
79     /**
80      * @brief Mms ip address and port
81      */
82     static constexpr const char *MMS_IP_ADDRESS = "mms_ip_address";
83     /**
84      * @brief Protocol to connect to the APN
85      */
86     static constexpr const char *APN_PROTOCOL = "apn_protocol";
87     /**
88      * @brief Protocol to connect to the APN when roaming
89      */
90     static constexpr const char *APN_ROAM_PROTOCOL = "apn_roam_protocol";
91     /**
92      * @brief Radio access family bitmask
93      */
94     static constexpr const char *BEARING_SYSTEM_TYPE = "bearing_system_type";
95     /**
96      * @brief MVNO match type
97      */
98     static constexpr const char *MVNO_TYPE = "mvno_type";
99     /**
100      * @brief MVNO match data
101      */
102     static constexpr const char *MVNO_MATCH_DATA = "mvno_match_data";
103     /**
104      * @brief APN edit status
105      */
106     static constexpr const char *EDITED_STATUS = "edited";
107     /**
108      * @brief Server address
109      */
110     static constexpr const char *SERVER = "server";
111     /**
112      * @brief SIM Id of the SIM card
113      */
114     static constexpr const char *SIM_ID = "sim_id";
115 };
116 
117 struct PdpProfile {
118     int profileId = 0;
119     std::string profileName = "";
120     std::string mcc = "";
121     std::string mnc = "";
122     std::string apn = "";
123     int authType = 0;
124     std::string authUser = "";
125     std::string authPwd = "";
126     std::string apnTypes = ""; // see ApnType
127     int isRoamingApn = 1;
128     std::string homeUrl = "";
129     std::string proxyIpAddress = "";
130     std::string mmsIpAddress = "";
131     std::string pdpProtocol = ""; // see PdpProtocol
132     std::string roamPdpProtocol = "";
133     int bearingSystemType = 0; // see BearingSystemType
134     std::string mvnoType = "";
135     std::string mvnoMatchData = "";
136     int edited = 0;
137     std::string server = "";
138 };
139 
140 class MvnoType {
141 public:
142     inline static const std::string SPN = "spn";
143     inline static const std::string IMSI = "imsi";
144     inline static const std::string GID1 = "gid1";
145     inline static const std::string ICCID = "iccid";
146 };
147 
148 enum class ApnType {
149     DEFAULT, IMS, MMS, ALL
150 };
151 
152 enum class ApnAuthType {
153     None = 0, PAP, CHAP, PAP_OR_CHAP
154 };
155 
156 enum class PdpProtocol {
157     IPV4 = 0, IPV6, IPV4V6
158 };
159 
160 enum class BearingSystemType {
161     UNKNOWN = 0,
162     LTE,
163     HSPAP,
164     HSPA,
165     HSUPA,
166     HSDPA,
167     UMTS,
168     EDGE,
169     GPRS,
170     eHRPD,
171     EVDO_B,
172     EVDO_A,
173     EVDO_0,
174     xRTT,
175     IS95B,
176     IS95AS
177 };
178 
179 inline static const std::string PREFER_APN_ID = "preferapn_id";
180 constexpr const int32_t DEFAULT_SIM_ID = 0;
181 constexpr const int32_t INVALID_PROFILE_ID = -1;
182 constexpr const char *TABLE_PDP_PROFILE = "pdp_profile";
183 constexpr const char *TEMP_TABLE_PDP_PROFILE = "temp_pdp_profile";
184 constexpr const char *PDP_PROFILE_URI = "datashare:///com.ohos.pdpprofileability";
185 } // namespace Telephony
186 } // namespace OHOS
187 #endif // DATA_STORAGE_PDP_PROFILE_DATA_H
188