Joe Onorato | 99598ee | 2019-02-11 15:55:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include <utils/Errors.h> |
| 20 | |
| 21 | #include <google/protobuf/message_lite.h> |
| 22 | |
| 23 | #include <vector> |
| 24 | |
| 25 | namespace android { |
| 26 | namespace os { |
| 27 | namespace incidentd { |
| 28 | |
| 29 | using std::vector; |
| 30 | using google::protobuf::MessageLite; |
| 31 | |
| 32 | /** |
| 33 | * Write the IncidentHeaderProto section |
| 34 | */ |
Yao Chen | cbafce9 | 2019-04-01 15:56:44 -0700 | [diff] [blame^] | 35 | status_t write_header_section(int fd, const uint8_t* buf, size_t bufSize); |
Joe Onorato | 99598ee | 2019-02-11 15:55:13 +0000 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Write the prologue for a section in the incident report |
| 39 | * (This is the proto length-prefixed field format). |
| 40 | */ |
| 41 | status_t write_section_header(int fd, int sectionId, size_t size); |
| 42 | |
| 43 | /** |
| 44 | * Write the given protobuf object as a section. |
| 45 | */ |
| 46 | status_t write_section(int fd, int sectionId, const MessageLite& message); |
| 47 | |
| 48 | } // namespace incidentd |
| 49 | } // namespace os |
| 50 | } // namespace android |
| 51 | |
| 52 | |