1 /*
2  * Copyright (c) 2021-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 FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_RECORD_H
17 #define FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_RECORD_H
18 
19 #include "accesstoken_kit.h"
20 #include "common_event_constant.h"
21 #include "common_event_data.h"
22 #include "common_event_publish_info.h"
23 
24 namespace OHOS {
25 namespace EventFwk {
26 struct EventRecordInfo {
27     pid_t pid;
28     uid_t uid;
29     Security::AccessToken::AccessTokenID callerToken;
30     std::string bundleName;
31     bool isSubsystem;
32     bool isSystemApp;
33     bool isProxy;
34     std::string subId;
35 
EventRecordInfoEventRecordInfo36     EventRecordInfo() : pid(0), uid(0), callerToken(0), isSubsystem(false), isSystemApp(false), isProxy(false) {}
37 };
38 
39 struct CommonEventRecord {
40     std::shared_ptr<CommonEventData> commonEventData;
41     std::shared_ptr<CommonEventPublishInfo> publishInfo;
42     struct tm recordTime {};
43     EventRecordInfo eventRecordInfo;
44     int32_t userId;
45     bool isSystemEvent;
46 
CommonEventRecordCommonEventRecord47     CommonEventRecord()
48         : commonEventData(nullptr),
49           publishInfo(nullptr),
50           userId(UNDEFINED_USER),
51           isSystemEvent(false)
52     {}
53 };
54 }  // namespace EventFwk
55 }  // namespace OHOS
56 #endif  // FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_COMMON_EVENT_RECORD_H