blob: 516766ec08d61e4d2382eae9296106f4bbfa6bab [file] [log] [blame]
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Use proto3 syntax as an optimization. The difference is that proto2 stores
// unknown fields seen while decoding in an internal buffer (std::string) while
// proto3 completely drops them. Since during validation we only need to check
// for the presence of the trusted fields below, we can use proto3 as a way to
// speed up this process.
//
// See https://developers.google.com/protocol-buffers/docs/proto3#unknowns and
// https://android-review.googlesource.com/c/platform/external/perfetto/+/
// 591673#17 for details.
syntax = "proto3";
option optimize_for = LITE_RUNTIME;
import "perfetto/common/trace_stats.proto";
import "perfetto/config/trace_config.proto";
import "perfetto/trace/clock_snapshot.proto";
import "perfetto/trace/system_info.proto";
import "perfetto/trace/trigger.proto";
package perfetto.protos;
// This proto contains trusted fields of TracePacket which may only be generated
// by the service (as opposed to the untrusted producers). Note that the field
// ids here must be kept in sync with TracePacket.
// This protobuf serves two purposes:
// 1. Security validation of packets (see packet_stream_validator.cc)
// 2. Avoid bloating the service binary with symbols for all possible trace
// protos. The service doesn't really care about all the protos in the trace,
// is just passes them through.
message TrustedPacket {
// User id of the producer which generated this packet.
// The oneof boilerplate here is required to tell the difference between
// uid == 0 and uid not set (the writer uses proto2).
oneof optional_trusted_uid { int32 trusted_uid = 3; };
oneof optional_trusted_packet_sequence_id {
uint32 trusted_packet_sequence_id = 10;
}
ClockSnapshot clock_snapshot = 6;
uint64 timestamp = 8;
TraceConfig trace_config = 33;
TraceStats trace_stats = 35;
bytes synchronization_marker = 36;
bool previous_packet_dropped = 42;
SystemInfo system_info = 45;
Trigger trigger = 46;
}