1 /* 2 * Copyright (c) 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 COMMUNICATIONNETMANAGEREXT_NETSHARE_EXEC_H 17 #define COMMUNICATIONNETMANAGEREXT_NETSHARE_EXEC_H 18 19 #include <napi/native_api.h> 20 #include <netdb.h> 21 22 #include "netshare_issharing_context.h" 23 #include "netshare_startsharing_context.h" 24 25 namespace OHOS { 26 namespace NetManagerStandard { 27 class NetShareExec final { 28 public: 29 DISALLOW_COPY_AND_MOVE(NetShareExec); 30 31 NetShareExec() = delete; 32 ~NetShareExec() = delete; 33 34 static bool ExecIsSharingSupported(IsSharingSupportedContext *context); 35 static napi_value IsSharingSupportedCallback(IsSharingSupportedContext *context); 36 static bool ExecIsSharing(NetShareIsSharingContext *context); 37 static napi_value IsSharingCallback(NetShareIsSharingContext *context); 38 static bool ExecStartSharing(NetShareStartSharingContext *context); 39 static napi_value StartSharingCallback(NetShareStartSharingContext *context); 40 static bool ExecStopSharing(StopSharingContext *context); 41 static napi_value StopSharingCallback(StopSharingContext *context); 42 static bool ExecGetSharingIfaces(GetSharingIfacesContext *context); 43 static napi_value GetSharingIfacesCallback(GetSharingIfacesContext *context); 44 static bool ExecGetSharingState(GetSharingStateContext *context); 45 static napi_value GetSharingStateCallback(GetSharingStateContext *context); 46 static bool ExecGetSharableRegexes(GetSharableRegexesContext *context); 47 static napi_value GetSharableRegexesCallback(GetSharableRegexesContext *context); 48 static bool ExecGetStatsRxBytes(GetStatsRxBytesContext *context); 49 static napi_value GetStatsRxBytesCallback(GetStatsRxBytesContext *context); 50 static bool ExecGetStatsTxBytes(GetStatsTxBytesContext *context); 51 static napi_value GetStatsTxBytesCallback(GetStatsTxBytesContext *context); 52 static bool ExecGetStatsTotalBytes(GetStatsTotalBytesContext *context); 53 static napi_value GetStatsTotalBytesCallback(GetStatsTotalBytesContext *context); 54 }; 55 } // namespace NetManagerStandard 56 } // namespace OHOS 57 #endif // COMMUNICATIONNETMANAGEREXT_NETSHARE_EXEC_H 58