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 CELLULAR_DATA_UTILS_H 17 #define CELLULAR_DATA_UTILS_H 18 19 #include <vector> 20 #include <utility> 21 22 #include "parameter.h" 23 24 #include "cellular_data_constant.h" 25 #include "cellular_data_state_machine.h" 26 27 namespace OHOS { 28 namespace Telephony { 29 class CellularDataUtils { 30 public: 31 static std::vector<AddressInfo> ParseIpAddr(const std::string &address); 32 static std::vector<AddressInfo> ParseNormalIpAddr(const std::string &address); 33 static std::vector<RouteInfo> ParseRoute(const std::string &address); 34 static bool ParseDotIpData(const std::string &address, AddressInfo &ipInfo); 35 static std::vector<std::string> Split(const std::string &input, const std::string &flag); 36 static bool IsDigit(const std::string &data); 37 static int32_t GetPrefixLen(const std::string &netmask, const std::string& flag); 38 static int32_t GetPrefixLen(const std::vector<std::string> &netmask, const size_t start); 39 static int GetDefaultMobileMtuConfig(); 40 static bool GetDefaultPreferApnConfig(); 41 static bool GetDefaultMultipleConnectionsConfig(); 42 static std::string ConvertRadioTechToRadioName(const int32_t radioTech); 43 44 private: 45 CellularDataUtils() = default; 46 ~CellularDataUtils() = default; 47 }; 48 } // namespace Telephony 49 } // namespace OHOS 50 #endif // CELLULAR_DATA_UTILS_H 51