1 /* 2 * Copyright (C) 2021 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 APN_ITEM_H 17 #define APN_ITEM_H 18 19 #include <string> 20 #include <vector> 21 22 #include "refbase.h" 23 24 #include "pdp_profile_data.h" 25 26 #include "cellular_data_constant.h" 27 28 namespace OHOS { 29 namespace Telephony { 30 class ApnItem : public RefBase { 31 public: 32 ApnItem(); 33 ~ApnItem(); 34 std::vector<std::string> GetApnTypes() const; 35 bool CanDealWithType(const std::string &type) const; 36 void MarkBadApn(bool badApn); 37 bool IsBadApn() const; 38 static sptr<ApnItem> MakeDefaultApn(const std::string &apnType); 39 static sptr<ApnItem> MakeApn(const PdpProfile &apnData); 40 41 public: 42 constexpr static int ALL_APN_ITEM_CHAR_LENGTH = 256; 43 struct attribute { 44 char types_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 45 char numeric_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 46 int32_t profileId_ = 0; 47 char protocol_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 48 char roamingProtocol_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 49 int32_t authType_ = 0; 50 char apn_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 51 char apnName_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 52 char user_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 53 char password_[ALL_APN_ITEM_CHAR_LENGTH] = { 0 }; 54 } attr_; 55 56 private: 57 std::vector<std::string> apnTypes_; 58 bool badApn_ = false; 59 }; 60 } // namespace Telephony 61 } // namespace OHOS 62 #endif // APN_ITEM_H 63