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 Operator key 33 */ 34 static constexpr const char *OPKEY = "opkey"; 35 /** 36 * @brief Mobile country code 37 */ 38 static constexpr const char *MCC = "mcc"; 39 /** 40 * @brief Mobile network code 41 */ 42 static constexpr const char *MNC = "mnc"; 43 /** 44 * @brief Mobile country code and mobile network code 45 */ 46 static constexpr const char *MCCMNC = "mccmnc"; 47 /** 48 * @brief APN name 49 */ 50 static constexpr const char *APN = "apn"; 51 /** 52 * @brief Authentication type 53 */ 54 static constexpr const char *AUTH_TYPE = "auth_type"; 55 /** 56 * @brief Authentication user 57 */ 58 static constexpr const char *AUTH_USER = "auth_user"; 59 /** 60 * @brief Authentication password 61 */ 62 static constexpr const char *AUTH_PWD = "auth_pwd"; 63 /** 64 * @brief APN type 65 */ 66 static constexpr const char *APN_TYPES = "apn_types"; 67 /** 68 * @brief Roaming or not 69 */ 70 static constexpr const char *IS_ROAMING_APN = "is_roaming_apn"; 71 /** 72 * @brief Operator enable or not 73 */ 74 static constexpr const char *PROFILE_ENABLE = "profile_enable"; 75 /** 76 * @brief Mms center url 77 */ 78 static constexpr const char *HOME_URL = "home_url"; 79 /** 80 * @brief Mms proxy ip address and port 81 */ 82 static constexpr const char *PROXY_IP_ADDRESS = "proxy_ip_address"; 83 /** 84 * @brief Mms ip address and port 85 */ 86 static constexpr const char *MMS_IP_ADDRESS = "mms_ip_address"; 87 /** 88 * @brief Protocol to connect to the APN 89 */ 90 static constexpr const char *APN_PROTOCOL = "apn_protocol"; 91 /** 92 * @brief Protocol to connect to the APN when roaming 93 */ 94 static constexpr const char *APN_ROAM_PROTOCOL = "apn_roam_protocol"; 95 /** 96 * @brief Radio access family bitmask 97 */ 98 static constexpr const char *BEARING_SYSTEM_TYPE = "bearing_system_type"; 99 /** 100 * @brief MVNO match type 101 */ 102 static constexpr const char *MVNO_TYPE = "mvno_type"; 103 /** 104 * @brief MVNO match data 105 */ 106 static constexpr const char *MVNO_MATCH_DATA = "mvno_match_data"; 107 /** 108 * @brief APN edit status 109 */ 110 static constexpr const char *EDITED_STATUS = "edited"; 111 /** 112 * @brief Server address 113 */ 114 static constexpr const char *SERVER = "server"; 115 /** 116 * @brief SIM Id of the SIM card 117 */ 118 static constexpr const char *SIM_ID = "sim_id"; 119 }; 120 121 class PseBaseStationData { 122 public: 123 /** 124 * @brief Operator id 125 */ 126 static constexpr const char *ID = "id"; 127 /** 128 * @brief Date 129 */ 130 static constexpr const char *DATE = "date"; 131 /** 132 * @brief Count 133 */ 134 static constexpr const char *COUNT = "count"; 135 }; 136 137 struct PdpProfile { 138 int profileId = 0; 139 std::string profileName = ""; 140 std::string mcc = ""; 141 std::string mnc = ""; 142 std::string apn = ""; 143 int authType = 0; 144 std::string authUser = ""; 145 std::string authPwd = ""; 146 std::string apnTypes = ""; // see ApnType 147 int isRoamingApn = 1; 148 std::string homeUrl = ""; 149 std::string proxyIpAddress = ""; 150 std::string mmsIpAddress = ""; 151 std::string pdpProtocol = ""; // see PdpProtocol 152 std::string roamPdpProtocol = ""; 153 int bearingSystemType = 0; // see BearingSystemType 154 std::string mvnoType = ""; 155 std::string mvnoMatchData = ""; 156 int edited = 0; 157 std::string server = ""; 158 }; 159 160 class MvnoType { 161 public: 162 inline static const std::string SPN = "spn"; 163 inline static const std::string IMSI = "imsi"; 164 inline static const std::string GID1 = "gid1"; 165 inline static const std::string ICCID = "iccid"; 166 }; 167 168 enum class ApnType { 169 DEFAULT, IMS, MMS, ALL 170 }; 171 172 enum class ApnAuthType { 173 INIT = -1, 174 NONE = 0, 175 PAP, 176 CHAP, 177 PAP_OR_CHAP 178 }; 179 180 enum class PdpProtocol { 181 IPV4 = 0, IPV6, IPV4V6 182 }; 183 184 enum class BearingSystemType { 185 UNKNOWN = 0, 186 LTE, 187 HSPAP, 188 HSPA, 189 HSUPA, 190 HSDPA, 191 UMTS, 192 EDGE, 193 GPRS, 194 eHRPD, 195 EVDO_B, 196 EVDO_A, 197 EVDO_0, 198 xRTT, 199 IS95B, 200 IS95AS 201 }; 202 203 inline static const std::string PREFER_APN_ID = "preferapn_id"; 204 inline static const std::string APN_CONF_CHECKSUM = "apn_conf_checksum"; 205 constexpr const int32_t DEFAULT_SIM_ID = 0; 206 constexpr const int32_t INVALID_PROFILE_ID = -1; 207 constexpr const char *INVALID_OPKEY = "-1"; 208 constexpr const char *TABLE_PDP_PROFILE = "pdp_profile"; 209 constexpr const char *TABLE_PSE_BASE_STATION = "pse_base_station"; 210 constexpr const char *TEMP_TABLE_PDP_PROFILE = "temp_pdp_profile"; 211 constexpr const char *PDP_PROFILE_URI = "datashare:///com.ohos.pdpprofileability"; 212 constexpr const char *PSE_BASE_STATION_URI = "datashare:///com.ohos.pdpprofileability/net/pse_base_station"; 213 } // namespace Telephony 214 } // namespace OHOS 215 #endif // DATA_STORAGE_PDP_PROFILE_DATA_H 216