• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 PRINT_SECURITY_GUARD_INFO_H
17 #define PRINT_SECURITY_GUARD_INFO_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include <json/json.h>
23 
24 #ifdef SECURITY_GUARDE_ENABLE
25 #include "sg_collect_client.h"
26 #include "time_service_client.h"
27 #include "event_info.h"
28 #endif
29 
30 #include "print_security_guard_util.h"
31 #include "printer_info.h"
32 #include "print_job.h"
33 #include "print_constant.h"
34 #include "print_json_util.h"
35 
36 namespace OHOS::Print {
37 class PrintSecurityGuardInfo {
38 struct PrintTypeInfo {
39     int32_t port = 631;
40     int32_t copyNumber = 1;
41     int32_t printPages = 1;
42     std::string ip;
43     std::string mac;
44     std::string domain;
45     std::string name;
46 };
47 
48 public:
49     PrintSecurityGuardInfo(const std::string callPkg, const std::vector<std::string> &fileList);
50     std::string ToJsonStr();
51     void SetPrintTypeInfo(const PrinterInfo &printerInfo, const PrintJob &printJob);
52 
53 private:
54     int32_t subType_{};
55     std::string caller_{};
56     std::string objectInfo_{};
57     std::string outcome_{};
58     std::string bootTime_{};
59     std::string wallTime_{};
60     std::string targetInfo_{};
61     std::string sourceInfo_{};
62     std::string extra_{};
63     std::string jobName_{};
64     PrintTypeInfo printTypeInfo_;
65 
66     Json::Value ToJson();
67 };
68 } // namespace OHOS::Print
69 
70 #endif // PRINT_SECURITY_GUARD_INFO_H