1// Copyright 2016 gRPC authors.
2//
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
15syntax = "proto3";
16
17import "google/protobuf/timestamp.proto";
18
19package grpc.binary_log.v1alpha;
20
21enum Direction {
22  SERVER_SEND = 0;
23  SERVER_RECV = 1;
24  CLIENT_SEND = 2;
25  CLIENT_RECV = 3;
26}
27
28message KeyValuePair {
29  string key = 1;
30  string value = 2;
31}
32
33// Any sort of metadata that may be sent in either direction during a call
34message Metadata {
35  // Cryptographically unique identifier, generated on the client and sent
36  // to the server.
37  uint64 rpc_id = 1;
38  // Timestamp of logging the metadata
39  google.protobuf.Timestamp timestamp = 2;
40  Direction direction = 3;
41  // The actual metadata that is being sent
42  repeated KeyValuePair metadata = 4;
43
44  // Initial metadata sent by the client to initiate a request
45  message ClientInitialMetadata {
46    // The full method name that is being called
47    string method_name = 1;
48    // The call's deadline
49    google.protobuf.Timestamp deadline = 2;
50    // The address of the connected peer
51    string peer = 3;
52  }
53
54  // Arbitrary key/value pairs specified by the user that are not sent over
55  // the network but are nonetheless useful to log
56  message UserData {
57  }
58
59  // Initial metadata response sent by the server after accepting the request
60  message ServerInitialMetadata {
61  }
62
63  // Status sent by the server when closing the call on the server side
64  message ServerStatus {
65    // The status code
66    uint32 code = 1;
67    // The status details
68    string details = 2;
69  }
70
71  oneof kind {
72    ClientInitialMetadata client_initial_metadata = 5;
73    UserData user_data = 6;
74    ServerInitialMetadata server_initial_metadata = 7;
75    ServerStatus server_status = 8;
76  }
77}
78
79// A message that is sent during a call
80message Message {
81  // Cryptographically unique identifier, generated on the client and sent
82  // to the server.
83  uint64 rpc_id = 1;
84  // The sequence number of the message. Messages sent by the client and by the
85  // server should have independently incrementing sequence numbers.
86  uint32 sequence_number = 2;
87  Direction direction = 3;
88  // The length of the complete message.
89  uint32 length = 4;
90  // The contents of the message. May be a prefix instead of the complete
91  // message.
92  bytes data = 5;
93}
94