18e745fdaSopenharmony_ci/*
28e745fdaSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
38e745fdaSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48e745fdaSopenharmony_ci * you may not use this file except in compliance with the License.
58e745fdaSopenharmony_ci * You may obtain a copy of the License at
68e745fdaSopenharmony_ci *
78e745fdaSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
88e745fdaSopenharmony_ci *
98e745fdaSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108e745fdaSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118e745fdaSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128e745fdaSopenharmony_ci * See the License for the specific language governing permissions and
138e745fdaSopenharmony_ci * limitations under the License.
148e745fdaSopenharmony_ci */
158e745fdaSopenharmony_ci
168e745fdaSopenharmony_ci#ifndef NETFIREWALL_HISYSEVENT_H
178e745fdaSopenharmony_ci#define NETFIREWALL_HISYSEVENT_H
188e745fdaSopenharmony_ci
198e745fdaSopenharmony_ci#include <string>
208e745fdaSopenharmony_ci
218e745fdaSopenharmony_ci#include "netfirewall_parcel.h"
228e745fdaSopenharmony_ci#include "net_event_report.h"
238e745fdaSopenharmony_ci#include "net_manager_ext_constants.h"
248e745fdaSopenharmony_ci
258e745fdaSopenharmony_cinamespace OHOS {
268e745fdaSopenharmony_cinamespace NetManagerStandard {
278e745fdaSopenharmony_cistruct NetFirewallEvent {
288e745fdaSopenharmony_ci    int32_t userId = 100;
298e745fdaSopenharmony_ci    int32_t errorType = 0;
308e745fdaSopenharmony_ci    std::string errorMsg;
318e745fdaSopenharmony_ci};
328e745fdaSopenharmony_ci
338e745fdaSopenharmony_ciclass NetFirewallHisysEvent {
348e745fdaSopenharmony_cipublic:
358e745fdaSopenharmony_ci    ~NetFirewallHisysEvent() = default;
368e745fdaSopenharmony_ci
378e745fdaSopenharmony_ci    static NetFirewallHisysEvent &GetInstance();
388e745fdaSopenharmony_ci
398e745fdaSopenharmony_ci    /**
408e745fdaSopenharmony_ci     * Send firewall configuration management information
418e745fdaSopenharmony_ci     *
428e745fdaSopenharmony_ci     * @param userId User id
438e745fdaSopenharmony_ci     * @param errorCode
448e745fdaSopenharmony_ci     */
458e745fdaSopenharmony_ci    static void SendFirewallConfigReport(int32_t userId, int32_t &errorCode);
468e745fdaSopenharmony_ci
478e745fdaSopenharmony_ci    /**
488e745fdaSopenharmony_ci     * Send and obtain firewall management information
498e745fdaSopenharmony_ci     *
508e745fdaSopenharmony_ci     * @param userId User id
518e745fdaSopenharmony_ci     * @param errorCode Errorcode such as FIREWALL_SUCCESS = 0,
528e745fdaSopenharmony_ci     *     FIREWALL_ERR_PERMISSION_DENIED = 201 and so on
538e745fdaSopenharmony_ci     */
548e745fdaSopenharmony_ci    static void SendFirewallRequestReport(const int32_t userId, int32_t &errorCode);
558e745fdaSopenharmony_ci
568e745fdaSopenharmony_ci    /**
578e745fdaSopenharmony_ci     * Sending and obtaining interception records and tracking information
588e745fdaSopenharmony_ci     *
598e745fdaSopenharmony_ci     * @param userId User id
608e745fdaSopenharmony_ci     * @param errorCode Errorcode such as FIREWALL_SUCCESS = 0,
618e745fdaSopenharmony_ci     *     FIREWALL_ERR_PERMISSION_DENIED = 201 and so on
628e745fdaSopenharmony_ci     */
638e745fdaSopenharmony_ci    static void SendRecordRequestReport(const int32_t userId, int32_t &errorCode);
648e745fdaSopenharmony_ci
658e745fdaSopenharmony_ci    /**
668e745fdaSopenharmony_ci     * Send initialization default rule information
678e745fdaSopenharmony_ci     *
688e745fdaSopenharmony_ci     * @param userId User id
698e745fdaSopenharmony_ci     * @param errorCode Errorcode such as FIREWALL_SUCCESS = 0,
708e745fdaSopenharmony_ci     *     FIREWALL_ERR_PERMISSION_DENIED = 201 and so on
718e745fdaSopenharmony_ci     */
728e745fdaSopenharmony_ci    static void SendInitDefaultRequestReport(const int32_t userId, int32_t &errorCode);
738e745fdaSopenharmony_ci
748e745fdaSopenharmony_ciprivate:
758e745fdaSopenharmony_ci    NetFirewallHisysEvent() = default;
768e745fdaSopenharmony_ci
778e745fdaSopenharmony_ci    void SendNetFirewallRuleFault(const NetFirewallEvent &event, const std::string &eventName);
788e745fdaSopenharmony_ci
798e745fdaSopenharmony_ci    void SendNetFirewallRuleBehavior(const int32_t userId, const std::string &eventName);
808e745fdaSopenharmony_ci
818e745fdaSopenharmony_ci    void SendNetFirewallFault(const NetFirewallEvent &event, const std::string &eventName);
828e745fdaSopenharmony_ci
838e745fdaSopenharmony_ci    void SendNetFirewallBehavior(const int32_t userId, const std::string &eventName);
848e745fdaSopenharmony_ci};
858e745fdaSopenharmony_ci} // namespace NetManagerStandard
868e745fdaSopenharmony_ci} // namespace OHOS
878e745fdaSopenharmony_ci#endif // NETFIREWALL_HISYSEVENT_H