1
1
// Protocol Buffers - Google's data interchange format
2
// Copyright 2008 Google Inc.
2
// Copyright 2008 Google Inc. All rights reserved.
3
3
// http://code.google.com/p/protobuf/
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
9
// http://www.apache.org/licenses/LICENSE-2.0
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
9
// * Redistributions of source code must retain the above copyright
10
// notice, this list of conditions and the following disclaimer.
11
// * Redistributions in binary form must reproduce the above
12
// copyright notice, this list of conditions and the following disclaimer
13
// in the documentation and/or other materials provided with the
15
// * Neither the name of Google Inc. nor the names of its
16
// contributors may be used to endorse or promote products derived from
17
// this software without specific prior written permission.
19
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
31
// Author: kenton@google.com (Kenton Varda)
18
32
// Based on original Protocol Buffers design by
32
46
// algorithms don't work during bootstrapping.
33
47
option optimize_for = SPEED;
49
// The protocol compiler can output a FileDescriptorSet containing the .proto
51
message FileDescriptorSet {
52
repeated FileDescriptorProto file = 1;
35
55
// Describes a complete .proto file.
36
56
message FileDescriptorProto {
37
57
optional string name = 1; // file name, relative to root of source tree
179
199
// Each of the definitions above may have "options" attached. These are
180
200
// just annotations which may cause code to be generated slightly differently
181
201
// or may contain hints for code that manipulates protocol messages.
203
// Clients may define custom options as extensions of the *Options messages.
204
// These extensions may not yet be known at parsing time, so the parser cannot
205
// store the values in them. Instead it stores them in a field in the *Options
206
// message called uninterpreted_option. This field must have the same name
207
// across all *Options messages. We then use this field to populate the
208
// extensions when we build a descriptor, at which point all protos have been
209
// parsed and so all extensions are known.
211
// Extension numbers for custom options may be chosen as follows:
212
// * For options which will only be used within a single application or
213
// organization, or for experimental options, use field numbers 50000
214
// through 99999. It is up to you to ensure that you do not use the
215
// same number for multiple options.
216
// * For options which will be published and used publicly by multiple
217
// independent entities, e-mail kenton@google.com to reserve extension
218
// numbers. Simply tell me how many you need and I'll send you back a
219
// set of numbers to use -- there's no need to explain how you intend to
220
// use them. If this turns out to be popular, a web service will be set up
221
// to automatically assign option numbers.
183
// TODO(kenton): Allow extensions to options.
185
224
message FileOptions {
234
280
// Because this is an option, the above two restrictions are not enforced by
235
281
// the protocol compiler.
236
282
optional bool message_set_wire_format = 1 [default=false];
284
// The parser stores options it doesn't recognize here. See above.
285
repeated UninterpretedOption uninterpreted_option = 999;
287
// Clients can define custom options in extensions of this message. See above.
288
extensions 1000 to max;
239
291
message FieldOptions {
261
313
// In this situation, the map key for Item will be set to "name".
262
314
// TODO: Fully-implement this, then remove the "experimental_" prefix.
263
315
optional string experimental_map_key = 9;
317
// The parser stores options it doesn't recognize here. See above.
318
repeated UninterpretedOption uninterpreted_option = 999;
320
// Clients can define custom options in extensions of this message. See above.
321
extensions 1000 to max;
266
324
message EnumOptions {
325
// The parser stores options it doesn't recognize here. See above.
326
repeated UninterpretedOption uninterpreted_option = 999;
328
// Clients can define custom options in extensions of this message. See above.
329
extensions 1000 to max;
269
332
message EnumValueOptions {
333
// The parser stores options it doesn't recognize here. See above.
334
repeated UninterpretedOption uninterpreted_option = 999;
336
// Clients can define custom options in extensions of this message. See above.
337
extensions 1000 to max;
272
340
message ServiceOptions {
283
357
// framework. We apologize for hoarding these numbers to ourselves, but
284
358
// we were already using them long before we decided to release Protocol
361
// The parser stores options it doesn't recognize here. See above.
362
repeated UninterpretedOption uninterpreted_option = 999;
364
// Clients can define custom options in extensions of this message. See above.
365
extensions 1000 to max;
368
// A message representing a option the parser does not recognize. This only
369
// appears in options protos created by the compiler::Parser class.
370
// DescriptorPool resolves these when building Descriptor objects. Therefore,
371
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
372
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
374
message UninterpretedOption {
375
// The name of the uninterpreted option. Each string represents a segment in
376
// a dot-separated name. is_extension is true iff a segment represents an
377
// extension (denoted with parentheses in options specs in .proto files).
378
// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
379
// "foo.(bar.baz).qux".
381
required string name_part = 1;
382
required bool is_extension = 2;
384
repeated NamePart name = 2;
386
// The value of the uninterpreted option, in whatever type the tokenizer
387
// identified it as during parsing. Exactly one of these should be set.
388
optional string identifier_value = 3;
389
optional uint64 positive_int_value = 4;
390
optional int64 negative_int_value = 5;
391
optional double double_value = 6;
392
optional bytes string_value = 7;