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 None = 0, PAP, CHAP, PAP_OR_CHAP 174 }; 175 176 enum class PdpProtocol { 177 IPV4 = 0, IPV6, IPV4V6 178 }; 179 180 enum class BearingSystemType { 181 UNKNOWN = 0, 182 LTE, 183 HSPAP, 184 HSPA, 185 HSUPA, 186 HSDPA, 187 UMTS, 188 EDGE, 189 GPRS, 190 eHRPD, 191 EVDO_B, 192 EVDO_A, 193 EVDO_0, 194 xRTT, 195 IS95B, 196 IS95AS 197 }; 198 199 inline static const std::string PREFER_APN_ID = "preferapn_id"; 200 inline static const std::string APN_CONF_CHECKSUM = "apn_conf_checksum"; 201 constexpr const int32_t DEFAULT_SIM_ID = 0; 202 constexpr const int32_t INVALID_PROFILE_ID = -1; 203 constexpr const char *INVALID_OPKEY = "-1"; 204 constexpr const char *TABLE_PDP_PROFILE = "pdp_profile"; 205 constexpr const char *TABLE_PSE_BASE_STATION = "pse_base_station"; 206 constexpr const char *TEMP_TABLE_PDP_PROFILE = "temp_pdp_profile"; 207 constexpr const char *PDP_PROFILE_URI = "datashare:///com.ohos.pdpprofileability"; 208 constexpr const char *PSE_BASE_STATION_URI = "datashare:///com.ohos.pdpprofileability/net/pse_base_station"; 209 } // namespace Telephony 210 } // namespace OHOS 211 #endif // DATA_STORAGE_PDP_PROFILE_DATA_H 212