1 /* 2 * Copyright (c) 2025-2026 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 NETWORKSLICE_DNS_RESULT_CALLBACK_H 17 #define NETWORKSLICE_DNS_RESULT_CALLBACK_H 18 19 #include "netsys_native_client.h" 20 #include "net_conn_client.h" 21 22 namespace OHOS::NetManagerStandard { 23 constexpr int32_t MIN_CELLULAR_NETID = 100; 24 class DnsResultCallback : public NetsysDnsReportCallback { 25 public: 26 DnsResultCallback(); 27 virtual ~DnsResultCallback(); 28 int32_t OnDnsResultReport(uint32_t size, const std::list<NetsysNative::NetDnsResultReport>) override; 29 30 private: 31 bool IsValidNetId(int32_t netId, int32_t wifiNetId, int32_t cellularNetId); 32 void HandleConnectivityChanged(int32_t &wifiNetId, int32_t &cellularNetId); 33 int32_t GetDefaultNetId(); 34 }; 35 } // OHOS 36 #endif 37