blob: e01a798fea44ac2086e8ca3a19257241af1ac387 [file] [log] [blame]
/*
* Copyright (C) 2017 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.
*/
syntax = "proto2";
package perfetto.protos;
message IPCFrame {
// Client -> Host.
message BindService { optional string service_name = 1; }
// Host -> Client.
message BindServiceReply {
message MethodInfo {
optional uint32 id = 1;
optional string name = 2;
}
optional bool success = 1;
optional uint32 service_id = 2;
repeated MethodInfo methods = 3;
}
// Client -> Host.
message InvokeMethod {
// BindServiceReply.id.
optional uint32 service_id = 1;
// BindServiceReply.method.id.
optional uint32 method_id = 2;
// Proto-encoded request argument.
optional bytes args_proto = 3;
// When true the client specifies that a reply is not needed. The use case
// is a method with an empty, where the client doesn't care about the
// success/failure of the method invocation and rather prefers avoiding the
// IPC roundtrip + context switch associated with the reply.
optional bool drop_reply = 4;
}
// Host -> Client.
message InvokeMethodReply {
optional bool success = 1;
// only for streaming RPCs.
optional bool has_more = 2;
// proto-encoded response value.
optional bytes reply_proto = 3;
}
// Host -> Client.
message RequestError { optional string error = 1; }
// Client (relay service) -> Host. This is generated by the relay service to
// fill the producer identity in the guest. This message is sent to the host
// service *before* any IPCFrame is from a local producer is relayed. This is
// accepted only on AF_VSOCK and AF_INET sockets, where we cannot validate the
// endpoont of the connection. for AF_UNIX sockets, this is ignored and traced
// uses instead the SO_PEERCRED.
message SetPeerIdentity {
// The UID and PID of the producer process.
optional int32 pid = 1;
optional int32 uid = 2;
// The hint for the tracing service to infer the machine ID. This field
// should satisfy the requriement that different machines should have
// different values. In practice, this filed contains the Linux kernel
// boot_id, or a hash of kernel bootup timestamp and uname(2) if boot_id
// isn't available.
optional string machine_id_hint = 3;
}
// The client is expected to send requests with monotonically increasing
// request_id. The host will match the request_id sent from the client.
// In the case of a Streaming response (has_more = true) the host will send
// several InvokeMethodReply with the same request_id.
optional uint64 request_id = 2;
oneof msg {
BindService msg_bind_service = 3;
BindServiceReply msg_bind_service_reply = 4;
InvokeMethod msg_invoke_method = 5;
InvokeMethodReply msg_invoke_method_reply = 6;
RequestError msg_request_error = 7;
SetPeerIdentity set_peer_identity = 8;
}
// Used only in unittests to generate a parsable message of arbitrary size.
repeated bytes data_for_testing = 1;
};