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 SECURITY_COLLECTOR_SECURITY_EVENT_H 17 #define SECURITY_COLLECTOR_SECURITY_EVENT_H 18 19 #include <string> 20 21 #include "parcel.h" 22 23 namespace OHOS::Security::SecurityCollector { 24 class SecurityEvent : public Parcelable { 25 public: 26 SecurityEvent() = default; 27 SecurityEvent(int64_t eventId, const std::string &version = "", const std::string &content = "") 28 : eventId_(eventId), version_(version), content_(content) {}; 29 ~SecurityEvent() override = default; 30 GetEventId()31 int64_t GetEventId() const { return eventId_; }; GetVersion()32 std::string GetVersion() const { return version_; }; GetContent()33 std::string GetContent() const { return content_; }; 34 bool Marshalling(Parcel& parcel) const override; 35 bool ReadFromParcel(Parcel &parcel); 36 static SecurityEvent* Unmarshalling(Parcel& parcel); 37 38 private: 39 int64_t eventId_; 40 std::string version_; 41 std::string content_; 42 }; 43 } // namespace OHOS::Security::SecurityCollector 44 45 #endif // SECURITY_COLLECTOR_SECURITY_EVENT_H 46