xref: /aosp_15_r20/external/grpc-grpc-java/services/src/main/proto/grpc/reflection/v1alpha/reflection.proto (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1// Copyright 2016 The 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// Service exported by server reflection
15
16
17// Warning: this entire file is deprecated. Use this instead:
18// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto
19
20syntax = "proto3";
21
22package grpc.reflection.v1alpha;
23
24option deprecated = true;
25option java_multiple_files = true;
26option java_package = "io.grpc.reflection.v1alpha";
27option java_outer_classname = "ServerReflectionProto";
28
29service ServerReflection {
30  // The reflection service is structured as a bidirectional stream, ensuring
31  // all related requests go to a single server.
32  rpc ServerReflectionInfo(stream ServerReflectionRequest)
33      returns (stream ServerReflectionResponse);
34}
35
36// The message sent by the client when calling ServerReflectionInfo method.
37message ServerReflectionRequest {
38  string host = 1;
39  // To use reflection service, the client should set one of the following
40  // fields in message_request. The server distinguishes requests by their
41  // defined field and then handles them using corresponding methods.
42  oneof message_request {
43    // Find a proto file by the file name.
44    string file_by_filename = 3;
45
46    // Find the proto file that declares the given fully-qualified symbol name.
47    // This field should be a fully-qualified symbol name
48    // (e.g. <package>.<service>[.<method>] or <package>.<type>).
49    string file_containing_symbol = 4;
50
51    // Find the proto file which defines an extension extending the given
52    // message type with the given field number.
53    ExtensionRequest file_containing_extension = 5;
54
55    // Finds the tag numbers used by all known extensions of extendee_type, and
56    // appends them to ExtensionNumberResponse in an undefined order.
57    // Its corresponding method is best-effort: it's not guaranteed that the
58    // reflection service will implement this method, and it's not guaranteed
59    // that this method will provide all extensions. Returns
60    // StatusCode::UNIMPLEMENTED if it's not implemented.
61    // This field should be a fully-qualified type name. The format is
62    // <package>.<type>
63    string all_extension_numbers_of_type = 6;
64
65    // List the full names of registered services. The content will not be
66    // checked.
67    string list_services = 7;
68  }
69}
70
71// The type name and extension number sent by the client when requesting
72// file_containing_extension.
73message ExtensionRequest {
74  // Fully-qualified type name. The format should be <package>.<type>
75  string containing_type = 1;
76  int32 extension_number = 2;
77}
78
79// The message sent by the server to answer ServerReflectionInfo method.
80message ServerReflectionResponse {
81  string valid_host = 1;
82  ServerReflectionRequest original_request = 2;
83  // The server set one of the following fields accroding to the message_request
84  // in the request.
85  oneof message_response {
86    // This message is used to answer file_by_filename, file_containing_symbol,
87    // file_containing_extension requests with transitive dependencies. As
88    // the repeated label is not allowed in oneof fields, we use a
89    // FileDescriptorResponse message to encapsulate the repeated fields.
90    // The reflection service is allowed to avoid sending FileDescriptorProtos
91    // that were previously sent in response to earlier requests in the stream.
92    FileDescriptorResponse file_descriptor_response = 4;
93
94    // This message is used to answer all_extension_numbers_of_type requst.
95    ExtensionNumberResponse all_extension_numbers_response = 5;
96
97    // This message is used to answer list_services request.
98    ListServiceResponse list_services_response = 6;
99
100    // This message is used when an error occurs.
101    ErrorResponse error_response = 7;
102  }
103}
104
105// Serialized FileDescriptorProto messages sent by the server answering
106// a file_by_filename, file_containing_symbol, or file_containing_extension
107// request.
108message FileDescriptorResponse {
109  // Serialized FileDescriptorProto messages. We avoid taking a dependency on
110  // descriptor.proto, which uses proto2 only features, by making them opaque
111  // bytes instead.
112  repeated bytes file_descriptor_proto = 1;
113}
114
115// A list of extension numbers sent by the server answering
116// all_extension_numbers_of_type request.
117message ExtensionNumberResponse {
118  // Full name of the base type, including the package name. The format
119  // is <package>.<type>
120  string base_type_name = 1;
121  repeated int32 extension_number = 2;
122}
123
124// A list of ServiceResponse sent by the server answering list_services request.
125message ListServiceResponse {
126  // The information of each service may be expanded in the future, so we use
127  // ServiceResponse message to encapsulate it.
128  repeated ServiceResponse service = 1;
129}
130
131// The information of a single service used by ListServiceResponse to answer
132// list_services request.
133message ServiceResponse {
134  // Full name of a registered service, including its package name. The format
135  // is <package>.<service>
136  string name = 1;
137}
138
139// The error code and error message sent by the server when an error occurs.
140message ErrorResponse {
141  // This field uses the error codes defined in grpc::StatusCode.
142  int32 error_code = 1;
143  string error_message = 2;
144}
145