1 /* 2 * Copyright (C) 2024 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 INCLUDE_WIFI_NETLINK_H 17 #define INCLUDE_WIFI_NETLINK_H 18 19 #include <functional> 20 #include <memory> 21 #include <netinet/in.h> 22 #include <sys/epoll.h> 23 #include "wifi_errcode.h" 24 25 struct WifiNetLinkCallbacks { 26 std::function<void(const std::vector<int64_t> &elems, const int32_t cmd, const int32_t mInstId)> 27 OnTcpReportMsgComplete; 28 }; 29 30 namespace OHOS { 31 namespace Wifi { 32 33 class WifiNetLink { 34 public: 35 static WifiNetLink &GetInstance(); 36 void InitWifiNetLink(const WifiNetLinkCallbacks &wifiNetLinkCallbacks); 37 int32_t SendCmdKernel(int32_t sockFd, int32_t cmd, int32_t flag); 38 int32_t StartMonitor(int32_t sockFd); 39 int32_t ProcessQueryTcp(int32_t sockFd); 40 int32_t SendQoeCmd(int32_t cmd, int32_t arg = 0); 41 int32_t ProcessReportMsg(int32_t sockFd, int32_t cmd); 42 private: 43 WifiNetLinkCallbacks mWifiNetLinkCallbacks; 44 int32_t mInstId = 0; 45 }; 46 47 } // namespace Wifi 48 } // namespace OHOS 49 #endif 50