• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 COMMUNICATIONNETMANAGERBASE_STATISTICS_EXEC_H
17 #define COMMUNICATIONNETMANAGERBASE_STATISTICS_EXEC_H
18 
19 #include <cstdint>
20 #include <string>
21 
22 #include <napi/native_api.h>
23 
24 #include "get_cellular_rxbytes_context.h"
25 #include "get_iface_rxbytes_context.h"
26 #include "get_iface_stats_context.h"
27 #include "get_iface_uid_stats_context.h"
28 #include "get_uid_rxbytes_context.h"
29 #include "update_iface_stats_context.h"
30 #include "get_sockfd_rxbytes_context.h"
31 
32 namespace OHOS {
33 namespace NetManagerStandard {
34 class StatisticsExec final {
35 public:
36     StatisticsExec() = delete;
37     ~StatisticsExec() = delete;
38 
39     static bool ExecGetCellularRxBytes(GetCellularRxBytesContext *context);
40     static bool ExecGetCellularTxBytes(GetCellularTxBytesContext *context);
41     static bool ExecGetAllRxBytes(GetAllRxBytesContext *context);
42     static bool ExecGetAllTxBytes(GetAllTxBytesContext *context);
43     static bool ExecGetUidRxBytes(GetUidRxBytesContext *context);
44     static bool ExecGetUidTxBytes(GetUidTxBytesContext *context);
45     static bool ExecGetIfaceRxBytes(GetIfaceRxBytesContext *context);
46     static bool ExecGetIfaceTxBytes(GetIfaceTxBytesContext *context);
47     static bool ExecGetIfaceStats(GetIfaceStatsContext *context);
48     static bool ExecGetIfaceUidStats(GetIfaceUidStatsContext *context);
49     static bool ExecUpdateIfacesStats(UpdateIfacesStatsContext *context);
50     static bool ExecUpdateStatsData(UpdateStatsDataContext *context);
51     static bool ExecGetSockfdRxBytes(GetSockfdRxBytesContext *context);
52     static bool ExecGetSockfdTxBytes(GetSockfdTxBytesContext *context);
53 
54     static napi_value GetCellularRxBytesCallback(GetCellularRxBytesContext *context);
55     static napi_value GetCellularTxBytesCallback(GetCellularTxBytesContext *context);
56     static napi_value GetAllRxBytesCallback(GetAllRxBytesContext *context);
57     static napi_value GetAllTxBytesCallback(GetAllTxBytesContext *context);
58     static napi_value GetUidRxBytesCallback(GetUidRxBytesContext *context);
59     static napi_value GetUidTxBytesCallback(GetUidTxBytesContext *context);
60     static napi_value GetIfaceRxBytesCallback(GetIfaceRxBytesContext *context);
61     static napi_value GetIfaceTxBytesCallback(GetIfaceTxBytesContext *context);
62     static napi_value GetIfaceStatsCallback(GetIfaceStatsContext *context);
63     static napi_value GetIfaceUidStatsCallback(GetIfaceUidStatsContext *context);
64     static napi_value UpdateIfacesStatsCallback(UpdateIfacesStatsContext *context);
65     static napi_value UpdateStatsDataCallback(UpdateStatsDataContext *context);
66     static napi_value GetSockfdRxBytesCallback(GetSockfdRxBytesContext *context);
67     static napi_value GetSockfdTxBytesCallback(GetSockfdTxBytesContext *context);
68 
69     static napi_value CreateCodeMessage(napi_env env, const std::string &msg, int32_t code);
70 };
71 } // namespace NetManagerStandard
72 } // namespace OHOS
73 #endif // COMMUNICATIONNETMANAGERBASE_STATISTICS_EXEC_H
74