blob: 2c0ab4893ba50c2033bd03957b29554fdfdc178e [file] [log] [blame]
Joe Onorato99598ee2019-02-11 15:55:13 +00001/*
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
25namespace android {
26namespace os {
27namespace incidentd {
28
29using std::vector;
30using google::protobuf::MessageLite;
31
32/**
33 * Write the IncidentHeaderProto section
34 */
Yao Chencbafce92019-04-01 15:56:44 -070035status_t write_header_section(int fd, const uint8_t* buf, size_t bufSize);
Joe Onorato99598ee2019-02-11 15:55:13 +000036
37/**
38 * Write the prologue for a section in the incident report
39 * (This is the proto length-prefixed field format).
40 */
41status_t write_section_header(int fd, int sectionId, size_t size);
42
43/**
44 * Write the given protobuf object as a section.
45 */
46status_t write_section(int fd, int sectionId, const MessageLite& message);
47
48} // namespace incidentd
49} // namespace os
50} // namespace android
51
52