Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.1 KiB
95 lines
3.1 KiB
/* |
|
* Copyright (c) 2009-2021, Google LLC |
|
* All rights reserved. |
|
* |
|
* Redistribution and use in source and binary forms, with or without |
|
* modification, are permitted provided that the following conditions are met: |
|
* * Redistributions of source code must retain the above copyright |
|
* notice, this list of conditions and the following disclaimer. |
|
* * Redistributions in binary form must reproduce the above copyright |
|
* notice, this list of conditions and the following disclaimer in the |
|
* documentation and/or other materials provided with the distribution. |
|
* * Neither the name of Google LLC nor the |
|
* names of its contributors may be used to endorse or promote products |
|
* derived from this software without specific prior written permission. |
|
* |
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
* DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY |
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
|
|
|
syntax = "proto2"; |
|
|
|
import "src/google/protobuf/test_messages_proto3.proto"; |
|
|
|
package upb_test; |
|
|
|
message TestExtensions { |
|
extensions 1000 to max; |
|
extend TestExtensions { |
|
optional int32 optional_int32_ext = 1000; |
|
} |
|
message Nested { |
|
extend TestExtensions { |
|
repeated int32 repeated_int32_ext = 1001; |
|
} |
|
} |
|
} |
|
|
|
extend TestExtensions { |
|
optional protobuf_test_messages.proto3.TestAllTypesProto3 optional_msg_ext = 1002; |
|
} |
|
|
|
message TestMessageSet { |
|
extensions 4 to max; |
|
option message_set_wire_format = true; |
|
} |
|
|
|
message MessageSetMember { |
|
optional int32 optional_int32 = 1; |
|
extend TestMessageSet { |
|
optional MessageSetMember message_set_extension = 4; |
|
} |
|
} |
|
|
|
message Proto2EnumMessage { |
|
enum Proto2TestEnum { |
|
ZERO = 0; |
|
NEGATIVE = -1; |
|
SMALL = 15; |
|
LARGE = 12345; |
|
} |
|
|
|
optional Proto2TestEnum optional_enum = 1; |
|
repeated Proto2TestEnum repeated_enum = 2; |
|
repeated Proto2TestEnum packed_enum = 3 [packed = true]; |
|
} |
|
|
|
// The same fields as Proto2EnumMessage, but with int32 fields so we can fake |
|
// wire format. |
|
message Proto2FakeEnumMessage { |
|
optional int32 optional_enum = 1; |
|
repeated int32 repeated_enum = 2; |
|
repeated int32 packed_enum = 3 [packed = true]; |
|
} |
|
|
|
message EmptyMessage {} |
|
|
|
message TestRequiredFields { |
|
required int32 required_int32 = 1; |
|
optional int32 optional_int32 = 2; |
|
required int64 required_int64 = 3; |
|
optional TestRequiredFields optional_message = 4; |
|
required EmptyMessage required_message = 5; |
|
} |
|
|
|
message SubMessageHasRequired { |
|
optional TestRequiredFields optional_message = 1; |
|
}
|
|
|