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
19namespace OHOS {
20namespace Telephony {
21class PdpProfileData {
22public:
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
121struct PdpProfile {
122    int profileId = 0;
123    std::string profileName = "";
124    std::string mcc = "";
125    std::string mnc = "";
126    std::string apn = "";
127    int authType = 0;
128    std::string authUser = "";
129    std::string authPwd = "";
130    std::string apnTypes = ""; // see ApnType
131    int isRoamingApn = 1;
132    std::string homeUrl = "";
133    std::string proxyIpAddress = "";
134    std::string mmsIpAddress = "";
135    std::string pdpProtocol = ""; // see PdpProtocol
136    std::string roamPdpProtocol = "";
137    int bearingSystemType = 0; // see BearingSystemType
138    std::string mvnoType = "";
139    std::string mvnoMatchData = "";
140    int edited = 0;
141    std::string server = "";
142};
143
144class MvnoType {
145public:
146    inline static const std::string SPN = "spn";
147    inline static const std::string IMSI = "imsi";
148    inline static const std::string GID1 = "gid1";
149    inline static const std::string ICCID = "iccid";
150};
151
152enum class ApnType {
153    DEFAULT, IMS, MMS, ALL
154};
155
156enum class ApnAuthType {
157    None = 0, PAP, CHAP, PAP_OR_CHAP
158};
159
160enum class PdpProtocol {
161    IPV4 = 0, IPV6, IPV4V6
162};
163
164enum class BearingSystemType {
165    UNKNOWN = 0,
166    LTE,
167    HSPAP,
168    HSPA,
169    HSUPA,
170    HSDPA,
171    UMTS,
172    EDGE,
173    GPRS,
174    eHRPD,
175    EVDO_B,
176    EVDO_A,
177    EVDO_0,
178    xRTT,
179    IS95B,
180    IS95AS
181};
182
183inline static const std::string PREFER_APN_ID = "preferapn_id";
184inline static const std::string APN_CONF_CHECKSUM = "apn_conf_checksum";
185constexpr const int32_t DEFAULT_SIM_ID = 0;
186constexpr const int32_t INVALID_PROFILE_ID = -1;
187constexpr const char *INVALID_OPKEY = "-1";
188constexpr const char *TABLE_PDP_PROFILE = "pdp_profile";
189constexpr const char *TEMP_TABLE_PDP_PROFILE = "temp_pdp_profile";
190constexpr const char *PDP_PROFILE_URI = "datashare:///com.ohos.pdpprofileability";
191} // namespace Telephony
192} // namespace OHOS
193#endif // DATA_STORAGE_PDP_PROFILE_DATA_H
194