OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2015, Google Inc. |
3 // https://developers.google.com/protocol-buffers/ | 3 // All rights reserved. |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
14 // distribution. | 14 // distribution. |
15 // * Neither the name of Google Inc. nor the names of its | 15 // * Neither the name of Google Inc. nor the names of its |
16 // contributors may be used to endorse or promote products derived from | 16 // contributors may be used to endorse or promote products derived from |
17 // this software without specific prior written permission. | 17 // this software without specific prior written permission. |
18 // | 18 // |
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 // Author: pbogle@google.com (Phil Bogle) | 31 // TODO: start using src/proto/math/math.proto and remove this file once |
| 32 // PHP supports proto3. |
32 | 33 |
33 syntax = "proto2"; | 34 syntax = "proto2"; |
34 | 35 |
35 package protobuf_unittest.lite_equals_and_hash; | 36 package math; |
36 | 37 |
37 // This proto definition is used to test that java_generate_equals_and_hash | 38 message DivArgs { |
38 // works correctly with the LITE_RUNTIME. | 39 optional int64 dividend = 1 [default = 0]; |
39 option java_generate_equals_and_hash = true; | 40 optional int64 divisor = 2 [default = 0]; |
40 option optimize_for = LITE_RUNTIME; | |
41 | |
42 message Foo { | |
43 optional int32 value = 1; | |
44 repeated Bar bar = 2; | |
45 | |
46 extensions 100 to max; | |
47 } | 41 } |
48 | 42 |
49 message Bar { | 43 message DivReply { |
50 extend Foo { | 44 optional int64 quotient = 1 [default = 0]; |
51 optional Bar foo_ext = 100; | 45 optional int64 remainder = 2 [default = 0]; |
| 46 } |
| 47 |
| 48 message FibArgs { |
| 49 optional int64 limit = 1 [default = 0]; |
| 50 } |
| 51 |
| 52 message Num { |
| 53 optional int64 num = 1 [default = 0]; |
| 54 } |
| 55 |
| 56 message FibReply { |
| 57 optional int64 count = 1 [default = 0]; |
| 58 } |
| 59 |
| 60 service Math { |
| 61 // Div divides args.dividend by args.divisor and returns the quotient and |
| 62 // remainder. |
| 63 rpc Div (DivArgs) returns (DivReply) { |
52 } | 64 } |
53 | 65 |
54 optional string name = 1; | 66 // DivMany accepts an arbitrary number of division args from the client stream |
55 } | 67 // and sends back the results in the reply stream. The stream continues until |
| 68 // the client closes its end; the server does the same after sending all the |
| 69 // replies. The stream ends immediately if either end aborts. |
| 70 rpc DivMany (stream DivArgs) returns (stream DivReply) { |
| 71 } |
56 | 72 |
57 message BarPrime { | 73 // Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib |
58 optional string name = 1; | 74 // generates up to limit numbers; otherwise it continues until the call is |
59 } | 75 // canceled. Unlike Fib above, Fib has no final FibReply. |
| 76 rpc Fib (FibArgs) returns (stream Num) { |
| 77 } |
60 | 78 |
61 message Empty { | 79 // Sum sums a stream of numbers, returning the final result once the stream |
62 } | 80 // is closed. |
63 | 81 rpc Sum (stream Num) returns (Num) { |
64 extend Foo { | |
65 optional int32 varint = 101; | |
66 optional fixed32 fixed32 = 102; | |
67 optional fixed64 fixed64 = 103; | |
68 optional group MyGroup = 104 { | |
69 optional string group_value = 1; | |
70 } | 82 } |
71 } | 83 } |
72 | |
OLD | NEW |