• 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_rxbeytes_contex.h"
25 #include "get_iface_rxbeytes_context.h"
26 #include "get_iface_stats_context.h"
27 #include "get_iface_uid_stats_context.h"
28 #include "get_uid_rxbeytes_context.h"
29 #include "update_iface_stats_context.h"
30 
31 namespace OHOS {
32 namespace NetManagerStandard {
33 class StatisticsExec final {
34 public:
35     StatisticsExec() = delete;
36     ~StatisticsExec() = delete;
37 
38     static bool ExecGetCellularRxBytes(GetCellularRxBytesContext *context);
39     static bool ExecGetCellularTxBytes(GetCellularTxBytesContext *context);
40     static bool ExecGetAllRxBytes(GetAllRxBytesContext *context);
41     static bool ExecGetAllTxBytes(GetAllTxBytesContext *context);
42     static bool ExecGetUidRxBytes(GetUidRxBytesContext *context);
43     static bool ExecGetUidTxBytes(GetUidTxBytesContext *context);
44     static bool ExecGetIfaceRxBytes(GetIfaceRxBytesContext *context);
45     static bool ExecGetIfaceTxBytes(GetIfaceTxBytesContext *context);
46 
47     static napi_value GetCellularRxBytesCallback(GetCellularRxBytesContext *context);
48     static napi_value GetCellularTxBytesCallback(GetCellularTxBytesContext *context);
49     static napi_value GetAllRxBytesCallback(GetAllRxBytesContext *context);
50     static napi_value GetAllTxBytesCallback(GetAllTxBytesContext *context);
51     static napi_value GetUidRxBytesCallback(GetUidRxBytesContext *context);
52     static napi_value GetUidTxBytesCallback(GetUidTxBytesContext *context);
53     static napi_value GetIfaceRxBytesCallback(GetIfaceRxBytesContext *context);
54     static napi_value GetIfaceTxBytesCallback(GetIfaceTxBytesContext *context);
55 
56     static napi_value CreateCodeMessage(napi_env env, const std::string &msg, int32_t code);
57 };
58 } // namespace NetManagerStandard
59 } // namespace OHOS
60 #endif // COMMUNICATIONNETMANAGERBASE_STATISTICS_EXEC_H
61