From 17c92b33647d8ab8e97019d12b5e205bb5c10b3d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 20 Apr 2015 17:01:24 -0700 Subject: [PATCH 01/46] Spec for Grpc.Core nuget package that works --- src/csharp/Grpc.Core/Grpc.Core.csproj | 5 +++-- src/csharp/Grpc.Core/Grpc.Core.nuspec | 10 ++++++++-- src/csharp/Grpc.Core/packages.config | 2 +- .../Grpc.IntegrationTesting.csproj | 5 +++-- src/csharp/Grpc.IntegrationTesting/packages.config | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index b4b42dfbf5b..b612512b03c 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -34,8 +34,9 @@ - - ..\packages\System.Collections.Immutable.1.1.34-rc\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + False + ..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll diff --git a/src/csharp/Grpc.Core/Grpc.Core.nuspec b/src/csharp/Grpc.Core/Grpc.Core.nuspec index f2032522c90..6a40277e0f2 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.nuspec +++ b/src/csharp/Grpc.Core/Grpc.Core.nuspec @@ -1,5 +1,5 @@ - + Grpc.Core gRPC Core @@ -7,7 +7,7 @@ Core C# implementation of gRPC - an RPC library and framework. See project site for more info. This is an experimental release, not ready to use. - 0.2.0 + 0.2.1 Google Inc. jtattermusch https://github.com/grpc/grpc/blob/master/LICENSE @@ -16,6 +16,12 @@ The first experimental release. Not ready to use. Copyright 2015, Google Inc. gRPC RPC Protocol HTTP/2 + + + + + + diff --git a/src/csharp/Grpc.Core/packages.config b/src/csharp/Grpc.Core/packages.config index 669c1dc625c..71967de56e5 100644 --- a/src/csharp/Grpc.Core/packages.config +++ b/src/csharp/Grpc.Core/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj index c3e5f03074a..584bf1068de 100644 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -39,8 +39,9 @@ ..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll - - ..\packages\System.Collections.Immutable.1.1.34-rc\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + + False + ..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll diff --git a/src/csharp/Grpc.IntegrationTesting/packages.config b/src/csharp/Grpc.IntegrationTesting/packages.config index 157c264eac0..335f829432d 100644 --- a/src/csharp/Grpc.IntegrationTesting/packages.config +++ b/src/csharp/Grpc.IntegrationTesting/packages.config @@ -1,6 +1,6 @@  + - \ No newline at end of file From 65c2020d8900958bc91838b98b0d646fc32a7c35 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 20 Apr 2015 17:03:10 -0700 Subject: [PATCH 02/46] fix typo in vcxproj template --- templates/vsprojects/vcxproj_defs.include | 2 +- vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/vsprojects/vcxproj_defs.include b/templates/vsprojects/vcxproj_defs.include index 61baa2b35de..062a3b02476 100644 --- a/templates/vsprojects/vcxproj_defs.include +++ b/templates/vsprojects/vcxproj_defs.include @@ -56,7 +56,7 @@ ${gen_package_props(packages)}\ % for prop in additional_props: - + % endfor diff --git a/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj b/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj index 501b0d9b1ab..2adb4a5367e 100644 --- a/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj +++ b/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj @@ -46,7 +46,7 @@ - + From e937cd3becf5728780f4705ab760d7d18e855a06 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 20 Apr 2015 17:03:53 -0700 Subject: [PATCH 03/46] .nupkg files to gitignore --- src/csharp/Grpc.Core/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/.gitignore b/src/csharp/Grpc.Core/.gitignore index 8d4a6c08a83..c2dd6641675 100644 --- a/src/csharp/Grpc.Core/.gitignore +++ b/src/csharp/Grpc.Core/.gitignore @@ -1,2 +1,3 @@ bin -obj \ No newline at end of file +obj +*.nupkg From c6d5f106aa3509c77609ee536522181fe95d4f78 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 20 Apr 2015 17:56:15 -0700 Subject: [PATCH 04/46] enabling creation of nuget package for grpc_csharp_ext --- src/csharp/Grpc.Core/Grpc.Core.nuspec | 4 +- vsprojects/nuget_package/.gitignore | 3 ++ vsprojects/nuget_package/README.md | 20 ++++++++ vsprojects/nuget_package/buildall.bat | 46 +++++++++++++++++++ .../grpc.native.csharp_ext.nuspec | 30 ++++++++++++ .../grpc.native.csharp_ext.props | 12 +++++ .../grpc.native.csharp_ext.targets | 14 ++++++ 7 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 vsprojects/nuget_package/.gitignore create mode 100644 vsprojects/nuget_package/README.md create mode 100644 vsprojects/nuget_package/buildall.bat create mode 100644 vsprojects/nuget_package/grpc.native.csharp_ext.nuspec create mode 100644 vsprojects/nuget_package/grpc.native.csharp_ext.props create mode 100644 vsprojects/nuget_package/grpc.native.csharp_ext.targets diff --git a/src/csharp/Grpc.Core/Grpc.Core.nuspec b/src/csharp/Grpc.Core/Grpc.Core.nuspec index 6a40277e0f2..4865ead555e 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.nuspec +++ b/src/csharp/Grpc.Core/Grpc.Core.nuspec @@ -18,9 +18,7 @@ gRPC RPC Protocol HTTP/2 - - - + diff --git a/vsprojects/nuget_package/.gitignore b/vsprojects/nuget_package/.gitignore new file mode 100644 index 00000000000..ae830da1b21 --- /dev/null +++ b/vsprojects/nuget_package/.gitignore @@ -0,0 +1,3 @@ +/tmp +/output +*.nupkg diff --git a/vsprojects/nuget_package/README.md b/vsprojects/nuget_package/README.md new file mode 100644 index 00000000000..80d84ce8c8c --- /dev/null +++ b/vsprojects/nuget_package/README.md @@ -0,0 +1,20 @@ +gRPC Native Nuget package +========================= + +Prerequisites +------------- +Multiple versions of VS installed to be able to build all the targets: +* Visual Studio 2013 +* Visual Studio 2010 (you might need SP1 to prevent LNK1123 error) + +NuGet binary + +Building the package +-------------------- + +Build all flavors of gRPC C# extension and package them as a NuGet package. +``` +buildall.bat + +nuget pack grpc.native.csharp_ext +``` \ No newline at end of file diff --git a/vsprojects/nuget_package/buildall.bat b/vsprojects/nuget_package/buildall.bat new file mode 100644 index 00000000000..837eef0f6ad --- /dev/null +++ b/vsprojects/nuget_package/buildall.bat @@ -0,0 +1,46 @@ +@echo off +setlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v120 || goto :eof +REM call :build x64 Debug v120 || goto :eof +REM endlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 +call :build Win32 Release v120 || goto :eof +call :build Win32 Debug v120 || goto :eof +endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v110 || goto :eof +REM call :build x64 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +REM call :build Win32 Release v110 || goto :eof +REM call :build Win32 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v100 || goto :eof +REM call :build x64 Debug v100 || goto :eof +REM endlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 +call :build Win32 Release v100 || goto :eof +call :build Win32 Debug v100 || goto :eof +endlocal + +goto :eof + +:build +msbuild /t:grpc_csharp_ext /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:OutDir=..\nuget_package\output\%3\%1\%2\ /P:IntDir=..\nuget_package\tmp\%3\%1\%2\ ..\grpc.sln || goto :eof +goto :eof + + diff --git a/vsprojects/nuget_package/grpc.native.csharp_ext.nuspec b/vsprojects/nuget_package/grpc.native.csharp_ext.nuspec new file mode 100644 index 00000000000..d225b771907 --- /dev/null +++ b/vsprojects/nuget_package/grpc.native.csharp_ext.nuspec @@ -0,0 +1,30 @@ + + + + grpc.native.csharp_ext + 0.6.0.0 + Google Inc. + Jan Tattermusch + https://github.com/grpc/grpc/blob/master/LICENSE + http://github.com/grpc/grpc + false + Native extension needed by gRPC C# library. This is not the package you are looking for, it is only meant to be used as a dependency. + Release of gRPC C core 0.6.0 libraries. + Copyright 2015 + gRPC C# Native Extension + Native library required by gRPC C# + gRPC native + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vsprojects/nuget_package/grpc.native.csharp_ext.props b/vsprojects/nuget_package/grpc.native.csharp_ext.props new file mode 100644 index 00000000000..63d23be3dad --- /dev/null +++ b/vsprojects/nuget_package/grpc.native.csharp_ext.props @@ -0,0 +1,12 @@ + + + + + true + + + v120 + Win32 + Debug + + \ No newline at end of file diff --git a/vsprojects/nuget_package/grpc.native.csharp_ext.targets b/vsprojects/nuget_package/grpc.native.csharp_ext.targets new file mode 100644 index 00000000000..1b69362d432 --- /dev/null +++ b/vsprojects/nuget_package/grpc.native.csharp_ext.targets @@ -0,0 +1,14 @@ + + + + + + + + PreserveNewest + + + + + + \ No newline at end of file From 3b3097fb7a6c598a03b90f44038e6697146dd15d Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 21 Apr 2015 11:47:45 -0700 Subject: [PATCH 05/46] Remove an extra unref --- src/cpp/util/byte_buffer.cc | 1 - test/cpp/end2end/generic_end2end_test.cc | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index f8d8eec0655..ac2657472cf 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -60,7 +60,6 @@ void ByteBuffer::Dump(std::vector* slices) { gpr_slice s; while (grpc_byte_buffer_reader_next(reader, &s)) { slices->push_back(Slice(s, Slice::STEAL_REF)); - gpr_slice_unref(s); } grpc_byte_buffer_reader_destroy(reader); } diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index eb6f5369a92..584d4bc7ba0 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -149,7 +149,8 @@ class GenericEnd2endTest : public ::testing::Test { GenericServerContext srv_ctx; GenericServerAsyncReaderWriter stream(&srv_ctx); - send_request.set_message("Hello"); + // The string needs to be long enough to test heap-based slice. + send_request.set_message("Hello world. Hello world. Hello world."); std::unique_ptr call = generic_stub_->Call(&cli_ctx, kMethodName, &cli_cq_, tag(1)); client_ok(1); From 14ae0b051b66e75f4c73a645a1a06fc9d10a2a67 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 Mar 2015 19:18:02 -0700 Subject: [PATCH 06/46] Add dependency to Protobuf 2.6 to the podfile --- src/objective-c/examples/Sample/Podfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index 848627ff547..4da8bc44f66 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -2,6 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'gRPC', :path => "../../../.." +pod 'ProtocolBuffers', '~> 1.9' link_with 'Sample', 'SampleTests' From 1f1d2c36e5524edb91d9b9a71cd64e3ff2ced466 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 Mar 2015 21:42:14 -0700 Subject: [PATCH 07/46] Copy route_guide.proto and make it 2.6 --- .../examples/Sample/protos/route_guide.proto | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/objective-c/examples/Sample/protos/route_guide.proto diff --git a/src/objective-c/examples/Sample/protos/route_guide.proto b/src/objective-c/examples/Sample/protos/route_guide.proto new file mode 100644 index 00000000000..6d35e786b42 --- /dev/null +++ b/src/objective-c/examples/Sample/protos/route_guide.proto @@ -0,0 +1,122 @@ +// Copyright 2015, Google Inc. +// 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 Inc. 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 THE COPYRIGHT +// OWNER OR CONTRIBUTORS 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"; + +package grpc.example.routeguide; + +option java_multiple_files = true; +option java_package = "io.grpc.examples.routeguide"; +option java_outer_classname = "RouteGuideProto"; + +// Interface exported by the server. +service RouteGuide { + // A simple RPC. + // + // Obtains the feature at a given position. + rpc GetFeature(Point) returns (Feature) {} + + // A server-to-client streaming RPC. + // + // Obtains the Features available within the given Rectangle. Results are + // streamed rather than returned at once (e.g. in a response message with a + // repeated field), as the rectangle may cover a large area and contain a + // huge number of features. +// rpc ListFeatures(Rectangle) returns (stream Feature) {} + + // A client-to-server streaming RPC. + // + // Accepts a stream of Points on a route being traversed, returning a + // RouteSummary when traversal is completed. +// rpc RecordRoute(stream Point) returns (RouteSummary) {} + + // A Bidirectional streaming RPC. + // + // Accepts a stream of RouteNotes sent while a route is being traversed, + // while receiving other RouteNotes (e.g. from other users). +// rpc RouteChat(stream RouteNote) returns (stream RouteNote) {} +} + +// Points are represented as latitude-longitude pairs in the E7 representation +// (degrees multiplied by 10**7 and rounded to the nearest integer). +// Latitudes should be in the range +/- 90 degrees and longitude should be in +// the range +/- 180 degrees (inclusive). +message Point { + optional int32 latitude = 1; + optional int32 longitude = 2; +} + +// A latitude-longitude rectangle, represented as two diagonally opposite +// points "lo" and "hi". +message Rectangle { + // One corner of the rectangle. + optional Point lo = 1; + + // The other corner of the rectangle. + optional Point hi = 2; +} + +// A feature names something at a given point. +// +// If a feature could not be named, the name is empty. +message Feature { + // The name of the feature. + optional string name = 1; + + // The point where the feature is detected. + optional Point location = 2; +} + +// A RouteNote is a message sent while at a given point. +message RouteNote { + // The location from which the message is sent. + optional Point location = 1; + + // The message to be sent. + optional string message = 2; +} + +// A RouteSummary is received in response to a RecordRoute rpc. +// +// It contains the number of individual points received, the number of +// detected features, and the total distance covered as the cumulative sum of +// the distance between each point. +message RouteSummary { + // The number of points received. + optional int32 point_count = 1; + + // The number of known features passed while traversing the route. + optional int32 feature_count = 2; + + // The distance covered in metres. + optional int32 distance = 3; + + // The duration of the traversal in seconds. + optional int32 elapsed_time = 4; +} \ No newline at end of file From f4ddfab3f73f7cfd821122caf58c37fa6e47f062 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 Mar 2015 21:43:00 -0700 Subject: [PATCH 08/46] Generated files :) --- .../examples/Sample/protos/Route_guide.pb.h | 343 ++++ .../examples/Sample/protos/Route_guide.pb.m | 1434 +++++++++++++++++ 2 files changed, 1777 insertions(+) create mode 100644 src/objective-c/examples/Sample/protos/Route_guide.pb.h create mode 100644 src/objective-c/examples/Sample/protos/Route_guide.pb.m diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.h b/src/objective-c/examples/Sample/protos/Route_guide.pb.h new file mode 100644 index 00000000000..f1e54d02def --- /dev/null +++ b/src/objective-c/examples/Sample/protos/Route_guide.pb.h @@ -0,0 +1,343 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import + +// @@protoc_insertion_point(imports) + +@class Feature; +@class FeatureBuilder; +@class Point; +@class PointBuilder; +@class Rectangle; +@class RectangleBuilder; +@class RouteNote; +@class RouteNoteBuilder; +@class RouteSummary; +@class RouteSummaryBuilder; + + + +@interface RouteGuideRoot : NSObject { +} ++ (PBExtensionRegistry*) extensionRegistry; ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; +@end + +@interface Point : PBGeneratedMessage { +@private + BOOL hasLatitude_:1; + BOOL hasLongitude_:1; + SInt32 latitude; + SInt32 longitude; +} +- (BOOL) hasLatitude; +- (BOOL) hasLongitude; +@property (readonly) SInt32 latitude; +@property (readonly) SInt32 longitude; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (PointBuilder*) builder; ++ (PointBuilder*) builder; ++ (PointBuilder*) builderWithPrototype:(Point*) prototype; +- (PointBuilder*) toBuilder; + ++ (Point*) parseFromData:(NSData*) data; ++ (Point*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (Point*) parseFromInputStream:(NSInputStream*) input; ++ (Point*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface PointBuilder : PBGeneratedMessageBuilder { +@private + Point* resultPoint; +} + +- (Point*) defaultInstance; + +- (PointBuilder*) clear; +- (PointBuilder*) clone; + +- (Point*) build; +- (Point*) buildPartial; + +- (PointBuilder*) mergeFrom:(Point*) other; +- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasLatitude; +- (SInt32) latitude; +- (PointBuilder*) setLatitude:(SInt32) value; +- (PointBuilder*) clearLatitude; + +- (BOOL) hasLongitude; +- (SInt32) longitude; +- (PointBuilder*) setLongitude:(SInt32) value; +- (PointBuilder*) clearLongitude; +@end + +@interface Rectangle : PBGeneratedMessage { +@private + BOOL hasLo_:1; + BOOL hasHi_:1; + Point* lo; + Point* hi; +} +- (BOOL) hasLo; +- (BOOL) hasHi; +@property (readonly, strong) Point* lo; +@property (readonly, strong) Point* hi; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RectangleBuilder*) builder; ++ (RectangleBuilder*) builder; ++ (RectangleBuilder*) builderWithPrototype:(Rectangle*) prototype; +- (RectangleBuilder*) toBuilder; + ++ (Rectangle*) parseFromData:(NSData*) data; ++ (Rectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (Rectangle*) parseFromInputStream:(NSInputStream*) input; ++ (Rectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RectangleBuilder : PBGeneratedMessageBuilder { +@private + Rectangle* resultRectangle; +} + +- (Rectangle*) defaultInstance; + +- (RectangleBuilder*) clear; +- (RectangleBuilder*) clone; + +- (Rectangle*) build; +- (Rectangle*) buildPartial; + +- (RectangleBuilder*) mergeFrom:(Rectangle*) other; +- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasLo; +- (Point*) lo; +- (RectangleBuilder*) setLo:(Point*) value; +- (RectangleBuilder*) setLoBuilder:(PointBuilder*) builderForValue; +- (RectangleBuilder*) mergeLo:(Point*) value; +- (RectangleBuilder*) clearLo; + +- (BOOL) hasHi; +- (Point*) hi; +- (RectangleBuilder*) setHi:(Point*) value; +- (RectangleBuilder*) setHiBuilder:(PointBuilder*) builderForValue; +- (RectangleBuilder*) mergeHi:(Point*) value; +- (RectangleBuilder*) clearHi; +@end + +@interface Feature : PBGeneratedMessage { +@private + BOOL hasName_:1; + BOOL hasLocation_:1; + NSString* name; + Point* location; +} +- (BOOL) hasName; +- (BOOL) hasLocation; +@property (readonly, strong) NSString* name; +@property (readonly, strong) Point* location; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (FeatureBuilder*) builder; ++ (FeatureBuilder*) builder; ++ (FeatureBuilder*) builderWithPrototype:(Feature*) prototype; +- (FeatureBuilder*) toBuilder; + ++ (Feature*) parseFromData:(NSData*) data; ++ (Feature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (Feature*) parseFromInputStream:(NSInputStream*) input; ++ (Feature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface FeatureBuilder : PBGeneratedMessageBuilder { +@private + Feature* resultFeature; +} + +- (Feature*) defaultInstance; + +- (FeatureBuilder*) clear; +- (FeatureBuilder*) clone; + +- (Feature*) build; +- (Feature*) buildPartial; + +- (FeatureBuilder*) mergeFrom:(Feature*) other; +- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasName; +- (NSString*) name; +- (FeatureBuilder*) setName:(NSString*) value; +- (FeatureBuilder*) clearName; + +- (BOOL) hasLocation; +- (Point*) location; +- (FeatureBuilder*) setLocation:(Point*) value; +- (FeatureBuilder*) setLocationBuilder:(PointBuilder*) builderForValue; +- (FeatureBuilder*) mergeLocation:(Point*) value; +- (FeatureBuilder*) clearLocation; +@end + +@interface RouteNote : PBGeneratedMessage { +@private + BOOL hasMessage_:1; + BOOL hasLocation_:1; + NSString* message; + Point* location; +} +- (BOOL) hasLocation; +- (BOOL) hasMessage; +@property (readonly, strong) Point* location; +@property (readonly, strong) NSString* message; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RouteNoteBuilder*) builder; ++ (RouteNoteBuilder*) builder; ++ (RouteNoteBuilder*) builderWithPrototype:(RouteNote*) prototype; +- (RouteNoteBuilder*) toBuilder; + ++ (RouteNote*) parseFromData:(NSData*) data; ++ (RouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RouteNote*) parseFromInputStream:(NSInputStream*) input; ++ (RouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RouteNoteBuilder : PBGeneratedMessageBuilder { +@private + RouteNote* resultRouteNote; +} + +- (RouteNote*) defaultInstance; + +- (RouteNoteBuilder*) clear; +- (RouteNoteBuilder*) clone; + +- (RouteNote*) build; +- (RouteNote*) buildPartial; + +- (RouteNoteBuilder*) mergeFrom:(RouteNote*) other; +- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasLocation; +- (Point*) location; +- (RouteNoteBuilder*) setLocation:(Point*) value; +- (RouteNoteBuilder*) setLocationBuilder:(PointBuilder*) builderForValue; +- (RouteNoteBuilder*) mergeLocation:(Point*) value; +- (RouteNoteBuilder*) clearLocation; + +- (BOOL) hasMessage; +- (NSString*) message; +- (RouteNoteBuilder*) setMessage:(NSString*) value; +- (RouteNoteBuilder*) clearMessage; +@end + +@interface RouteSummary : PBGeneratedMessage { +@private + BOOL hasPointCount_:1; + BOOL hasFeatureCount_:1; + BOOL hasDistance_:1; + BOOL hasElapsedTime_:1; + SInt32 pointCount; + SInt32 featureCount; + SInt32 distance; + SInt32 elapsedTime; +} +- (BOOL) hasPointCount; +- (BOOL) hasFeatureCount; +- (BOOL) hasDistance; +- (BOOL) hasElapsedTime; +@property (readonly) SInt32 pointCount; +@property (readonly) SInt32 featureCount; +@property (readonly) SInt32 distance; +@property (readonly) SInt32 elapsedTime; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RouteSummaryBuilder*) builder; ++ (RouteSummaryBuilder*) builder; ++ (RouteSummaryBuilder*) builderWithPrototype:(RouteSummary*) prototype; +- (RouteSummaryBuilder*) toBuilder; + ++ (RouteSummary*) parseFromData:(NSData*) data; ++ (RouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RouteSummary*) parseFromInputStream:(NSInputStream*) input; ++ (RouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RouteSummaryBuilder : PBGeneratedMessageBuilder { +@private + RouteSummary* resultRouteSummary; +} + +- (RouteSummary*) defaultInstance; + +- (RouteSummaryBuilder*) clear; +- (RouteSummaryBuilder*) clone; + +- (RouteSummary*) build; +- (RouteSummary*) buildPartial; + +- (RouteSummaryBuilder*) mergeFrom:(RouteSummary*) other; +- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasPointCount; +- (SInt32) pointCount; +- (RouteSummaryBuilder*) setPointCount:(SInt32) value; +- (RouteSummaryBuilder*) clearPointCount; + +- (BOOL) hasFeatureCount; +- (SInt32) featureCount; +- (RouteSummaryBuilder*) setFeatureCount:(SInt32) value; +- (RouteSummaryBuilder*) clearFeatureCount; + +- (BOOL) hasDistance; +- (SInt32) distance; +- (RouteSummaryBuilder*) setDistance:(SInt32) value; +- (RouteSummaryBuilder*) clearDistance; + +- (BOOL) hasElapsedTime; +- (SInt32) elapsedTime; +- (RouteSummaryBuilder*) setElapsedTime:(SInt32) value; +- (RouteSummaryBuilder*) clearElapsedTime; +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.m b/src/objective-c/examples/Sample/protos/Route_guide.pb.m new file mode 100644 index 00000000000..d7847dfced1 --- /dev/null +++ b/src/objective-c/examples/Sample/protos/Route_guide.pb.m @@ -0,0 +1,1434 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import "Route_guide.pb.h" +// @@protoc_insertion_point(imports) + +@implementation RouteGuideRoot +static PBExtensionRegistry* extensionRegistry = nil; ++ (PBExtensionRegistry*) extensionRegistry { + return extensionRegistry; +} + ++ (void) initialize { + if (self == [RouteGuideRoot class]) { + PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; + [self registerAllExtensions:registry]; + extensionRegistry = registry; + } +} ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { +} +@end + +@interface Point () +@property SInt32 latitude; +@property SInt32 longitude; +@end + +@implementation Point + +- (BOOL) hasLatitude { + return !!hasLatitude_; +} +- (void) setHasLatitude:(BOOL) _value_ { + hasLatitude_ = !!_value_; +} +@synthesize latitude; +- (BOOL) hasLongitude { + return !!hasLongitude_; +} +- (void) setHasLongitude:(BOOL) _value_ { + hasLongitude_ = !!_value_; +} +@synthesize longitude; +- (instancetype) init { + if ((self = [super init])) { + self.latitude = 0; + self.longitude = 0; + } + return self; +} +static Point* defaultPointInstance = nil; ++ (void) initialize { + if (self == [Point class]) { + defaultPointInstance = [[Point alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultPointInstance; +} +- (instancetype) defaultInstance { + return defaultPointInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasLatitude) { + [output writeInt32:1 value:self.latitude]; + } + if (self.hasLongitude) { + [output writeInt32:2 value:self.longitude]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasLatitude) { + size_ += computeInt32Size(1, self.latitude); + } + if (self.hasLongitude) { + size_ += computeInt32Size(2, self.longitude); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (Point*) parseFromData:(NSData*) data { + return (Point*)[[[Point builder] mergeFromData:data] build]; +} ++ (Point*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Point*)[[[Point builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (Point*) parseFromInputStream:(NSInputStream*) input { + return (Point*)[[[Point builder] mergeFromInputStream:input] build]; +} ++ (Point*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Point*)[[[Point builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (Point*)[[[Point builder] mergeFromCodedInputStream:input] build]; +} ++ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Point*)[[[Point builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (PointBuilder*) builder { + return [[PointBuilder alloc] init]; +} ++ (PointBuilder*) builderWithPrototype:(Point*) prototype { + return [[Point builder] mergeFrom:prototype]; +} +- (PointBuilder*) builder { + return [Point builder]; +} +- (PointBuilder*) toBuilder { + return [Point builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasLatitude) { + [output appendFormat:@"%@%@: %@\n", indent, @"latitude", [NSNumber numberWithInteger:self.latitude]]; + } + if (self.hasLongitude) { + [output appendFormat:@"%@%@: %@\n", indent, @"longitude", [NSNumber numberWithInteger:self.longitude]]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[Point class]]) { + return NO; + } + Point *otherMessage = other; + return + self.hasLatitude == otherMessage.hasLatitude && + (!self.hasLatitude || self.latitude == otherMessage.latitude) && + self.hasLongitude == otherMessage.hasLongitude && + (!self.hasLongitude || self.longitude == otherMessage.longitude) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasLatitude) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.latitude] hash]; + } + if (self.hasLongitude) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.longitude] hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface PointBuilder() +@property (strong) Point* resultPoint; +@end + +@implementation PointBuilder +@synthesize resultPoint; +- (instancetype) init { + if ((self = [super init])) { + self.resultPoint = [[Point alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultPoint; +} +- (PointBuilder*) clear { + self.resultPoint = [[Point alloc] init]; + return self; +} +- (PointBuilder*) clone { + return [Point builderWithPrototype:resultPoint]; +} +- (Point*) defaultInstance { + return [Point defaultInstance]; +} +- (Point*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (Point*) buildPartial { + Point* returnMe = resultPoint; + self.resultPoint = nil; + return returnMe; +} +- (PointBuilder*) mergeFrom:(Point*) other { + if (other == [Point defaultInstance]) { + return self; + } + if (other.hasLatitude) { + [self setLatitude:other.latitude]; + } + if (other.hasLongitude) { + [self setLongitude:other.longitude]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + [self setLatitude:[input readInt32]]; + break; + } + case 16: { + [self setLongitude:[input readInt32]]; + break; + } + } + } +} +- (BOOL) hasLatitude { + return resultPoint.hasLatitude; +} +- (SInt32) latitude { + return resultPoint.latitude; +} +- (PointBuilder*) setLatitude:(SInt32) value { + resultPoint.hasLatitude = YES; + resultPoint.latitude = value; + return self; +} +- (PointBuilder*) clearLatitude { + resultPoint.hasLatitude = NO; + resultPoint.latitude = 0; + return self; +} +- (BOOL) hasLongitude { + return resultPoint.hasLongitude; +} +- (SInt32) longitude { + return resultPoint.longitude; +} +- (PointBuilder*) setLongitude:(SInt32) value { + resultPoint.hasLongitude = YES; + resultPoint.longitude = value; + return self; +} +- (PointBuilder*) clearLongitude { + resultPoint.hasLongitude = NO; + resultPoint.longitude = 0; + return self; +} +@end + +@interface Rectangle () +@property (strong) Point* lo; +@property (strong) Point* hi; +@end + +@implementation Rectangle + +- (BOOL) hasLo { + return !!hasLo_; +} +- (void) setHasLo:(BOOL) _value_ { + hasLo_ = !!_value_; +} +@synthesize lo; +- (BOOL) hasHi { + return !!hasHi_; +} +- (void) setHasHi:(BOOL) _value_ { + hasHi_ = !!_value_; +} +@synthesize hi; +- (instancetype) init { + if ((self = [super init])) { + self.lo = [Point defaultInstance]; + self.hi = [Point defaultInstance]; + } + return self; +} +static Rectangle* defaultRectangleInstance = nil; ++ (void) initialize { + if (self == [Rectangle class]) { + defaultRectangleInstance = [[Rectangle alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRectangleInstance; +} +- (instancetype) defaultInstance { + return defaultRectangleInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasLo) { + [output writeMessage:1 value:self.lo]; + } + if (self.hasHi) { + [output writeMessage:2 value:self.hi]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasLo) { + size_ += computeMessageSize(1, self.lo); + } + if (self.hasHi) { + size_ += computeMessageSize(2, self.hi); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (Rectangle*) parseFromData:(NSData*) data { + return (Rectangle*)[[[Rectangle builder] mergeFromData:data] build]; +} ++ (Rectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Rectangle*)[[[Rectangle builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (Rectangle*) parseFromInputStream:(NSInputStream*) input { + return (Rectangle*)[[[Rectangle builder] mergeFromInputStream:input] build]; +} ++ (Rectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Rectangle*)[[[Rectangle builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (Rectangle*)[[[Rectangle builder] mergeFromCodedInputStream:input] build]; +} ++ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Rectangle*)[[[Rectangle builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RectangleBuilder*) builder { + return [[RectangleBuilder alloc] init]; +} ++ (RectangleBuilder*) builderWithPrototype:(Rectangle*) prototype { + return [[Rectangle builder] mergeFrom:prototype]; +} +- (RectangleBuilder*) builder { + return [Rectangle builder]; +} +- (RectangleBuilder*) toBuilder { + return [Rectangle builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasLo) { + [output appendFormat:@"%@%@ {\n", indent, @"lo"]; + [self.lo writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + if (self.hasHi) { + [output appendFormat:@"%@%@ {\n", indent, @"hi"]; + [self.hi writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[Rectangle class]]) { + return NO; + } + Rectangle *otherMessage = other; + return + self.hasLo == otherMessage.hasLo && + (!self.hasLo || [self.lo isEqual:otherMessage.lo]) && + self.hasHi == otherMessage.hasHi && + (!self.hasHi || [self.hi isEqual:otherMessage.hi]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasLo) { + hashCode = hashCode * 31 + [self.lo hash]; + } + if (self.hasHi) { + hashCode = hashCode * 31 + [self.hi hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RectangleBuilder() +@property (strong) Rectangle* resultRectangle; +@end + +@implementation RectangleBuilder +@synthesize resultRectangle; +- (instancetype) init { + if ((self = [super init])) { + self.resultRectangle = [[Rectangle alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultRectangle; +} +- (RectangleBuilder*) clear { + self.resultRectangle = [[Rectangle alloc] init]; + return self; +} +- (RectangleBuilder*) clone { + return [Rectangle builderWithPrototype:resultRectangle]; +} +- (Rectangle*) defaultInstance { + return [Rectangle defaultInstance]; +} +- (Rectangle*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (Rectangle*) buildPartial { + Rectangle* returnMe = resultRectangle; + self.resultRectangle = nil; + return returnMe; +} +- (RectangleBuilder*) mergeFrom:(Rectangle*) other { + if (other == [Rectangle defaultInstance]) { + return self; + } + if (other.hasLo) { + [self mergeLo:other.lo]; + } + if (other.hasHi) { + [self mergeHi:other.hi]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + PointBuilder* subBuilder = [Point builder]; + if (self.hasLo) { + [subBuilder mergeFrom:self.lo]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setLo:[subBuilder buildPartial]]; + break; + } + case 18: { + PointBuilder* subBuilder = [Point builder]; + if (self.hasHi) { + [subBuilder mergeFrom:self.hi]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setHi:[subBuilder buildPartial]]; + break; + } + } + } +} +- (BOOL) hasLo { + return resultRectangle.hasLo; +} +- (Point*) lo { + return resultRectangle.lo; +} +- (RectangleBuilder*) setLo:(Point*) value { + resultRectangle.hasLo = YES; + resultRectangle.lo = value; + return self; +} +- (RectangleBuilder*) setLoBuilder:(PointBuilder*) builderForValue { + return [self setLo:[builderForValue build]]; +} +- (RectangleBuilder*) mergeLo:(Point*) value { + if (resultRectangle.hasLo && + resultRectangle.lo != [Point defaultInstance]) { + resultRectangle.lo = + [[[Point builderWithPrototype:resultRectangle.lo] mergeFrom:value] buildPartial]; + } else { + resultRectangle.lo = value; + } + resultRectangle.hasLo = YES; + return self; +} +- (RectangleBuilder*) clearLo { + resultRectangle.hasLo = NO; + resultRectangle.lo = [Point defaultInstance]; + return self; +} +- (BOOL) hasHi { + return resultRectangle.hasHi; +} +- (Point*) hi { + return resultRectangle.hi; +} +- (RectangleBuilder*) setHi:(Point*) value { + resultRectangle.hasHi = YES; + resultRectangle.hi = value; + return self; +} +- (RectangleBuilder*) setHiBuilder:(PointBuilder*) builderForValue { + return [self setHi:[builderForValue build]]; +} +- (RectangleBuilder*) mergeHi:(Point*) value { + if (resultRectangle.hasHi && + resultRectangle.hi != [Point defaultInstance]) { + resultRectangle.hi = + [[[Point builderWithPrototype:resultRectangle.hi] mergeFrom:value] buildPartial]; + } else { + resultRectangle.hi = value; + } + resultRectangle.hasHi = YES; + return self; +} +- (RectangleBuilder*) clearHi { + resultRectangle.hasHi = NO; + resultRectangle.hi = [Point defaultInstance]; + return self; +} +@end + +@interface Feature () +@property (strong) NSString* name; +@property (strong) Point* location; +@end + +@implementation Feature + +- (BOOL) hasName { + return !!hasName_; +} +- (void) setHasName:(BOOL) _value_ { + hasName_ = !!_value_; +} +@synthesize name; +- (BOOL) hasLocation { + return !!hasLocation_; +} +- (void) setHasLocation:(BOOL) _value_ { + hasLocation_ = !!_value_; +} +@synthesize location; +- (instancetype) init { + if ((self = [super init])) { + self.name = @""; + self.location = [Point defaultInstance]; + } + return self; +} +static Feature* defaultFeatureInstance = nil; ++ (void) initialize { + if (self == [Feature class]) { + defaultFeatureInstance = [[Feature alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultFeatureInstance; +} +- (instancetype) defaultInstance { + return defaultFeatureInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasName) { + [output writeString:1 value:self.name]; + } + if (self.hasLocation) { + [output writeMessage:2 value:self.location]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasName) { + size_ += computeStringSize(1, self.name); + } + if (self.hasLocation) { + size_ += computeMessageSize(2, self.location); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (Feature*) parseFromData:(NSData*) data { + return (Feature*)[[[Feature builder] mergeFromData:data] build]; +} ++ (Feature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Feature*)[[[Feature builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (Feature*) parseFromInputStream:(NSInputStream*) input { + return (Feature*)[[[Feature builder] mergeFromInputStream:input] build]; +} ++ (Feature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Feature*)[[[Feature builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (Feature*)[[[Feature builder] mergeFromCodedInputStream:input] build]; +} ++ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (Feature*)[[[Feature builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (FeatureBuilder*) builder { + return [[FeatureBuilder alloc] init]; +} ++ (FeatureBuilder*) builderWithPrototype:(Feature*) prototype { + return [[Feature builder] mergeFrom:prototype]; +} +- (FeatureBuilder*) builder { + return [Feature builder]; +} +- (FeatureBuilder*) toBuilder { + return [Feature builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasName) { + [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; + } + if (self.hasLocation) { + [output appendFormat:@"%@%@ {\n", indent, @"location"]; + [self.location writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[Feature class]]) { + return NO; + } + Feature *otherMessage = other; + return + self.hasName == otherMessage.hasName && + (!self.hasName || [self.name isEqual:otherMessage.name]) && + self.hasLocation == otherMessage.hasLocation && + (!self.hasLocation || [self.location isEqual:otherMessage.location]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasName) { + hashCode = hashCode * 31 + [self.name hash]; + } + if (self.hasLocation) { + hashCode = hashCode * 31 + [self.location hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface FeatureBuilder() +@property (strong) Feature* resultFeature; +@end + +@implementation FeatureBuilder +@synthesize resultFeature; +- (instancetype) init { + if ((self = [super init])) { + self.resultFeature = [[Feature alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultFeature; +} +- (FeatureBuilder*) clear { + self.resultFeature = [[Feature alloc] init]; + return self; +} +- (FeatureBuilder*) clone { + return [Feature builderWithPrototype:resultFeature]; +} +- (Feature*) defaultInstance { + return [Feature defaultInstance]; +} +- (Feature*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (Feature*) buildPartial { + Feature* returnMe = resultFeature; + self.resultFeature = nil; + return returnMe; +} +- (FeatureBuilder*) mergeFrom:(Feature*) other { + if (other == [Feature defaultInstance]) { + return self; + } + if (other.hasName) { + [self setName:other.name]; + } + if (other.hasLocation) { + [self mergeLocation:other.location]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + [self setName:[input readString]]; + break; + } + case 18: { + PointBuilder* subBuilder = [Point builder]; + if (self.hasLocation) { + [subBuilder mergeFrom:self.location]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setLocation:[subBuilder buildPartial]]; + break; + } + } + } +} +- (BOOL) hasName { + return resultFeature.hasName; +} +- (NSString*) name { + return resultFeature.name; +} +- (FeatureBuilder*) setName:(NSString*) value { + resultFeature.hasName = YES; + resultFeature.name = value; + return self; +} +- (FeatureBuilder*) clearName { + resultFeature.hasName = NO; + resultFeature.name = @""; + return self; +} +- (BOOL) hasLocation { + return resultFeature.hasLocation; +} +- (Point*) location { + return resultFeature.location; +} +- (FeatureBuilder*) setLocation:(Point*) value { + resultFeature.hasLocation = YES; + resultFeature.location = value; + return self; +} +- (FeatureBuilder*) setLocationBuilder:(PointBuilder*) builderForValue { + return [self setLocation:[builderForValue build]]; +} +- (FeatureBuilder*) mergeLocation:(Point*) value { + if (resultFeature.hasLocation && + resultFeature.location != [Point defaultInstance]) { + resultFeature.location = + [[[Point builderWithPrototype:resultFeature.location] mergeFrom:value] buildPartial]; + } else { + resultFeature.location = value; + } + resultFeature.hasLocation = YES; + return self; +} +- (FeatureBuilder*) clearLocation { + resultFeature.hasLocation = NO; + resultFeature.location = [Point defaultInstance]; + return self; +} +@end + +@interface RouteNote () +@property (strong) Point* location; +@property (strong) NSString* message; +@end + +@implementation RouteNote + +- (BOOL) hasLocation { + return !!hasLocation_; +} +- (void) setHasLocation:(BOOL) _value_ { + hasLocation_ = !!_value_; +} +@synthesize location; +- (BOOL) hasMessage { + return !!hasMessage_; +} +- (void) setHasMessage:(BOOL) _value_ { + hasMessage_ = !!_value_; +} +@synthesize message; +- (instancetype) init { + if ((self = [super init])) { + self.location = [Point defaultInstance]; + self.message = @""; + } + return self; +} +static RouteNote* defaultRouteNoteInstance = nil; ++ (void) initialize { + if (self == [RouteNote class]) { + defaultRouteNoteInstance = [[RouteNote alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRouteNoteInstance; +} +- (instancetype) defaultInstance { + return defaultRouteNoteInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasLocation) { + [output writeMessage:1 value:self.location]; + } + if (self.hasMessage) { + [output writeString:2 value:self.message]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasLocation) { + size_ += computeMessageSize(1, self.location); + } + if (self.hasMessage) { + size_ += computeStringSize(2, self.message); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RouteNote*) parseFromData:(NSData*) data { + return (RouteNote*)[[[RouteNote builder] mergeFromData:data] build]; +} ++ (RouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RouteNote*)[[[RouteNote builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RouteNote*) parseFromInputStream:(NSInputStream*) input { + return (RouteNote*)[[[RouteNote builder] mergeFromInputStream:input] build]; +} ++ (RouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RouteNote*)[[[RouteNote builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RouteNote*)[[[RouteNote builder] mergeFromCodedInputStream:input] build]; +} ++ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RouteNote*)[[[RouteNote builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RouteNoteBuilder*) builder { + return [[RouteNoteBuilder alloc] init]; +} ++ (RouteNoteBuilder*) builderWithPrototype:(RouteNote*) prototype { + return [[RouteNote builder] mergeFrom:prototype]; +} +- (RouteNoteBuilder*) builder { + return [RouteNote builder]; +} +- (RouteNoteBuilder*) toBuilder { + return [RouteNote builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasLocation) { + [output appendFormat:@"%@%@ {\n", indent, @"location"]; + [self.location writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + if (self.hasMessage) { + [output appendFormat:@"%@%@: %@\n", indent, @"message", self.message]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RouteNote class]]) { + return NO; + } + RouteNote *otherMessage = other; + return + self.hasLocation == otherMessage.hasLocation && + (!self.hasLocation || [self.location isEqual:otherMessage.location]) && + self.hasMessage == otherMessage.hasMessage && + (!self.hasMessage || [self.message isEqual:otherMessage.message]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasLocation) { + hashCode = hashCode * 31 + [self.location hash]; + } + if (self.hasMessage) { + hashCode = hashCode * 31 + [self.message hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RouteNoteBuilder() +@property (strong) RouteNote* resultRouteNote; +@end + +@implementation RouteNoteBuilder +@synthesize resultRouteNote; +- (instancetype) init { + if ((self = [super init])) { + self.resultRouteNote = [[RouteNote alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultRouteNote; +} +- (RouteNoteBuilder*) clear { + self.resultRouteNote = [[RouteNote alloc] init]; + return self; +} +- (RouteNoteBuilder*) clone { + return [RouteNote builderWithPrototype:resultRouteNote]; +} +- (RouteNote*) defaultInstance { + return [RouteNote defaultInstance]; +} +- (RouteNote*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RouteNote*) buildPartial { + RouteNote* returnMe = resultRouteNote; + self.resultRouteNote = nil; + return returnMe; +} +- (RouteNoteBuilder*) mergeFrom:(RouteNote*) other { + if (other == [RouteNote defaultInstance]) { + return self; + } + if (other.hasLocation) { + [self mergeLocation:other.location]; + } + if (other.hasMessage) { + [self setMessage:other.message]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + PointBuilder* subBuilder = [Point builder]; + if (self.hasLocation) { + [subBuilder mergeFrom:self.location]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setLocation:[subBuilder buildPartial]]; + break; + } + case 18: { + [self setMessage:[input readString]]; + break; + } + } + } +} +- (BOOL) hasLocation { + return resultRouteNote.hasLocation; +} +- (Point*) location { + return resultRouteNote.location; +} +- (RouteNoteBuilder*) setLocation:(Point*) value { + resultRouteNote.hasLocation = YES; + resultRouteNote.location = value; + return self; +} +- (RouteNoteBuilder*) setLocationBuilder:(PointBuilder*) builderForValue { + return [self setLocation:[builderForValue build]]; +} +- (RouteNoteBuilder*) mergeLocation:(Point*) value { + if (resultRouteNote.hasLocation && + resultRouteNote.location != [Point defaultInstance]) { + resultRouteNote.location = + [[[Point builderWithPrototype:resultRouteNote.location] mergeFrom:value] buildPartial]; + } else { + resultRouteNote.location = value; + } + resultRouteNote.hasLocation = YES; + return self; +} +- (RouteNoteBuilder*) clearLocation { + resultRouteNote.hasLocation = NO; + resultRouteNote.location = [Point defaultInstance]; + return self; +} +- (BOOL) hasMessage { + return resultRouteNote.hasMessage; +} +- (NSString*) message { + return resultRouteNote.message; +} +- (RouteNoteBuilder*) setMessage:(NSString*) value { + resultRouteNote.hasMessage = YES; + resultRouteNote.message = value; + return self; +} +- (RouteNoteBuilder*) clearMessage { + resultRouteNote.hasMessage = NO; + resultRouteNote.message = @""; + return self; +} +@end + +@interface RouteSummary () +@property SInt32 pointCount; +@property SInt32 featureCount; +@property SInt32 distance; +@property SInt32 elapsedTime; +@end + +@implementation RouteSummary + +- (BOOL) hasPointCount { + return !!hasPointCount_; +} +- (void) setHasPointCount:(BOOL) _value_ { + hasPointCount_ = !!_value_; +} +@synthesize pointCount; +- (BOOL) hasFeatureCount { + return !!hasFeatureCount_; +} +- (void) setHasFeatureCount:(BOOL) _value_ { + hasFeatureCount_ = !!_value_; +} +@synthesize featureCount; +- (BOOL) hasDistance { + return !!hasDistance_; +} +- (void) setHasDistance:(BOOL) _value_ { + hasDistance_ = !!_value_; +} +@synthesize distance; +- (BOOL) hasElapsedTime { + return !!hasElapsedTime_; +} +- (void) setHasElapsedTime:(BOOL) _value_ { + hasElapsedTime_ = !!_value_; +} +@synthesize elapsedTime; +- (instancetype) init { + if ((self = [super init])) { + self.pointCount = 0; + self.featureCount = 0; + self.distance = 0; + self.elapsedTime = 0; + } + return self; +} +static RouteSummary* defaultRouteSummaryInstance = nil; ++ (void) initialize { + if (self == [RouteSummary class]) { + defaultRouteSummaryInstance = [[RouteSummary alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRouteSummaryInstance; +} +- (instancetype) defaultInstance { + return defaultRouteSummaryInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasPointCount) { + [output writeInt32:1 value:self.pointCount]; + } + if (self.hasFeatureCount) { + [output writeInt32:2 value:self.featureCount]; + } + if (self.hasDistance) { + [output writeInt32:3 value:self.distance]; + } + if (self.hasElapsedTime) { + [output writeInt32:4 value:self.elapsedTime]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasPointCount) { + size_ += computeInt32Size(1, self.pointCount); + } + if (self.hasFeatureCount) { + size_ += computeInt32Size(2, self.featureCount); + } + if (self.hasDistance) { + size_ += computeInt32Size(3, self.distance); + } + if (self.hasElapsedTime) { + size_ += computeInt32Size(4, self.elapsedTime); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RouteSummary*) parseFromData:(NSData*) data { + return (RouteSummary*)[[[RouteSummary builder] mergeFromData:data] build]; +} ++ (RouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RouteSummary*)[[[RouteSummary builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RouteSummary*) parseFromInputStream:(NSInputStream*) input { + return (RouteSummary*)[[[RouteSummary builder] mergeFromInputStream:input] build]; +} ++ (RouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RouteSummary*)[[[RouteSummary builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RouteSummary*)[[[RouteSummary builder] mergeFromCodedInputStream:input] build]; +} ++ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RouteSummary*)[[[RouteSummary builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RouteSummaryBuilder*) builder { + return [[RouteSummaryBuilder alloc] init]; +} ++ (RouteSummaryBuilder*) builderWithPrototype:(RouteSummary*) prototype { + return [[RouteSummary builder] mergeFrom:prototype]; +} +- (RouteSummaryBuilder*) builder { + return [RouteSummary builder]; +} +- (RouteSummaryBuilder*) toBuilder { + return [RouteSummary builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasPointCount) { + [output appendFormat:@"%@%@: %@\n", indent, @"pointCount", [NSNumber numberWithInteger:self.pointCount]]; + } + if (self.hasFeatureCount) { + [output appendFormat:@"%@%@: %@\n", indent, @"featureCount", [NSNumber numberWithInteger:self.featureCount]]; + } + if (self.hasDistance) { + [output appendFormat:@"%@%@: %@\n", indent, @"distance", [NSNumber numberWithInteger:self.distance]]; + } + if (self.hasElapsedTime) { + [output appendFormat:@"%@%@: %@\n", indent, @"elapsedTime", [NSNumber numberWithInteger:self.elapsedTime]]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RouteSummary class]]) { + return NO; + } + RouteSummary *otherMessage = other; + return + self.hasPointCount == otherMessage.hasPointCount && + (!self.hasPointCount || self.pointCount == otherMessage.pointCount) && + self.hasFeatureCount == otherMessage.hasFeatureCount && + (!self.hasFeatureCount || self.featureCount == otherMessage.featureCount) && + self.hasDistance == otherMessage.hasDistance && + (!self.hasDistance || self.distance == otherMessage.distance) && + self.hasElapsedTime == otherMessage.hasElapsedTime && + (!self.hasElapsedTime || self.elapsedTime == otherMessage.elapsedTime) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasPointCount) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.pointCount] hash]; + } + if (self.hasFeatureCount) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.featureCount] hash]; + } + if (self.hasDistance) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.distance] hash]; + } + if (self.hasElapsedTime) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.elapsedTime] hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RouteSummaryBuilder() +@property (strong) RouteSummary* resultRouteSummary; +@end + +@implementation RouteSummaryBuilder +@synthesize resultRouteSummary; +- (instancetype) init { + if ((self = [super init])) { + self.resultRouteSummary = [[RouteSummary alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultRouteSummary; +} +- (RouteSummaryBuilder*) clear { + self.resultRouteSummary = [[RouteSummary alloc] init]; + return self; +} +- (RouteSummaryBuilder*) clone { + return [RouteSummary builderWithPrototype:resultRouteSummary]; +} +- (RouteSummary*) defaultInstance { + return [RouteSummary defaultInstance]; +} +- (RouteSummary*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RouteSummary*) buildPartial { + RouteSummary* returnMe = resultRouteSummary; + self.resultRouteSummary = nil; + return returnMe; +} +- (RouteSummaryBuilder*) mergeFrom:(RouteSummary*) other { + if (other == [RouteSummary defaultInstance]) { + return self; + } + if (other.hasPointCount) { + [self setPointCount:other.pointCount]; + } + if (other.hasFeatureCount) { + [self setFeatureCount:other.featureCount]; + } + if (other.hasDistance) { + [self setDistance:other.distance]; + } + if (other.hasElapsedTime) { + [self setElapsedTime:other.elapsedTime]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + [self setPointCount:[input readInt32]]; + break; + } + case 16: { + [self setFeatureCount:[input readInt32]]; + break; + } + case 24: { + [self setDistance:[input readInt32]]; + break; + } + case 32: { + [self setElapsedTime:[input readInt32]]; + break; + } + } + } +} +- (BOOL) hasPointCount { + return resultRouteSummary.hasPointCount; +} +- (SInt32) pointCount { + return resultRouteSummary.pointCount; +} +- (RouteSummaryBuilder*) setPointCount:(SInt32) value { + resultRouteSummary.hasPointCount = YES; + resultRouteSummary.pointCount = value; + return self; +} +- (RouteSummaryBuilder*) clearPointCount { + resultRouteSummary.hasPointCount = NO; + resultRouteSummary.pointCount = 0; + return self; +} +- (BOOL) hasFeatureCount { + return resultRouteSummary.hasFeatureCount; +} +- (SInt32) featureCount { + return resultRouteSummary.featureCount; +} +- (RouteSummaryBuilder*) setFeatureCount:(SInt32) value { + resultRouteSummary.hasFeatureCount = YES; + resultRouteSummary.featureCount = value; + return self; +} +- (RouteSummaryBuilder*) clearFeatureCount { + resultRouteSummary.hasFeatureCount = NO; + resultRouteSummary.featureCount = 0; + return self; +} +- (BOOL) hasDistance { + return resultRouteSummary.hasDistance; +} +- (SInt32) distance { + return resultRouteSummary.distance; +} +- (RouteSummaryBuilder*) setDistance:(SInt32) value { + resultRouteSummary.hasDistance = YES; + resultRouteSummary.distance = value; + return self; +} +- (RouteSummaryBuilder*) clearDistance { + resultRouteSummary.hasDistance = NO; + resultRouteSummary.distance = 0; + return self; +} +- (BOOL) hasElapsedTime { + return resultRouteSummary.hasElapsedTime; +} +- (SInt32) elapsedTime { + return resultRouteSummary.elapsedTime; +} +- (RouteSummaryBuilder*) setElapsedTime:(SInt32) value { + resultRouteSummary.hasElapsedTime = YES; + resultRouteSummary.elapsedTime = value; + return self; +} +- (RouteSummaryBuilder*) clearElapsedTime { + resultRouteSummary.hasElapsedTime = NO; + resultRouteSummary.elapsedTime = 0; + return self; +} +@end + + +// @@protoc_insertion_point(global_scope) From b7f970bc92966bfd237f8c6fc3d36f2f46c1da41 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 Mar 2015 21:49:24 -0700 Subject: [PATCH 09/46] Point the Podfile to a "generated" local podspec --- src/objective-c/examples/Sample/Podfile | 2 +- .../examples/Sample/protos/Route_guide.podspec | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/objective-c/examples/Sample/protos/Route_guide.podspec diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index 4da8bc44f66..31bd4eb8216 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -2,7 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'gRPC', :path => "../../../.." -pod 'ProtocolBuffers', '~> 1.9' +pod 'Route_guide', :path => "protos" link_with 'Sample', 'SampleTests' diff --git a/src/objective-c/examples/Sample/protos/Route_guide.podspec b/src/objective-c/examples/Sample/protos/Route_guide.podspec new file mode 100644 index 00000000000..3c7abf20d39 --- /dev/null +++ b/src/objective-c/examples/Sample/protos/Route_guide.podspec @@ -0,0 +1,16 @@ +Pod::Spec.new do |s| + s.name = 'Route_guide' + s.version = '0.0.1' + s.summary = 'Protobuf library generated from route_guide.proto' + s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/protos' + s.license = 'New BSD' + s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } + + s.source_files = './*.{h,m}' + + s.platform = :ios + s.ios.deployment_target = '6.0' + s.requires_arc = true + + s.dependency 'ProtocolBuffers', '~> 1.9' +end From 0ae1f4d0ca6dd10b1ef881151193d6f29e843493 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 Mar 2015 22:37:22 -0700 Subject: [PATCH 10/46] Fix Route_guide to declare public headers --- src/objective-c/examples/Sample/protos/Route_guide.podspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objective-c/examples/Sample/protos/Route_guide.podspec b/src/objective-c/examples/Sample/protos/Route_guide.podspec index 3c7abf20d39..6fba1c5c1e3 100644 --- a/src/objective-c/examples/Sample/protos/Route_guide.podspec +++ b/src/objective-c/examples/Sample/protos/Route_guide.podspec @@ -6,7 +6,8 @@ Pod::Spec.new do |s| s.license = 'New BSD' s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } - s.source_files = './*.{h,m}' + s.source_files = '*.pb.{h,m}' + s.public_header_files = '*.pb.h' s.platform = :ios s.ios.deployment_target = '6.0' From aa5611bed7342e3ddc6e6ab73fbacb415b4efb77 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 Mar 2015 23:06:20 -0700 Subject: [PATCH 11/46] Adds Objective-C prefixes to the protos Generated with: protoc --plugin=/usr/local/bin/protoc-gen-objc route_guide.proto --proto_path=/Users/jcanizales/git/protobuf-objc/src/compiler --proto_path=. --objc_out="./" --- .../examples/Sample/protos/Route_guide.pb.h | 380 +++++++----- .../examples/Sample/protos/Route_guide.pb.m | 585 +++++++++--------- .../examples/Sample/protos/route_guide.proto | 5 +- 3 files changed, 507 insertions(+), 463 deletions(-) diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.h b/src/objective-c/examples/Sample/protos/Route_guide.pb.h index f1e54d02def..194bfc5f2ae 100644 --- a/src/objective-c/examples/Sample/protos/Route_guide.pb.h +++ b/src/objective-c/examples/Sample/protos/Route_guide.pb.h @@ -4,26 +4,70 @@ // @@protoc_insertion_point(imports) -@class Feature; -@class FeatureBuilder; -@class Point; -@class PointBuilder; -@class Rectangle; -@class RectangleBuilder; -@class RouteNote; -@class RouteNoteBuilder; -@class RouteSummary; -@class RouteSummaryBuilder; - - - -@interface RouteGuideRoot : NSObject { +@class ObjectiveCFileOptions; +@class ObjectiveCFileOptionsBuilder; +@class PBDescriptorProto; +@class PBDescriptorProtoBuilder; +@class PBDescriptorProtoExtensionRange; +@class PBDescriptorProtoExtensionRangeBuilder; +@class PBEnumDescriptorProto; +@class PBEnumDescriptorProtoBuilder; +@class PBEnumOptions; +@class PBEnumOptionsBuilder; +@class PBEnumValueDescriptorProto; +@class PBEnumValueDescriptorProtoBuilder; +@class PBEnumValueOptions; +@class PBEnumValueOptionsBuilder; +@class PBFieldDescriptorProto; +@class PBFieldDescriptorProtoBuilder; +@class PBFieldOptions; +@class PBFieldOptionsBuilder; +@class PBFileDescriptorProto; +@class PBFileDescriptorProtoBuilder; +@class PBFileDescriptorSet; +@class PBFileDescriptorSetBuilder; +@class PBFileOptions; +@class PBFileOptionsBuilder; +@class PBMessageOptions; +@class PBMessageOptionsBuilder; +@class PBMethodDescriptorProto; +@class PBMethodDescriptorProtoBuilder; +@class PBMethodOptions; +@class PBMethodOptionsBuilder; +@class PBOneofDescriptorProto; +@class PBOneofDescriptorProtoBuilder; +@class PBServiceDescriptorProto; +@class PBServiceDescriptorProtoBuilder; +@class PBServiceOptions; +@class PBServiceOptionsBuilder; +@class PBSourceCodeInfo; +@class PBSourceCodeInfoBuilder; +@class PBSourceCodeInfoLocation; +@class PBSourceCodeInfoLocationBuilder; +@class PBUninterpretedOption; +@class PBUninterpretedOptionBuilder; +@class PBUninterpretedOptionNamePart; +@class PBUninterpretedOptionNamePartBuilder; +@class RGDFeature; +@class RGDFeatureBuilder; +@class RGDPoint; +@class RGDPointBuilder; +@class RGDRectangle; +@class RGDRectangleBuilder; +@class RGDRouteNote; +@class RGDRouteNoteBuilder; +@class RGDRouteSummary; +@class RGDRouteSummaryBuilder; + + + +@interface RGDRouteGuideRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end -@interface Point : PBGeneratedMessage { +@interface RGDPoint : PBGeneratedMessage { @private BOOL hasLatitude_:1; BOOL hasLongitude_:1; @@ -40,179 +84,179 @@ - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; -- (PointBuilder*) builder; -+ (PointBuilder*) builder; -+ (PointBuilder*) builderWithPrototype:(Point*) prototype; -- (PointBuilder*) toBuilder; - -+ (Point*) parseFromData:(NSData*) data; -+ (Point*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (Point*) parseFromInputStream:(NSInputStream*) input; -+ (Point*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input; -+ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDPointBuilder*) builder; ++ (RGDPointBuilder*) builder; ++ (RGDPointBuilder*) builderWithPrototype:(RGDPoint*) prototype; +- (RGDPointBuilder*) toBuilder; + ++ (RGDPoint*) parseFromData:(NSData*) data; ++ (RGDPoint*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input; ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end -@interface PointBuilder : PBGeneratedMessageBuilder { +@interface RGDPointBuilder : PBGeneratedMessageBuilder { @private - Point* resultPoint; + RGDPoint* resultPoint; } -- (Point*) defaultInstance; +- (RGDPoint*) defaultInstance; -- (PointBuilder*) clear; -- (PointBuilder*) clone; +- (RGDPointBuilder*) clear; +- (RGDPointBuilder*) clone; -- (Point*) build; -- (Point*) buildPartial; +- (RGDPoint*) build; +- (RGDPoint*) buildPartial; -- (PointBuilder*) mergeFrom:(Point*) other; -- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; -- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDPointBuilder*) mergeFrom:(RGDPoint*) other; +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasLatitude; - (SInt32) latitude; -- (PointBuilder*) setLatitude:(SInt32) value; -- (PointBuilder*) clearLatitude; +- (RGDPointBuilder*) setLatitude:(SInt32) value; +- (RGDPointBuilder*) clearLatitude; - (BOOL) hasLongitude; - (SInt32) longitude; -- (PointBuilder*) setLongitude:(SInt32) value; -- (PointBuilder*) clearLongitude; +- (RGDPointBuilder*) setLongitude:(SInt32) value; +- (RGDPointBuilder*) clearLongitude; @end -@interface Rectangle : PBGeneratedMessage { +@interface RGDRectangle : PBGeneratedMessage { @private BOOL hasLo_:1; BOOL hasHi_:1; - Point* lo; - Point* hi; + RGDPoint* lo; + RGDPoint* hi; } - (BOOL) hasLo; - (BOOL) hasHi; -@property (readonly, strong) Point* lo; -@property (readonly, strong) Point* hi; +@property (readonly, strong) RGDPoint* lo; +@property (readonly, strong) RGDPoint* hi; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; -- (RectangleBuilder*) builder; -+ (RectangleBuilder*) builder; -+ (RectangleBuilder*) builderWithPrototype:(Rectangle*) prototype; -- (RectangleBuilder*) toBuilder; - -+ (Rectangle*) parseFromData:(NSData*) data; -+ (Rectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (Rectangle*) parseFromInputStream:(NSInputStream*) input; -+ (Rectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input; -+ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDRectangleBuilder*) builder; ++ (RGDRectangleBuilder*) builder; ++ (RGDRectangleBuilder*) builderWithPrototype:(RGDRectangle*) prototype; +- (RGDRectangleBuilder*) toBuilder; + ++ (RGDRectangle*) parseFromData:(NSData*) data; ++ (RGDRectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input; ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end -@interface RectangleBuilder : PBGeneratedMessageBuilder { +@interface RGDRectangleBuilder : PBGeneratedMessageBuilder { @private - Rectangle* resultRectangle; + RGDRectangle* resultRectangle; } -- (Rectangle*) defaultInstance; +- (RGDRectangle*) defaultInstance; -- (RectangleBuilder*) clear; -- (RectangleBuilder*) clone; +- (RGDRectangleBuilder*) clear; +- (RGDRectangleBuilder*) clone; -- (Rectangle*) build; -- (Rectangle*) buildPartial; +- (RGDRectangle*) build; +- (RGDRectangle*) buildPartial; -- (RectangleBuilder*) mergeFrom:(Rectangle*) other; -- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; -- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDRectangleBuilder*) mergeFrom:(RGDRectangle*) other; +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasLo; -- (Point*) lo; -- (RectangleBuilder*) setLo:(Point*) value; -- (RectangleBuilder*) setLoBuilder:(PointBuilder*) builderForValue; -- (RectangleBuilder*) mergeLo:(Point*) value; -- (RectangleBuilder*) clearLo; +- (RGDPoint*) lo; +- (RGDRectangleBuilder*) setLo:(RGDPoint*) value; +- (RGDRectangleBuilder*) setLoBuilder:(RGDPointBuilder*) builderForValue; +- (RGDRectangleBuilder*) mergeLo:(RGDPoint*) value; +- (RGDRectangleBuilder*) clearLo; - (BOOL) hasHi; -- (Point*) hi; -- (RectangleBuilder*) setHi:(Point*) value; -- (RectangleBuilder*) setHiBuilder:(PointBuilder*) builderForValue; -- (RectangleBuilder*) mergeHi:(Point*) value; -- (RectangleBuilder*) clearHi; +- (RGDPoint*) hi; +- (RGDRectangleBuilder*) setHi:(RGDPoint*) value; +- (RGDRectangleBuilder*) setHiBuilder:(RGDPointBuilder*) builderForValue; +- (RGDRectangleBuilder*) mergeHi:(RGDPoint*) value; +- (RGDRectangleBuilder*) clearHi; @end -@interface Feature : PBGeneratedMessage { +@interface RGDFeature : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasLocation_:1; NSString* name; - Point* location; + RGDPoint* location; } - (BOOL) hasName; - (BOOL) hasLocation; @property (readonly, strong) NSString* name; -@property (readonly, strong) Point* location; +@property (readonly, strong) RGDPoint* location; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; -- (FeatureBuilder*) builder; -+ (FeatureBuilder*) builder; -+ (FeatureBuilder*) builderWithPrototype:(Feature*) prototype; -- (FeatureBuilder*) toBuilder; - -+ (Feature*) parseFromData:(NSData*) data; -+ (Feature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (Feature*) parseFromInputStream:(NSInputStream*) input; -+ (Feature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input; -+ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDFeatureBuilder*) builder; ++ (RGDFeatureBuilder*) builder; ++ (RGDFeatureBuilder*) builderWithPrototype:(RGDFeature*) prototype; +- (RGDFeatureBuilder*) toBuilder; + ++ (RGDFeature*) parseFromData:(NSData*) data; ++ (RGDFeature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input; ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end -@interface FeatureBuilder : PBGeneratedMessageBuilder { +@interface RGDFeatureBuilder : PBGeneratedMessageBuilder { @private - Feature* resultFeature; + RGDFeature* resultFeature; } -- (Feature*) defaultInstance; +- (RGDFeature*) defaultInstance; -- (FeatureBuilder*) clear; -- (FeatureBuilder*) clone; +- (RGDFeatureBuilder*) clear; +- (RGDFeatureBuilder*) clone; -- (Feature*) build; -- (Feature*) buildPartial; +- (RGDFeature*) build; +- (RGDFeature*) buildPartial; -- (FeatureBuilder*) mergeFrom:(Feature*) other; -- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; -- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDFeatureBuilder*) mergeFrom:(RGDFeature*) other; +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; -- (FeatureBuilder*) setName:(NSString*) value; -- (FeatureBuilder*) clearName; +- (RGDFeatureBuilder*) setName:(NSString*) value; +- (RGDFeatureBuilder*) clearName; - (BOOL) hasLocation; -- (Point*) location; -- (FeatureBuilder*) setLocation:(Point*) value; -- (FeatureBuilder*) setLocationBuilder:(PointBuilder*) builderForValue; -- (FeatureBuilder*) mergeLocation:(Point*) value; -- (FeatureBuilder*) clearLocation; +- (RGDPoint*) location; +- (RGDFeatureBuilder*) setLocation:(RGDPoint*) value; +- (RGDFeatureBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue; +- (RGDFeatureBuilder*) mergeLocation:(RGDPoint*) value; +- (RGDFeatureBuilder*) clearLocation; @end -@interface RouteNote : PBGeneratedMessage { +@interface RGDRouteNote : PBGeneratedMessage { @private BOOL hasMessage_:1; BOOL hasLocation_:1; NSString* message; - Point* location; + RGDPoint* location; } - (BOOL) hasLocation; - (BOOL) hasMessage; -@property (readonly, strong) Point* location; +@property (readonly, strong) RGDPoint* location; @property (readonly, strong) NSString* message; + (instancetype) defaultInstance; @@ -220,50 +264,50 @@ - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; -- (RouteNoteBuilder*) builder; -+ (RouteNoteBuilder*) builder; -+ (RouteNoteBuilder*) builderWithPrototype:(RouteNote*) prototype; -- (RouteNoteBuilder*) toBuilder; - -+ (RouteNote*) parseFromData:(NSData*) data; -+ (RouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (RouteNote*) parseFromInputStream:(NSInputStream*) input; -+ (RouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input; -+ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDRouteNoteBuilder*) builder; ++ (RGDRouteNoteBuilder*) builder; ++ (RGDRouteNoteBuilder*) builderWithPrototype:(RGDRouteNote*) prototype; +- (RGDRouteNoteBuilder*) toBuilder; + ++ (RGDRouteNote*) parseFromData:(NSData*) data; ++ (RGDRouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input; ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end -@interface RouteNoteBuilder : PBGeneratedMessageBuilder { +@interface RGDRouteNoteBuilder : PBGeneratedMessageBuilder { @private - RouteNote* resultRouteNote; + RGDRouteNote* resultRouteNote; } -- (RouteNote*) defaultInstance; +- (RGDRouteNote*) defaultInstance; -- (RouteNoteBuilder*) clear; -- (RouteNoteBuilder*) clone; +- (RGDRouteNoteBuilder*) clear; +- (RGDRouteNoteBuilder*) clone; -- (RouteNote*) build; -- (RouteNote*) buildPartial; +- (RGDRouteNote*) build; +- (RGDRouteNote*) buildPartial; -- (RouteNoteBuilder*) mergeFrom:(RouteNote*) other; -- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; -- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDRouteNoteBuilder*) mergeFrom:(RGDRouteNote*) other; +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasLocation; -- (Point*) location; -- (RouteNoteBuilder*) setLocation:(Point*) value; -- (RouteNoteBuilder*) setLocationBuilder:(PointBuilder*) builderForValue; -- (RouteNoteBuilder*) mergeLocation:(Point*) value; -- (RouteNoteBuilder*) clearLocation; +- (RGDPoint*) location; +- (RGDRouteNoteBuilder*) setLocation:(RGDPoint*) value; +- (RGDRouteNoteBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue; +- (RGDRouteNoteBuilder*) mergeLocation:(RGDPoint*) value; +- (RGDRouteNoteBuilder*) clearLocation; - (BOOL) hasMessage; - (NSString*) message; -- (RouteNoteBuilder*) setMessage:(NSString*) value; -- (RouteNoteBuilder*) clearMessage; +- (RGDRouteNoteBuilder*) setMessage:(NSString*) value; +- (RGDRouteNoteBuilder*) clearMessage; @end -@interface RouteSummary : PBGeneratedMessage { +@interface RGDRouteSummary : PBGeneratedMessage { @private BOOL hasPointCount_:1; BOOL hasFeatureCount_:1; @@ -288,55 +332,55 @@ - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; -- (RouteSummaryBuilder*) builder; -+ (RouteSummaryBuilder*) builder; -+ (RouteSummaryBuilder*) builderWithPrototype:(RouteSummary*) prototype; -- (RouteSummaryBuilder*) toBuilder; - -+ (RouteSummary*) parseFromData:(NSData*) data; -+ (RouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (RouteSummary*) parseFromInputStream:(NSInputStream*) input; -+ (RouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; -+ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input; -+ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDRouteSummaryBuilder*) builder; ++ (RGDRouteSummaryBuilder*) builder; ++ (RGDRouteSummaryBuilder*) builderWithPrototype:(RGDRouteSummary*) prototype; +- (RGDRouteSummaryBuilder*) toBuilder; + ++ (RGDRouteSummary*) parseFromData:(NSData*) data; ++ (RGDRouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input; ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end -@interface RouteSummaryBuilder : PBGeneratedMessageBuilder { +@interface RGDRouteSummaryBuilder : PBGeneratedMessageBuilder { @private - RouteSummary* resultRouteSummary; + RGDRouteSummary* resultRouteSummary; } -- (RouteSummary*) defaultInstance; +- (RGDRouteSummary*) defaultInstance; -- (RouteSummaryBuilder*) clear; -- (RouteSummaryBuilder*) clone; +- (RGDRouteSummaryBuilder*) clear; +- (RGDRouteSummaryBuilder*) clone; -- (RouteSummary*) build; -- (RouteSummary*) buildPartial; +- (RGDRouteSummary*) build; +- (RGDRouteSummary*) buildPartial; -- (RouteSummaryBuilder*) mergeFrom:(RouteSummary*) other; -- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; -- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +- (RGDRouteSummaryBuilder*) mergeFrom:(RGDRouteSummary*) other; +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasPointCount; - (SInt32) pointCount; -- (RouteSummaryBuilder*) setPointCount:(SInt32) value; -- (RouteSummaryBuilder*) clearPointCount; +- (RGDRouteSummaryBuilder*) setPointCount:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearPointCount; - (BOOL) hasFeatureCount; - (SInt32) featureCount; -- (RouteSummaryBuilder*) setFeatureCount:(SInt32) value; -- (RouteSummaryBuilder*) clearFeatureCount; +- (RGDRouteSummaryBuilder*) setFeatureCount:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearFeatureCount; - (BOOL) hasDistance; - (SInt32) distance; -- (RouteSummaryBuilder*) setDistance:(SInt32) value; -- (RouteSummaryBuilder*) clearDistance; +- (RGDRouteSummaryBuilder*) setDistance:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearDistance; - (BOOL) hasElapsedTime; - (SInt32) elapsedTime; -- (RouteSummaryBuilder*) setElapsedTime:(SInt32) value; -- (RouteSummaryBuilder*) clearElapsedTime; +- (RGDRouteSummaryBuilder*) setElapsedTime:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearElapsedTime; @end diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.m b/src/objective-c/examples/Sample/protos/Route_guide.pb.m index d7847dfced1..63cdd00206d 100644 --- a/src/objective-c/examples/Sample/protos/Route_guide.pb.m +++ b/src/objective-c/examples/Sample/protos/Route_guide.pb.m @@ -3,16 +3,17 @@ #import "Route_guide.pb.h" // @@protoc_insertion_point(imports) -@implementation RouteGuideRoot +@implementation RGDRouteGuideRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { - if (self == [RouteGuideRoot class]) { + if (self == [RGDRouteGuideRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; + [ObjectivecDescriptorRoot registerAllExtensions:registry]; extensionRegistry = registry; } } @@ -20,12 +21,12 @@ static PBExtensionRegistry* extensionRegistry = nil; } @end -@interface Point () +@interface RGDPoint () @property SInt32 latitude; @property SInt32 longitude; @end -@implementation Point +@implementation RGDPoint - (BOOL) hasLatitude { return !!hasLatitude_; @@ -48,17 +49,17 @@ static PBExtensionRegistry* extensionRegistry = nil; } return self; } -static Point* defaultPointInstance = nil; +static RGDPoint* defaultRGDPointInstance = nil; + (void) initialize { - if (self == [Point class]) { - defaultPointInstance = [[Point alloc] init]; + if (self == [RGDPoint class]) { + defaultRGDPointInstance = [[RGDPoint alloc] init]; } } + (instancetype) defaultInstance { - return defaultPointInstance; + return defaultRGDPointInstance; } - (instancetype) defaultInstance { - return defaultPointInstance; + return defaultRGDPointInstance; } - (BOOL) isInitialized { return YES; @@ -89,35 +90,35 @@ static Point* defaultPointInstance = nil; memoizedSerializedSize = size_; return size_; } -+ (Point*) parseFromData:(NSData*) data { - return (Point*)[[[Point builder] mergeFromData:data] build]; ++ (RGDPoint*) parseFromData:(NSData*) data { + return (RGDPoint*)[[[RGDPoint builder] mergeFromData:data] build]; } -+ (Point*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Point*)[[[Point builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; ++ (RGDPoint*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDPoint*)[[[RGDPoint builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } -+ (Point*) parseFromInputStream:(NSInputStream*) input { - return (Point*)[[[Point builder] mergeFromInputStream:input] build]; ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input { + return (RGDPoint*)[[[RGDPoint builder] mergeFromInputStream:input] build]; } -+ (Point*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Point*)[[[Point builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDPoint*)[[[RGDPoint builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (Point*)[[[Point builder] mergeFromCodedInputStream:input] build]; ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDPoint*)[[[RGDPoint builder] mergeFromCodedInputStream:input] build]; } -+ (Point*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Point*)[[[Point builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDPoint*)[[[RGDPoint builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (PointBuilder*) builder { - return [[PointBuilder alloc] init]; ++ (RGDPointBuilder*) builder { + return [[RGDPointBuilder alloc] init]; } -+ (PointBuilder*) builderWithPrototype:(Point*) prototype { - return [[Point builder] mergeFrom:prototype]; ++ (RGDPointBuilder*) builderWithPrototype:(RGDPoint*) prototype { + return [[RGDPoint builder] mergeFrom:prototype]; } -- (PointBuilder*) builder { - return [Point builder]; +- (RGDPointBuilder*) builder { + return [RGDPoint builder]; } -- (PointBuilder*) toBuilder { - return [Point builderWithPrototype:self]; +- (RGDPointBuilder*) toBuilder { + return [RGDPoint builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasLatitude) { @@ -132,10 +133,10 @@ static Point* defaultPointInstance = nil; if (other == self) { return YES; } - if (![other isKindOfClass:[Point class]]) { + if (![other isKindOfClass:[RGDPoint class]]) { return NO; } - Point *otherMessage = other; + RGDPoint *otherMessage = other; return self.hasLatitude == otherMessage.hasLatitude && (!self.hasLatitude || self.latitude == otherMessage.latitude) && @@ -156,42 +157,42 @@ static Point* defaultPointInstance = nil; } @end -@interface PointBuilder() -@property (strong) Point* resultPoint; +@interface RGDPointBuilder() +@property (strong) RGDPoint* resultPoint; @end -@implementation PointBuilder +@implementation RGDPointBuilder @synthesize resultPoint; - (instancetype) init { if ((self = [super init])) { - self.resultPoint = [[Point alloc] init]; + self.resultPoint = [[RGDPoint alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultPoint; } -- (PointBuilder*) clear { - self.resultPoint = [[Point alloc] init]; +- (RGDPointBuilder*) clear { + self.resultPoint = [[RGDPoint alloc] init]; return self; } -- (PointBuilder*) clone { - return [Point builderWithPrototype:resultPoint]; +- (RGDPointBuilder*) clone { + return [RGDPoint builderWithPrototype:resultPoint]; } -- (Point*) defaultInstance { - return [Point defaultInstance]; +- (RGDPoint*) defaultInstance { + return [RGDPoint defaultInstance]; } -- (Point*) build { +- (RGDPoint*) build { [self checkInitialized]; return [self buildPartial]; } -- (Point*) buildPartial { - Point* returnMe = resultPoint; +- (RGDPoint*) buildPartial { + RGDPoint* returnMe = resultPoint; self.resultPoint = nil; return returnMe; } -- (PointBuilder*) mergeFrom:(Point*) other { - if (other == [Point defaultInstance]) { +- (RGDPointBuilder*) mergeFrom:(RGDPoint*) other { + if (other == [RGDPoint defaultInstance]) { return self; } if (other.hasLatitude) { @@ -203,10 +204,10 @@ static Point* defaultPointInstance = nil; [self mergeUnknownFields:other.unknownFields]; return self; } -- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } -- (PointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; @@ -238,12 +239,12 @@ static Point* defaultPointInstance = nil; - (SInt32) latitude { return resultPoint.latitude; } -- (PointBuilder*) setLatitude:(SInt32) value { +- (RGDPointBuilder*) setLatitude:(SInt32) value { resultPoint.hasLatitude = YES; resultPoint.latitude = value; return self; } -- (PointBuilder*) clearLatitude { +- (RGDPointBuilder*) clearLatitude { resultPoint.hasLatitude = NO; resultPoint.latitude = 0; return self; @@ -254,24 +255,24 @@ static Point* defaultPointInstance = nil; - (SInt32) longitude { return resultPoint.longitude; } -- (PointBuilder*) setLongitude:(SInt32) value { +- (RGDPointBuilder*) setLongitude:(SInt32) value { resultPoint.hasLongitude = YES; resultPoint.longitude = value; return self; } -- (PointBuilder*) clearLongitude { +- (RGDPointBuilder*) clearLongitude { resultPoint.hasLongitude = NO; resultPoint.longitude = 0; return self; } @end -@interface Rectangle () -@property (strong) Point* lo; -@property (strong) Point* hi; +@interface RGDRectangle () +@property (strong) RGDPoint* lo; +@property (strong) RGDPoint* hi; @end -@implementation Rectangle +@implementation RGDRectangle - (BOOL) hasLo { return !!hasLo_; @@ -289,22 +290,22 @@ static Point* defaultPointInstance = nil; @synthesize hi; - (instancetype) init { if ((self = [super init])) { - self.lo = [Point defaultInstance]; - self.hi = [Point defaultInstance]; + self.lo = [RGDPoint defaultInstance]; + self.hi = [RGDPoint defaultInstance]; } return self; } -static Rectangle* defaultRectangleInstance = nil; +static RGDRectangle* defaultRGDRectangleInstance = nil; + (void) initialize { - if (self == [Rectangle class]) { - defaultRectangleInstance = [[Rectangle alloc] init]; + if (self == [RGDRectangle class]) { + defaultRGDRectangleInstance = [[RGDRectangle alloc] init]; } } + (instancetype) defaultInstance { - return defaultRectangleInstance; + return defaultRGDRectangleInstance; } - (instancetype) defaultInstance { - return defaultRectangleInstance; + return defaultRGDRectangleInstance; } - (BOOL) isInitialized { return YES; @@ -335,35 +336,35 @@ static Rectangle* defaultRectangleInstance = nil; memoizedSerializedSize = size_; return size_; } -+ (Rectangle*) parseFromData:(NSData*) data { - return (Rectangle*)[[[Rectangle builder] mergeFromData:data] build]; ++ (RGDRectangle*) parseFromData:(NSData*) data { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromData:data] build]; } -+ (Rectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Rectangle*)[[[Rectangle builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; ++ (RGDRectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } -+ (Rectangle*) parseFromInputStream:(NSInputStream*) input { - return (Rectangle*)[[[Rectangle builder] mergeFromInputStream:input] build]; ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromInputStream:input] build]; } -+ (Rectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Rectangle*)[[[Rectangle builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (Rectangle*)[[[Rectangle builder] mergeFromCodedInputStream:input] build]; ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromCodedInputStream:input] build]; } -+ (Rectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Rectangle*)[[[Rectangle builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (RectangleBuilder*) builder { - return [[RectangleBuilder alloc] init]; ++ (RGDRectangleBuilder*) builder { + return [[RGDRectangleBuilder alloc] init]; } -+ (RectangleBuilder*) builderWithPrototype:(Rectangle*) prototype { - return [[Rectangle builder] mergeFrom:prototype]; ++ (RGDRectangleBuilder*) builderWithPrototype:(RGDRectangle*) prototype { + return [[RGDRectangle builder] mergeFrom:prototype]; } -- (RectangleBuilder*) builder { - return [Rectangle builder]; +- (RGDRectangleBuilder*) builder { + return [RGDRectangle builder]; } -- (RectangleBuilder*) toBuilder { - return [Rectangle builderWithPrototype:self]; +- (RGDRectangleBuilder*) toBuilder { + return [RGDRectangle builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasLo) { @@ -384,10 +385,10 @@ static Rectangle* defaultRectangleInstance = nil; if (other == self) { return YES; } - if (![other isKindOfClass:[Rectangle class]]) { + if (![other isKindOfClass:[RGDRectangle class]]) { return NO; } - Rectangle *otherMessage = other; + RGDRectangle *otherMessage = other; return self.hasLo == otherMessage.hasLo && (!self.hasLo || [self.lo isEqual:otherMessage.lo]) && @@ -408,42 +409,42 @@ static Rectangle* defaultRectangleInstance = nil; } @end -@interface RectangleBuilder() -@property (strong) Rectangle* resultRectangle; +@interface RGDRectangleBuilder() +@property (strong) RGDRectangle* resultRectangle; @end -@implementation RectangleBuilder +@implementation RGDRectangleBuilder @synthesize resultRectangle; - (instancetype) init { if ((self = [super init])) { - self.resultRectangle = [[Rectangle alloc] init]; + self.resultRectangle = [[RGDRectangle alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultRectangle; } -- (RectangleBuilder*) clear { - self.resultRectangle = [[Rectangle alloc] init]; +- (RGDRectangleBuilder*) clear { + self.resultRectangle = [[RGDRectangle alloc] init]; return self; } -- (RectangleBuilder*) clone { - return [Rectangle builderWithPrototype:resultRectangle]; +- (RGDRectangleBuilder*) clone { + return [RGDRectangle builderWithPrototype:resultRectangle]; } -- (Rectangle*) defaultInstance { - return [Rectangle defaultInstance]; +- (RGDRectangle*) defaultInstance { + return [RGDRectangle defaultInstance]; } -- (Rectangle*) build { +- (RGDRectangle*) build { [self checkInitialized]; return [self buildPartial]; } -- (Rectangle*) buildPartial { - Rectangle* returnMe = resultRectangle; +- (RGDRectangle*) buildPartial { + RGDRectangle* returnMe = resultRectangle; self.resultRectangle = nil; return returnMe; } -- (RectangleBuilder*) mergeFrom:(Rectangle*) other { - if (other == [Rectangle defaultInstance]) { +- (RGDRectangleBuilder*) mergeFrom:(RGDRectangle*) other { + if (other == [RGDRectangle defaultInstance]) { return self; } if (other.hasLo) { @@ -455,10 +456,10 @@ static Rectangle* defaultRectangleInstance = nil; [self mergeUnknownFields:other.unknownFields]; return self; } -- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } -- (RectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; @@ -474,7 +475,7 @@ static Rectangle* defaultRectangleInstance = nil; break; } case 10: { - PointBuilder* subBuilder = [Point builder]; + RGDPointBuilder* subBuilder = [RGDPoint builder]; if (self.hasLo) { [subBuilder mergeFrom:self.lo]; } @@ -483,7 +484,7 @@ static Rectangle* defaultRectangleInstance = nil; break; } case 18: { - PointBuilder* subBuilder = [Point builder]; + RGDPointBuilder* subBuilder = [RGDPoint builder]; if (self.hasHi) { [subBuilder mergeFrom:self.hi]; } @@ -497,71 +498,71 @@ static Rectangle* defaultRectangleInstance = nil; - (BOOL) hasLo { return resultRectangle.hasLo; } -- (Point*) lo { +- (RGDPoint*) lo { return resultRectangle.lo; } -- (RectangleBuilder*) setLo:(Point*) value { +- (RGDRectangleBuilder*) setLo:(RGDPoint*) value { resultRectangle.hasLo = YES; resultRectangle.lo = value; return self; } -- (RectangleBuilder*) setLoBuilder:(PointBuilder*) builderForValue { +- (RGDRectangleBuilder*) setLoBuilder:(RGDPointBuilder*) builderForValue { return [self setLo:[builderForValue build]]; } -- (RectangleBuilder*) mergeLo:(Point*) value { +- (RGDRectangleBuilder*) mergeLo:(RGDPoint*) value { if (resultRectangle.hasLo && - resultRectangle.lo != [Point defaultInstance]) { + resultRectangle.lo != [RGDPoint defaultInstance]) { resultRectangle.lo = - [[[Point builderWithPrototype:resultRectangle.lo] mergeFrom:value] buildPartial]; + [[[RGDPoint builderWithPrototype:resultRectangle.lo] mergeFrom:value] buildPartial]; } else { resultRectangle.lo = value; } resultRectangle.hasLo = YES; return self; } -- (RectangleBuilder*) clearLo { +- (RGDRectangleBuilder*) clearLo { resultRectangle.hasLo = NO; - resultRectangle.lo = [Point defaultInstance]; + resultRectangle.lo = [RGDPoint defaultInstance]; return self; } - (BOOL) hasHi { return resultRectangle.hasHi; } -- (Point*) hi { +- (RGDPoint*) hi { return resultRectangle.hi; } -- (RectangleBuilder*) setHi:(Point*) value { +- (RGDRectangleBuilder*) setHi:(RGDPoint*) value { resultRectangle.hasHi = YES; resultRectangle.hi = value; return self; } -- (RectangleBuilder*) setHiBuilder:(PointBuilder*) builderForValue { +- (RGDRectangleBuilder*) setHiBuilder:(RGDPointBuilder*) builderForValue { return [self setHi:[builderForValue build]]; } -- (RectangleBuilder*) mergeHi:(Point*) value { +- (RGDRectangleBuilder*) mergeHi:(RGDPoint*) value { if (resultRectangle.hasHi && - resultRectangle.hi != [Point defaultInstance]) { + resultRectangle.hi != [RGDPoint defaultInstance]) { resultRectangle.hi = - [[[Point builderWithPrototype:resultRectangle.hi] mergeFrom:value] buildPartial]; + [[[RGDPoint builderWithPrototype:resultRectangle.hi] mergeFrom:value] buildPartial]; } else { resultRectangle.hi = value; } resultRectangle.hasHi = YES; return self; } -- (RectangleBuilder*) clearHi { +- (RGDRectangleBuilder*) clearHi { resultRectangle.hasHi = NO; - resultRectangle.hi = [Point defaultInstance]; + resultRectangle.hi = [RGDPoint defaultInstance]; return self; } @end -@interface Feature () +@interface RGDFeature () @property (strong) NSString* name; -@property (strong) Point* location; +@property (strong) RGDPoint* location; @end -@implementation Feature +@implementation RGDFeature - (BOOL) hasName { return !!hasName_; @@ -580,21 +581,21 @@ static Rectangle* defaultRectangleInstance = nil; - (instancetype) init { if ((self = [super init])) { self.name = @""; - self.location = [Point defaultInstance]; + self.location = [RGDPoint defaultInstance]; } return self; } -static Feature* defaultFeatureInstance = nil; +static RGDFeature* defaultRGDFeatureInstance = nil; + (void) initialize { - if (self == [Feature class]) { - defaultFeatureInstance = [[Feature alloc] init]; + if (self == [RGDFeature class]) { + defaultRGDFeatureInstance = [[RGDFeature alloc] init]; } } + (instancetype) defaultInstance { - return defaultFeatureInstance; + return defaultRGDFeatureInstance; } - (instancetype) defaultInstance { - return defaultFeatureInstance; + return defaultRGDFeatureInstance; } - (BOOL) isInitialized { return YES; @@ -625,35 +626,35 @@ static Feature* defaultFeatureInstance = nil; memoizedSerializedSize = size_; return size_; } -+ (Feature*) parseFromData:(NSData*) data { - return (Feature*)[[[Feature builder] mergeFromData:data] build]; ++ (RGDFeature*) parseFromData:(NSData*) data { + return (RGDFeature*)[[[RGDFeature builder] mergeFromData:data] build]; } -+ (Feature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Feature*)[[[Feature builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; ++ (RGDFeature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDFeature*)[[[RGDFeature builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } -+ (Feature*) parseFromInputStream:(NSInputStream*) input { - return (Feature*)[[[Feature builder] mergeFromInputStream:input] build]; ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input { + return (RGDFeature*)[[[RGDFeature builder] mergeFromInputStream:input] build]; } -+ (Feature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Feature*)[[[Feature builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDFeature*)[[[RGDFeature builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (Feature*)[[[Feature builder] mergeFromCodedInputStream:input] build]; ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDFeature*)[[[RGDFeature builder] mergeFromCodedInputStream:input] build]; } -+ (Feature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (Feature*)[[[Feature builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDFeature*)[[[RGDFeature builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (FeatureBuilder*) builder { - return [[FeatureBuilder alloc] init]; ++ (RGDFeatureBuilder*) builder { + return [[RGDFeatureBuilder alloc] init]; } -+ (FeatureBuilder*) builderWithPrototype:(Feature*) prototype { - return [[Feature builder] mergeFrom:prototype]; ++ (RGDFeatureBuilder*) builderWithPrototype:(RGDFeature*) prototype { + return [[RGDFeature builder] mergeFrom:prototype]; } -- (FeatureBuilder*) builder { - return [Feature builder]; +- (RGDFeatureBuilder*) builder { + return [RGDFeature builder]; } -- (FeatureBuilder*) toBuilder { - return [Feature builderWithPrototype:self]; +- (RGDFeatureBuilder*) toBuilder { + return [RGDFeature builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { @@ -671,10 +672,10 @@ static Feature* defaultFeatureInstance = nil; if (other == self) { return YES; } - if (![other isKindOfClass:[Feature class]]) { + if (![other isKindOfClass:[RGDFeature class]]) { return NO; } - Feature *otherMessage = other; + RGDFeature *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && @@ -695,42 +696,42 @@ static Feature* defaultFeatureInstance = nil; } @end -@interface FeatureBuilder() -@property (strong) Feature* resultFeature; +@interface RGDFeatureBuilder() +@property (strong) RGDFeature* resultFeature; @end -@implementation FeatureBuilder +@implementation RGDFeatureBuilder @synthesize resultFeature; - (instancetype) init { if ((self = [super init])) { - self.resultFeature = [[Feature alloc] init]; + self.resultFeature = [[RGDFeature alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultFeature; } -- (FeatureBuilder*) clear { - self.resultFeature = [[Feature alloc] init]; +- (RGDFeatureBuilder*) clear { + self.resultFeature = [[RGDFeature alloc] init]; return self; } -- (FeatureBuilder*) clone { - return [Feature builderWithPrototype:resultFeature]; +- (RGDFeatureBuilder*) clone { + return [RGDFeature builderWithPrototype:resultFeature]; } -- (Feature*) defaultInstance { - return [Feature defaultInstance]; +- (RGDFeature*) defaultInstance { + return [RGDFeature defaultInstance]; } -- (Feature*) build { +- (RGDFeature*) build { [self checkInitialized]; return [self buildPartial]; } -- (Feature*) buildPartial { - Feature* returnMe = resultFeature; +- (RGDFeature*) buildPartial { + RGDFeature* returnMe = resultFeature; self.resultFeature = nil; return returnMe; } -- (FeatureBuilder*) mergeFrom:(Feature*) other { - if (other == [Feature defaultInstance]) { +- (RGDFeatureBuilder*) mergeFrom:(RGDFeature*) other { + if (other == [RGDFeature defaultInstance]) { return self; } if (other.hasName) { @@ -742,10 +743,10 @@ static Feature* defaultFeatureInstance = nil; [self mergeUnknownFields:other.unknownFields]; return self; } -- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } -- (FeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; @@ -765,7 +766,7 @@ static Feature* defaultFeatureInstance = nil; break; } case 18: { - PointBuilder* subBuilder = [Point builder]; + RGDPointBuilder* subBuilder = [RGDPoint builder]; if (self.hasLocation) { [subBuilder mergeFrom:self.location]; } @@ -782,12 +783,12 @@ static Feature* defaultFeatureInstance = nil; - (NSString*) name { return resultFeature.name; } -- (FeatureBuilder*) setName:(NSString*) value { +- (RGDFeatureBuilder*) setName:(NSString*) value { resultFeature.hasName = YES; resultFeature.name = value; return self; } -- (FeatureBuilder*) clearName { +- (RGDFeatureBuilder*) clearName { resultFeature.hasName = NO; resultFeature.name = @""; return self; @@ -795,41 +796,41 @@ static Feature* defaultFeatureInstance = nil; - (BOOL) hasLocation { return resultFeature.hasLocation; } -- (Point*) location { +- (RGDPoint*) location { return resultFeature.location; } -- (FeatureBuilder*) setLocation:(Point*) value { +- (RGDFeatureBuilder*) setLocation:(RGDPoint*) value { resultFeature.hasLocation = YES; resultFeature.location = value; return self; } -- (FeatureBuilder*) setLocationBuilder:(PointBuilder*) builderForValue { +- (RGDFeatureBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue { return [self setLocation:[builderForValue build]]; } -- (FeatureBuilder*) mergeLocation:(Point*) value { +- (RGDFeatureBuilder*) mergeLocation:(RGDPoint*) value { if (resultFeature.hasLocation && - resultFeature.location != [Point defaultInstance]) { + resultFeature.location != [RGDPoint defaultInstance]) { resultFeature.location = - [[[Point builderWithPrototype:resultFeature.location] mergeFrom:value] buildPartial]; + [[[RGDPoint builderWithPrototype:resultFeature.location] mergeFrom:value] buildPartial]; } else { resultFeature.location = value; } resultFeature.hasLocation = YES; return self; } -- (FeatureBuilder*) clearLocation { +- (RGDFeatureBuilder*) clearLocation { resultFeature.hasLocation = NO; - resultFeature.location = [Point defaultInstance]; + resultFeature.location = [RGDPoint defaultInstance]; return self; } @end -@interface RouteNote () -@property (strong) Point* location; +@interface RGDRouteNote () +@property (strong) RGDPoint* location; @property (strong) NSString* message; @end -@implementation RouteNote +@implementation RGDRouteNote - (BOOL) hasLocation { return !!hasLocation_; @@ -847,22 +848,22 @@ static Feature* defaultFeatureInstance = nil; @synthesize message; - (instancetype) init { if ((self = [super init])) { - self.location = [Point defaultInstance]; + self.location = [RGDPoint defaultInstance]; self.message = @""; } return self; } -static RouteNote* defaultRouteNoteInstance = nil; +static RGDRouteNote* defaultRGDRouteNoteInstance = nil; + (void) initialize { - if (self == [RouteNote class]) { - defaultRouteNoteInstance = [[RouteNote alloc] init]; + if (self == [RGDRouteNote class]) { + defaultRGDRouteNoteInstance = [[RGDRouteNote alloc] init]; } } + (instancetype) defaultInstance { - return defaultRouteNoteInstance; + return defaultRGDRouteNoteInstance; } - (instancetype) defaultInstance { - return defaultRouteNoteInstance; + return defaultRGDRouteNoteInstance; } - (BOOL) isInitialized { return YES; @@ -893,35 +894,35 @@ static RouteNote* defaultRouteNoteInstance = nil; memoizedSerializedSize = size_; return size_; } -+ (RouteNote*) parseFromData:(NSData*) data { - return (RouteNote*)[[[RouteNote builder] mergeFromData:data] build]; ++ (RGDRouteNote*) parseFromData:(NSData*) data { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromData:data] build]; } -+ (RouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (RouteNote*)[[[RouteNote builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; ++ (RGDRouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } -+ (RouteNote*) parseFromInputStream:(NSInputStream*) input { - return (RouteNote*)[[[RouteNote builder] mergeFromInputStream:input] build]; ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromInputStream:input] build]; } -+ (RouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (RouteNote*)[[[RouteNote builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (RouteNote*)[[[RouteNote builder] mergeFromCodedInputStream:input] build]; ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromCodedInputStream:input] build]; } -+ (RouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (RouteNote*)[[[RouteNote builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (RouteNoteBuilder*) builder { - return [[RouteNoteBuilder alloc] init]; ++ (RGDRouteNoteBuilder*) builder { + return [[RGDRouteNoteBuilder alloc] init]; } -+ (RouteNoteBuilder*) builderWithPrototype:(RouteNote*) prototype { - return [[RouteNote builder] mergeFrom:prototype]; ++ (RGDRouteNoteBuilder*) builderWithPrototype:(RGDRouteNote*) prototype { + return [[RGDRouteNote builder] mergeFrom:prototype]; } -- (RouteNoteBuilder*) builder { - return [RouteNote builder]; +- (RGDRouteNoteBuilder*) builder { + return [RGDRouteNote builder]; } -- (RouteNoteBuilder*) toBuilder { - return [RouteNote builderWithPrototype:self]; +- (RGDRouteNoteBuilder*) toBuilder { + return [RGDRouteNote builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasLocation) { @@ -939,10 +940,10 @@ static RouteNote* defaultRouteNoteInstance = nil; if (other == self) { return YES; } - if (![other isKindOfClass:[RouteNote class]]) { + if (![other isKindOfClass:[RGDRouteNote class]]) { return NO; } - RouteNote *otherMessage = other; + RGDRouteNote *otherMessage = other; return self.hasLocation == otherMessage.hasLocation && (!self.hasLocation || [self.location isEqual:otherMessage.location]) && @@ -963,42 +964,42 @@ static RouteNote* defaultRouteNoteInstance = nil; } @end -@interface RouteNoteBuilder() -@property (strong) RouteNote* resultRouteNote; +@interface RGDRouteNoteBuilder() +@property (strong) RGDRouteNote* resultRouteNote; @end -@implementation RouteNoteBuilder +@implementation RGDRouteNoteBuilder @synthesize resultRouteNote; - (instancetype) init { if ((self = [super init])) { - self.resultRouteNote = [[RouteNote alloc] init]; + self.resultRouteNote = [[RGDRouteNote alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultRouteNote; } -- (RouteNoteBuilder*) clear { - self.resultRouteNote = [[RouteNote alloc] init]; +- (RGDRouteNoteBuilder*) clear { + self.resultRouteNote = [[RGDRouteNote alloc] init]; return self; } -- (RouteNoteBuilder*) clone { - return [RouteNote builderWithPrototype:resultRouteNote]; +- (RGDRouteNoteBuilder*) clone { + return [RGDRouteNote builderWithPrototype:resultRouteNote]; } -- (RouteNote*) defaultInstance { - return [RouteNote defaultInstance]; +- (RGDRouteNote*) defaultInstance { + return [RGDRouteNote defaultInstance]; } -- (RouteNote*) build { +- (RGDRouteNote*) build { [self checkInitialized]; return [self buildPartial]; } -- (RouteNote*) buildPartial { - RouteNote* returnMe = resultRouteNote; +- (RGDRouteNote*) buildPartial { + RGDRouteNote* returnMe = resultRouteNote; self.resultRouteNote = nil; return returnMe; } -- (RouteNoteBuilder*) mergeFrom:(RouteNote*) other { - if (other == [RouteNote defaultInstance]) { +- (RGDRouteNoteBuilder*) mergeFrom:(RGDRouteNote*) other { + if (other == [RGDRouteNote defaultInstance]) { return self; } if (other.hasLocation) { @@ -1010,10 +1011,10 @@ static RouteNote* defaultRouteNoteInstance = nil; [self mergeUnknownFields:other.unknownFields]; return self; } -- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } -- (RouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; @@ -1029,7 +1030,7 @@ static RouteNote* defaultRouteNoteInstance = nil; break; } case 10: { - PointBuilder* subBuilder = [Point builder]; + RGDPointBuilder* subBuilder = [RGDPoint builder]; if (self.hasLocation) { [subBuilder mergeFrom:self.location]; } @@ -1047,31 +1048,31 @@ static RouteNote* defaultRouteNoteInstance = nil; - (BOOL) hasLocation { return resultRouteNote.hasLocation; } -- (Point*) location { +- (RGDPoint*) location { return resultRouteNote.location; } -- (RouteNoteBuilder*) setLocation:(Point*) value { +- (RGDRouteNoteBuilder*) setLocation:(RGDPoint*) value { resultRouteNote.hasLocation = YES; resultRouteNote.location = value; return self; } -- (RouteNoteBuilder*) setLocationBuilder:(PointBuilder*) builderForValue { +- (RGDRouteNoteBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue { return [self setLocation:[builderForValue build]]; } -- (RouteNoteBuilder*) mergeLocation:(Point*) value { +- (RGDRouteNoteBuilder*) mergeLocation:(RGDPoint*) value { if (resultRouteNote.hasLocation && - resultRouteNote.location != [Point defaultInstance]) { + resultRouteNote.location != [RGDPoint defaultInstance]) { resultRouteNote.location = - [[[Point builderWithPrototype:resultRouteNote.location] mergeFrom:value] buildPartial]; + [[[RGDPoint builderWithPrototype:resultRouteNote.location] mergeFrom:value] buildPartial]; } else { resultRouteNote.location = value; } resultRouteNote.hasLocation = YES; return self; } -- (RouteNoteBuilder*) clearLocation { +- (RGDRouteNoteBuilder*) clearLocation { resultRouteNote.hasLocation = NO; - resultRouteNote.location = [Point defaultInstance]; + resultRouteNote.location = [RGDPoint defaultInstance]; return self; } - (BOOL) hasMessage { @@ -1080,26 +1081,26 @@ static RouteNote* defaultRouteNoteInstance = nil; - (NSString*) message { return resultRouteNote.message; } -- (RouteNoteBuilder*) setMessage:(NSString*) value { +- (RGDRouteNoteBuilder*) setMessage:(NSString*) value { resultRouteNote.hasMessage = YES; resultRouteNote.message = value; return self; } -- (RouteNoteBuilder*) clearMessage { +- (RGDRouteNoteBuilder*) clearMessage { resultRouteNote.hasMessage = NO; resultRouteNote.message = @""; return self; } @end -@interface RouteSummary () +@interface RGDRouteSummary () @property SInt32 pointCount; @property SInt32 featureCount; @property SInt32 distance; @property SInt32 elapsedTime; @end -@implementation RouteSummary +@implementation RGDRouteSummary - (BOOL) hasPointCount { return !!hasPointCount_; @@ -1138,17 +1139,17 @@ static RouteNote* defaultRouteNoteInstance = nil; } return self; } -static RouteSummary* defaultRouteSummaryInstance = nil; +static RGDRouteSummary* defaultRGDRouteSummaryInstance = nil; + (void) initialize { - if (self == [RouteSummary class]) { - defaultRouteSummaryInstance = [[RouteSummary alloc] init]; + if (self == [RGDRouteSummary class]) { + defaultRGDRouteSummaryInstance = [[RGDRouteSummary alloc] init]; } } + (instancetype) defaultInstance { - return defaultRouteSummaryInstance; + return defaultRGDRouteSummaryInstance; } - (instancetype) defaultInstance { - return defaultRouteSummaryInstance; + return defaultRGDRouteSummaryInstance; } - (BOOL) isInitialized { return YES; @@ -1191,35 +1192,35 @@ static RouteSummary* defaultRouteSummaryInstance = nil; memoizedSerializedSize = size_; return size_; } -+ (RouteSummary*) parseFromData:(NSData*) data { - return (RouteSummary*)[[[RouteSummary builder] mergeFromData:data] build]; ++ (RGDRouteSummary*) parseFromData:(NSData*) data { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromData:data] build]; } -+ (RouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (RouteSummary*)[[[RouteSummary builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; ++ (RGDRouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } -+ (RouteSummary*) parseFromInputStream:(NSInputStream*) input { - return (RouteSummary*)[[[RouteSummary builder] mergeFromInputStream:input] build]; ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromInputStream:input] build]; } -+ (RouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (RouteSummary*)[[[RouteSummary builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input { - return (RouteSummary*)[[[RouteSummary builder] mergeFromCodedInputStream:input] build]; ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromCodedInputStream:input] build]; } -+ (RouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { - return (RouteSummary*)[[[RouteSummary builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } -+ (RouteSummaryBuilder*) builder { - return [[RouteSummaryBuilder alloc] init]; ++ (RGDRouteSummaryBuilder*) builder { + return [[RGDRouteSummaryBuilder alloc] init]; } -+ (RouteSummaryBuilder*) builderWithPrototype:(RouteSummary*) prototype { - return [[RouteSummary builder] mergeFrom:prototype]; ++ (RGDRouteSummaryBuilder*) builderWithPrototype:(RGDRouteSummary*) prototype { + return [[RGDRouteSummary builder] mergeFrom:prototype]; } -- (RouteSummaryBuilder*) builder { - return [RouteSummary builder]; +- (RGDRouteSummaryBuilder*) builder { + return [RGDRouteSummary builder]; } -- (RouteSummaryBuilder*) toBuilder { - return [RouteSummary builderWithPrototype:self]; +- (RGDRouteSummaryBuilder*) toBuilder { + return [RGDRouteSummary builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasPointCount) { @@ -1240,10 +1241,10 @@ static RouteSummary* defaultRouteSummaryInstance = nil; if (other == self) { return YES; } - if (![other isKindOfClass:[RouteSummary class]]) { + if (![other isKindOfClass:[RGDRouteSummary class]]) { return NO; } - RouteSummary *otherMessage = other; + RGDRouteSummary *otherMessage = other; return self.hasPointCount == otherMessage.hasPointCount && (!self.hasPointCount || self.pointCount == otherMessage.pointCount) && @@ -1274,42 +1275,42 @@ static RouteSummary* defaultRouteSummaryInstance = nil; } @end -@interface RouteSummaryBuilder() -@property (strong) RouteSummary* resultRouteSummary; +@interface RGDRouteSummaryBuilder() +@property (strong) RGDRouteSummary* resultRouteSummary; @end -@implementation RouteSummaryBuilder +@implementation RGDRouteSummaryBuilder @synthesize resultRouteSummary; - (instancetype) init { if ((self = [super init])) { - self.resultRouteSummary = [[RouteSummary alloc] init]; + self.resultRouteSummary = [[RGDRouteSummary alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultRouteSummary; } -- (RouteSummaryBuilder*) clear { - self.resultRouteSummary = [[RouteSummary alloc] init]; +- (RGDRouteSummaryBuilder*) clear { + self.resultRouteSummary = [[RGDRouteSummary alloc] init]; return self; } -- (RouteSummaryBuilder*) clone { - return [RouteSummary builderWithPrototype:resultRouteSummary]; +- (RGDRouteSummaryBuilder*) clone { + return [RGDRouteSummary builderWithPrototype:resultRouteSummary]; } -- (RouteSummary*) defaultInstance { - return [RouteSummary defaultInstance]; +- (RGDRouteSummary*) defaultInstance { + return [RGDRouteSummary defaultInstance]; } -- (RouteSummary*) build { +- (RGDRouteSummary*) build { [self checkInitialized]; return [self buildPartial]; } -- (RouteSummary*) buildPartial { - RouteSummary* returnMe = resultRouteSummary; +- (RGDRouteSummary*) buildPartial { + RGDRouteSummary* returnMe = resultRouteSummary; self.resultRouteSummary = nil; return returnMe; } -- (RouteSummaryBuilder*) mergeFrom:(RouteSummary*) other { - if (other == [RouteSummary defaultInstance]) { +- (RGDRouteSummaryBuilder*) mergeFrom:(RGDRouteSummary*) other { + if (other == [RGDRouteSummary defaultInstance]) { return self; } if (other.hasPointCount) { @@ -1327,10 +1328,10 @@ static RouteSummary* defaultRouteSummaryInstance = nil; [self mergeUnknownFields:other.unknownFields]; return self; } -- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } -- (RouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; @@ -1370,12 +1371,12 @@ static RouteSummary* defaultRouteSummaryInstance = nil; - (SInt32) pointCount { return resultRouteSummary.pointCount; } -- (RouteSummaryBuilder*) setPointCount:(SInt32) value { +- (RGDRouteSummaryBuilder*) setPointCount:(SInt32) value { resultRouteSummary.hasPointCount = YES; resultRouteSummary.pointCount = value; return self; } -- (RouteSummaryBuilder*) clearPointCount { +- (RGDRouteSummaryBuilder*) clearPointCount { resultRouteSummary.hasPointCount = NO; resultRouteSummary.pointCount = 0; return self; @@ -1386,12 +1387,12 @@ static RouteSummary* defaultRouteSummaryInstance = nil; - (SInt32) featureCount { return resultRouteSummary.featureCount; } -- (RouteSummaryBuilder*) setFeatureCount:(SInt32) value { +- (RGDRouteSummaryBuilder*) setFeatureCount:(SInt32) value { resultRouteSummary.hasFeatureCount = YES; resultRouteSummary.featureCount = value; return self; } -- (RouteSummaryBuilder*) clearFeatureCount { +- (RGDRouteSummaryBuilder*) clearFeatureCount { resultRouteSummary.hasFeatureCount = NO; resultRouteSummary.featureCount = 0; return self; @@ -1402,12 +1403,12 @@ static RouteSummary* defaultRouteSummaryInstance = nil; - (SInt32) distance { return resultRouteSummary.distance; } -- (RouteSummaryBuilder*) setDistance:(SInt32) value { +- (RGDRouteSummaryBuilder*) setDistance:(SInt32) value { resultRouteSummary.hasDistance = YES; resultRouteSummary.distance = value; return self; } -- (RouteSummaryBuilder*) clearDistance { +- (RGDRouteSummaryBuilder*) clearDistance { resultRouteSummary.hasDistance = NO; resultRouteSummary.distance = 0; return self; @@ -1418,12 +1419,12 @@ static RouteSummary* defaultRouteSummaryInstance = nil; - (SInt32) elapsedTime { return resultRouteSummary.elapsedTime; } -- (RouteSummaryBuilder*) setElapsedTime:(SInt32) value { +- (RGDRouteSummaryBuilder*) setElapsedTime:(SInt32) value { resultRouteSummary.hasElapsedTime = YES; resultRouteSummary.elapsedTime = value; return self; } -- (RouteSummaryBuilder*) clearElapsedTime { +- (RGDRouteSummaryBuilder*) clearElapsedTime { resultRouteSummary.hasElapsedTime = NO; resultRouteSummary.elapsedTime = 0; return self; diff --git a/src/objective-c/examples/Sample/protos/route_guide.proto b/src/objective-c/examples/Sample/protos/route_guide.proto index 6d35e786b42..91b0372a079 100644 --- a/src/objective-c/examples/Sample/protos/route_guide.proto +++ b/src/objective-c/examples/Sample/protos/route_guide.proto @@ -31,9 +31,8 @@ syntax = "proto2"; package grpc.example.routeguide; -option java_multiple_files = true; -option java_package = "io.grpc.examples.routeguide"; -option java_outer_classname = "RouteGuideProto"; +import "google/protobuf/objectivec-descriptor.proto"; +option (google.protobuf.objectivec_file_options).class_prefix = "RGD"; // Interface exported by the server. service RouteGuide { From 6a84b3d269fe8965b360fab8f29e923c1d5e52ec Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 11:55:05 -0700 Subject: [PATCH 12/46] Adds test that sends proto and expects one --- .../examples/Sample/SampleTests/SampleTests.m | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index bf0b3642b13..92beb20a6a4 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -38,6 +38,7 @@ #import #import #import +#import @interface SampleTests : XCTestCase @end @@ -101,4 +102,37 @@ [self waitForExpectationsWithTimeout:2.0 handler:nil]; } + +- (void)testSimpleProtoRPC { + __weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."]; + __weak XCTestExpectation *expectedResponse = + [self expectationWithDescription:@"Expected response."]; + __weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."]; + + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide" + interface:@"RouteGuide" + method:@"GetFeature"]; + + RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-30E7] build]; + id requestsWriter = [GRXWriter writerWithValue:[point data]]; + + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"127.0.0.1:8980" + method:method + requestsWriter:requestsWriter]; + + id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + XCTAssertNotNil(value, @"nil value received as response."); + [response fulfill]; + RGDFeature *feature = [RGDFeature parseFromData:value]; + NSLog(@"%@ %@", feature.name, feature.location); + [expectedResponse fulfill]; + } completionHandler:^(NSError *errorOrNil) { + XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); + [completion fulfill]; + }]; + + [call startWithWriteable:responsesWriteable]; + + [self waitForExpectationsWithTimeout:2.0 handler:nil]; +} @end From 6ad8c2008ebb30e0b411a391746403f3fd7c109c Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 12:12:54 -0700 Subject: [PATCH 13/46] Adds more assertions to the test --- src/objective-c/examples/Sample/SampleTests/SampleTests.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index 92beb20a6a4..838efc1ce5e 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -124,7 +124,8 @@ XCTAssertNotNil(value, @"nil value received as response."); [response fulfill]; RGDFeature *feature = [RGDFeature parseFromData:value]; - NSLog(@"%@ %@", feature.name, feature.location); + XCTAssertEqualObjects(point, feature.location); + XCTAssertNotNil(feature.name, @"Response's name is nil."); [expectedResponse fulfill]; } completionHandler:^(NSError *errorOrNil) { XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); From 3d86bca23fc9dcd4c050a02865a51ed580c9397f Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 14:13:08 -0700 Subject: [PATCH 14/46] Centers the sample location in Gran Canaria :P --- src/objective-c/examples/Sample/SampleTests/SampleTests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index 838efc1ce5e..ca5e302a174 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -113,7 +113,7 @@ interface:@"RouteGuide" method:@"GetFeature"]; - RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-30E7] build]; + RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build]; id requestsWriter = [GRXWriter writerWithValue:[point data]]; GRPCCall *call = [[GRPCCall alloc] initWithHost:@"127.0.0.1:8980" From 2c9c76310e78ca3a64018d2aabc5ee54e98a8ea9 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 20 Apr 2015 14:13:54 -0700 Subject: [PATCH 15/46] Support update metadata callback function in php BaseStub --- src/php/bin/run_gen_code_test.sh | 3 + src/php/lib/Grpc/BaseStub.php | 45 ++++++++- .../AbstractGeneratedCodeTest.php | 97 +++++++++++++++++++ .../generated_code/GeneratedCodeTest.php | 66 +------------ .../GeneratedCodeWithCallbackTest.php | 48 +++++++++ 5 files changed, 192 insertions(+), 67 deletions(-) create mode 100644 src/php/tests/generated_code/AbstractGeneratedCodeTest.php create mode 100644 src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php diff --git a/src/php/bin/run_gen_code_test.sh b/src/php/bin/run_gen_code_test.sh index 3f176fb5e4a..79abbe6cf8c 100755 --- a/src/php/bin/run_gen_code_test.sh +++ b/src/php/bin/run_gen_code_test.sh @@ -32,3 +32,6 @@ cd $(dirname $0) GRPC_TEST_HOST=localhost:7070 php -d extension_dir=../ext/grpc/modules/ \ -d extension=grpc.so /usr/local/bin/phpunit -v --debug --strict \ ../tests/generated_code/GeneratedCodeTest.php +GRPC_TEST_HOST=localhost:7070 php -d extension_dir=../ext/grpc/modules/ \ + -d extension=grpc.so /usr/local/bin/phpunit -v --debug --strict \ + ../tests/generated_code/GeneratedCodeWithCallbackTest.php diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index fc83dace205..cb2537fe98d 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -41,7 +41,24 @@ class BaseStub { private $channel; + // a callback function + private $update_metadata; + + /** + * @param $hostname string + * @param $opts array + * - 'update_metadata': (optional) a callback function which takes in a + * metadata array, and returns an updated metadata array + */ public function __construct($hostname, $opts) { + $this->update_metadata = null; + if (isset($opts['update_metadata'])) { + if (is_callable($opts['update_metadata'])) { + $this->update_metadata = $opts['update_metadata']; + } + unset($opts['update_metadata']); + } + $this->channel = new Channel($hostname, $opts); } @@ -69,7 +86,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new UnaryCall($this->channel, $method, $deserialize); - $call->start($argument, $metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($argument, $actual_metadata); return $call; } @@ -89,7 +111,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new ClientStreamingCall($this->channel, $method, $deserialize); - $call->start($arguments, $metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($arguments, $actual_metadata); return $call; } @@ -108,7 +135,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new ServerStreamingCall($this->channel, $method, $deserialize); - $call->start($argument, $metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($argument, $actual_metadata); return $call; } @@ -124,7 +156,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new BidiStreamingCall($this->channel, $method, $deserialize); - $call->start($metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($actual_metadata); return $call; } } diff --git a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php new file mode 100644 index 00000000000..2d2352b1996 --- /dev/null +++ b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php @@ -0,0 +1,97 @@ +setDividend(7); + $div_arg->setDivisor(4); + list($response, $status) = self::$client->Div($div_arg)->wait(); + $this->assertSame(1, $response->getQuotient()); + $this->assertSame(3, $response->getRemainder()); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } + + public function testServerStreaming() { + $fib_arg = new math\FibArgs(); + $fib_arg->setLimit(7); + $call = self::$client->Fib($fib_arg); + $result_array = iterator_to_array($call->responses()); + $extract_num = function($num){ + return $num->getNum(); + }; + $values = array_map($extract_num, $result_array); + $this->assertSame([1, 1, 2, 3, 5, 8, 13], $values); + $status = $call->getStatus(); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } + + public function testClientStreaming() { + $num_iter = function() { + for ($i = 0; $i < 7; $i++) { + $num = new math\Num(); + $num->setNum($i); + yield $num; + } + }; + $call = self::$client->Sum($num_iter()); + list($response, $status) = $call->wait(); + $this->assertSame(21, $response->getNum()); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } + + public function testBidiStreaming() { + $call = self::$client->DivMany(); + for ($i = 0; $i < 7; $i++) { + $div_arg = new math\DivArgs(); + $div_arg->setDividend(2 * $i + 1); + $div_arg->setDivisor(2); + $call->write($div_arg); + $response = $call->read(); + $this->assertSame($i, $response->getQuotient()); + $this->assertSame(1, $response->getRemainder()); + } + $call->writesDone(); + $status = $call->getStatus(); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } +} diff --git a/src/php/tests/generated_code/GeneratedCodeTest.php b/src/php/tests/generated_code/GeneratedCodeTest.php index 927d24ca630..1e4742fc800 100755 --- a/src/php/tests/generated_code/GeneratedCodeTest.php +++ b/src/php/tests/generated_code/GeneratedCodeTest.php @@ -31,71 +31,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); -require 'DrSlump/Protobuf.php'; -\DrSlump\Protobuf::autoload(); -require 'math.php'; -class GeneratedCodeTest extends PHPUnit_Framework_TestCase { - /* These tests require that a server exporting the math service must be - * running on $GRPC_TEST_HOST */ - protected static $client; - protected static $timeout; +require 'AbstractGeneratedCodeTest.php'; + +class GeneratedCodeTest extends AbstractGeneratedCodeTest { public static function setUpBeforeClass() { self::$client = new math\MathClient(new Grpc\BaseStub( getenv('GRPC_TEST_HOST'), [])); } - - public function testSimpleRequest() { - $div_arg = new math\DivArgs(); - $div_arg->setDividend(7); - $div_arg->setDivisor(4); - list($response, $status) = self::$client->Div($div_arg)->wait(); - $this->assertSame(1, $response->getQuotient()); - $this->assertSame(3, $response->getRemainder()); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } - - public function testServerStreaming() { - $fib_arg = new math\FibArgs(); - $fib_arg->setLimit(7); - $call = self::$client->Fib($fib_arg); - $result_array = iterator_to_array($call->responses()); - $extract_num = function($num){ - return $num->getNum(); - }; - $values = array_map($extract_num, $result_array); - $this->assertSame([1, 1, 2, 3, 5, 8, 13], $values); - $status = $call->getStatus(); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } - - public function testClientStreaming() { - $num_iter = function() { - for ($i = 0; $i < 7; $i++) { - $num = new math\Num(); - $num->setNum($i); - yield $num; - } - }; - $call = self::$client->Sum($num_iter()); - list($response, $status) = $call->wait(); - $this->assertSame(21, $response->getNum()); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } - - public function testBidiStreaming() { - $call = self::$client->DivMany(); - for ($i = 0; $i < 7; $i++) { - $div_arg = new math\DivArgs(); - $div_arg->setDividend(2 * $i + 1); - $div_arg->setDivisor(2); - $call->write($div_arg); - $response = $call->read(); - $this->assertSame($i, $response->getQuotient()); - $this->assertSame(1, $response->getRemainder()); - } - $call->writesDone(); - $status = $call->getStatus(); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } } diff --git a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php new file mode 100644 index 00000000000..6cda1e17021 --- /dev/null +++ b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php @@ -0,0 +1,48 @@ + + function($a_hash, + $opts = array(), + $client = array()) { + $a_copy = $a_hash; + $a_copy['foo'] = ['bar']; + return $a_copy; + }])); + } +} From 9bd0c64d66e67e70bc0a8707280bd31b3f0da799 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Tue, 21 Apr 2015 14:59:20 -0700 Subject: [PATCH 16/46] forgot to update class name --- src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php index 6cda1e17021..9ec95375e91 100644 --- a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php +++ b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php @@ -33,7 +33,7 @@ */ require 'AbstractGeneratedCodeTest.php'; -class GeneratedCodeWithAuthTest extends AbstractGeneratedCodeTest { +class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest { public static function setUpBeforeClass() { self::$client = new math\MathClient(new Grpc\BaseStub( getenv('GRPC_TEST_HOST'), ['update_metadata' => From a836705b78976e762bc09d4ac92b04d46e7c73df Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 21 Apr 2015 15:45:23 -0700 Subject: [PATCH 17/46] allow empty messages in gRPC on windows --- src/core/iomgr/tcp_windows.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index ec5496e7eef..ce76ccad8c2 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -266,7 +266,6 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, WSABUF *buffers = local_buffers; GPR_ASSERT(nslices != 0); - GPR_ASSERT(GPR_SLICE_LENGTH(slices[0]) != 0); GPR_ASSERT(!tcp->outstanding_write); tcp_ref(tcp); From e569804ade005019e2b7c938b6ffc1613784f526 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Tue, 21 Apr 2015 16:29:31 -0700 Subject: [PATCH 18/46] remove opts param from signature --- src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php index 9ec95375e91..f8ec1e7da88 100644 --- a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php +++ b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php @@ -38,7 +38,6 @@ class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest { self::$client = new math\MathClient(new Grpc\BaseStub( getenv('GRPC_TEST_HOST'), ['update_metadata' => function($a_hash, - $opts = array(), $client = array()) { $a_copy = $a_hash; $a_copy['foo'] = ['bar']; From 2710786240c3d82310503054fff2cb1bac5d7833 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 21 Apr 2015 16:41:06 -0700 Subject: [PATCH 19/46] remove nslices assertion on windows --- src/core/iomgr/tcp_windows.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index ce76ccad8c2..324a2da9a34 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -265,7 +265,6 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, WSABUF *allocated = NULL; WSABUF *buffers = local_buffers; - GPR_ASSERT(nslices != 0); GPR_ASSERT(!tcp->outstanding_write); tcp_ref(tcp); From 7ad18e6437970c53e0f94664a21e8aad1594361a Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 22 Apr 2015 01:57:33 +0200 Subject: [PATCH 20/46] Avoid writing build.json during a test. The test environment might be read only, so let's not modify a file just for running a test. --- tools/buildgen/generate_projects.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/buildgen/generate_projects.sh b/tools/buildgen/generate_projects.sh index c745edb7970..cdea1f93192 100755 --- a/tools/buildgen/generate_projects.sh +++ b/tools/buildgen/generate_projects.sh @@ -40,7 +40,9 @@ cd `dirname $0`/../.. mako_renderer=tools/buildgen/mako_renderer.py gen_build_json=test/core/end2end/gen_build_json.py -tools/buildgen/build-cleaner.py build.json +if [ "x$TEST" != "x" ] ; then + tools/buildgen/build-cleaner.py build.json +fi end2end_test_build=`mktemp /tmp/genXXXXXX` $gen_build_json > $end2end_test_build From 77c45eb042ba328d25df9e602c84dedc9e82e9c9 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Tue, 21 Apr 2015 16:29:31 -0700 Subject: [PATCH 21/46] remove opts param from signature --- src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php index 9ec95375e91..f8ec1e7da88 100644 --- a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php +++ b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php @@ -38,7 +38,6 @@ class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest { self::$client = new math\MathClient(new Grpc\BaseStub( getenv('GRPC_TEST_HOST'), ['update_metadata' => function($a_hash, - $opts = array(), $client = array()) { $a_copy = $a_hash; $a_copy['foo'] = ['bar']; From ccf39971efcc734227dbf0f60589d98e0d0bfc75 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 16 Mar 2015 22:01:08 -0700 Subject: [PATCH 22/46] Makes GRPCChannel a cluster class of secure and unsecured. --- .../GRPCClient/private/GRPCChannel.h | 5 +- .../GRPCClient/private/GRPCChannel.m | 25 ++++++++-- .../GRPCClient/private/GRPCSecureChannel.h | 38 +++++++++++++++ .../GRPCClient/private/GRPCSecureChannel.m | 48 +++++++++++++++++++ .../GRPCClient/private/GRPCUnsecuredChannel.h | 38 +++++++++++++++ .../GRPCClient/private/GRPCUnsecuredChannel.m | 44 +++++++++++++++++ 6 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 src/objective-c/GRPCClient/private/GRPCSecureChannel.h create mode 100644 src/objective-c/GRPCClient/private/GRPCSecureChannel.m create mode 100644 src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.h create mode 100644 src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.m diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index 2e07dcc3c7e..bc6a47d469c 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -45,6 +45,7 @@ struct grpc_channel; // Convenience constructor to allow for reuse of connections. + (instancetype)channelToHost:(NSString *)host; -// Designated initializer -- (instancetype)initWithHost:(NSString *)host; +- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithChannel:(struct grpc_channel *)unmanagedChannel NS_DESIGNATED_INITIALIZER; @end diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 7ddc01dc240..d998a1f32ef 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -33,7 +33,10 @@ #import "GRPCChannel.h" -#import +#include + +#import "GRPCSecureChannel.h" +#import "GRPCUnsecuredChannel.h" @implementation GRPCChannel @@ -46,13 +49,25 @@ return [self initWithHost:nil]; } -// Designated initializer - (instancetype)initWithHost:(NSString *)host { - if (!host) { - [NSException raise:NSInvalidArgumentException format:@"Host can't be nil."]; + NSURL *hostURL = [NSURL URLWithString:host]; + if (!hostURL) { + [NSException raise:NSInvalidArgumentException format:@"Invalid URL: %@", host]; + } + if (!hostURL.scheme || [hostURL.scheme isEqualToString:@"https"]) { + return [[GRPCSecureChannel alloc] initWithHost:host]; + } + if ([hostURL.scheme isEqualToString:@"http"]) { + return [[GRPCUnsecuredChannel alloc] initWithHost:host]; } + [NSException raise:NSInvalidArgumentException + format:@"URL scheme %@ isn't supported.", hostURL.scheme]; + return nil; // silence warning. +} + +- (instancetype)initWithChannel:(struct grpc_channel *)unmanagedChannel { if ((self = [super init])) { - _unmanagedChannel = grpc_channel_create(host.UTF8String, NULL); + _unmanagedChannel = unmanagedChannel; } return self; } diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannel.h b/src/objective-c/GRPCClient/private/GRPCSecureChannel.h new file mode 100644 index 00000000000..d34ceaea0c1 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCSecureChannel.h @@ -0,0 +1,38 @@ +/* + * + * Copyright 2015, Google Inc. + * 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 Inc. 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 THE COPYRIGHT + * OWNER OR CONTRIBUTORS 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. + * + */ + +#import "GRPCChannel.h" + +@interface GRPCSecureChannel : GRPCChannel + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m new file mode 100644 index 00000000000..a12a1a8c17b --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m @@ -0,0 +1,48 @@ +/* + * + * Copyright 2015, Google Inc. + * 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 Inc. 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 THE COPYRIGHT + * OWNER OR CONTRIBUTORS 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. + * + */ + +#import "GRPCSecureChannel.h" + +#import + +@implementation GRPCSecureChannel + +- (instancetype)initWithHost:(NSString *)host { + // TODO(jcanizales): Get the certificates here. + grpc_credentials *credentials = grpc_ssl_credentials_create(NULL, NULL); + return (self = [super initWithChannel:grpc_secure_channel_create(credentials, + host.UTF8String, + NULL)]); +} + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.h b/src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.h new file mode 100644 index 00000000000..9d89cfb5419 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.h @@ -0,0 +1,38 @@ +/* + * + * Copyright 2015, Google Inc. + * 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 Inc. 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 THE COPYRIGHT + * OWNER OR CONTRIBUTORS 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. + * + */ + +#import "GRPCChannel.h" + +@interface GRPCUnsecuredChannel : GRPCChannel + +@end diff --git a/src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.m b/src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.m new file mode 100644 index 00000000000..d27f7ca565b --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCUnsecuredChannel.m @@ -0,0 +1,44 @@ +/* + * + * Copyright 2015, Google Inc. + * 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 Inc. 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 THE COPYRIGHT + * OWNER OR CONTRIBUTORS 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. + * + */ + +#import "GRPCUnsecuredChannel.h" + +#include + +@implementation GRPCUnsecuredChannel + +- (instancetype)initWithHost:(NSString *)host { + return (self = [super initWithChannel:grpc_channel_create(host.UTF8String, NULL)]); +} + +@end From ba37a3e525fb2d52aecd174d2a4d7491bcc95764 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 15:34:58 -0700 Subject: [PATCH 23/46] Fixes scheme detection logic and NPE --- gRPC.podspec | 9 ++++--- .../GRPCClient/private/GRPCChannel.m | 15 ++++++++--- .../GRPCClient/private/GRPCSecureChannel.m | 27 ++++++++++++++++++- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/gRPC.podspec b/gRPC.podspec index 654f613f1c2..562b797eaff 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -24,9 +24,9 @@ Pod::Spec.new do |s| s.subspec 'C-Core' do |cs| cs.summary = 'Core gRPC library, written in C' - cs.authors = { 'Craig Tiller' => 'ctiller@google.com', - 'David Klempner' => 'klempner@google.com', - 'Nicolas Noble' => 'nnoble@google.com', + cs.authors = { 'Craig Tiller' => 'ctiller@google.com', + 'David Klempner' => 'klempner@google.com', + 'Nicolas Noble' => 'nnoble@google.com', 'Vijay Pai' => 'vpai@google.com', 'Yang Gao' => 'yangg@google.com' } @@ -63,4 +63,7 @@ Pod::Spec.new do |s| CMD s.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Public/gRPC/include"' } + + # Certificates, to be able to establish TLS connections: + s.resource_bundles = { 'gRPC' => ['etc/roots.pem'] } end diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index d998a1f32ef..91f2aac40eb 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -50,11 +50,14 @@ } - (instancetype)initWithHost:(NSString *)host { + if (![host containsString:@"://"]) { + host = [@"https://" stringByAppendingString:host]; + } NSURL *hostURL = [NSURL URLWithString:host]; if (!hostURL) { [NSException raise:NSInvalidArgumentException format:@"Invalid URL: %@", host]; } - if (!hostURL.scheme || [hostURL.scheme isEqualToString:@"https"]) { + if ([hostURL.scheme isEqualToString:@"https"]) { return [[GRPCSecureChannel alloc] initWithHost:host]; } if ([hostURL.scheme isEqualToString:@"http"]) { @@ -73,8 +76,12 @@ } - (void)dealloc { - // TODO(jcanizales): Be sure to add a test with a server that closes the connection prematurely, - // as in the past that made this call to crash. - grpc_channel_destroy(_unmanagedChannel); + // _unmanagedChannel is NULL when deallocating an object of the base class (because the + // initializer returns a different object). + if (_unmanagedChannel) { + // TODO(jcanizales): Be sure to add a test with a server that closes the connection prematurely, + // as in the past that made this call to crash. + grpc_channel_destroy(_unmanagedChannel); + } } @end diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m index a12a1a8c17b..5ed788347c7 100644 --- a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m @@ -35,11 +35,36 @@ #import +static const char *kCertificates = +"# Issuer: CN=GTE CyberTrust Global Root O=GTE Corporation OU=GTE CyberTrust Solutions, Inc.\n" +"# Subject: CN=GTE CyberTrust Global Root O=GTE Corporation OU=GTE CyberTrust Solutions, Inc.\n" +"# Label: \"GTE CyberTrust Global Root\"\n" +"# Serial: 421\n" +"# MD5 Fingerprint: ca:3d:d3:68:f1:03:5c:d0:32:fa:b8:2b:59:e8:5a:db\n" +"# SHA1 Fingerprint: 97:81:79:50:d8:1c:96:70:cc:34:d8:09:cf:79:44:31:36:7e:f4:74\n" +"# SHA256 Fingerprint: a5:31:25:18:8d:21:10:aa:96:4b:02:c7:b7:c6:da:32:03:17:08:94:e5:fb:71:ff:fb:66:67:d5:e6:81:0a:36\n" +"-----BEGIN CERTIFICATE-----\n" +"MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD\n" +"VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv\n" +"bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv\n" +"b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV\n" +"UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU\n" +"cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds\n" +"b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH\n" +"iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS\n" +"r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4\n" +"04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r\n" +"GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9\n" +"3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P\n" +"lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/\n" +"-----END CERTIFICATE-----\n"; + + @implementation GRPCSecureChannel - (instancetype)initWithHost:(NSString *)host { // TODO(jcanizales): Get the certificates here. - grpc_credentials *credentials = grpc_ssl_credentials_create(NULL, NULL); + grpc_credentials *credentials = grpc_ssl_credentials_create(kCertificates, NULL); return (self = [super initWithChannel:grpc_secure_channel_create(credentials, host.UTF8String, NULL)]); From bb58d224e7a2500502c3ebc31fe198ae98487a34 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 19 Mar 2015 00:31:36 -0700 Subject: [PATCH 24/46] Removes scheme before passing to C layer --- src/objective-c/GRPCClient/private/GRPCChannel.m | 3 +++ src/objective-c/examples/Sample/Sample/ViewController.m | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 91f2aac40eb..2107685d853 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -51,6 +51,7 @@ - (instancetype)initWithHost:(NSString *)host { if (![host containsString:@"://"]) { + // No scheme provided; assume https. host = [@"https://" stringByAppendingString:host]; } NSURL *hostURL = [NSURL URLWithString:host]; @@ -58,9 +59,11 @@ [NSException raise:NSInvalidArgumentException format:@"Invalid URL: %@", host]; } if ([hostURL.scheme isEqualToString:@"https"]) { + host = [hostURL.host stringByAppendingString:hostURL.port.stringValue ?: @":443"]; return [[GRPCSecureChannel alloc] initWithHost:host]; } if ([hostURL.scheme isEqualToString:@"http"]) { + host = [hostURL.host stringByAppendingString:hostURL.port.stringValue ?: @":80"]; return [[GRPCUnsecuredChannel alloc] initWithHost:host]; } [NSException raise:NSInvalidArgumentException diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 839e1810703..99d6df522d6 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -54,7 +54,7 @@ id requestsWriter = [GRXWriter writerWithValue:[NSData data]]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com:443" + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com" method:method requestsWriter:requestsWriter]; From 6465c3404556fe38a6516b068b2b26f049a1d14b Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 15:37:35 -0700 Subject: [PATCH 25/46] Loads certificates from file. SSL works ^^ --- src/objective-c/GRPCClient/private/GRPCSecureChannel.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m index 5ed788347c7..f5b132e99ab 100644 --- a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m @@ -64,7 +64,11 @@ static const char *kCertificates = - (instancetype)initWithHost:(NSString *)host { // TODO(jcanizales): Get the certificates here. - grpc_credentials *credentials = grpc_ssl_credentials_create(kCertificates, NULL); + NSURL *url = [[NSBundle mainBundle] URLForResource:@"gRPC.bundle/roots" withExtension:@"pem"]; + NSData *fontData = [NSData dataWithContentsOfURL:url]; + NSString *str = [[NSString alloc] initWithData:fontData encoding:NSUTF8StringEncoding]; + NSLog(@"Certs:\n%@", str); + grpc_credentials *credentials = grpc_ssl_credentials_create(str.UTF8String, NULL); return (self = [super initWithChannel:grpc_secure_channel_create(credentials, host.UTF8String, NULL)]); From aa4fb1404fd6c1102fd48476a148a957eb4aa9c0 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 19 Mar 2015 01:24:56 -0700 Subject: [PATCH 26/46] Cleanup --- .../GRPCClient/private/GRPCSecureChannel.m | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m index f5b132e99ab..47bdfe3f28b 100644 --- a/src/objective-c/GRPCClient/private/GRPCSecureChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCSecureChannel.m @@ -35,40 +35,15 @@ #import -static const char *kCertificates = -"# Issuer: CN=GTE CyberTrust Global Root O=GTE Corporation OU=GTE CyberTrust Solutions, Inc.\n" -"# Subject: CN=GTE CyberTrust Global Root O=GTE Corporation OU=GTE CyberTrust Solutions, Inc.\n" -"# Label: \"GTE CyberTrust Global Root\"\n" -"# Serial: 421\n" -"# MD5 Fingerprint: ca:3d:d3:68:f1:03:5c:d0:32:fa:b8:2b:59:e8:5a:db\n" -"# SHA1 Fingerprint: 97:81:79:50:d8:1c:96:70:cc:34:d8:09:cf:79:44:31:36:7e:f4:74\n" -"# SHA256 Fingerprint: a5:31:25:18:8d:21:10:aa:96:4b:02:c7:b7:c6:da:32:03:17:08:94:e5:fb:71:ff:fb:66:67:d5:e6:81:0a:36\n" -"-----BEGIN CERTIFICATE-----\n" -"MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD\n" -"VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv\n" -"bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv\n" -"b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV\n" -"UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU\n" -"cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds\n" -"b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH\n" -"iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS\n" -"r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4\n" -"04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r\n" -"GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9\n" -"3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P\n" -"lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/\n" -"-----END CERTIFICATE-----\n"; - - @implementation GRPCSecureChannel - (instancetype)initWithHost:(NSString *)host { - // TODO(jcanizales): Get the certificates here. - NSURL *url = [[NSBundle mainBundle] URLForResource:@"gRPC.bundle/roots" withExtension:@"pem"]; - NSData *fontData = [NSData dataWithContentsOfURL:url]; - NSString *str = [[NSString alloc] initWithData:fontData encoding:NSUTF8StringEncoding]; - NSLog(@"Certs:\n%@", str); - grpc_credentials *credentials = grpc_ssl_credentials_create(str.UTF8String, NULL); + // TODO(jcanizales): Load certs only once. + NSURL *certsURL = [[NSBundle mainBundle] URLForResource:@"gRPC.bundle/roots" withExtension:@"pem"]; + NSData *certsData = [NSData dataWithContentsOfURL:certsURL]; + NSString *certsString = [[NSString alloc] initWithData:certsData encoding:NSUTF8StringEncoding]; + + grpc_credentials *credentials = grpc_ssl_credentials_create(certsString.UTF8String, NULL); return (self = [super initWithChannel:grpc_secure_channel_create(credentials, host.UTF8String, NULL)]); From 5618a9d67a98833a64bbcd43c28529da224bcfdd Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 21 Apr 2015 18:10:16 -0700 Subject: [PATCH 27/46] removed chatty log messages on windows --- src/core/iomgr/iocp_windows.c | 9 -------- src/core/iomgr/resolve_address_windows.c | 4 ---- src/core/iomgr/socket_windows.c | 3 --- src/core/iomgr/tcp_client_windows.c | 6 +---- src/core/iomgr/tcp_server_windows.c | 6 +---- src/core/iomgr/tcp_windows.c | 28 ------------------------ 6 files changed, 2 insertions(+), 54 deletions(-) diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index aec626509aa..7968729353a 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -78,7 +78,6 @@ static void do_iocp_work() { if (overlapped == &g_iocp_custom_overlap) { if (completion_key == (ULONG_PTR) &g_iocp_kick_token) { /* We were awoken from a kick. */ - gpr_log(GPR_DEBUG, "do_iocp_work - got a kick"); return; } gpr_log(GPR_ERROR, "Unknown custom completion key."); @@ -87,10 +86,8 @@ static void do_iocp_work() { socket = (grpc_winsocket*) completion_key; if (overlapped == &socket->write_info.overlapped) { - gpr_log(GPR_DEBUG, "do_iocp_work - got write packet"); info = &socket->write_info; } else if (overlapped == &socket->read_info.overlapped) { - gpr_log(GPR_DEBUG, "do_iocp_work - got read packet"); info = &socket->read_info; } else { gpr_log(GPR_ERROR, "Unknown IOCP operation"); @@ -98,8 +95,6 @@ static void do_iocp_work() { } success = WSAGetOverlappedResult(socket->socket, &info->overlapped, &bytes, FALSE, &flags); - gpr_log(GPR_DEBUG, "bytes: %u, flags: %u - op %s %s", bytes, flags, - success ? "succeeded" : "failed", socket->orphan ? "orphan" : ""); if (socket->orphan) { grpc_winsocket_destroy(socket); gpr_atm_full_fetch_add(&g_orphans, -1); @@ -189,11 +184,9 @@ static void socket_notify_on_iocp(grpc_winsocket *socket, if (info->has_pending_iocp) { run_now = 1; info->has_pending_iocp = 0; - gpr_log(GPR_DEBUG, "socket_notify_on_iocp - runs now"); } else { info->cb = cb; info->opaque = opaque; - gpr_log(GPR_DEBUG, "socket_notify_on_iocp - queued"); } gpr_mu_unlock(&socket->state_mu); if (run_now) cb(opaque, 1); @@ -201,13 +194,11 @@ static void socket_notify_on_iocp(grpc_winsocket *socket, void grpc_socket_notify_on_write(grpc_winsocket *socket, void(*cb)(void *, int), void *opaque) { - gpr_log(GPR_DEBUG, "grpc_socket_notify_on_write"); socket_notify_on_iocp(socket, cb, opaque, &socket->write_info); } void grpc_socket_notify_on_read(grpc_winsocket *socket, void(*cb)(void *, int), void *opaque) { - gpr_log(GPR_DEBUG, "grpc_socket_notify_on_read"); socket_notify_on_iocp(socket, cb, opaque, &socket->read_info); } diff --git a/src/core/iomgr/resolve_address_windows.c b/src/core/iomgr/resolve_address_windows.c index 877b3f35ed8..ac31dadd9d7 100644 --- a/src/core/iomgr/resolve_address_windows.c +++ b/src/core/iomgr/resolve_address_windows.c @@ -107,18 +107,14 @@ grpc_resolved_addresses *grpc_blocking_resolve_address( i++; } - /* Temporary logging, to help identify flakiness in dualstack_socket_test. */ { const gpr_timespec delay = gpr_time_sub(gpr_now(), start_time); const int delay_ms = delay.tv_sec * GPR_MS_PER_SEC + delay.tv_nsec / GPR_NS_PER_MS; - gpr_log(GPR_INFO, "logspam: getaddrinfo(%s, %s) resolved %d addrs in %dms:", - host, port, addrs->naddrs, delay_ms); for (i = 0; i < addrs->naddrs; i++) { char *buf; grpc_sockaddr_to_string(&buf, (struct sockaddr *)&addrs->addrs[i].addr, 0); - gpr_log(GPR_INFO, "logspam: [%d] %s", i, buf); gpr_free(buf); } } diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c index 22dad41783f..91268c04e6d 100644 --- a/src/core/iomgr/socket_windows.c +++ b/src/core/iomgr/socket_windows.c @@ -46,7 +46,6 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket) { grpc_winsocket *r = gpr_malloc(sizeof(grpc_winsocket)); - gpr_log(GPR_DEBUG, "grpc_winsocket_create"); memset(r, 0, sizeof(grpc_winsocket)); r->socket = socket; gpr_mu_init(&r->state_mu); @@ -61,13 +60,11 @@ static void shutdown_op(grpc_winsocket_callback_info *info) { } void grpc_winsocket_shutdown(grpc_winsocket *socket) { - gpr_log(GPR_DEBUG, "grpc_winsocket_shutdown"); shutdown_op(&socket->read_info); shutdown_op(&socket->write_info); } void grpc_winsocket_orphan(grpc_winsocket *socket) { - gpr_log(GPR_DEBUG, "grpc_winsocket_orphan"); grpc_iocp_socket_orphan(socket); socket->orphan = 1; grpc_iomgr_unref(); diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/iomgr/tcp_client_windows.c index 181d89cb6d3..00c8da601b4 100644 --- a/src/core/iomgr/tcp_client_windows.c +++ b/src/core/iomgr/tcp_client_windows.c @@ -102,7 +102,6 @@ static void on_connect(void *acp, int success) { gpr_free(utf8_message); goto finish; } else { - gpr_log(GPR_DEBUG, "on_connect: connection established"); ep = grpc_tcp_create(ac->socket); goto finish; } @@ -179,9 +178,7 @@ void grpc_tcp_client_connect(void(*cb)(void *arg, grpc_endpoint *tcp), info = &socket->write_info; success = ConnectEx(sock, addr, addr_len, NULL, 0, NULL, &info->overlapped); - if (success) { - gpr_log(GPR_DEBUG, "connected immediately - but we still go to sleep"); - } else { + if (!success) { int error = WSAGetLastError(); if (error != ERROR_IO_PENDING) { message = "ConnectEx failed: %s"; @@ -189,7 +186,6 @@ void grpc_tcp_client_connect(void(*cb)(void *arg, grpc_endpoint *tcp), } } - gpr_log(GPR_DEBUG, "grpc_tcp_client_connect: connection pending"); ac = gpr_malloc(sizeof(async_connect)); ac->cb = cb; ac->cb_arg = arg; diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index a43d5670a41..d1b02a6935b 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -195,9 +195,7 @@ static void start_accept(server_port *port) { addrlen, addrlen, &bytes_received, &port->socket->read_info.overlapped); - if (success) { - gpr_log(GPR_DEBUG, "accepted immediately - but we still go to sleep"); - } else { + if (!success) { int error = WSAGetLastError(); if (error != ERROR_IO_PENDING) { message = "AcceptEx failed: %s"; @@ -234,11 +232,9 @@ static void on_accept(void *arg, int success) { gpr_free(utf8_message); closesocket(sock); } else { - gpr_log(GPR_DEBUG, "on_accept: accepted connection"); ep = grpc_tcp_create(grpc_winsocket_create(sock)); } } else { - gpr_log(GPR_DEBUG, "on_accept: shutting down"); closesocket(sock); gpr_mu_lock(&sp->server->mu); if (0 == --sp->server->active_ports) { diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index 324a2da9a34..90fa8778471 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -93,14 +93,11 @@ typedef struct grpc_tcp { } grpc_tcp; static void tcp_ref(grpc_tcp *tcp) { - gpr_log(GPR_DEBUG, "tcp_ref"); gpr_ref(&tcp->refcount); } static void tcp_unref(grpc_tcp *tcp) { - gpr_log(GPR_DEBUG, "tcp_unref"); if (gpr_unref(&tcp->refcount)) { - gpr_log(GPR_DEBUG, "tcp_unref: destroying"); gpr_slice_buffer_destroy(&tcp->write_slices); grpc_winsocket_orphan(tcp->socket); gpr_free(tcp); @@ -126,24 +123,19 @@ static void on_read(void *tcpp, int success) { return; } - gpr_log(GPR_DEBUG, "on_read"); tcp->outstanding_read = 0; if (socket->read_info.wsa_error != 0) { char *utf8_message = gpr_format_message(info->wsa_error); - __debugbreak(); - gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message); gpr_free(utf8_message); status = GRPC_ENDPOINT_CB_ERROR; } else { if (info->bytes_transfered != 0) { sub = gpr_slice_sub(tcp->read_slice, 0, info->bytes_transfered); - gpr_log(GPR_DEBUG, "on_read: calling callback"); status = GRPC_ENDPOINT_CB_OK; slice = ⊂ nslices = 1; } else { - gpr_log(GPR_DEBUG, "on_read: closed socket"); gpr_slice_unref(tcp->read_slice); status = GRPC_ENDPOINT_CB_EOF; } @@ -174,27 +166,22 @@ static void win_notify_on_read(grpc_endpoint *ep, buffer.len = GPR_SLICE_LENGTH(tcp->read_slice); buffer.buf = (char *)GPR_SLICE_START_PTR(tcp->read_slice); - gpr_log(GPR_DEBUG, "win_notify_on_read: calling WSARecv without overlap"); status = WSARecv(tcp->socket->socket, &buffer, 1, &bytes_read, &flags, NULL, NULL); info->wsa_error = status == 0 ? 0 : WSAGetLastError(); if (info->wsa_error != WSAEWOULDBLOCK) { - gpr_log(GPR_DEBUG, "got response immediately, calling on_read"); info->bytes_transfered = bytes_read; /* This might heavily recurse. */ on_read(tcp, 1); return; } - gpr_log(GPR_DEBUG, "got WSAEWOULDBLOCK - calling WSARecv with overlap"); - memset(&tcp->socket->read_info.overlapped, 0, sizeof(OVERLAPPED)); status = WSARecv(tcp->socket->socket, &buffer, 1, &bytes_read, &flags, &info->overlapped, NULL); if (status == 0) { - gpr_log(GPR_DEBUG, "got response immediately, but we're going to sleep"); grpc_socket_notify_on_read(tcp->socket, on_read, tcp); return; } @@ -213,7 +200,6 @@ static void win_notify_on_read(grpc_endpoint *ep, return; } - gpr_log(GPR_DEBUG, "waiting on the IO completion port now"); grpc_socket_notify_on_read(tcp->socket, on_read, tcp); } @@ -227,8 +213,6 @@ static void on_write(void *tcpp, int success) { GPR_ASSERT(tcp->outstanding_write); - gpr_log(GPR_DEBUG, "on_write"); - if (!success) { tcp_unref(tcp); cb(opaque, GRPC_ENDPOINT_CB_SHUTDOWN); @@ -268,8 +252,6 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, GPR_ASSERT(!tcp->outstanding_write); tcp_ref(tcp); - gpr_log(GPR_DEBUG, "win_write"); - tcp->outstanding_write = 1; tcp->write_cb = cb; tcp->write_user_data = arg; @@ -285,14 +267,12 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, buffers[i].buf = (char *)GPR_SLICE_START_PTR(tcp->write_slices.slices[i]); } - gpr_log(GPR_DEBUG, "win_write: calling WSASend without overlap"); status = WSASend(socket->socket, buffers, tcp->write_slices.count, &bytes_sent, 0, NULL, NULL); info->wsa_error = status == 0 ? 0 : WSAGetLastError(); if (info->wsa_error != WSAEWOULDBLOCK) { grpc_endpoint_write_status ret = GRPC_ENDPOINT_WRITE_ERROR; - gpr_log(GPR_DEBUG, "got response immediately, cleaning up and leaving"); if (status == 0) { ret = GRPC_ENDPOINT_WRITE_DONE; GPR_ASSERT(bytes_sent == tcp->write_slices.length); @@ -308,8 +288,6 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, return ret; } - gpr_log(GPR_DEBUG, "got WSAEWOULDBLOCK - calling WSASend with overlap"); - memset(&socket->write_info, 0, sizeof(OVERLAPPED)); status = WSASend(socket->socket, buffers, tcp->write_slices.count, &bytes_sent, 0, &socket->write_info.overlapped, NULL); @@ -327,9 +305,6 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, tcp_unref(tcp); return GRPC_ENDPOINT_WRITE_ERROR; } - gpr_log(GPR_DEBUG, "win_write: got pending op"); - } else { - gpr_log(GPR_DEBUG, "wrote data immediately - but we're going to sleep"); } grpc_socket_notify_on_write(socket, on_write, tcp); @@ -338,19 +313,16 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, static void win_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset) { grpc_tcp *tcp = (grpc_tcp *) ep; - gpr_log(GPR_DEBUG, "win_add_to_pollset"); grpc_iocp_add_socket(tcp->socket); } static void win_shutdown(grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *) ep; - gpr_log(GPR_DEBUG, "win_shutdown"); grpc_winsocket_shutdown(tcp->socket); } static void win_destroy(grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *) ep; - gpr_log(GPR_DEBUG, "win_destroy"); tcp_unref(tcp); } From f1bda85ad9149d4b7f06f1c5635361d3d610b897 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 21:52:55 -0700 Subject: [PATCH 28/46] Add remote HTTPS tests. Local HTTP ones fail to connect. --- .../examples/Sample/SampleTests/RemoteTests.m | 138 ++++++++++++++++++ .../examples/Sample/SampleTests/SampleTests.m | 6 +- 2 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 src/objective-c/examples/Sample/SampleTests/RemoteTests.m diff --git a/src/objective-c/examples/Sample/SampleTests/RemoteTests.m b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m new file mode 100644 index 00000000000..ba5d46f277c --- /dev/null +++ b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m @@ -0,0 +1,138 @@ +/* + * + * Copyright 2015, Google Inc. + * 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 Inc. 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 THE COPYRIGHT + * OWNER OR CONTRIBUTORS 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. + * + */ + +#import +#import + +#import +#import +#import +#import +#import + +@interface RemoteTests : XCTestCase +@end + +@implementation RemoteTests + +- (void)testConnectionToRemoteServer { + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Server reachable."]; + + // This method isn't implemented by the remote server. + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing" + interface:@"TestService" + method:@"Nonexistent"]; + + id requestsWriter = [GRXWriter writerWithValue:[NSData data]]; + + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com" + method:method + requestsWriter:requestsWriter]; + + id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + XCTFail(@"Received unexpected response: %@", value); + } completionHandler:^(NSError *errorOrNil) { + XCTAssertNotNil(errorOrNil, @"Finished without error!"); + // TODO(jcanizales): The server should return code 12 UNIMPLEMENTED, not 5 NOT FOUND. + XCTAssertEqual(errorOrNil.code, 5, @"Finished with unexpected error: %@", errorOrNil); + [expectation fulfill]; + }]; + + [call startWithWriteable:responsesWriteable]; + + [self waitForExpectationsWithTimeout:2. handler:nil]; +} + +- (void)testEmptyRPC { + __weak XCTestExpectation *response = [self expectationWithDescription:@"Empty response received."]; + __weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."]; + + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing" + interface:@"TestService" + method:@"EmptyCall"]; + + id requestsWriter = [GRXWriter writerWithValue:[NSData data]]; + + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com" + method:method + requestsWriter:requestsWriter]; + + id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + XCTAssertNotNil(value, @"nil value received as response."); + XCTAssertEqual([value length], 0, @"Non-empty response received: %@", value); + [response fulfill]; + } completionHandler:^(NSError *errorOrNil) { + XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); + [completion fulfill]; + }]; + + [call startWithWriteable:responsesWriteable]; + + [self waitForExpectationsWithTimeout:2. handler:nil]; +} + +- (void)testSimpleProtoRPC { + __weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."]; + __weak XCTestExpectation *expectedResponse = + [self expectationWithDescription:@"Expected response."]; + __weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."]; + + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing" + interface:@"TestService" + method:@"UnaryCall"]; + + RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build]; + id requestsWriter = [GRXWriter writerWithValue:[point data]]; + + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com" + method:method + requestsWriter:requestsWriter]; + + id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + XCTAssertNotNil(value, @"nil value received as response."); + [response fulfill]; + RGDFeature *feature = [RGDFeature parseFromData:value]; + XCTAssertEqualObjects(point, feature.location); + XCTAssertNotNil(feature.name, @"Response's name is nil."); + [expectedResponse fulfill]; + } completionHandler:^(NSError *errorOrNil) { + XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); + [completion fulfill]; + }]; + + [call startWithWriteable:responsesWriteable]; + + [self waitForExpectationsWithTimeout:2. handler:nil]; +} + +@end diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index ca5e302a174..322a5928874 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -58,7 +58,7 @@ id requestsWriter = [GRXWriter writerWithValue:[NSData data]]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"127.0.0.1:8980" + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" method:method requestsWriter:requestsWriter]; @@ -85,7 +85,7 @@ id requestsWriter = [GRXWriter emptyWriter]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"127.0.0.1:8980" + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" method:method requestsWriter:requestsWriter]; @@ -116,7 +116,7 @@ RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build]; id requestsWriter = [GRXWriter writerWithValue:[point data]]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"127.0.0.1:8980" + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"https://127.0.0.1:8980" method:method requestsWriter:requestsWriter]; From eddb0065c12bd0f3ac23e36147cba84e5a0755b5 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 22:10:09 -0700 Subject: [PATCH 29/46] Fixes host transformation when user supplies a port. --- src/objective-c/GRPCClient/private/GRPCChannel.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 2107685d853..8b7055815d3 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -59,11 +59,11 @@ [NSException raise:NSInvalidArgumentException format:@"Invalid URL: %@", host]; } if ([hostURL.scheme isEqualToString:@"https"]) { - host = [hostURL.host stringByAppendingString:hostURL.port.stringValue ?: @":443"]; + host = [@[hostURL.host, hostURL.port ?: @443] componentsJoinedByString:@":"]; return [[GRPCSecureChannel alloc] initWithHost:host]; } if ([hostURL.scheme isEqualToString:@"http"]) { - host = [hostURL.host stringByAppendingString:hostURL.port.stringValue ?: @":80"]; + host = [@[hostURL.host, hostURL.port ?: @80] componentsJoinedByString:@":"]; return [[GRPCUnsecuredChannel alloc] initWithHost:host]; } [NSException raise:NSInvalidArgumentException From e72114cc9cf52988bef274da2c29dda3bee0ffb1 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 22:18:45 -0700 Subject: [PATCH 30/46] Fixes local test after ensuring using https:// doesn't work with it. --- src/objective-c/examples/Sample/SampleTests/SampleTests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index 322a5928874..6d6875c2333 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -116,7 +116,7 @@ RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build]; id requestsWriter = [GRXWriter writerWithValue:[point data]]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"https://127.0.0.1:8980" + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" method:method requestsWriter:requestsWriter]; From 23cb957f69d0d7f50be044ab9fd1e60f5e10aae9 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 22:23:19 -0700 Subject: [PATCH 31/46] Move Route_guide protos to their own folder to make room for remote test protos --- src/objective-c/examples/Sample/Podfile | 2 +- .../Sample/{protos => RouteGuideClient}/Route_guide.pb.h | 0 .../Sample/{protos => RouteGuideClient}/Route_guide.pb.m | 0 .../Sample/{protos => RouteGuideClient}/Route_guide.podspec | 0 .../Sample/{protos => RouteGuideClient}/route_guide.proto | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename src/objective-c/examples/Sample/{protos => RouteGuideClient}/Route_guide.pb.h (100%) rename src/objective-c/examples/Sample/{protos => RouteGuideClient}/Route_guide.pb.m (100%) rename src/objective-c/examples/Sample/{protos => RouteGuideClient}/Route_guide.podspec (100%) rename src/objective-c/examples/Sample/{protos => RouteGuideClient}/route_guide.proto (100%) diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index 31bd4eb8216..471b83c6c7d 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -2,7 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'gRPC', :path => "../../../.." -pod 'Route_guide', :path => "protos" +pod 'Route_guide', :path => "RouteGuideClient" link_with 'Sample', 'SampleTests' diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.h b/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.pb.h similarity index 100% rename from src/objective-c/examples/Sample/protos/Route_guide.pb.h rename to src/objective-c/examples/Sample/RouteGuideClient/Route_guide.pb.h diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.m b/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.pb.m similarity index 100% rename from src/objective-c/examples/Sample/protos/Route_guide.pb.m rename to src/objective-c/examples/Sample/RouteGuideClient/Route_guide.pb.m diff --git a/src/objective-c/examples/Sample/protos/Route_guide.podspec b/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec similarity index 100% rename from src/objective-c/examples/Sample/protos/Route_guide.podspec rename to src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec diff --git a/src/objective-c/examples/Sample/protos/route_guide.proto b/src/objective-c/examples/Sample/RouteGuideClient/route_guide.proto similarity index 100% rename from src/objective-c/examples/Sample/protos/route_guide.proto rename to src/objective-c/examples/Sample/RouteGuideClient/route_guide.proto From 1380ac89413412224faba244675d40af278e91c3 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 22:39:47 -0700 Subject: [PATCH 32/46] Brings in proto files for the remote test server. --- .../Sample/RemoteTestClient/empty.proto | 42 ++++++ .../Sample/RemoteTestClient/messages.proto | 131 ++++++++++++++++++ .../Sample/RemoteTestClient/test.proto | 71 ++++++++++ 3 files changed, 244 insertions(+) create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/empty.proto create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/messages.proto create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/test.proto diff --git a/src/objective-c/examples/Sample/RemoteTestClient/empty.proto b/src/objective-c/examples/Sample/RemoteTestClient/empty.proto new file mode 100644 index 00000000000..b7ec9cb7cda --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/empty.proto @@ -0,0 +1,42 @@ +// Copyright 2015, Google Inc. +// 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 Inc. 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 THE COPYRIGHT +// OWNER OR CONTRIBUTORS 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"; + +package grpc.testing; + +// An empty message that you can re-use to avoid defining duplicated empty +// messages in your project. A typical example is to use it as argument or the +// return value of a service API. For instance: +// +// service Foo { +// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; +// }; +// +message Empty {} diff --git a/src/objective-c/examples/Sample/RemoteTestClient/messages.proto b/src/objective-c/examples/Sample/RemoteTestClient/messages.proto new file mode 100644 index 00000000000..b23e2efb0fb --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/messages.proto @@ -0,0 +1,131 @@ +// Copyright 2015, Google Inc. +// 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 Inc. 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 THE COPYRIGHT +// OWNER OR CONTRIBUTORS 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. + +// Message definitions to be used by integration test service definitions. + +syntax = "proto2"; + +package grpc.testing; + +// The type of payload that should be returned. +enum PayloadType { + // Compressable text format. + COMPRESSABLE = 0; + + // Uncompressable binary format. + UNCOMPRESSABLE = 1; + + // Randomly chosen from all other formats defined in this enum. + RANDOM = 2; +} + +// A block of data, to simply increase gRPC message size. +message Payload { + // The type of data in body. + optional PayloadType type = 1; + // Primary contents of payload. + optional bytes body = 2; +} + +// Unary request. +message SimpleRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, server randomly chooses one from other formats. + optional PayloadType response_type = 1; + + // Desired payload size in the response from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 response_size = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; + + // Whether SimpleResponse should include username. + optional bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + optional bool fill_oauth_scope = 5; +} + +// Unary response, as configured by the request. +message SimpleResponse { + // Payload to increase message size. + optional Payload payload = 1; + // The user the request came from, for verifying authentication was + // successful when the client expected it. + optional string username = 2; + // OAuth scope. + optional string oauth_scope = 3; +} + +// Client-streaming request. +message StreamingInputCallRequest { + // Optional input payload sent along with the request. + optional Payload payload = 1; + + // Not expecting any payload from the response. +} + +// Client-streaming response. +message StreamingInputCallResponse { + // Aggregated size of payloads received from the client. + optional int32 aggregated_payload_size = 1; +} + +// Configuration for a particular response. +message ResponseParameters { + // Desired payload sizes in responses from the server. + // If response_type is COMPRESSABLE, this denotes the size before compression. + optional int32 size = 1; + + // Desired interval between consecutive responses in the response stream in + // microseconds. + optional int32 interval_us = 2; +} + +// Server-streaming request. +message StreamingOutputCallRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, the payload from each response in the stream + // might be of different types. This is to simulate a mixed type of payload + // stream. + optional PayloadType response_type = 1; + + // Configuration for each expected response message. + repeated ResponseParameters response_parameters = 2; + + // Optional input payload sent along with the request. + optional Payload payload = 3; +} + +// Server-streaming response, as configured by the request and parameters. +message StreamingOutputCallResponse { + // Payload to increase response size. + optional Payload payload = 1; +} diff --git a/src/objective-c/examples/Sample/RemoteTestClient/test.proto b/src/objective-c/examples/Sample/RemoteTestClient/test.proto new file mode 100644 index 00000000000..99fd75e021e --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/test.proto @@ -0,0 +1,71 @@ +// Copyright 2015, Google Inc. +// 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 Inc. 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 THE COPYRIGHT +// OWNER OR CONTRIBUTORS 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. + +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto2"; + +import "empty.proto"; +import "messages.proto"; + +package grpc.testing; + +// A simple service to test the various types of RPCs and experiment with +// performance with various types of payload. +service TestService { + // One empty request followed by one empty response. + rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty); + + // One request followed by one response. + // TODO(Issue 527): Describe required server behavior. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // One request followed by a sequence of responses (streamed download). + // The server returns the payload with client desired type and sizes. +// rpc StreamingOutputCall(StreamingOutputCallRequest) +// returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by one response (streamed upload). + // The server returns the aggregated size of client payload as the result. +// rpc StreamingInputCall(stream StreamingInputCallRequest) +// returns (StreamingInputCallResponse); + + // A sequence of requests with each request served by the server immediately. + // As one request could lead to multiple responses, this interface + // demonstrates the idea of full duplexing. +// rpc FullDuplexCall(stream StreamingOutputCallRequest) +// returns (stream StreamingOutputCallResponse); + + // A sequence of requests followed by a sequence of responses. + // The server buffers all the client requests and then serves them in order. A + // stream of responses are returned to the client when the server starts with + // first request. +// rpc HalfDuplexCall(stream StreamingOutputCallRequest) +// returns (stream StreamingOutputCallResponse); +} From 41a53741d8fed6370dd394911f8677744e538666 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 22:42:31 -0700 Subject: [PATCH 33/46] Adds Class prefix RMT --- src/objective-c/examples/Sample/RemoteTestClient/empty.proto | 4 ++++ .../examples/Sample/RemoteTestClient/messages.proto | 4 ++++ src/objective-c/examples/Sample/RemoteTestClient/test.proto | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/objective-c/examples/Sample/RemoteTestClient/empty.proto b/src/objective-c/examples/Sample/RemoteTestClient/empty.proto index b7ec9cb7cda..3b626ab1314 100644 --- a/src/objective-c/examples/Sample/RemoteTestClient/empty.proto +++ b/src/objective-c/examples/Sample/RemoteTestClient/empty.proto @@ -29,8 +29,12 @@ syntax = "proto2"; +import "google/protobuf/objectivec-descriptor.proto"; + package grpc.testing; +option (google.protobuf.objectivec_file_options).class_prefix = "RMT"; + // An empty message that you can re-use to avoid defining duplicated empty // messages in your project. A typical example is to use it as argument or the // return value of a service API. For instance: diff --git a/src/objective-c/examples/Sample/RemoteTestClient/messages.proto b/src/objective-c/examples/Sample/RemoteTestClient/messages.proto index b23e2efb0fb..ab8577401fc 100644 --- a/src/objective-c/examples/Sample/RemoteTestClient/messages.proto +++ b/src/objective-c/examples/Sample/RemoteTestClient/messages.proto @@ -31,8 +31,12 @@ syntax = "proto2"; +import "google/protobuf/objectivec-descriptor.proto"; + package grpc.testing; +option (google.protobuf.objectivec_file_options).class_prefix = "RMT"; + // The type of payload that should be returned. enum PayloadType { // Compressable text format. diff --git a/src/objective-c/examples/Sample/RemoteTestClient/test.proto b/src/objective-c/examples/Sample/RemoteTestClient/test.proto index 99fd75e021e..4b082205996 100644 --- a/src/objective-c/examples/Sample/RemoteTestClient/test.proto +++ b/src/objective-c/examples/Sample/RemoteTestClient/test.proto @@ -33,9 +33,12 @@ syntax = "proto2"; import "empty.proto"; import "messages.proto"; +import "google/protobuf/objectivec-descriptor.proto"; package grpc.testing; +option (google.protobuf.objectivec_file_options).class_prefix = "RMT"; + // A simple service to test the various types of RPCs and experiment with // performance with various types of payload. service TestService { From 7205cda0f0e9c85b67b45adef900e06adbdf8bcd Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 22:45:22 -0700 Subject: [PATCH 34/46] Generates ObjC code for the test protos Command: protoc --plugin=/usr/local/bin/protoc-gen-objc test.proto messages.proto empty.proto --proto_path=/Users/jcanizales/git/protobuf-objc/src/compiler --proto_path=. --objc_out="./" --- .../Sample/RemoteTestClient/Empty.pb.h | 103 + .../Sample/RemoteTestClient/Empty.pb.m | 179 ++ .../Sample/RemoteTestClient/Messages.pb.h | 578 +++++ .../Sample/RemoteTestClient/Messages.pb.m | 2256 +++++++++++++++++ .../Sample/RemoteTestClient/Test.pb.h | 81 + .../Sample/RemoteTestClient/Test.pb.m | 27 + 6 files changed, 3224 insertions(+) create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.h create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.m create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.h create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.m create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/Test.pb.h create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/Test.pb.m diff --git a/src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.h b/src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.h new file mode 100644 index 00000000000..bf9fa3e36f4 --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.h @@ -0,0 +1,103 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import + +// @@protoc_insertion_point(imports) + +@class ObjectiveCFileOptions; +@class ObjectiveCFileOptionsBuilder; +@class PBDescriptorProto; +@class PBDescriptorProtoBuilder; +@class PBDescriptorProtoExtensionRange; +@class PBDescriptorProtoExtensionRangeBuilder; +@class PBEnumDescriptorProto; +@class PBEnumDescriptorProtoBuilder; +@class PBEnumOptions; +@class PBEnumOptionsBuilder; +@class PBEnumValueDescriptorProto; +@class PBEnumValueDescriptorProtoBuilder; +@class PBEnumValueOptions; +@class PBEnumValueOptionsBuilder; +@class PBFieldDescriptorProto; +@class PBFieldDescriptorProtoBuilder; +@class PBFieldOptions; +@class PBFieldOptionsBuilder; +@class PBFileDescriptorProto; +@class PBFileDescriptorProtoBuilder; +@class PBFileDescriptorSet; +@class PBFileDescriptorSetBuilder; +@class PBFileOptions; +@class PBFileOptionsBuilder; +@class PBMessageOptions; +@class PBMessageOptionsBuilder; +@class PBMethodDescriptorProto; +@class PBMethodDescriptorProtoBuilder; +@class PBMethodOptions; +@class PBMethodOptionsBuilder; +@class PBOneofDescriptorProto; +@class PBOneofDescriptorProtoBuilder; +@class PBServiceDescriptorProto; +@class PBServiceDescriptorProtoBuilder; +@class PBServiceOptions; +@class PBServiceOptionsBuilder; +@class PBSourceCodeInfo; +@class PBSourceCodeInfoBuilder; +@class PBSourceCodeInfoLocation; +@class PBSourceCodeInfoLocationBuilder; +@class PBUninterpretedOption; +@class PBUninterpretedOptionBuilder; +@class PBUninterpretedOptionNamePart; +@class PBUninterpretedOptionNamePartBuilder; +@class RMTEmpty; +@class RMTEmptyBuilder; + + + +@interface RMTEmptyRoot : NSObject { +} ++ (PBExtensionRegistry*) extensionRegistry; ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; +@end + +@interface RMTEmpty : PBGeneratedMessage { +@private +} + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTEmptyBuilder*) builder; ++ (RMTEmptyBuilder*) builder; ++ (RMTEmptyBuilder*) builderWithPrototype:(RMTEmpty*) prototype; +- (RMTEmptyBuilder*) toBuilder; + ++ (RMTEmpty*) parseFromData:(NSData*) data; ++ (RMTEmpty*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input; ++ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTEmptyBuilder : PBGeneratedMessageBuilder { +@private + RMTEmpty* resultEmpty; +} + +- (RMTEmpty*) defaultInstance; + +- (RMTEmptyBuilder*) clear; +- (RMTEmptyBuilder*) clone; + +- (RMTEmpty*) build; +- (RMTEmpty*) buildPartial; + +- (RMTEmptyBuilder*) mergeFrom:(RMTEmpty*) other; +- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.m b/src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.m new file mode 100644 index 00000000000..8e39cb70d18 --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/Empty.pb.m @@ -0,0 +1,179 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import "Empty.pb.h" +// @@protoc_insertion_point(imports) + +@implementation RMTEmptyRoot +static PBExtensionRegistry* extensionRegistry = nil; ++ (PBExtensionRegistry*) extensionRegistry { + return extensionRegistry; +} + ++ (void) initialize { + if (self == [RMTEmptyRoot class]) { + PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; + [self registerAllExtensions:registry]; + [ObjectivecDescriptorRoot registerAllExtensions:registry]; + extensionRegistry = registry; + } +} ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { +} +@end + +@interface RMTEmpty () +@end + +@implementation RMTEmpty + +- (instancetype) init { + if ((self = [super init])) { + } + return self; +} +static RMTEmpty* defaultRMTEmptyInstance = nil; ++ (void) initialize { + if (self == [RMTEmpty class]) { + defaultRMTEmptyInstance = [[RMTEmpty alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTEmptyInstance; +} +- (instancetype) defaultInstance { + return defaultRMTEmptyInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTEmpty*) parseFromData:(NSData*) data { + return (RMTEmpty*)[[[RMTEmpty builder] mergeFromData:data] build]; +} ++ (RMTEmpty*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTEmpty*)[[[RMTEmpty builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input { + return (RMTEmpty*)[[[RMTEmpty builder] mergeFromInputStream:input] build]; +} ++ (RMTEmpty*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTEmpty*)[[[RMTEmpty builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTEmpty*)[[[RMTEmpty builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTEmpty*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTEmpty*)[[[RMTEmpty builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTEmptyBuilder*) builder { + return [[RMTEmptyBuilder alloc] init]; +} ++ (RMTEmptyBuilder*) builderWithPrototype:(RMTEmpty*) prototype { + return [[RMTEmpty builder] mergeFrom:prototype]; +} +- (RMTEmptyBuilder*) builder { + return [RMTEmpty builder]; +} +- (RMTEmptyBuilder*) toBuilder { + return [RMTEmpty builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTEmpty class]]) { + return NO; + } + RMTEmpty *otherMessage = other; + return + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTEmptyBuilder() +@property (strong) RMTEmpty* resultEmpty; +@end + +@implementation RMTEmptyBuilder +@synthesize resultEmpty; +- (instancetype) init { + if ((self = [super init])) { + self.resultEmpty = [[RMTEmpty alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultEmpty; +} +- (RMTEmptyBuilder*) clear { + self.resultEmpty = [[RMTEmpty alloc] init]; + return self; +} +- (RMTEmptyBuilder*) clone { + return [RMTEmpty builderWithPrototype:resultEmpty]; +} +- (RMTEmpty*) defaultInstance { + return [RMTEmpty defaultInstance]; +} +- (RMTEmpty*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTEmpty*) buildPartial { + RMTEmpty* returnMe = resultEmpty; + self.resultEmpty = nil; + return returnMe; +} +- (RMTEmptyBuilder*) mergeFrom:(RMTEmpty*) other { + if (other == [RMTEmpty defaultInstance]) { + return self; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTEmptyBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + } + } +} +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.h b/src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.h new file mode 100644 index 00000000000..0a08e67702e --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.h @@ -0,0 +1,578 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import + +// @@protoc_insertion_point(imports) + +@class ObjectiveCFileOptions; +@class ObjectiveCFileOptionsBuilder; +@class PBDescriptorProto; +@class PBDescriptorProtoBuilder; +@class PBDescriptorProtoExtensionRange; +@class PBDescriptorProtoExtensionRangeBuilder; +@class PBEnumDescriptorProto; +@class PBEnumDescriptorProtoBuilder; +@class PBEnumOptions; +@class PBEnumOptionsBuilder; +@class PBEnumValueDescriptorProto; +@class PBEnumValueDescriptorProtoBuilder; +@class PBEnumValueOptions; +@class PBEnumValueOptionsBuilder; +@class PBFieldDescriptorProto; +@class PBFieldDescriptorProtoBuilder; +@class PBFieldOptions; +@class PBFieldOptionsBuilder; +@class PBFileDescriptorProto; +@class PBFileDescriptorProtoBuilder; +@class PBFileDescriptorSet; +@class PBFileDescriptorSetBuilder; +@class PBFileOptions; +@class PBFileOptionsBuilder; +@class PBMessageOptions; +@class PBMessageOptionsBuilder; +@class PBMethodDescriptorProto; +@class PBMethodDescriptorProtoBuilder; +@class PBMethodOptions; +@class PBMethodOptionsBuilder; +@class PBOneofDescriptorProto; +@class PBOneofDescriptorProtoBuilder; +@class PBServiceDescriptorProto; +@class PBServiceDescriptorProtoBuilder; +@class PBServiceOptions; +@class PBServiceOptionsBuilder; +@class PBSourceCodeInfo; +@class PBSourceCodeInfoBuilder; +@class PBSourceCodeInfoLocation; +@class PBSourceCodeInfoLocationBuilder; +@class PBUninterpretedOption; +@class PBUninterpretedOptionBuilder; +@class PBUninterpretedOptionNamePart; +@class PBUninterpretedOptionNamePartBuilder; +@class RMTPayload; +@class RMTPayloadBuilder; +@class RMTResponseParameters; +@class RMTResponseParametersBuilder; +@class RMTSimpleRequest; +@class RMTSimpleRequestBuilder; +@class RMTSimpleResponse; +@class RMTSimpleResponseBuilder; +@class RMTStreamingInputCallRequest; +@class RMTStreamingInputCallRequestBuilder; +@class RMTStreamingInputCallResponse; +@class RMTStreamingInputCallResponseBuilder; +@class RMTStreamingOutputCallRequest; +@class RMTStreamingOutputCallRequestBuilder; +@class RMTStreamingOutputCallResponse; +@class RMTStreamingOutputCallResponseBuilder; + + +typedef NS_ENUM(SInt32, RMTPayloadType) { + RMTPayloadTypeCompressable = 0, + RMTPayloadTypeUncompressable = 1, + RMTPayloadTypeRandom = 2, +}; + +BOOL RMTPayloadTypeIsValidValue(RMTPayloadType value); +NSString *NSStringFromRMTPayloadType(RMTPayloadType value); + + +@interface RMTMessagesRoot : NSObject { +} ++ (PBExtensionRegistry*) extensionRegistry; ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; +@end + +@interface RMTPayload : PBGeneratedMessage { +@private + BOOL hasBody_:1; + BOOL hasType_:1; + NSData* body; + RMTPayloadType type; +} +- (BOOL) hasType; +- (BOOL) hasBody; +@property (readonly) RMTPayloadType type; +@property (readonly, strong) NSData* body; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTPayloadBuilder*) builder; ++ (RMTPayloadBuilder*) builder; ++ (RMTPayloadBuilder*) builderWithPrototype:(RMTPayload*) prototype; +- (RMTPayloadBuilder*) toBuilder; + ++ (RMTPayload*) parseFromData:(NSData*) data; ++ (RMTPayload*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTPayload*) parseFromInputStream:(NSInputStream*) input; ++ (RMTPayload*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTPayload*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTPayload*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTPayloadBuilder : PBGeneratedMessageBuilder { +@private + RMTPayload* resultPayload; +} + +- (RMTPayload*) defaultInstance; + +- (RMTPayloadBuilder*) clear; +- (RMTPayloadBuilder*) clone; + +- (RMTPayload*) build; +- (RMTPayload*) buildPartial; + +- (RMTPayloadBuilder*) mergeFrom:(RMTPayload*) other; +- (RMTPayloadBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTPayloadBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasType; +- (RMTPayloadType) type; +- (RMTPayloadBuilder*) setType:(RMTPayloadType) value; +- (RMTPayloadBuilder*) clearType; + +- (BOOL) hasBody; +- (NSData*) body; +- (RMTPayloadBuilder*) setBody:(NSData*) value; +- (RMTPayloadBuilder*) clearBody; +@end + +@interface RMTSimpleRequest : PBGeneratedMessage { +@private + BOOL hasFillUsername_:1; + BOOL hasFillOauthScope_:1; + BOOL hasResponseSize_:1; + BOOL hasPayload_:1; + BOOL hasResponseType_:1; + BOOL fillUsername_:1; + BOOL fillOauthScope_:1; + SInt32 responseSize; + RMTPayload* payload; + RMTPayloadType responseType; +} +- (BOOL) hasResponseType; +- (BOOL) hasResponseSize; +- (BOOL) hasPayload; +- (BOOL) hasFillUsername; +- (BOOL) hasFillOauthScope; +@property (readonly) RMTPayloadType responseType; +@property (readonly) SInt32 responseSize; +@property (readonly, strong) RMTPayload* payload; +- (BOOL) fillUsername; +- (BOOL) fillOauthScope; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTSimpleRequestBuilder*) builder; ++ (RMTSimpleRequestBuilder*) builder; ++ (RMTSimpleRequestBuilder*) builderWithPrototype:(RMTSimpleRequest*) prototype; +- (RMTSimpleRequestBuilder*) toBuilder; + ++ (RMTSimpleRequest*) parseFromData:(NSData*) data; ++ (RMTSimpleRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTSimpleRequest*) parseFromInputStream:(NSInputStream*) input; ++ (RMTSimpleRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTSimpleRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTSimpleRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTSimpleRequestBuilder : PBGeneratedMessageBuilder { +@private + RMTSimpleRequest* resultSimpleRequest; +} + +- (RMTSimpleRequest*) defaultInstance; + +- (RMTSimpleRequestBuilder*) clear; +- (RMTSimpleRequestBuilder*) clone; + +- (RMTSimpleRequest*) build; +- (RMTSimpleRequest*) buildPartial; + +- (RMTSimpleRequestBuilder*) mergeFrom:(RMTSimpleRequest*) other; +- (RMTSimpleRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTSimpleRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasResponseType; +- (RMTPayloadType) responseType; +- (RMTSimpleRequestBuilder*) setResponseType:(RMTPayloadType) value; +- (RMTSimpleRequestBuilder*) clearResponseType; + +- (BOOL) hasResponseSize; +- (SInt32) responseSize; +- (RMTSimpleRequestBuilder*) setResponseSize:(SInt32) value; +- (RMTSimpleRequestBuilder*) clearResponseSize; + +- (BOOL) hasPayload; +- (RMTPayload*) payload; +- (RMTSimpleRequestBuilder*) setPayload:(RMTPayload*) value; +- (RMTSimpleRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue; +- (RMTSimpleRequestBuilder*) mergePayload:(RMTPayload*) value; +- (RMTSimpleRequestBuilder*) clearPayload; + +- (BOOL) hasFillUsername; +- (BOOL) fillUsername; +- (RMTSimpleRequestBuilder*) setFillUsername:(BOOL) value; +- (RMTSimpleRequestBuilder*) clearFillUsername; + +- (BOOL) hasFillOauthScope; +- (BOOL) fillOauthScope; +- (RMTSimpleRequestBuilder*) setFillOauthScope:(BOOL) value; +- (RMTSimpleRequestBuilder*) clearFillOauthScope; +@end + +@interface RMTSimpleResponse : PBGeneratedMessage { +@private + BOOL hasUsername_:1; + BOOL hasOauthScope_:1; + BOOL hasPayload_:1; + NSString* username; + NSString* oauthScope; + RMTPayload* payload; +} +- (BOOL) hasPayload; +- (BOOL) hasUsername; +- (BOOL) hasOauthScope; +@property (readonly, strong) RMTPayload* payload; +@property (readonly, strong) NSString* username; +@property (readonly, strong) NSString* oauthScope; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTSimpleResponseBuilder*) builder; ++ (RMTSimpleResponseBuilder*) builder; ++ (RMTSimpleResponseBuilder*) builderWithPrototype:(RMTSimpleResponse*) prototype; +- (RMTSimpleResponseBuilder*) toBuilder; + ++ (RMTSimpleResponse*) parseFromData:(NSData*) data; ++ (RMTSimpleResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTSimpleResponse*) parseFromInputStream:(NSInputStream*) input; ++ (RMTSimpleResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTSimpleResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTSimpleResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTSimpleResponseBuilder : PBGeneratedMessageBuilder { +@private + RMTSimpleResponse* resultSimpleResponse; +} + +- (RMTSimpleResponse*) defaultInstance; + +- (RMTSimpleResponseBuilder*) clear; +- (RMTSimpleResponseBuilder*) clone; + +- (RMTSimpleResponse*) build; +- (RMTSimpleResponse*) buildPartial; + +- (RMTSimpleResponseBuilder*) mergeFrom:(RMTSimpleResponse*) other; +- (RMTSimpleResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTSimpleResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasPayload; +- (RMTPayload*) payload; +- (RMTSimpleResponseBuilder*) setPayload:(RMTPayload*) value; +- (RMTSimpleResponseBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue; +- (RMTSimpleResponseBuilder*) mergePayload:(RMTPayload*) value; +- (RMTSimpleResponseBuilder*) clearPayload; + +- (BOOL) hasUsername; +- (NSString*) username; +- (RMTSimpleResponseBuilder*) setUsername:(NSString*) value; +- (RMTSimpleResponseBuilder*) clearUsername; + +- (BOOL) hasOauthScope; +- (NSString*) oauthScope; +- (RMTSimpleResponseBuilder*) setOauthScope:(NSString*) value; +- (RMTSimpleResponseBuilder*) clearOauthScope; +@end + +@interface RMTStreamingInputCallRequest : PBGeneratedMessage { +@private + BOOL hasPayload_:1; + RMTPayload* payload; +} +- (BOOL) hasPayload; +@property (readonly, strong) RMTPayload* payload; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTStreamingInputCallRequestBuilder*) builder; ++ (RMTStreamingInputCallRequestBuilder*) builder; ++ (RMTStreamingInputCallRequestBuilder*) builderWithPrototype:(RMTStreamingInputCallRequest*) prototype; +- (RMTStreamingInputCallRequestBuilder*) toBuilder; + ++ (RMTStreamingInputCallRequest*) parseFromData:(NSData*) data; ++ (RMTStreamingInputCallRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingInputCallRequest*) parseFromInputStream:(NSInputStream*) input; ++ (RMTStreamingInputCallRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingInputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTStreamingInputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTStreamingInputCallRequestBuilder : PBGeneratedMessageBuilder { +@private + RMTStreamingInputCallRequest* resultStreamingInputCallRequest; +} + +- (RMTStreamingInputCallRequest*) defaultInstance; + +- (RMTStreamingInputCallRequestBuilder*) clear; +- (RMTStreamingInputCallRequestBuilder*) clone; + +- (RMTStreamingInputCallRequest*) build; +- (RMTStreamingInputCallRequest*) buildPartial; + +- (RMTStreamingInputCallRequestBuilder*) mergeFrom:(RMTStreamingInputCallRequest*) other; +- (RMTStreamingInputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTStreamingInputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasPayload; +- (RMTPayload*) payload; +- (RMTStreamingInputCallRequestBuilder*) setPayload:(RMTPayload*) value; +- (RMTStreamingInputCallRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue; +- (RMTStreamingInputCallRequestBuilder*) mergePayload:(RMTPayload*) value; +- (RMTStreamingInputCallRequestBuilder*) clearPayload; +@end + +@interface RMTStreamingInputCallResponse : PBGeneratedMessage { +@private + BOOL hasAggregatedPayloadSize_:1; + SInt32 aggregatedPayloadSize; +} +- (BOOL) hasAggregatedPayloadSize; +@property (readonly) SInt32 aggregatedPayloadSize; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTStreamingInputCallResponseBuilder*) builder; ++ (RMTStreamingInputCallResponseBuilder*) builder; ++ (RMTStreamingInputCallResponseBuilder*) builderWithPrototype:(RMTStreamingInputCallResponse*) prototype; +- (RMTStreamingInputCallResponseBuilder*) toBuilder; + ++ (RMTStreamingInputCallResponse*) parseFromData:(NSData*) data; ++ (RMTStreamingInputCallResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingInputCallResponse*) parseFromInputStream:(NSInputStream*) input; ++ (RMTStreamingInputCallResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingInputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTStreamingInputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTStreamingInputCallResponseBuilder : PBGeneratedMessageBuilder { +@private + RMTStreamingInputCallResponse* resultStreamingInputCallResponse; +} + +- (RMTStreamingInputCallResponse*) defaultInstance; + +- (RMTStreamingInputCallResponseBuilder*) clear; +- (RMTStreamingInputCallResponseBuilder*) clone; + +- (RMTStreamingInputCallResponse*) build; +- (RMTStreamingInputCallResponse*) buildPartial; + +- (RMTStreamingInputCallResponseBuilder*) mergeFrom:(RMTStreamingInputCallResponse*) other; +- (RMTStreamingInputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTStreamingInputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasAggregatedPayloadSize; +- (SInt32) aggregatedPayloadSize; +- (RMTStreamingInputCallResponseBuilder*) setAggregatedPayloadSize:(SInt32) value; +- (RMTStreamingInputCallResponseBuilder*) clearAggregatedPayloadSize; +@end + +@interface RMTResponseParameters : PBGeneratedMessage { +@private + BOOL hasSize_:1; + BOOL hasIntervalUs_:1; + SInt32 size; + SInt32 intervalUs; +} +- (BOOL) hasSize; +- (BOOL) hasIntervalUs; +@property (readonly) SInt32 size; +@property (readonly) SInt32 intervalUs; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTResponseParametersBuilder*) builder; ++ (RMTResponseParametersBuilder*) builder; ++ (RMTResponseParametersBuilder*) builderWithPrototype:(RMTResponseParameters*) prototype; +- (RMTResponseParametersBuilder*) toBuilder; + ++ (RMTResponseParameters*) parseFromData:(NSData*) data; ++ (RMTResponseParameters*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTResponseParameters*) parseFromInputStream:(NSInputStream*) input; ++ (RMTResponseParameters*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTResponseParameters*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTResponseParameters*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTResponseParametersBuilder : PBGeneratedMessageBuilder { +@private + RMTResponseParameters* resultResponseParameters; +} + +- (RMTResponseParameters*) defaultInstance; + +- (RMTResponseParametersBuilder*) clear; +- (RMTResponseParametersBuilder*) clone; + +- (RMTResponseParameters*) build; +- (RMTResponseParameters*) buildPartial; + +- (RMTResponseParametersBuilder*) mergeFrom:(RMTResponseParameters*) other; +- (RMTResponseParametersBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTResponseParametersBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasSize; +- (SInt32) size; +- (RMTResponseParametersBuilder*) setSize:(SInt32) value; +- (RMTResponseParametersBuilder*) clearSize; + +- (BOOL) hasIntervalUs; +- (SInt32) intervalUs; +- (RMTResponseParametersBuilder*) setIntervalUs:(SInt32) value; +- (RMTResponseParametersBuilder*) clearIntervalUs; +@end + +@interface RMTStreamingOutputCallRequest : PBGeneratedMessage { +@private + BOOL hasPayload_:1; + BOOL hasResponseType_:1; + RMTPayload* payload; + RMTPayloadType responseType; + NSMutableArray * responseParametersArray; +} +- (BOOL) hasResponseType; +- (BOOL) hasPayload; +@property (readonly) RMTPayloadType responseType; +@property (readonly, strong) NSArray * responseParameters; +@property (readonly, strong) RMTPayload* payload; +- (RMTResponseParameters*)responseParametersAtIndex:(NSUInteger)index; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTStreamingOutputCallRequestBuilder*) builder; ++ (RMTStreamingOutputCallRequestBuilder*) builder; ++ (RMTStreamingOutputCallRequestBuilder*) builderWithPrototype:(RMTStreamingOutputCallRequest*) prototype; +- (RMTStreamingOutputCallRequestBuilder*) toBuilder; + ++ (RMTStreamingOutputCallRequest*) parseFromData:(NSData*) data; ++ (RMTStreamingOutputCallRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingOutputCallRequest*) parseFromInputStream:(NSInputStream*) input; ++ (RMTStreamingOutputCallRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingOutputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTStreamingOutputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTStreamingOutputCallRequestBuilder : PBGeneratedMessageBuilder { +@private + RMTStreamingOutputCallRequest* resultStreamingOutputCallRequest; +} + +- (RMTStreamingOutputCallRequest*) defaultInstance; + +- (RMTStreamingOutputCallRequestBuilder*) clear; +- (RMTStreamingOutputCallRequestBuilder*) clone; + +- (RMTStreamingOutputCallRequest*) build; +- (RMTStreamingOutputCallRequest*) buildPartial; + +- (RMTStreamingOutputCallRequestBuilder*) mergeFrom:(RMTStreamingOutputCallRequest*) other; +- (RMTStreamingOutputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTStreamingOutputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasResponseType; +- (RMTPayloadType) responseType; +- (RMTStreamingOutputCallRequestBuilder*) setResponseType:(RMTPayloadType) value; +- (RMTStreamingOutputCallRequestBuilder*) clearResponseType; + +- (NSMutableArray *)responseParameters; +- (RMTResponseParameters*)responseParametersAtIndex:(NSUInteger)index; +- (RMTStreamingOutputCallRequestBuilder *)addResponseParameters:(RMTResponseParameters*)value; +- (RMTStreamingOutputCallRequestBuilder *)setResponseParametersArray:(NSArray *)array; +- (RMTStreamingOutputCallRequestBuilder *)clearResponseParameters; + +- (BOOL) hasPayload; +- (RMTPayload*) payload; +- (RMTStreamingOutputCallRequestBuilder*) setPayload:(RMTPayload*) value; +- (RMTStreamingOutputCallRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue; +- (RMTStreamingOutputCallRequestBuilder*) mergePayload:(RMTPayload*) value; +- (RMTStreamingOutputCallRequestBuilder*) clearPayload; +@end + +@interface RMTStreamingOutputCallResponse : PBGeneratedMessage { +@private + BOOL hasPayload_:1; + RMTPayload* payload; +} +- (BOOL) hasPayload; +@property (readonly, strong) RMTPayload* payload; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RMTStreamingOutputCallResponseBuilder*) builder; ++ (RMTStreamingOutputCallResponseBuilder*) builder; ++ (RMTStreamingOutputCallResponseBuilder*) builderWithPrototype:(RMTStreamingOutputCallResponse*) prototype; +- (RMTStreamingOutputCallResponseBuilder*) toBuilder; + ++ (RMTStreamingOutputCallResponse*) parseFromData:(NSData*) data; ++ (RMTStreamingOutputCallResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingOutputCallResponse*) parseFromInputStream:(NSInputStream*) input; ++ (RMTStreamingOutputCallResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RMTStreamingOutputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RMTStreamingOutputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RMTStreamingOutputCallResponseBuilder : PBGeneratedMessageBuilder { +@private + RMTStreamingOutputCallResponse* resultStreamingOutputCallResponse; +} + +- (RMTStreamingOutputCallResponse*) defaultInstance; + +- (RMTStreamingOutputCallResponseBuilder*) clear; +- (RMTStreamingOutputCallResponseBuilder*) clone; + +- (RMTStreamingOutputCallResponse*) build; +- (RMTStreamingOutputCallResponse*) buildPartial; + +- (RMTStreamingOutputCallResponseBuilder*) mergeFrom:(RMTStreamingOutputCallResponse*) other; +- (RMTStreamingOutputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RMTStreamingOutputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasPayload; +- (RMTPayload*) payload; +- (RMTStreamingOutputCallResponseBuilder*) setPayload:(RMTPayload*) value; +- (RMTStreamingOutputCallResponseBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue; +- (RMTStreamingOutputCallResponseBuilder*) mergePayload:(RMTPayload*) value; +- (RMTStreamingOutputCallResponseBuilder*) clearPayload; +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.m b/src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.m new file mode 100644 index 00000000000..fbad1a9c097 --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/Messages.pb.m @@ -0,0 +1,2256 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import "Messages.pb.h" +// @@protoc_insertion_point(imports) + +@implementation RMTMessagesRoot +static PBExtensionRegistry* extensionRegistry = nil; ++ (PBExtensionRegistry*) extensionRegistry { + return extensionRegistry; +} + ++ (void) initialize { + if (self == [RMTMessagesRoot class]) { + PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; + [self registerAllExtensions:registry]; + [ObjectivecDescriptorRoot registerAllExtensions:registry]; + extensionRegistry = registry; + } +} ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { +} +@end + +BOOL RMTPayloadTypeIsValidValue(RMTPayloadType value) { + switch (value) { + case RMTPayloadTypeCompressable: + case RMTPayloadTypeUncompressable: + case RMTPayloadTypeRandom: + return YES; + default: + return NO; + } +} +NSString *NSStringFromRMTPayloadType(RMTPayloadType value) { + switch (value) { + case RMTPayloadTypeCompressable: + return @"RMTPayloadTypeCompressable"; + case RMTPayloadTypeUncompressable: + return @"RMTPayloadTypeUncompressable"; + case RMTPayloadTypeRandom: + return @"RMTPayloadTypeRandom"; + default: + return nil; + } +} + +@interface RMTPayload () +@property RMTPayloadType type; +@property (strong) NSData* body; +@end + +@implementation RMTPayload + +- (BOOL) hasType { + return !!hasType_; +} +- (void) setHasType:(BOOL) _value_ { + hasType_ = !!_value_; +} +@synthesize type; +- (BOOL) hasBody { + return !!hasBody_; +} +- (void) setHasBody:(BOOL) _value_ { + hasBody_ = !!_value_; +} +@synthesize body; +- (instancetype) init { + if ((self = [super init])) { + self.type = RMTPayloadTypeCompressable; + self.body = [NSData data]; + } + return self; +} +static RMTPayload* defaultRMTPayloadInstance = nil; ++ (void) initialize { + if (self == [RMTPayload class]) { + defaultRMTPayloadInstance = [[RMTPayload alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTPayloadInstance; +} +- (instancetype) defaultInstance { + return defaultRMTPayloadInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasType) { + [output writeEnum:1 value:self.type]; + } + if (self.hasBody) { + [output writeData:2 value:self.body]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasType) { + size_ += computeEnumSize(1, self.type); + } + if (self.hasBody) { + size_ += computeDataSize(2, self.body); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTPayload*) parseFromData:(NSData*) data { + return (RMTPayload*)[[[RMTPayload builder] mergeFromData:data] build]; +} ++ (RMTPayload*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTPayload*)[[[RMTPayload builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTPayload*) parseFromInputStream:(NSInputStream*) input { + return (RMTPayload*)[[[RMTPayload builder] mergeFromInputStream:input] build]; +} ++ (RMTPayload*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTPayload*)[[[RMTPayload builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTPayload*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTPayload*)[[[RMTPayload builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTPayload*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTPayload*)[[[RMTPayload builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTPayloadBuilder*) builder { + return [[RMTPayloadBuilder alloc] init]; +} ++ (RMTPayloadBuilder*) builderWithPrototype:(RMTPayload*) prototype { + return [[RMTPayload builder] mergeFrom:prototype]; +} +- (RMTPayloadBuilder*) builder { + return [RMTPayload builder]; +} +- (RMTPayloadBuilder*) toBuilder { + return [RMTPayload builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasType) { + [output appendFormat:@"%@%@: %@\n", indent, @"type", NSStringFromRMTPayloadType(self.type)]; + } + if (self.hasBody) { + [output appendFormat:@"%@%@: %@\n", indent, @"body", self.body]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTPayload class]]) { + return NO; + } + RMTPayload *otherMessage = other; + return + self.hasType == otherMessage.hasType && + (!self.hasType || self.type == otherMessage.type) && + self.hasBody == otherMessage.hasBody && + (!self.hasBody || [self.body isEqual:otherMessage.body]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasType) { + hashCode = hashCode * 31 + self.type; + } + if (self.hasBody) { + hashCode = hashCode * 31 + [self.body hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTPayloadBuilder() +@property (strong) RMTPayload* resultPayload; +@end + +@implementation RMTPayloadBuilder +@synthesize resultPayload; +- (instancetype) init { + if ((self = [super init])) { + self.resultPayload = [[RMTPayload alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultPayload; +} +- (RMTPayloadBuilder*) clear { + self.resultPayload = [[RMTPayload alloc] init]; + return self; +} +- (RMTPayloadBuilder*) clone { + return [RMTPayload builderWithPrototype:resultPayload]; +} +- (RMTPayload*) defaultInstance { + return [RMTPayload defaultInstance]; +} +- (RMTPayload*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTPayload*) buildPartial { + RMTPayload* returnMe = resultPayload; + self.resultPayload = nil; + return returnMe; +} +- (RMTPayloadBuilder*) mergeFrom:(RMTPayload*) other { + if (other == [RMTPayload defaultInstance]) { + return self; + } + if (other.hasType) { + [self setType:other.type]; + } + if (other.hasBody) { + [self setBody:other.body]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTPayloadBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTPayloadBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + RMTPayloadType value = (RMTPayloadType)[input readEnum]; + if (RMTPayloadTypeIsValidValue(value)) { + [self setType:value]; + } else { + [unknownFields mergeVarintField:1 value:value]; + } + break; + } + case 18: { + [self setBody:[input readData]]; + break; + } + } + } +} +- (BOOL) hasType { + return resultPayload.hasType; +} +- (RMTPayloadType) type { + return resultPayload.type; +} +- (RMTPayloadBuilder*) setType:(RMTPayloadType) value { + resultPayload.hasType = YES; + resultPayload.type = value; + return self; +} +- (RMTPayloadBuilder*) clearType { + resultPayload.hasType = NO; + resultPayload.type = RMTPayloadTypeCompressable; + return self; +} +- (BOOL) hasBody { + return resultPayload.hasBody; +} +- (NSData*) body { + return resultPayload.body; +} +- (RMTPayloadBuilder*) setBody:(NSData*) value { + resultPayload.hasBody = YES; + resultPayload.body = value; + return self; +} +- (RMTPayloadBuilder*) clearBody { + resultPayload.hasBody = NO; + resultPayload.body = [NSData data]; + return self; +} +@end + +@interface RMTSimpleRequest () +@property RMTPayloadType responseType; +@property SInt32 responseSize; +@property (strong) RMTPayload* payload; +@property BOOL fillUsername; +@property BOOL fillOauthScope; +@end + +@implementation RMTSimpleRequest + +- (BOOL) hasResponseType { + return !!hasResponseType_; +} +- (void) setHasResponseType:(BOOL) _value_ { + hasResponseType_ = !!_value_; +} +@synthesize responseType; +- (BOOL) hasResponseSize { + return !!hasResponseSize_; +} +- (void) setHasResponseSize:(BOOL) _value_ { + hasResponseSize_ = !!_value_; +} +@synthesize responseSize; +- (BOOL) hasPayload { + return !!hasPayload_; +} +- (void) setHasPayload:(BOOL) _value_ { + hasPayload_ = !!_value_; +} +@synthesize payload; +- (BOOL) hasFillUsername { + return !!hasFillUsername_; +} +- (void) setHasFillUsername:(BOOL) _value_ { + hasFillUsername_ = !!_value_; +} +- (BOOL) fillUsername { + return !!fillUsername_; +} +- (void) setFillUsername:(BOOL) _value_ { + fillUsername_ = !!_value_; +} +- (BOOL) hasFillOauthScope { + return !!hasFillOauthScope_; +} +- (void) setHasFillOauthScope:(BOOL) _value_ { + hasFillOauthScope_ = !!_value_; +} +- (BOOL) fillOauthScope { + return !!fillOauthScope_; +} +- (void) setFillOauthScope:(BOOL) _value_ { + fillOauthScope_ = !!_value_; +} +- (instancetype) init { + if ((self = [super init])) { + self.responseType = RMTPayloadTypeCompressable; + self.responseSize = 0; + self.payload = [RMTPayload defaultInstance]; + self.fillUsername = NO; + self.fillOauthScope = NO; + } + return self; +} +static RMTSimpleRequest* defaultRMTSimpleRequestInstance = nil; ++ (void) initialize { + if (self == [RMTSimpleRequest class]) { + defaultRMTSimpleRequestInstance = [[RMTSimpleRequest alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTSimpleRequestInstance; +} +- (instancetype) defaultInstance { + return defaultRMTSimpleRequestInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasResponseType) { + [output writeEnum:1 value:self.responseType]; + } + if (self.hasResponseSize) { + [output writeInt32:2 value:self.responseSize]; + } + if (self.hasPayload) { + [output writeMessage:3 value:self.payload]; + } + if (self.hasFillUsername) { + [output writeBool:4 value:self.fillUsername]; + } + if (self.hasFillOauthScope) { + [output writeBool:5 value:self.fillOauthScope]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasResponseType) { + size_ += computeEnumSize(1, self.responseType); + } + if (self.hasResponseSize) { + size_ += computeInt32Size(2, self.responseSize); + } + if (self.hasPayload) { + size_ += computeMessageSize(3, self.payload); + } + if (self.hasFillUsername) { + size_ += computeBoolSize(4, self.fillUsername); + } + if (self.hasFillOauthScope) { + size_ += computeBoolSize(5, self.fillOauthScope); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTSimpleRequest*) parseFromData:(NSData*) data { + return (RMTSimpleRequest*)[[[RMTSimpleRequest builder] mergeFromData:data] build]; +} ++ (RMTSimpleRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTSimpleRequest*)[[[RMTSimpleRequest builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTSimpleRequest*) parseFromInputStream:(NSInputStream*) input { + return (RMTSimpleRequest*)[[[RMTSimpleRequest builder] mergeFromInputStream:input] build]; +} ++ (RMTSimpleRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTSimpleRequest*)[[[RMTSimpleRequest builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTSimpleRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTSimpleRequest*)[[[RMTSimpleRequest builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTSimpleRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTSimpleRequest*)[[[RMTSimpleRequest builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTSimpleRequestBuilder*) builder { + return [[RMTSimpleRequestBuilder alloc] init]; +} ++ (RMTSimpleRequestBuilder*) builderWithPrototype:(RMTSimpleRequest*) prototype { + return [[RMTSimpleRequest builder] mergeFrom:prototype]; +} +- (RMTSimpleRequestBuilder*) builder { + return [RMTSimpleRequest builder]; +} +- (RMTSimpleRequestBuilder*) toBuilder { + return [RMTSimpleRequest builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasResponseType) { + [output appendFormat:@"%@%@: %@\n", indent, @"responseType", NSStringFromRMTPayloadType(self.responseType)]; + } + if (self.hasResponseSize) { + [output appendFormat:@"%@%@: %@\n", indent, @"responseSize", [NSNumber numberWithInteger:self.responseSize]]; + } + if (self.hasPayload) { + [output appendFormat:@"%@%@ {\n", indent, @"payload"]; + [self.payload writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + if (self.hasFillUsername) { + [output appendFormat:@"%@%@: %@\n", indent, @"fillUsername", [NSNumber numberWithBool:self.fillUsername]]; + } + if (self.hasFillOauthScope) { + [output appendFormat:@"%@%@: %@\n", indent, @"fillOauthScope", [NSNumber numberWithBool:self.fillOauthScope]]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTSimpleRequest class]]) { + return NO; + } + RMTSimpleRequest *otherMessage = other; + return + self.hasResponseType == otherMessage.hasResponseType && + (!self.hasResponseType || self.responseType == otherMessage.responseType) && + self.hasResponseSize == otherMessage.hasResponseSize && + (!self.hasResponseSize || self.responseSize == otherMessage.responseSize) && + self.hasPayload == otherMessage.hasPayload && + (!self.hasPayload || [self.payload isEqual:otherMessage.payload]) && + self.hasFillUsername == otherMessage.hasFillUsername && + (!self.hasFillUsername || self.fillUsername == otherMessage.fillUsername) && + self.hasFillOauthScope == otherMessage.hasFillOauthScope && + (!self.hasFillOauthScope || self.fillOauthScope == otherMessage.fillOauthScope) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasResponseType) { + hashCode = hashCode * 31 + self.responseType; + } + if (self.hasResponseSize) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.responseSize] hash]; + } + if (self.hasPayload) { + hashCode = hashCode * 31 + [self.payload hash]; + } + if (self.hasFillUsername) { + hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.fillUsername] hash]; + } + if (self.hasFillOauthScope) { + hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.fillOauthScope] hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTSimpleRequestBuilder() +@property (strong) RMTSimpleRequest* resultSimpleRequest; +@end + +@implementation RMTSimpleRequestBuilder +@synthesize resultSimpleRequest; +- (instancetype) init { + if ((self = [super init])) { + self.resultSimpleRequest = [[RMTSimpleRequest alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultSimpleRequest; +} +- (RMTSimpleRequestBuilder*) clear { + self.resultSimpleRequest = [[RMTSimpleRequest alloc] init]; + return self; +} +- (RMTSimpleRequestBuilder*) clone { + return [RMTSimpleRequest builderWithPrototype:resultSimpleRequest]; +} +- (RMTSimpleRequest*) defaultInstance { + return [RMTSimpleRequest defaultInstance]; +} +- (RMTSimpleRequest*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTSimpleRequest*) buildPartial { + RMTSimpleRequest* returnMe = resultSimpleRequest; + self.resultSimpleRequest = nil; + return returnMe; +} +- (RMTSimpleRequestBuilder*) mergeFrom:(RMTSimpleRequest*) other { + if (other == [RMTSimpleRequest defaultInstance]) { + return self; + } + if (other.hasResponseType) { + [self setResponseType:other.responseType]; + } + if (other.hasResponseSize) { + [self setResponseSize:other.responseSize]; + } + if (other.hasPayload) { + [self mergePayload:other.payload]; + } + if (other.hasFillUsername) { + [self setFillUsername:other.fillUsername]; + } + if (other.hasFillOauthScope) { + [self setFillOauthScope:other.fillOauthScope]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTSimpleRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTSimpleRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + RMTPayloadType value = (RMTPayloadType)[input readEnum]; + if (RMTPayloadTypeIsValidValue(value)) { + [self setResponseType:value]; + } else { + [unknownFields mergeVarintField:1 value:value]; + } + break; + } + case 16: { + [self setResponseSize:[input readInt32]]; + break; + } + case 26: { + RMTPayloadBuilder* subBuilder = [RMTPayload builder]; + if (self.hasPayload) { + [subBuilder mergeFrom:self.payload]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setPayload:[subBuilder buildPartial]]; + break; + } + case 32: { + [self setFillUsername:[input readBool]]; + break; + } + case 40: { + [self setFillOauthScope:[input readBool]]; + break; + } + } + } +} +- (BOOL) hasResponseType { + return resultSimpleRequest.hasResponseType; +} +- (RMTPayloadType) responseType { + return resultSimpleRequest.responseType; +} +- (RMTSimpleRequestBuilder*) setResponseType:(RMTPayloadType) value { + resultSimpleRequest.hasResponseType = YES; + resultSimpleRequest.responseType = value; + return self; +} +- (RMTSimpleRequestBuilder*) clearResponseType { + resultSimpleRequest.hasResponseType = NO; + resultSimpleRequest.responseType = RMTPayloadTypeCompressable; + return self; +} +- (BOOL) hasResponseSize { + return resultSimpleRequest.hasResponseSize; +} +- (SInt32) responseSize { + return resultSimpleRequest.responseSize; +} +- (RMTSimpleRequestBuilder*) setResponseSize:(SInt32) value { + resultSimpleRequest.hasResponseSize = YES; + resultSimpleRequest.responseSize = value; + return self; +} +- (RMTSimpleRequestBuilder*) clearResponseSize { + resultSimpleRequest.hasResponseSize = NO; + resultSimpleRequest.responseSize = 0; + return self; +} +- (BOOL) hasPayload { + return resultSimpleRequest.hasPayload; +} +- (RMTPayload*) payload { + return resultSimpleRequest.payload; +} +- (RMTSimpleRequestBuilder*) setPayload:(RMTPayload*) value { + resultSimpleRequest.hasPayload = YES; + resultSimpleRequest.payload = value; + return self; +} +- (RMTSimpleRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue { + return [self setPayload:[builderForValue build]]; +} +- (RMTSimpleRequestBuilder*) mergePayload:(RMTPayload*) value { + if (resultSimpleRequest.hasPayload && + resultSimpleRequest.payload != [RMTPayload defaultInstance]) { + resultSimpleRequest.payload = + [[[RMTPayload builderWithPrototype:resultSimpleRequest.payload] mergeFrom:value] buildPartial]; + } else { + resultSimpleRequest.payload = value; + } + resultSimpleRequest.hasPayload = YES; + return self; +} +- (RMTSimpleRequestBuilder*) clearPayload { + resultSimpleRequest.hasPayload = NO; + resultSimpleRequest.payload = [RMTPayload defaultInstance]; + return self; +} +- (BOOL) hasFillUsername { + return resultSimpleRequest.hasFillUsername; +} +- (BOOL) fillUsername { + return resultSimpleRequest.fillUsername; +} +- (RMTSimpleRequestBuilder*) setFillUsername:(BOOL) value { + resultSimpleRequest.hasFillUsername = YES; + resultSimpleRequest.fillUsername = value; + return self; +} +- (RMTSimpleRequestBuilder*) clearFillUsername { + resultSimpleRequest.hasFillUsername = NO; + resultSimpleRequest.fillUsername = NO; + return self; +} +- (BOOL) hasFillOauthScope { + return resultSimpleRequest.hasFillOauthScope; +} +- (BOOL) fillOauthScope { + return resultSimpleRequest.fillOauthScope; +} +- (RMTSimpleRequestBuilder*) setFillOauthScope:(BOOL) value { + resultSimpleRequest.hasFillOauthScope = YES; + resultSimpleRequest.fillOauthScope = value; + return self; +} +- (RMTSimpleRequestBuilder*) clearFillOauthScope { + resultSimpleRequest.hasFillOauthScope = NO; + resultSimpleRequest.fillOauthScope = NO; + return self; +} +@end + +@interface RMTSimpleResponse () +@property (strong) RMTPayload* payload; +@property (strong) NSString* username; +@property (strong) NSString* oauthScope; +@end + +@implementation RMTSimpleResponse + +- (BOOL) hasPayload { + return !!hasPayload_; +} +- (void) setHasPayload:(BOOL) _value_ { + hasPayload_ = !!_value_; +} +@synthesize payload; +- (BOOL) hasUsername { + return !!hasUsername_; +} +- (void) setHasUsername:(BOOL) _value_ { + hasUsername_ = !!_value_; +} +@synthesize username; +- (BOOL) hasOauthScope { + return !!hasOauthScope_; +} +- (void) setHasOauthScope:(BOOL) _value_ { + hasOauthScope_ = !!_value_; +} +@synthesize oauthScope; +- (instancetype) init { + if ((self = [super init])) { + self.payload = [RMTPayload defaultInstance]; + self.username = @""; + self.oauthScope = @""; + } + return self; +} +static RMTSimpleResponse* defaultRMTSimpleResponseInstance = nil; ++ (void) initialize { + if (self == [RMTSimpleResponse class]) { + defaultRMTSimpleResponseInstance = [[RMTSimpleResponse alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTSimpleResponseInstance; +} +- (instancetype) defaultInstance { + return defaultRMTSimpleResponseInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasPayload) { + [output writeMessage:1 value:self.payload]; + } + if (self.hasUsername) { + [output writeString:2 value:self.username]; + } + if (self.hasOauthScope) { + [output writeString:3 value:self.oauthScope]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasPayload) { + size_ += computeMessageSize(1, self.payload); + } + if (self.hasUsername) { + size_ += computeStringSize(2, self.username); + } + if (self.hasOauthScope) { + size_ += computeStringSize(3, self.oauthScope); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTSimpleResponse*) parseFromData:(NSData*) data { + return (RMTSimpleResponse*)[[[RMTSimpleResponse builder] mergeFromData:data] build]; +} ++ (RMTSimpleResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTSimpleResponse*)[[[RMTSimpleResponse builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTSimpleResponse*) parseFromInputStream:(NSInputStream*) input { + return (RMTSimpleResponse*)[[[RMTSimpleResponse builder] mergeFromInputStream:input] build]; +} ++ (RMTSimpleResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTSimpleResponse*)[[[RMTSimpleResponse builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTSimpleResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTSimpleResponse*)[[[RMTSimpleResponse builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTSimpleResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTSimpleResponse*)[[[RMTSimpleResponse builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTSimpleResponseBuilder*) builder { + return [[RMTSimpleResponseBuilder alloc] init]; +} ++ (RMTSimpleResponseBuilder*) builderWithPrototype:(RMTSimpleResponse*) prototype { + return [[RMTSimpleResponse builder] mergeFrom:prototype]; +} +- (RMTSimpleResponseBuilder*) builder { + return [RMTSimpleResponse builder]; +} +- (RMTSimpleResponseBuilder*) toBuilder { + return [RMTSimpleResponse builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasPayload) { + [output appendFormat:@"%@%@ {\n", indent, @"payload"]; + [self.payload writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + if (self.hasUsername) { + [output appendFormat:@"%@%@: %@\n", indent, @"username", self.username]; + } + if (self.hasOauthScope) { + [output appendFormat:@"%@%@: %@\n", indent, @"oauthScope", self.oauthScope]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTSimpleResponse class]]) { + return NO; + } + RMTSimpleResponse *otherMessage = other; + return + self.hasPayload == otherMessage.hasPayload && + (!self.hasPayload || [self.payload isEqual:otherMessage.payload]) && + self.hasUsername == otherMessage.hasUsername && + (!self.hasUsername || [self.username isEqual:otherMessage.username]) && + self.hasOauthScope == otherMessage.hasOauthScope && + (!self.hasOauthScope || [self.oauthScope isEqual:otherMessage.oauthScope]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasPayload) { + hashCode = hashCode * 31 + [self.payload hash]; + } + if (self.hasUsername) { + hashCode = hashCode * 31 + [self.username hash]; + } + if (self.hasOauthScope) { + hashCode = hashCode * 31 + [self.oauthScope hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTSimpleResponseBuilder() +@property (strong) RMTSimpleResponse* resultSimpleResponse; +@end + +@implementation RMTSimpleResponseBuilder +@synthesize resultSimpleResponse; +- (instancetype) init { + if ((self = [super init])) { + self.resultSimpleResponse = [[RMTSimpleResponse alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultSimpleResponse; +} +- (RMTSimpleResponseBuilder*) clear { + self.resultSimpleResponse = [[RMTSimpleResponse alloc] init]; + return self; +} +- (RMTSimpleResponseBuilder*) clone { + return [RMTSimpleResponse builderWithPrototype:resultSimpleResponse]; +} +- (RMTSimpleResponse*) defaultInstance { + return [RMTSimpleResponse defaultInstance]; +} +- (RMTSimpleResponse*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTSimpleResponse*) buildPartial { + RMTSimpleResponse* returnMe = resultSimpleResponse; + self.resultSimpleResponse = nil; + return returnMe; +} +- (RMTSimpleResponseBuilder*) mergeFrom:(RMTSimpleResponse*) other { + if (other == [RMTSimpleResponse defaultInstance]) { + return self; + } + if (other.hasPayload) { + [self mergePayload:other.payload]; + } + if (other.hasUsername) { + [self setUsername:other.username]; + } + if (other.hasOauthScope) { + [self setOauthScope:other.oauthScope]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTSimpleResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTSimpleResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + RMTPayloadBuilder* subBuilder = [RMTPayload builder]; + if (self.hasPayload) { + [subBuilder mergeFrom:self.payload]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setPayload:[subBuilder buildPartial]]; + break; + } + case 18: { + [self setUsername:[input readString]]; + break; + } + case 26: { + [self setOauthScope:[input readString]]; + break; + } + } + } +} +- (BOOL) hasPayload { + return resultSimpleResponse.hasPayload; +} +- (RMTPayload*) payload { + return resultSimpleResponse.payload; +} +- (RMTSimpleResponseBuilder*) setPayload:(RMTPayload*) value { + resultSimpleResponse.hasPayload = YES; + resultSimpleResponse.payload = value; + return self; +} +- (RMTSimpleResponseBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue { + return [self setPayload:[builderForValue build]]; +} +- (RMTSimpleResponseBuilder*) mergePayload:(RMTPayload*) value { + if (resultSimpleResponse.hasPayload && + resultSimpleResponse.payload != [RMTPayload defaultInstance]) { + resultSimpleResponse.payload = + [[[RMTPayload builderWithPrototype:resultSimpleResponse.payload] mergeFrom:value] buildPartial]; + } else { + resultSimpleResponse.payload = value; + } + resultSimpleResponse.hasPayload = YES; + return self; +} +- (RMTSimpleResponseBuilder*) clearPayload { + resultSimpleResponse.hasPayload = NO; + resultSimpleResponse.payload = [RMTPayload defaultInstance]; + return self; +} +- (BOOL) hasUsername { + return resultSimpleResponse.hasUsername; +} +- (NSString*) username { + return resultSimpleResponse.username; +} +- (RMTSimpleResponseBuilder*) setUsername:(NSString*) value { + resultSimpleResponse.hasUsername = YES; + resultSimpleResponse.username = value; + return self; +} +- (RMTSimpleResponseBuilder*) clearUsername { + resultSimpleResponse.hasUsername = NO; + resultSimpleResponse.username = @""; + return self; +} +- (BOOL) hasOauthScope { + return resultSimpleResponse.hasOauthScope; +} +- (NSString*) oauthScope { + return resultSimpleResponse.oauthScope; +} +- (RMTSimpleResponseBuilder*) setOauthScope:(NSString*) value { + resultSimpleResponse.hasOauthScope = YES; + resultSimpleResponse.oauthScope = value; + return self; +} +- (RMTSimpleResponseBuilder*) clearOauthScope { + resultSimpleResponse.hasOauthScope = NO; + resultSimpleResponse.oauthScope = @""; + return self; +} +@end + +@interface RMTStreamingInputCallRequest () +@property (strong) RMTPayload* payload; +@end + +@implementation RMTStreamingInputCallRequest + +- (BOOL) hasPayload { + return !!hasPayload_; +} +- (void) setHasPayload:(BOOL) _value_ { + hasPayload_ = !!_value_; +} +@synthesize payload; +- (instancetype) init { + if ((self = [super init])) { + self.payload = [RMTPayload defaultInstance]; + } + return self; +} +static RMTStreamingInputCallRequest* defaultRMTStreamingInputCallRequestInstance = nil; ++ (void) initialize { + if (self == [RMTStreamingInputCallRequest class]) { + defaultRMTStreamingInputCallRequestInstance = [[RMTStreamingInputCallRequest alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTStreamingInputCallRequestInstance; +} +- (instancetype) defaultInstance { + return defaultRMTStreamingInputCallRequestInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasPayload) { + [output writeMessage:1 value:self.payload]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasPayload) { + size_ += computeMessageSize(1, self.payload); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTStreamingInputCallRequest*) parseFromData:(NSData*) data { + return (RMTStreamingInputCallRequest*)[[[RMTStreamingInputCallRequest builder] mergeFromData:data] build]; +} ++ (RMTStreamingInputCallRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingInputCallRequest*)[[[RMTStreamingInputCallRequest builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingInputCallRequest*) parseFromInputStream:(NSInputStream*) input { + return (RMTStreamingInputCallRequest*)[[[RMTStreamingInputCallRequest builder] mergeFromInputStream:input] build]; +} ++ (RMTStreamingInputCallRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingInputCallRequest*)[[[RMTStreamingInputCallRequest builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingInputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTStreamingInputCallRequest*)[[[RMTStreamingInputCallRequest builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTStreamingInputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingInputCallRequest*)[[[RMTStreamingInputCallRequest builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingInputCallRequestBuilder*) builder { + return [[RMTStreamingInputCallRequestBuilder alloc] init]; +} ++ (RMTStreamingInputCallRequestBuilder*) builderWithPrototype:(RMTStreamingInputCallRequest*) prototype { + return [[RMTStreamingInputCallRequest builder] mergeFrom:prototype]; +} +- (RMTStreamingInputCallRequestBuilder*) builder { + return [RMTStreamingInputCallRequest builder]; +} +- (RMTStreamingInputCallRequestBuilder*) toBuilder { + return [RMTStreamingInputCallRequest builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasPayload) { + [output appendFormat:@"%@%@ {\n", indent, @"payload"]; + [self.payload writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTStreamingInputCallRequest class]]) { + return NO; + } + RMTStreamingInputCallRequest *otherMessage = other; + return + self.hasPayload == otherMessage.hasPayload && + (!self.hasPayload || [self.payload isEqual:otherMessage.payload]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasPayload) { + hashCode = hashCode * 31 + [self.payload hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTStreamingInputCallRequestBuilder() +@property (strong) RMTStreamingInputCallRequest* resultStreamingInputCallRequest; +@end + +@implementation RMTStreamingInputCallRequestBuilder +@synthesize resultStreamingInputCallRequest; +- (instancetype) init { + if ((self = [super init])) { + self.resultStreamingInputCallRequest = [[RMTStreamingInputCallRequest alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultStreamingInputCallRequest; +} +- (RMTStreamingInputCallRequestBuilder*) clear { + self.resultStreamingInputCallRequest = [[RMTStreamingInputCallRequest alloc] init]; + return self; +} +- (RMTStreamingInputCallRequestBuilder*) clone { + return [RMTStreamingInputCallRequest builderWithPrototype:resultStreamingInputCallRequest]; +} +- (RMTStreamingInputCallRequest*) defaultInstance { + return [RMTStreamingInputCallRequest defaultInstance]; +} +- (RMTStreamingInputCallRequest*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTStreamingInputCallRequest*) buildPartial { + RMTStreamingInputCallRequest* returnMe = resultStreamingInputCallRequest; + self.resultStreamingInputCallRequest = nil; + return returnMe; +} +- (RMTStreamingInputCallRequestBuilder*) mergeFrom:(RMTStreamingInputCallRequest*) other { + if (other == [RMTStreamingInputCallRequest defaultInstance]) { + return self; + } + if (other.hasPayload) { + [self mergePayload:other.payload]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTStreamingInputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTStreamingInputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + RMTPayloadBuilder* subBuilder = [RMTPayload builder]; + if (self.hasPayload) { + [subBuilder mergeFrom:self.payload]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setPayload:[subBuilder buildPartial]]; + break; + } + } + } +} +- (BOOL) hasPayload { + return resultStreamingInputCallRequest.hasPayload; +} +- (RMTPayload*) payload { + return resultStreamingInputCallRequest.payload; +} +- (RMTStreamingInputCallRequestBuilder*) setPayload:(RMTPayload*) value { + resultStreamingInputCallRequest.hasPayload = YES; + resultStreamingInputCallRequest.payload = value; + return self; +} +- (RMTStreamingInputCallRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue { + return [self setPayload:[builderForValue build]]; +} +- (RMTStreamingInputCallRequestBuilder*) mergePayload:(RMTPayload*) value { + if (resultStreamingInputCallRequest.hasPayload && + resultStreamingInputCallRequest.payload != [RMTPayload defaultInstance]) { + resultStreamingInputCallRequest.payload = + [[[RMTPayload builderWithPrototype:resultStreamingInputCallRequest.payload] mergeFrom:value] buildPartial]; + } else { + resultStreamingInputCallRequest.payload = value; + } + resultStreamingInputCallRequest.hasPayload = YES; + return self; +} +- (RMTStreamingInputCallRequestBuilder*) clearPayload { + resultStreamingInputCallRequest.hasPayload = NO; + resultStreamingInputCallRequest.payload = [RMTPayload defaultInstance]; + return self; +} +@end + +@interface RMTStreamingInputCallResponse () +@property SInt32 aggregatedPayloadSize; +@end + +@implementation RMTStreamingInputCallResponse + +- (BOOL) hasAggregatedPayloadSize { + return !!hasAggregatedPayloadSize_; +} +- (void) setHasAggregatedPayloadSize:(BOOL) _value_ { + hasAggregatedPayloadSize_ = !!_value_; +} +@synthesize aggregatedPayloadSize; +- (instancetype) init { + if ((self = [super init])) { + self.aggregatedPayloadSize = 0; + } + return self; +} +static RMTStreamingInputCallResponse* defaultRMTStreamingInputCallResponseInstance = nil; ++ (void) initialize { + if (self == [RMTStreamingInputCallResponse class]) { + defaultRMTStreamingInputCallResponseInstance = [[RMTStreamingInputCallResponse alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTStreamingInputCallResponseInstance; +} +- (instancetype) defaultInstance { + return defaultRMTStreamingInputCallResponseInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasAggregatedPayloadSize) { + [output writeInt32:1 value:self.aggregatedPayloadSize]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasAggregatedPayloadSize) { + size_ += computeInt32Size(1, self.aggregatedPayloadSize); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTStreamingInputCallResponse*) parseFromData:(NSData*) data { + return (RMTStreamingInputCallResponse*)[[[RMTStreamingInputCallResponse builder] mergeFromData:data] build]; +} ++ (RMTStreamingInputCallResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingInputCallResponse*)[[[RMTStreamingInputCallResponse builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingInputCallResponse*) parseFromInputStream:(NSInputStream*) input { + return (RMTStreamingInputCallResponse*)[[[RMTStreamingInputCallResponse builder] mergeFromInputStream:input] build]; +} ++ (RMTStreamingInputCallResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingInputCallResponse*)[[[RMTStreamingInputCallResponse builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingInputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTStreamingInputCallResponse*)[[[RMTStreamingInputCallResponse builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTStreamingInputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingInputCallResponse*)[[[RMTStreamingInputCallResponse builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingInputCallResponseBuilder*) builder { + return [[RMTStreamingInputCallResponseBuilder alloc] init]; +} ++ (RMTStreamingInputCallResponseBuilder*) builderWithPrototype:(RMTStreamingInputCallResponse*) prototype { + return [[RMTStreamingInputCallResponse builder] mergeFrom:prototype]; +} +- (RMTStreamingInputCallResponseBuilder*) builder { + return [RMTStreamingInputCallResponse builder]; +} +- (RMTStreamingInputCallResponseBuilder*) toBuilder { + return [RMTStreamingInputCallResponse builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasAggregatedPayloadSize) { + [output appendFormat:@"%@%@: %@\n", indent, @"aggregatedPayloadSize", [NSNumber numberWithInteger:self.aggregatedPayloadSize]]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTStreamingInputCallResponse class]]) { + return NO; + } + RMTStreamingInputCallResponse *otherMessage = other; + return + self.hasAggregatedPayloadSize == otherMessage.hasAggregatedPayloadSize && + (!self.hasAggregatedPayloadSize || self.aggregatedPayloadSize == otherMessage.aggregatedPayloadSize) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasAggregatedPayloadSize) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.aggregatedPayloadSize] hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTStreamingInputCallResponseBuilder() +@property (strong) RMTStreamingInputCallResponse* resultStreamingInputCallResponse; +@end + +@implementation RMTStreamingInputCallResponseBuilder +@synthesize resultStreamingInputCallResponse; +- (instancetype) init { + if ((self = [super init])) { + self.resultStreamingInputCallResponse = [[RMTStreamingInputCallResponse alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultStreamingInputCallResponse; +} +- (RMTStreamingInputCallResponseBuilder*) clear { + self.resultStreamingInputCallResponse = [[RMTStreamingInputCallResponse alloc] init]; + return self; +} +- (RMTStreamingInputCallResponseBuilder*) clone { + return [RMTStreamingInputCallResponse builderWithPrototype:resultStreamingInputCallResponse]; +} +- (RMTStreamingInputCallResponse*) defaultInstance { + return [RMTStreamingInputCallResponse defaultInstance]; +} +- (RMTStreamingInputCallResponse*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTStreamingInputCallResponse*) buildPartial { + RMTStreamingInputCallResponse* returnMe = resultStreamingInputCallResponse; + self.resultStreamingInputCallResponse = nil; + return returnMe; +} +- (RMTStreamingInputCallResponseBuilder*) mergeFrom:(RMTStreamingInputCallResponse*) other { + if (other == [RMTStreamingInputCallResponse defaultInstance]) { + return self; + } + if (other.hasAggregatedPayloadSize) { + [self setAggregatedPayloadSize:other.aggregatedPayloadSize]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTStreamingInputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTStreamingInputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + [self setAggregatedPayloadSize:[input readInt32]]; + break; + } + } + } +} +- (BOOL) hasAggregatedPayloadSize { + return resultStreamingInputCallResponse.hasAggregatedPayloadSize; +} +- (SInt32) aggregatedPayloadSize { + return resultStreamingInputCallResponse.aggregatedPayloadSize; +} +- (RMTStreamingInputCallResponseBuilder*) setAggregatedPayloadSize:(SInt32) value { + resultStreamingInputCallResponse.hasAggregatedPayloadSize = YES; + resultStreamingInputCallResponse.aggregatedPayloadSize = value; + return self; +} +- (RMTStreamingInputCallResponseBuilder*) clearAggregatedPayloadSize { + resultStreamingInputCallResponse.hasAggregatedPayloadSize = NO; + resultStreamingInputCallResponse.aggregatedPayloadSize = 0; + return self; +} +@end + +@interface RMTResponseParameters () +@property SInt32 size; +@property SInt32 intervalUs; +@end + +@implementation RMTResponseParameters + +- (BOOL) hasSize { + return !!hasSize_; +} +- (void) setHasSize:(BOOL) _value_ { + hasSize_ = !!_value_; +} +@synthesize size; +- (BOOL) hasIntervalUs { + return !!hasIntervalUs_; +} +- (void) setHasIntervalUs:(BOOL) _value_ { + hasIntervalUs_ = !!_value_; +} +@synthesize intervalUs; +- (instancetype) init { + if ((self = [super init])) { + self.size = 0; + self.intervalUs = 0; + } + return self; +} +static RMTResponseParameters* defaultRMTResponseParametersInstance = nil; ++ (void) initialize { + if (self == [RMTResponseParameters class]) { + defaultRMTResponseParametersInstance = [[RMTResponseParameters alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTResponseParametersInstance; +} +- (instancetype) defaultInstance { + return defaultRMTResponseParametersInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasSize) { + [output writeInt32:1 value:self.size]; + } + if (self.hasIntervalUs) { + [output writeInt32:2 value:self.intervalUs]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasSize) { + size_ += computeInt32Size(1, self.size); + } + if (self.hasIntervalUs) { + size_ += computeInt32Size(2, self.intervalUs); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTResponseParameters*) parseFromData:(NSData*) data { + return (RMTResponseParameters*)[[[RMTResponseParameters builder] mergeFromData:data] build]; +} ++ (RMTResponseParameters*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTResponseParameters*)[[[RMTResponseParameters builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTResponseParameters*) parseFromInputStream:(NSInputStream*) input { + return (RMTResponseParameters*)[[[RMTResponseParameters builder] mergeFromInputStream:input] build]; +} ++ (RMTResponseParameters*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTResponseParameters*)[[[RMTResponseParameters builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTResponseParameters*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTResponseParameters*)[[[RMTResponseParameters builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTResponseParameters*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTResponseParameters*)[[[RMTResponseParameters builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTResponseParametersBuilder*) builder { + return [[RMTResponseParametersBuilder alloc] init]; +} ++ (RMTResponseParametersBuilder*) builderWithPrototype:(RMTResponseParameters*) prototype { + return [[RMTResponseParameters builder] mergeFrom:prototype]; +} +- (RMTResponseParametersBuilder*) builder { + return [RMTResponseParameters builder]; +} +- (RMTResponseParametersBuilder*) toBuilder { + return [RMTResponseParameters builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasSize) { + [output appendFormat:@"%@%@: %@\n", indent, @"size", [NSNumber numberWithInteger:self.size]]; + } + if (self.hasIntervalUs) { + [output appendFormat:@"%@%@: %@\n", indent, @"intervalUs", [NSNumber numberWithInteger:self.intervalUs]]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTResponseParameters class]]) { + return NO; + } + RMTResponseParameters *otherMessage = other; + return + self.hasSize == otherMessage.hasSize && + (!self.hasSize || self.size == otherMessage.size) && + self.hasIntervalUs == otherMessage.hasIntervalUs && + (!self.hasIntervalUs || self.intervalUs == otherMessage.intervalUs) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasSize) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.size] hash]; + } + if (self.hasIntervalUs) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.intervalUs] hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTResponseParametersBuilder() +@property (strong) RMTResponseParameters* resultResponseParameters; +@end + +@implementation RMTResponseParametersBuilder +@synthesize resultResponseParameters; +- (instancetype) init { + if ((self = [super init])) { + self.resultResponseParameters = [[RMTResponseParameters alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultResponseParameters; +} +- (RMTResponseParametersBuilder*) clear { + self.resultResponseParameters = [[RMTResponseParameters alloc] init]; + return self; +} +- (RMTResponseParametersBuilder*) clone { + return [RMTResponseParameters builderWithPrototype:resultResponseParameters]; +} +- (RMTResponseParameters*) defaultInstance { + return [RMTResponseParameters defaultInstance]; +} +- (RMTResponseParameters*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTResponseParameters*) buildPartial { + RMTResponseParameters* returnMe = resultResponseParameters; + self.resultResponseParameters = nil; + return returnMe; +} +- (RMTResponseParametersBuilder*) mergeFrom:(RMTResponseParameters*) other { + if (other == [RMTResponseParameters defaultInstance]) { + return self; + } + if (other.hasSize) { + [self setSize:other.size]; + } + if (other.hasIntervalUs) { + [self setIntervalUs:other.intervalUs]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTResponseParametersBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTResponseParametersBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + [self setSize:[input readInt32]]; + break; + } + case 16: { + [self setIntervalUs:[input readInt32]]; + break; + } + } + } +} +- (BOOL) hasSize { + return resultResponseParameters.hasSize; +} +- (SInt32) size { + return resultResponseParameters.size; +} +- (RMTResponseParametersBuilder*) setSize:(SInt32) value { + resultResponseParameters.hasSize = YES; + resultResponseParameters.size = value; + return self; +} +- (RMTResponseParametersBuilder*) clearSize { + resultResponseParameters.hasSize = NO; + resultResponseParameters.size = 0; + return self; +} +- (BOOL) hasIntervalUs { + return resultResponseParameters.hasIntervalUs; +} +- (SInt32) intervalUs { + return resultResponseParameters.intervalUs; +} +- (RMTResponseParametersBuilder*) setIntervalUs:(SInt32) value { + resultResponseParameters.hasIntervalUs = YES; + resultResponseParameters.intervalUs = value; + return self; +} +- (RMTResponseParametersBuilder*) clearIntervalUs { + resultResponseParameters.hasIntervalUs = NO; + resultResponseParameters.intervalUs = 0; + return self; +} +@end + +@interface RMTStreamingOutputCallRequest () +@property RMTPayloadType responseType; +@property (strong) NSMutableArray * responseParametersArray; +@property (strong) RMTPayload* payload; +@end + +@implementation RMTStreamingOutputCallRequest + +- (BOOL) hasResponseType { + return !!hasResponseType_; +} +- (void) setHasResponseType:(BOOL) _value_ { + hasResponseType_ = !!_value_; +} +@synthesize responseType; +@synthesize responseParametersArray; +@dynamic responseParameters; +- (BOOL) hasPayload { + return !!hasPayload_; +} +- (void) setHasPayload:(BOOL) _value_ { + hasPayload_ = !!_value_; +} +@synthesize payload; +- (instancetype) init { + if ((self = [super init])) { + self.responseType = RMTPayloadTypeCompressable; + self.payload = [RMTPayload defaultInstance]; + } + return self; +} +static RMTStreamingOutputCallRequest* defaultRMTStreamingOutputCallRequestInstance = nil; ++ (void) initialize { + if (self == [RMTStreamingOutputCallRequest class]) { + defaultRMTStreamingOutputCallRequestInstance = [[RMTStreamingOutputCallRequest alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTStreamingOutputCallRequestInstance; +} +- (instancetype) defaultInstance { + return defaultRMTStreamingOutputCallRequestInstance; +} +- (NSArray *)responseParameters { + return responseParametersArray; +} +- (RMTResponseParameters*)responseParametersAtIndex:(NSUInteger)index { + return [responseParametersArray objectAtIndex:index]; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasResponseType) { + [output writeEnum:1 value:self.responseType]; + } + [self.responseParametersArray enumerateObjectsUsingBlock:^(RMTResponseParameters *element, NSUInteger idx, BOOL *stop) { + [output writeMessage:2 value:element]; + }]; + if (self.hasPayload) { + [output writeMessage:3 value:self.payload]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasResponseType) { + size_ += computeEnumSize(1, self.responseType); + } + [self.responseParametersArray enumerateObjectsUsingBlock:^(RMTResponseParameters *element, NSUInteger idx, BOOL *stop) { + size_ += computeMessageSize(2, element); + }]; + if (self.hasPayload) { + size_ += computeMessageSize(3, self.payload); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTStreamingOutputCallRequest*) parseFromData:(NSData*) data { + return (RMTStreamingOutputCallRequest*)[[[RMTStreamingOutputCallRequest builder] mergeFromData:data] build]; +} ++ (RMTStreamingOutputCallRequest*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingOutputCallRequest*)[[[RMTStreamingOutputCallRequest builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingOutputCallRequest*) parseFromInputStream:(NSInputStream*) input { + return (RMTStreamingOutputCallRequest*)[[[RMTStreamingOutputCallRequest builder] mergeFromInputStream:input] build]; +} ++ (RMTStreamingOutputCallRequest*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingOutputCallRequest*)[[[RMTStreamingOutputCallRequest builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingOutputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTStreamingOutputCallRequest*)[[[RMTStreamingOutputCallRequest builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTStreamingOutputCallRequest*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingOutputCallRequest*)[[[RMTStreamingOutputCallRequest builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingOutputCallRequestBuilder*) builder { + return [[RMTStreamingOutputCallRequestBuilder alloc] init]; +} ++ (RMTStreamingOutputCallRequestBuilder*) builderWithPrototype:(RMTStreamingOutputCallRequest*) prototype { + return [[RMTStreamingOutputCallRequest builder] mergeFrom:prototype]; +} +- (RMTStreamingOutputCallRequestBuilder*) builder { + return [RMTStreamingOutputCallRequest builder]; +} +- (RMTStreamingOutputCallRequestBuilder*) toBuilder { + return [RMTStreamingOutputCallRequest builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasResponseType) { + [output appendFormat:@"%@%@: %@\n", indent, @"responseType", NSStringFromRMTPayloadType(self.responseType)]; + } + [self.responseParametersArray enumerateObjectsUsingBlock:^(RMTResponseParameters *element, NSUInteger idx, BOOL *stop) { + [output appendFormat:@"%@%@ {\n", indent, @"responseParameters"]; + [element writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + }]; + if (self.hasPayload) { + [output appendFormat:@"%@%@ {\n", indent, @"payload"]; + [self.payload writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTStreamingOutputCallRequest class]]) { + return NO; + } + RMTStreamingOutputCallRequest *otherMessage = other; + return + self.hasResponseType == otherMessage.hasResponseType && + (!self.hasResponseType || self.responseType == otherMessage.responseType) && + [self.responseParametersArray isEqualToArray:otherMessage.responseParametersArray] && + self.hasPayload == otherMessage.hasPayload && + (!self.hasPayload || [self.payload isEqual:otherMessage.payload]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasResponseType) { + hashCode = hashCode * 31 + self.responseType; + } + [self.responseParametersArray enumerateObjectsUsingBlock:^(RMTResponseParameters *element, NSUInteger idx, BOOL *stop) { + hashCode = hashCode * 31 + [element hash]; + }]; + if (self.hasPayload) { + hashCode = hashCode * 31 + [self.payload hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTStreamingOutputCallRequestBuilder() +@property (strong) RMTStreamingOutputCallRequest* resultStreamingOutputCallRequest; +@end + +@implementation RMTStreamingOutputCallRequestBuilder +@synthesize resultStreamingOutputCallRequest; +- (instancetype) init { + if ((self = [super init])) { + self.resultStreamingOutputCallRequest = [[RMTStreamingOutputCallRequest alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultStreamingOutputCallRequest; +} +- (RMTStreamingOutputCallRequestBuilder*) clear { + self.resultStreamingOutputCallRequest = [[RMTStreamingOutputCallRequest alloc] init]; + return self; +} +- (RMTStreamingOutputCallRequestBuilder*) clone { + return [RMTStreamingOutputCallRequest builderWithPrototype:resultStreamingOutputCallRequest]; +} +- (RMTStreamingOutputCallRequest*) defaultInstance { + return [RMTStreamingOutputCallRequest defaultInstance]; +} +- (RMTStreamingOutputCallRequest*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTStreamingOutputCallRequest*) buildPartial { + RMTStreamingOutputCallRequest* returnMe = resultStreamingOutputCallRequest; + self.resultStreamingOutputCallRequest = nil; + return returnMe; +} +- (RMTStreamingOutputCallRequestBuilder*) mergeFrom:(RMTStreamingOutputCallRequest*) other { + if (other == [RMTStreamingOutputCallRequest defaultInstance]) { + return self; + } + if (other.hasResponseType) { + [self setResponseType:other.responseType]; + } + if (other.responseParametersArray.count > 0) { + if (resultStreamingOutputCallRequest.responseParametersArray == nil) { + resultStreamingOutputCallRequest.responseParametersArray = [[NSMutableArray alloc] initWithArray:other.responseParametersArray]; + } else { + [resultStreamingOutputCallRequest.responseParametersArray addObjectsFromArray:other.responseParametersArray]; + } + } + if (other.hasPayload) { + [self mergePayload:other.payload]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTStreamingOutputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTStreamingOutputCallRequestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + RMTPayloadType value = (RMTPayloadType)[input readEnum]; + if (RMTPayloadTypeIsValidValue(value)) { + [self setResponseType:value]; + } else { + [unknownFields mergeVarintField:1 value:value]; + } + break; + } + case 18: { + RMTResponseParametersBuilder* subBuilder = [RMTResponseParameters builder]; + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self addResponseParameters:[subBuilder buildPartial]]; + break; + } + case 26: { + RMTPayloadBuilder* subBuilder = [RMTPayload builder]; + if (self.hasPayload) { + [subBuilder mergeFrom:self.payload]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setPayload:[subBuilder buildPartial]]; + break; + } + } + } +} +- (BOOL) hasResponseType { + return resultStreamingOutputCallRequest.hasResponseType; +} +- (RMTPayloadType) responseType { + return resultStreamingOutputCallRequest.responseType; +} +- (RMTStreamingOutputCallRequestBuilder*) setResponseType:(RMTPayloadType) value { + resultStreamingOutputCallRequest.hasResponseType = YES; + resultStreamingOutputCallRequest.responseType = value; + return self; +} +- (RMTStreamingOutputCallRequestBuilder*) clearResponseType { + resultStreamingOutputCallRequest.hasResponseType = NO; + resultStreamingOutputCallRequest.responseType = RMTPayloadTypeCompressable; + return self; +} +- (NSMutableArray *)responseParameters { + return resultStreamingOutputCallRequest.responseParametersArray; +} +- (RMTResponseParameters*)responseParametersAtIndex:(NSUInteger)index { + return [resultStreamingOutputCallRequest responseParametersAtIndex:index]; +} +- (RMTStreamingOutputCallRequestBuilder *)addResponseParameters:(RMTResponseParameters*)value { + if (resultStreamingOutputCallRequest.responseParametersArray == nil) { + resultStreamingOutputCallRequest.responseParametersArray = [[NSMutableArray alloc]init]; + } + [resultStreamingOutputCallRequest.responseParametersArray addObject:value]; + return self; +} +- (RMTStreamingOutputCallRequestBuilder *)setResponseParametersArray:(NSArray *)array { + resultStreamingOutputCallRequest.responseParametersArray = [[NSMutableArray alloc]initWithArray:array]; + return self; +} +- (RMTStreamingOutputCallRequestBuilder *)clearResponseParameters { + resultStreamingOutputCallRequest.responseParametersArray = nil; + return self; +} +- (BOOL) hasPayload { + return resultStreamingOutputCallRequest.hasPayload; +} +- (RMTPayload*) payload { + return resultStreamingOutputCallRequest.payload; +} +- (RMTStreamingOutputCallRequestBuilder*) setPayload:(RMTPayload*) value { + resultStreamingOutputCallRequest.hasPayload = YES; + resultStreamingOutputCallRequest.payload = value; + return self; +} +- (RMTStreamingOutputCallRequestBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue { + return [self setPayload:[builderForValue build]]; +} +- (RMTStreamingOutputCallRequestBuilder*) mergePayload:(RMTPayload*) value { + if (resultStreamingOutputCallRequest.hasPayload && + resultStreamingOutputCallRequest.payload != [RMTPayload defaultInstance]) { + resultStreamingOutputCallRequest.payload = + [[[RMTPayload builderWithPrototype:resultStreamingOutputCallRequest.payload] mergeFrom:value] buildPartial]; + } else { + resultStreamingOutputCallRequest.payload = value; + } + resultStreamingOutputCallRequest.hasPayload = YES; + return self; +} +- (RMTStreamingOutputCallRequestBuilder*) clearPayload { + resultStreamingOutputCallRequest.hasPayload = NO; + resultStreamingOutputCallRequest.payload = [RMTPayload defaultInstance]; + return self; +} +@end + +@interface RMTStreamingOutputCallResponse () +@property (strong) RMTPayload* payload; +@end + +@implementation RMTStreamingOutputCallResponse + +- (BOOL) hasPayload { + return !!hasPayload_; +} +- (void) setHasPayload:(BOOL) _value_ { + hasPayload_ = !!_value_; +} +@synthesize payload; +- (instancetype) init { + if ((self = [super init])) { + self.payload = [RMTPayload defaultInstance]; + } + return self; +} +static RMTStreamingOutputCallResponse* defaultRMTStreamingOutputCallResponseInstance = nil; ++ (void) initialize { + if (self == [RMTStreamingOutputCallResponse class]) { + defaultRMTStreamingOutputCallResponseInstance = [[RMTStreamingOutputCallResponse alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRMTStreamingOutputCallResponseInstance; +} +- (instancetype) defaultInstance { + return defaultRMTStreamingOutputCallResponseInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasPayload) { + [output writeMessage:1 value:self.payload]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasPayload) { + size_ += computeMessageSize(1, self.payload); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RMTStreamingOutputCallResponse*) parseFromData:(NSData*) data { + return (RMTStreamingOutputCallResponse*)[[[RMTStreamingOutputCallResponse builder] mergeFromData:data] build]; +} ++ (RMTStreamingOutputCallResponse*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingOutputCallResponse*)[[[RMTStreamingOutputCallResponse builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingOutputCallResponse*) parseFromInputStream:(NSInputStream*) input { + return (RMTStreamingOutputCallResponse*)[[[RMTStreamingOutputCallResponse builder] mergeFromInputStream:input] build]; +} ++ (RMTStreamingOutputCallResponse*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingOutputCallResponse*)[[[RMTStreamingOutputCallResponse builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingOutputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RMTStreamingOutputCallResponse*)[[[RMTStreamingOutputCallResponse builder] mergeFromCodedInputStream:input] build]; +} ++ (RMTStreamingOutputCallResponse*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RMTStreamingOutputCallResponse*)[[[RMTStreamingOutputCallResponse builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RMTStreamingOutputCallResponseBuilder*) builder { + return [[RMTStreamingOutputCallResponseBuilder alloc] init]; +} ++ (RMTStreamingOutputCallResponseBuilder*) builderWithPrototype:(RMTStreamingOutputCallResponse*) prototype { + return [[RMTStreamingOutputCallResponse builder] mergeFrom:prototype]; +} +- (RMTStreamingOutputCallResponseBuilder*) builder { + return [RMTStreamingOutputCallResponse builder]; +} +- (RMTStreamingOutputCallResponseBuilder*) toBuilder { + return [RMTStreamingOutputCallResponse builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasPayload) { + [output appendFormat:@"%@%@ {\n", indent, @"payload"]; + [self.payload writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RMTStreamingOutputCallResponse class]]) { + return NO; + } + RMTStreamingOutputCallResponse *otherMessage = other; + return + self.hasPayload == otherMessage.hasPayload && + (!self.hasPayload || [self.payload isEqual:otherMessage.payload]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasPayload) { + hashCode = hashCode * 31 + [self.payload hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RMTStreamingOutputCallResponseBuilder() +@property (strong) RMTStreamingOutputCallResponse* resultStreamingOutputCallResponse; +@end + +@implementation RMTStreamingOutputCallResponseBuilder +@synthesize resultStreamingOutputCallResponse; +- (instancetype) init { + if ((self = [super init])) { + self.resultStreamingOutputCallResponse = [[RMTStreamingOutputCallResponse alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultStreamingOutputCallResponse; +} +- (RMTStreamingOutputCallResponseBuilder*) clear { + self.resultStreamingOutputCallResponse = [[RMTStreamingOutputCallResponse alloc] init]; + return self; +} +- (RMTStreamingOutputCallResponseBuilder*) clone { + return [RMTStreamingOutputCallResponse builderWithPrototype:resultStreamingOutputCallResponse]; +} +- (RMTStreamingOutputCallResponse*) defaultInstance { + return [RMTStreamingOutputCallResponse defaultInstance]; +} +- (RMTStreamingOutputCallResponse*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RMTStreamingOutputCallResponse*) buildPartial { + RMTStreamingOutputCallResponse* returnMe = resultStreamingOutputCallResponse; + self.resultStreamingOutputCallResponse = nil; + return returnMe; +} +- (RMTStreamingOutputCallResponseBuilder*) mergeFrom:(RMTStreamingOutputCallResponse*) other { + if (other == [RMTStreamingOutputCallResponse defaultInstance]) { + return self; + } + if (other.hasPayload) { + [self mergePayload:other.payload]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RMTStreamingOutputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RMTStreamingOutputCallResponseBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + RMTPayloadBuilder* subBuilder = [RMTPayload builder]; + if (self.hasPayload) { + [subBuilder mergeFrom:self.payload]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setPayload:[subBuilder buildPartial]]; + break; + } + } + } +} +- (BOOL) hasPayload { + return resultStreamingOutputCallResponse.hasPayload; +} +- (RMTPayload*) payload { + return resultStreamingOutputCallResponse.payload; +} +- (RMTStreamingOutputCallResponseBuilder*) setPayload:(RMTPayload*) value { + resultStreamingOutputCallResponse.hasPayload = YES; + resultStreamingOutputCallResponse.payload = value; + return self; +} +- (RMTStreamingOutputCallResponseBuilder*) setPayloadBuilder:(RMTPayloadBuilder*) builderForValue { + return [self setPayload:[builderForValue build]]; +} +- (RMTStreamingOutputCallResponseBuilder*) mergePayload:(RMTPayload*) value { + if (resultStreamingOutputCallResponse.hasPayload && + resultStreamingOutputCallResponse.payload != [RMTPayload defaultInstance]) { + resultStreamingOutputCallResponse.payload = + [[[RMTPayload builderWithPrototype:resultStreamingOutputCallResponse.payload] mergeFrom:value] buildPartial]; + } else { + resultStreamingOutputCallResponse.payload = value; + } + resultStreamingOutputCallResponse.hasPayload = YES; + return self; +} +- (RMTStreamingOutputCallResponseBuilder*) clearPayload { + resultStreamingOutputCallResponse.hasPayload = NO; + resultStreamingOutputCallResponse.payload = [RMTPayload defaultInstance]; + return self; +} +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/RemoteTestClient/Test.pb.h b/src/objective-c/examples/Sample/RemoteTestClient/Test.pb.h new file mode 100644 index 00000000000..6db981dc5bb --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/Test.pb.h @@ -0,0 +1,81 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import + +#import "Empty.pb.h" +#import "Messages.pb.h" +// @@protoc_insertion_point(imports) + +@class ObjectiveCFileOptions; +@class ObjectiveCFileOptionsBuilder; +@class PBDescriptorProto; +@class PBDescriptorProtoBuilder; +@class PBDescriptorProtoExtensionRange; +@class PBDescriptorProtoExtensionRangeBuilder; +@class PBEnumDescriptorProto; +@class PBEnumDescriptorProtoBuilder; +@class PBEnumOptions; +@class PBEnumOptionsBuilder; +@class PBEnumValueDescriptorProto; +@class PBEnumValueDescriptorProtoBuilder; +@class PBEnumValueOptions; +@class PBEnumValueOptionsBuilder; +@class PBFieldDescriptorProto; +@class PBFieldDescriptorProtoBuilder; +@class PBFieldOptions; +@class PBFieldOptionsBuilder; +@class PBFileDescriptorProto; +@class PBFileDescriptorProtoBuilder; +@class PBFileDescriptorSet; +@class PBFileDescriptorSetBuilder; +@class PBFileOptions; +@class PBFileOptionsBuilder; +@class PBMessageOptions; +@class PBMessageOptionsBuilder; +@class PBMethodDescriptorProto; +@class PBMethodDescriptorProtoBuilder; +@class PBMethodOptions; +@class PBMethodOptionsBuilder; +@class PBOneofDescriptorProto; +@class PBOneofDescriptorProtoBuilder; +@class PBServiceDescriptorProto; +@class PBServiceDescriptorProtoBuilder; +@class PBServiceOptions; +@class PBServiceOptionsBuilder; +@class PBSourceCodeInfo; +@class PBSourceCodeInfoBuilder; +@class PBSourceCodeInfoLocation; +@class PBSourceCodeInfoLocationBuilder; +@class PBUninterpretedOption; +@class PBUninterpretedOptionBuilder; +@class PBUninterpretedOptionNamePart; +@class PBUninterpretedOptionNamePartBuilder; +@class RMTEmpty; +@class RMTEmptyBuilder; +@class RMTPayload; +@class RMTPayloadBuilder; +@class RMTResponseParameters; +@class RMTResponseParametersBuilder; +@class RMTSimpleRequest; +@class RMTSimpleRequestBuilder; +@class RMTSimpleResponse; +@class RMTSimpleResponseBuilder; +@class RMTStreamingInputCallRequest; +@class RMTStreamingInputCallRequestBuilder; +@class RMTStreamingInputCallResponse; +@class RMTStreamingInputCallResponseBuilder; +@class RMTStreamingOutputCallRequest; +@class RMTStreamingOutputCallRequestBuilder; +@class RMTStreamingOutputCallResponse; +@class RMTStreamingOutputCallResponseBuilder; + + + +@interface RMTTestRoot : NSObject { +} ++ (PBExtensionRegistry*) extensionRegistry; ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/RemoteTestClient/Test.pb.m b/src/objective-c/examples/Sample/RemoteTestClient/Test.pb.m new file mode 100644 index 00000000000..bd6a29df413 --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/Test.pb.m @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import "Test.pb.h" +// @@protoc_insertion_point(imports) + +@implementation RMTTestRoot +static PBExtensionRegistry* extensionRegistry = nil; ++ (PBExtensionRegistry*) extensionRegistry { + return extensionRegistry; +} + ++ (void) initialize { + if (self == [RMTTestRoot class]) { + PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; + [self registerAllExtensions:registry]; + [RMTEmptyRoot registerAllExtensions:registry]; + [RMTMessagesRoot registerAllExtensions:registry]; + [ObjectivecDescriptorRoot registerAllExtensions:registry]; + extensionRegistry = registry; + } +} ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { +} +@end + + +// @@protoc_insertion_point(global_scope) From d168f50e4e8a874e587c7ab79c102636b92438fd Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 23:08:27 -0700 Subject: [PATCH 35/46] Adds podspec for the generated files --- src/objective-c/examples/Sample/Podfile | 1 + .../Sample/RemoteTestClient/RemoteTest.podspec | 17 +++++++++++++++++ .../Sample/RouteGuideClient/Route_guide.podspec | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/objective-c/examples/Sample/RemoteTestClient/RemoteTest.podspec diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index 471b83c6c7d..8b1a90e39bd 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -3,6 +3,7 @@ platform :ios, '8.0' pod 'gRPC', :path => "../../../.." pod 'Route_guide', :path => "RouteGuideClient" +pod 'RemoteTest', :path => "RemoteTestClient" link_with 'Sample', 'SampleTests' diff --git a/src/objective-c/examples/Sample/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/Sample/RemoteTestClient/RemoteTest.podspec new file mode 100644 index 00000000000..4790594bc5b --- /dev/null +++ b/src/objective-c/examples/Sample/RemoteTestClient/RemoteTest.podspec @@ -0,0 +1,17 @@ +Pod::Spec.new do |s| + s.name = 'RemoteTest' + s.version = '0.0.1' + s.summary = 'Protobuf library generated from test.proto, messages.proto, and empty.proto' + s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RemoteTestClient' + s.license = 'New BSD' + s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } + + s.source_files = '*.pb.{h,m}' + s.public_header_files = '*.pb.h' + + s.platform = :ios + s.ios.deployment_target = '6.0' + s.requires_arc = true + + s.dependency 'ProtocolBuffers', '~> 1.9' +end diff --git a/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec b/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec index 6fba1c5c1e3..04d847bf8ff 100644 --- a/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec +++ b/src/objective-c/examples/Sample/RouteGuideClient/Route_guide.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'Route_guide' s.version = '0.0.1' s.summary = 'Protobuf library generated from route_guide.proto' - s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/protos' + s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RouteGuideClient' s.license = 'New BSD' s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } From 25e28e801ff6b4a34de7b3defa7b61ac733e3e01 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 23:10:10 -0700 Subject: [PATCH 36/46] Fixes proto remote test to use the actual protos of the service. --- .../examples/Sample/SampleTests/RemoteTests.m | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/objective-c/examples/Sample/SampleTests/RemoteTests.m b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m index ba5d46f277c..7dcc01ae099 100644 --- a/src/objective-c/examples/Sample/SampleTests/RemoteTests.m +++ b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m @@ -36,7 +36,7 @@ #import #import -#import +#import #import #import @@ -111,8 +111,12 @@ interface:@"TestService" method:@"UnaryCall"]; - RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build]; - id requestsWriter = [GRXWriter writerWithValue:[point data]]; + RMTSimpleRequest *request = [[[[[[RMTSimpleRequestBuilder alloc] init] + setResponseSize:100] + setFillUsername:YES] + setFillOauthScope:YES] + build]; + id requestsWriter = [GRXWriter writerWithValue:[request data]]; GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com" method:method @@ -121,9 +125,11 @@ id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { XCTAssertNotNil(value, @"nil value received as response."); [response fulfill]; - RGDFeature *feature = [RGDFeature parseFromData:value]; - XCTAssertEqualObjects(point, feature.location); - XCTAssertNotNil(feature.name, @"Response's name is nil."); + XCTAssertGreaterThan(value.length, 0, @"Empty response received."); + RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value]; + // We expect empty strings, not nil: + XCTAssertNotNil(response.username, @"Response's username is nil."); + XCTAssertNotNil(response.oauthScope, @"Response's OAuth scope is nil."); [expectedResponse fulfill]; } completionHandler:^(NSError *errorOrNil) { XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); From 5cff49dfca5d2bf610056f78056e983d6aefe0ef Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 23:35:52 -0700 Subject: [PATCH 37/46] Adds proto support to the main app too. --- .../examples/Sample/Sample/ViewController.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 99d6df522d6..8afe8a6e99b 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -37,6 +37,7 @@ #import #import #import +#import @interface ViewController () @@ -50,16 +51,22 @@ GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing" interface:@"TestService" - method:@"EmptyCall"]; + method:@"UnaryCall"]; - id requestsWriter = [GRXWriter writerWithValue:[NSData data]]; + RMTSimpleRequest *request = [[[[[[RMTSimpleRequestBuilder alloc] init] + setResponseSize:100] + setFillUsername:YES] + setFillOauthScope:YES] + build]; + id requestsWriter = [GRXWriter writerWithValue:[request data]]; GRPCCall *call = [[GRPCCall alloc] initWithHost:@"grpc-test.sandbox.google.com" method:method requestsWriter:requestsWriter]; id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { - NSLog(@"Received response: %@", value); + RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value]; + NSLog(@"Received response: %@", response); } completionHandler:^(NSError *errorOrNil) { NSLog(@"Finished with error: %@", errorOrNil); }]; From 914d74ee37d191df7dab08d9ab27ffec8b518564 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 23:38:24 -0700 Subject: [PATCH 38/46] Small logging formatting fix --- src/objective-c/examples/Sample/Sample/ViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 8afe8a6e99b..8c97d14ff7d 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -66,7 +66,7 @@ id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value]; - NSLog(@"Received response: %@", response); + NSLog(@"Received response:\n%@", response); } completionHandler:^(NSError *errorOrNil) { NSLog(@"Finished with error: %@", errorOrNil); }]; From 48e07dfa10f83fc9d0f7737b50872eafc89da6b1 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Mon, 23 Mar 2015 23:40:15 -0700 Subject: [PATCH 39/46] Small cleanup of the sample app --- .../examples/Sample/Sample/AppDelegate.h | 1 - .../examples/Sample/Sample/AppDelegate.m | 25 ------------------- .../examples/Sample/Sample/ViewController.h | 3 --- .../examples/Sample/Sample/ViewController.m | 7 ------ 4 files changed, 36 deletions(-) diff --git a/src/objective-c/examples/Sample/Sample/AppDelegate.h b/src/objective-c/examples/Sample/Sample/AppDelegate.h index 867e62842ae..b1857f28e08 100644 --- a/src/objective-c/examples/Sample/Sample/AppDelegate.h +++ b/src/objective-c/examples/Sample/Sample/AppDelegate.h @@ -37,6 +37,5 @@ @property (strong, nonatomic) UIWindow *window; - @end diff --git a/src/objective-c/examples/Sample/Sample/AppDelegate.m b/src/objective-c/examples/Sample/Sample/AppDelegate.m index 66fceffd85c..12e1ad9d676 100644 --- a/src/objective-c/examples/Sample/Sample/AppDelegate.m +++ b/src/objective-c/examples/Sample/Sample/AppDelegate.m @@ -34,37 +34,12 @@ #import "AppDelegate.h" @interface AppDelegate () - @end @implementation AppDelegate - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. return YES; } -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - @end diff --git a/src/objective-c/examples/Sample/Sample/ViewController.h b/src/objective-c/examples/Sample/Sample/ViewController.h index 38cd7f92b66..c0b4aca77eb 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.h +++ b/src/objective-c/examples/Sample/Sample/ViewController.h @@ -34,7 +34,4 @@ #import @interface ViewController : UIViewController - - @end - diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 8c97d14ff7d..c7d8e0d1454 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -40,14 +40,12 @@ #import @interface ViewController () - @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing" interface:@"TestService" @@ -74,9 +72,4 @@ [call startWithWriteable:responsesWriteable]; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - @end From 638c1ee16147f40981cdfc785d520eb162dbcbea Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 21 Apr 2015 17:14:44 -0700 Subject: [PATCH 40/46] partial fix for #546 --- src/core/iomgr/tcp_server_windows.c | 6 +++++- src/core/iomgr/tcp_windows.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index d1b02a6935b..6e10da97ccb 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -191,6 +191,8 @@ static void start_accept(server_port *port) { goto failure; } + /* TODO(jtattermusch): probably a race here, we regularly get use-after-free on server shutdown */ + GPR_ASSERT(port->socket != 0xfeeefeee); success = port->AcceptEx(port->socket->socket, sock, port->addresses, 0, addrlen, addrlen, &bytes_received, &port->socket->read_info.overlapped); @@ -244,7 +246,9 @@ static void on_accept(void *arg, int success) { } if (ep) sp->server->cb(sp->server->cb_arg, ep); - start_accept(sp); + if (success) { + start_accept(sp); + } } static int add_socket_to_server(grpc_tcp_server *s, SOCKET sock, diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index 90fa8778471..71534eaa3df 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -127,6 +127,7 @@ static void on_read(void *tcpp, int success) { if (socket->read_info.wsa_error != 0) { char *utf8_message = gpr_format_message(info->wsa_error); + gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message); gpr_free(utf8_message); status = GRPC_ENDPOINT_CB_ERROR; } else { From 3dbb9c58796251b2fef1fe4de71b2f72da70f7f4 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 21 Apr 2015 19:00:25 -0700 Subject: [PATCH 41/46] Adds RemoteTests to the Xcode project, and fixes RxLibrary #imports --- .../Sample/Sample.xcodeproj/project.pbxproj | 1556 ++++++----------- .../examples/Sample/SampleTests/RemoteTests.m | 4 +- 2 files changed, 534 insertions(+), 1026 deletions(-) diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index 162046fca6f..3ddaceadce4 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -1,1024 +1,532 @@ - - - - - archiveVersion - 1 - classes - - objectVersion - 46 - objects - - 04554623324BE4A838846086 - - buildActionMask - 2147483647 - files - - inputPaths - - isa - PBXShellScriptBuildPhase - name - Copy Pods Resources - outputPaths - - runOnlyForDeploymentPostprocessing - 0 - shellPath - /bin/sh - shellScript - "${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh" - - showEnvVarsInLog - 0 - - 2DC7B7C4C0410F43B9621631 - - explicitFileType - archive.ar - includeInIndex - 0 - isa - PBXFileReference - path - libPods.a - sourceTree - BUILT_PRODUCTS_DIR - - 41F7486D8F66994B0BFB84AF - - buildActionMask - 2147483647 - files - - inputPaths - - isa - PBXShellScriptBuildPhase - name - Check Pods Manifest.lock - outputPaths - - runOnlyForDeploymentPostprocessing - 0 - shellPath - /bin/sh - shellScript - diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null -if [[ $? != 0 ]] ; then - cat << EOM -error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. -EOM - exit 1 -fi - - showEnvVarsInLog - 0 - - 60BBBBB15823BBF7639D7AA9 - - fileRef - 2DC7B7C4C0410F43B9621631 - isa - PBXBuildFile - - 6369A2611A9322E20015FC5C - - children - - 6369A26C1A9322E20015FC5C - 6369A2861A9322E20015FC5C - 6369A26B1A9322E20015FC5C - AB3331C9AE6488E61B2B094E - C4C2C5219053E079C9EFB930 - - isa - PBXGroup - sourceTree - <group> - - 6369A2621A9322E20015FC5C - - attributes - - LastUpgradeCheck - 0610 - ORGANIZATIONNAME - gRPC - TargetAttributes - - 6369A2691A9322E20015FC5C - - CreatedOnToolsVersion - 6.1.1 - - 6369A2821A9322E20015FC5C - - CreatedOnToolsVersion - 6.1.1 - TestTargetID - 6369A2691A9322E20015FC5C - - - - buildConfigurationList - 6369A2651A9322E20015FC5C - compatibilityVersion - Xcode 3.2 - developmentRegion - English - hasScannedForEncodings - 0 - isa - PBXProject - knownRegions - - en - Base - - mainGroup - 6369A2611A9322E20015FC5C - productRefGroup - 6369A26B1A9322E20015FC5C - projectDirPath - - projectReferences - - projectRoot - - targets - - 6369A2691A9322E20015FC5C - 6369A2821A9322E20015FC5C - - - 6369A2651A9322E20015FC5C - - buildConfigurations - - 6369A28B1A9322E20015FC5C - 6369A28C1A9322E20015FC5C - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release - isa - XCConfigurationList - - 6369A2661A9322E20015FC5C - - buildActionMask - 2147483647 - files - - 6369A2761A9322E20015FC5C - 6369A2731A9322E20015FC5C - 6369A2701A9322E20015FC5C - - isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 6369A2671A9322E20015FC5C - - buildActionMask - 2147483647 - files - - FC81FE63CA655031F3524EC0 - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 6369A2681A9322E20015FC5C - - buildActionMask - 2147483647 - files - - 6369A2791A9322E20015FC5C - 6369A27E1A9322E20015FC5C - 6369A27B1A9322E20015FC5C - - isa - PBXResourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 6369A2691A9322E20015FC5C - - buildConfigurationList - 6369A28D1A9322E20015FC5C - buildPhases - - 41F7486D8F66994B0BFB84AF - 6369A2661A9322E20015FC5C - 6369A2671A9322E20015FC5C - 6369A2681A9322E20015FC5C - 04554623324BE4A838846086 - - buildRules - - dependencies - - isa - PBXNativeTarget - name - Sample - productName - Sample - productReference - 6369A26A1A9322E20015FC5C - productType - com.apple.product-type.application - - 6369A26A1A9322E20015FC5C - - explicitFileType - wrapper.application - includeInIndex - 0 - isa - PBXFileReference - path - Sample.app - sourceTree - BUILT_PRODUCTS_DIR - - 6369A26B1A9322E20015FC5C - - children - - 6369A26A1A9322E20015FC5C - 6369A2831A9322E20015FC5C - - isa - PBXGroup - name - Products - sourceTree - <group> - - 6369A26C1A9322E20015FC5C - - children - - 6369A2711A9322E20015FC5C - 6369A2721A9322E20015FC5C - 6369A2741A9322E20015FC5C - 6369A2751A9322E20015FC5C - 6369A2771A9322E20015FC5C - 6369A27A1A9322E20015FC5C - 6369A27C1A9322E20015FC5C - 6369A26D1A9322E20015FC5C - - isa - PBXGroup - path - Sample - sourceTree - <group> - - 6369A26D1A9322E20015FC5C - - children - - 6369A26E1A9322E20015FC5C - 6369A26F1A9322E20015FC5C - - isa - PBXGroup - name - Supporting Files - sourceTree - <group> - - 6369A26E1A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - text.plist.xml - path - Info.plist - sourceTree - <group> - - 6369A26F1A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - main.m - sourceTree - <group> - - 6369A2701A9322E20015FC5C - - fileRef - 6369A26F1A9322E20015FC5C - isa - PBXBuildFile - - 6369A2711A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - path - AppDelegate.h - sourceTree - <group> - - 6369A2721A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - AppDelegate.m - sourceTree - <group> - - 6369A2731A9322E20015FC5C - - fileRef - 6369A2721A9322E20015FC5C - isa - PBXBuildFile - - 6369A2741A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - path - ViewController.h - sourceTree - <group> - - 6369A2751A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - ViewController.m - sourceTree - <group> - - 6369A2761A9322E20015FC5C - - fileRef - 6369A2751A9322E20015FC5C - isa - PBXBuildFile - - 6369A2771A9322E20015FC5C - - children - - 6369A2781A9322E20015FC5C - - isa - PBXVariantGroup - name - Main.storyboard - sourceTree - <group> - - 6369A2781A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - file.storyboard - name - Base - path - Base.lproj/Main.storyboard - sourceTree - <group> - - 6369A2791A9322E20015FC5C - - fileRef - 6369A2771A9322E20015FC5C - isa - PBXBuildFile - - 6369A27A1A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - folder.assetcatalog - path - Images.xcassets - sourceTree - <group> - - 6369A27B1A9322E20015FC5C - - fileRef - 6369A27A1A9322E20015FC5C - isa - PBXBuildFile - - 6369A27C1A9322E20015FC5C - - children - - 6369A27D1A9322E20015FC5C - - isa - PBXVariantGroup - name - LaunchScreen.xib - sourceTree - <group> - - 6369A27D1A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - file.xib - name - Base - path - Base.lproj/LaunchScreen.xib - sourceTree - <group> - - 6369A27E1A9322E20015FC5C - - fileRef - 6369A27C1A9322E20015FC5C - isa - PBXBuildFile - - 6369A27F1A9322E20015FC5C - - buildActionMask - 2147483647 - files - - 6369A28A1A9322E20015FC5C - - isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 6369A2801A9322E20015FC5C - - buildActionMask - 2147483647 - files - - 60BBBBB15823BBF7639D7AA9 - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 6369A2811A9322E20015FC5C - - buildActionMask - 2147483647 - files - - isa - PBXResourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 6369A2821A9322E20015FC5C - - buildConfigurationList - 6369A2901A9322E20015FC5C - buildPhases - - 75C393B2FDC60A22B2121058 - 6369A27F1A9322E20015FC5C - 6369A2801A9322E20015FC5C - 6369A2811A9322E20015FC5C - 7B8CDC152F76D6014A96C798 - - buildRules - - dependencies - - 6369A2851A9322E20015FC5C - - isa - PBXNativeTarget - name - SampleTests - productName - SampleTests - productReference - 6369A2831A9322E20015FC5C - productType - com.apple.product-type.bundle.unit-test - - 6369A2831A9322E20015FC5C - - explicitFileType - wrapper.cfbundle - includeInIndex - 0 - isa - PBXFileReference - path - SampleTests.xctest - sourceTree - BUILT_PRODUCTS_DIR - - 6369A2841A9322E20015FC5C - - containerPortal - 6369A2621A9322E20015FC5C - isa - PBXContainerItemProxy - proxyType - 1 - remoteGlobalIDString - 6369A2691A9322E20015FC5C - remoteInfo - Sample - - 6369A2851A9322E20015FC5C - - isa - PBXTargetDependency - target - 6369A2691A9322E20015FC5C - targetProxy - 6369A2841A9322E20015FC5C - - 6369A2861A9322E20015FC5C - - children - - 6369A2891A9322E20015FC5C - 6369A2871A9322E20015FC5C - - isa - PBXGroup - path - SampleTests - sourceTree - <group> - - 6369A2871A9322E20015FC5C - - children - - 6369A2881A9322E20015FC5C - - isa - PBXGroup - name - Supporting Files - sourceTree - <group> - - 6369A2881A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - text.plist.xml - path - Info.plist - sourceTree - <group> - - 6369A2891A9322E20015FC5C - - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - SampleTests.m - sourceTree - <group> - - 6369A28A1A9322E20015FC5C - - fileRef - 6369A2891A9322E20015FC5C - isa - PBXBuildFile - - 6369A28B1A9322E20015FC5C - - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - CLANG_CXX_LANGUAGE_STANDARD - gnu++0x - CLANG_CXX_LIBRARY - libc++ - CLANG_ENABLE_MODULES - YES - CLANG_ENABLE_OBJC_ARC - YES - CLANG_WARN_BOOL_CONVERSION - YES - CLANG_WARN_CONSTANT_CONVERSION - YES - CLANG_WARN_DIRECT_OBJC_ISA_USAGE - YES_ERROR - CLANG_WARN_EMPTY_BODY - YES - CLANG_WARN_ENUM_CONVERSION - YES - CLANG_WARN_INT_CONVERSION - YES - CLANG_WARN_OBJC_ROOT_CLASS - YES_ERROR - CLANG_WARN_UNREACHABLE_CODE - YES - CLANG_WARN__DUPLICATE_METHOD_MATCH - YES - CODE_SIGN_IDENTITY[sdk=iphoneos*] - iPhone Developer - COPY_PHASE_STRIP - NO - ENABLE_STRICT_OBJC_MSGSEND - YES - GCC_C_LANGUAGE_STANDARD - gnu99 - GCC_DYNAMIC_NO_PIC - NO - GCC_OPTIMIZATION_LEVEL - 0 - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - GCC_SYMBOLS_PRIVATE_EXTERN - NO - GCC_WARN_64_TO_32_BIT_CONVERSION - YES - GCC_WARN_ABOUT_RETURN_TYPE - YES_ERROR - GCC_WARN_UNDECLARED_SELECTOR - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES_AGGRESSIVE - GCC_WARN_UNUSED_FUNCTION - YES - GCC_WARN_UNUSED_VARIABLE - YES - IPHONEOS_DEPLOYMENT_TARGET - 8.1 - MTL_ENABLE_DEBUG_INFO - YES - ONLY_ACTIVE_ARCH - YES - SDKROOT - iphoneos - TARGETED_DEVICE_FAMILY - 1,2 - - isa - XCBuildConfiguration - name - Debug - - 6369A28C1A9322E20015FC5C - - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - CLANG_CXX_LANGUAGE_STANDARD - gnu++0x - CLANG_CXX_LIBRARY - libc++ - CLANG_ENABLE_MODULES - YES - CLANG_ENABLE_OBJC_ARC - YES - CLANG_WARN_BOOL_CONVERSION - YES - CLANG_WARN_CONSTANT_CONVERSION - YES - CLANG_WARN_DIRECT_OBJC_ISA_USAGE - YES_ERROR - CLANG_WARN_EMPTY_BODY - YES - CLANG_WARN_ENUM_CONVERSION - YES - CLANG_WARN_INT_CONVERSION - YES - CLANG_WARN_OBJC_ROOT_CLASS - YES_ERROR - CLANG_WARN_UNREACHABLE_CODE - YES - CLANG_WARN__DUPLICATE_METHOD_MATCH - YES - CODE_SIGN_IDENTITY[sdk=iphoneos*] - iPhone Developer - COPY_PHASE_STRIP - YES - ENABLE_NS_ASSERTIONS - NO - ENABLE_STRICT_OBJC_MSGSEND - YES - GCC_C_LANGUAGE_STANDARD - gnu99 - GCC_WARN_64_TO_32_BIT_CONVERSION - YES - GCC_WARN_ABOUT_RETURN_TYPE - YES_ERROR - GCC_WARN_UNDECLARED_SELECTOR - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES_AGGRESSIVE - GCC_WARN_UNUSED_FUNCTION - YES - GCC_WARN_UNUSED_VARIABLE - YES - IPHONEOS_DEPLOYMENT_TARGET - 8.1 - MTL_ENABLE_DEBUG_INFO - NO - SDKROOT - iphoneos - TARGETED_DEVICE_FAMILY - 1,2 - VALIDATE_PRODUCT - YES - - isa - XCBuildConfiguration - name - Release - - 6369A28D1A9322E20015FC5C - - buildConfigurations - - 6369A28E1A9322E20015FC5C - 6369A28F1A9322E20015FC5C - - defaultConfigurationIsVisible - 0 - isa - XCConfigurationList - - 6369A28E1A9322E20015FC5C - - baseConfigurationReference - AC29DD6FCDF962F519FEBB0D - buildSettings - - ASSETCATALOG_COMPILER_APPICON_NAME - AppIcon - INFOPLIST_FILE - Sample/Info.plist - LD_RUNPATH_SEARCH_PATHS - $(inherited) @executable_path/Frameworks - PRODUCT_NAME - $(TARGET_NAME) - - isa - XCBuildConfiguration - name - Debug - - 6369A28F1A9322E20015FC5C - - baseConfigurationReference - C68330F8D451CC6ACEABA09F - buildSettings - - ASSETCATALOG_COMPILER_APPICON_NAME - AppIcon - INFOPLIST_FILE - Sample/Info.plist - LD_RUNPATH_SEARCH_PATHS - $(inherited) @executable_path/Frameworks - PRODUCT_NAME - $(TARGET_NAME) - - isa - XCBuildConfiguration - name - Release - - 6369A2901A9322E20015FC5C - - buildConfigurations - - 6369A2911A9322E20015FC5C - 6369A2921A9322E20015FC5C - - defaultConfigurationIsVisible - 0 - isa - XCConfigurationList - - 6369A2911A9322E20015FC5C - - baseConfigurationReference - AC29DD6FCDF962F519FEBB0D - buildSettings - - BUNDLE_LOADER - $(TEST_HOST) - FRAMEWORK_SEARCH_PATHS - - $(SDKROOT)/Developer/Library/Frameworks - $(inherited) - - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - INFOPLIST_FILE - SampleTests/Info.plist - LD_RUNPATH_SEARCH_PATHS - $(inherited) @executable_path/Frameworks @loader_path/Frameworks - PRODUCT_NAME - $(TARGET_NAME) - TEST_HOST - $(BUILT_PRODUCTS_DIR)/Sample.app/Sample - - isa - XCBuildConfiguration - name - Debug - - 6369A2921A9322E20015FC5C - - baseConfigurationReference - C68330F8D451CC6ACEABA09F - buildSettings - - BUNDLE_LOADER - $(TEST_HOST) - FRAMEWORK_SEARCH_PATHS - - $(SDKROOT)/Developer/Library/Frameworks - $(inherited) - - INFOPLIST_FILE - SampleTests/Info.plist - LD_RUNPATH_SEARCH_PATHS - $(inherited) @executable_path/Frameworks @loader_path/Frameworks - PRODUCT_NAME - $(TARGET_NAME) - TEST_HOST - $(BUILT_PRODUCTS_DIR)/Sample.app/Sample - - isa - XCBuildConfiguration - name - Release - - 75C393B2FDC60A22B2121058 - - buildActionMask - 2147483647 - files - - inputPaths - - isa - PBXShellScriptBuildPhase - name - Check Pods Manifest.lock - outputPaths - - runOnlyForDeploymentPostprocessing - 0 - shellPath - /bin/sh - shellScript - diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null -if [[ $? != 0 ]] ; then - cat << EOM -error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. -EOM - exit 1 -fi - - showEnvVarsInLog - 0 - - 7B8CDC152F76D6014A96C798 - - buildActionMask - 2147483647 - files - - inputPaths - - isa - PBXShellScriptBuildPhase - name - Copy Pods Resources - outputPaths - - runOnlyForDeploymentPostprocessing - 0 - shellPath - /bin/sh - shellScript - "${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh" - - showEnvVarsInLog - 0 - - AB3331C9AE6488E61B2B094E - - children - - AC29DD6FCDF962F519FEBB0D - C68330F8D451CC6ACEABA09F - - isa - PBXGroup - name - Pods - sourceTree - <group> - - AC29DD6FCDF962F519FEBB0D - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.xcconfig - name - Pods.debug.xcconfig - path - Pods/Target Support Files/Pods/Pods.debug.xcconfig - sourceTree - <group> - - C4C2C5219053E079C9EFB930 - - children - - 2DC7B7C4C0410F43B9621631 - - isa - PBXGroup - name - Frameworks - sourceTree - <group> - - C68330F8D451CC6ACEABA09F - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.xcconfig - name - Pods.release.xcconfig - path - Pods/Target Support Files/Pods/Pods.release.xcconfig - sourceTree - <group> - - FC81FE63CA655031F3524EC0 - - fileRef - 2DC7B7C4C0410F43B9621631 - isa - PBXBuildFile - - - rootObject - 6369A2621A9322E20015FC5C - - +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 60BBBBB15823BBF7639D7AA9 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DC7B7C4C0410F43B9621631 /* libPods.a */; }; + 6369A2701A9322E20015FC5C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A26F1A9322E20015FC5C /* main.m */; }; + 6369A2731A9322E20015FC5C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2721A9322E20015FC5C /* AppDelegate.m */; }; + 6369A2761A9322E20015FC5C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2751A9322E20015FC5C /* ViewController.m */; }; + 6369A2791A9322E20015FC5C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6369A2771A9322E20015FC5C /* Main.storyboard */; }; + 6369A27B1A9322E20015FC5C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6369A27A1A9322E20015FC5C /* Images.xcassets */; }; + 6369A27E1A9322E20015FC5C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6369A27C1A9322E20015FC5C /* LaunchScreen.xib */; }; + 6369A28A1A9322E20015FC5C /* SampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2891A9322E20015FC5C /* SampleTests.m */; }; + 63D886A71AE73797000580D7 /* RemoteTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63D886A61AE73797000580D7 /* RemoteTests.m */; }; + FC81FE63CA655031F3524EC0 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DC7B7C4C0410F43B9621631 /* libPods.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 6369A2841A9322E20015FC5C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 6369A2621A9322E20015FC5C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6369A2691A9322E20015FC5C; + remoteInfo = Sample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2DC7B7C4C0410F43B9621631 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 6369A26A1A9322E20015FC5C /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 6369A26E1A9322E20015FC5C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6369A26F1A9322E20015FC5C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 6369A2711A9322E20015FC5C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 6369A2721A9322E20015FC5C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 6369A2741A9322E20015FC5C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 6369A2751A9322E20015FC5C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 6369A2781A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 6369A27A1A9322E20015FC5C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 6369A27D1A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 6369A2831A9322E20015FC5C /* SampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 6369A2881A9322E20015FC5C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6369A2891A9322E20015FC5C /* SampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SampleTests.m; sourceTree = ""; }; + 63D886A61AE73797000580D7 /* RemoteTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RemoteTests.m; sourceTree = ""; }; + AC29DD6FCDF962F519FEBB0D /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; + C68330F8D451CC6ACEABA09F /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6369A2671A9322E20015FC5C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FC81FE63CA655031F3524EC0 /* libPods.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6369A2801A9322E20015FC5C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 60BBBBB15823BBF7639D7AA9 /* libPods.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6369A2611A9322E20015FC5C = { + isa = PBXGroup; + children = ( + 6369A26C1A9322E20015FC5C /* Sample */, + 6369A2861A9322E20015FC5C /* SampleTests */, + 6369A26B1A9322E20015FC5C /* Products */, + AB3331C9AE6488E61B2B094E /* Pods */, + C4C2C5219053E079C9EFB930 /* Frameworks */, + ); + sourceTree = ""; + }; + 6369A26B1A9322E20015FC5C /* Products */ = { + isa = PBXGroup; + children = ( + 6369A26A1A9322E20015FC5C /* Sample.app */, + 6369A2831A9322E20015FC5C /* SampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 6369A26C1A9322E20015FC5C /* Sample */ = { + isa = PBXGroup; + children = ( + 6369A2711A9322E20015FC5C /* AppDelegate.h */, + 6369A2721A9322E20015FC5C /* AppDelegate.m */, + 6369A2741A9322E20015FC5C /* ViewController.h */, + 6369A2751A9322E20015FC5C /* ViewController.m */, + 6369A2771A9322E20015FC5C /* Main.storyboard */, + 6369A27A1A9322E20015FC5C /* Images.xcassets */, + 6369A27C1A9322E20015FC5C /* LaunchScreen.xib */, + 6369A26D1A9322E20015FC5C /* Supporting Files */, + ); + path = Sample; + sourceTree = ""; + }; + 6369A26D1A9322E20015FC5C /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 6369A26E1A9322E20015FC5C /* Info.plist */, + 6369A26F1A9322E20015FC5C /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 6369A2861A9322E20015FC5C /* SampleTests */ = { + isa = PBXGroup; + children = ( + 63D886A61AE73797000580D7 /* RemoteTests.m */, + 6369A2891A9322E20015FC5C /* SampleTests.m */, + 6369A2871A9322E20015FC5C /* Supporting Files */, + ); + path = SampleTests; + sourceTree = ""; + }; + 6369A2871A9322E20015FC5C /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 6369A2881A9322E20015FC5C /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + AB3331C9AE6488E61B2B094E /* Pods */ = { + isa = PBXGroup; + children = ( + AC29DD6FCDF962F519FEBB0D /* Pods.debug.xcconfig */, + C68330F8D451CC6ACEABA09F /* Pods.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + C4C2C5219053E079C9EFB930 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2DC7B7C4C0410F43B9621631 /* libPods.a */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6369A2691A9322E20015FC5C /* Sample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6369A28D1A9322E20015FC5C /* Build configuration list for PBXNativeTarget "Sample" */; + buildPhases = ( + 41F7486D8F66994B0BFB84AF /* Check Pods Manifest.lock */, + 6369A2661A9322E20015FC5C /* Sources */, + 6369A2671A9322E20015FC5C /* Frameworks */, + 6369A2681A9322E20015FC5C /* Resources */, + 04554623324BE4A838846086 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Sample; + productName = Sample; + productReference = 6369A26A1A9322E20015FC5C /* Sample.app */; + productType = "com.apple.product-type.application"; + }; + 6369A2821A9322E20015FC5C /* SampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6369A2901A9322E20015FC5C /* Build configuration list for PBXNativeTarget "SampleTests" */; + buildPhases = ( + 75C393B2FDC60A22B2121058 /* Check Pods Manifest.lock */, + 6369A27F1A9322E20015FC5C /* Sources */, + 6369A2801A9322E20015FC5C /* Frameworks */, + 6369A2811A9322E20015FC5C /* Resources */, + 7B8CDC152F76D6014A96C798 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + 6369A2851A9322E20015FC5C /* PBXTargetDependency */, + ); + name = SampleTests; + productName = SampleTests; + productReference = 6369A2831A9322E20015FC5C /* SampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6369A2621A9322E20015FC5C /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = gRPC; + TargetAttributes = { + 6369A2691A9322E20015FC5C = { + CreatedOnToolsVersion = 6.1.1; + }; + 6369A2821A9322E20015FC5C = { + CreatedOnToolsVersion = 6.1.1; + TestTargetID = 6369A2691A9322E20015FC5C; + }; + }; + }; + buildConfigurationList = 6369A2651A9322E20015FC5C /* Build configuration list for PBXProject "Sample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6369A2611A9322E20015FC5C; + productRefGroup = 6369A26B1A9322E20015FC5C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6369A2691A9322E20015FC5C /* Sample */, + 6369A2821A9322E20015FC5C /* SampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6369A2681A9322E20015FC5C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6369A2791A9322E20015FC5C /* Main.storyboard in Resources */, + 6369A27E1A9322E20015FC5C /* LaunchScreen.xib in Resources */, + 6369A27B1A9322E20015FC5C /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6369A2811A9322E20015FC5C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 04554623324BE4A838846086 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 41F7486D8F66994B0BFB84AF /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 75C393B2FDC60A22B2121058 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 7B8CDC152F76D6014A96C798 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6369A2661A9322E20015FC5C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6369A2761A9322E20015FC5C /* ViewController.m in Sources */, + 6369A2731A9322E20015FC5C /* AppDelegate.m in Sources */, + 6369A2701A9322E20015FC5C /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6369A27F1A9322E20015FC5C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6369A28A1A9322E20015FC5C /* SampleTests.m in Sources */, + 63D886A71AE73797000580D7 /* RemoteTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 6369A2851A9322E20015FC5C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6369A2691A9322E20015FC5C /* Sample */; + targetProxy = 6369A2841A9322E20015FC5C /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 6369A2771A9322E20015FC5C /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 6369A2781A9322E20015FC5C /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 6369A27C1A9322E20015FC5C /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 6369A27D1A9322E20015FC5C /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 6369A28B1A9322E20015FC5C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6369A28C1A9322E20015FC5C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6369A28E1A9322E20015FC5C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AC29DD6FCDF962F519FEBB0D /* Pods.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = Sample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 6369A28F1A9322E20015FC5C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C68330F8D451CC6ACEABA09F /* Pods.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = Sample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 6369A2911A9322E20015FC5C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AC29DD6FCDF962F519FEBB0D /* Pods.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = SampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample"; + }; + name = Debug; + }; + 6369A2921A9322E20015FC5C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C68330F8D451CC6ACEABA09F /* Pods.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = SampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6369A2651A9322E20015FC5C /* Build configuration list for PBXProject "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6369A28B1A9322E20015FC5C /* Debug */, + 6369A28C1A9322E20015FC5C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6369A28D1A9322E20015FC5C /* Build configuration list for PBXNativeTarget "Sample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6369A28E1A9322E20015FC5C /* Debug */, + 6369A28F1A9322E20015FC5C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6369A2901A9322E20015FC5C /* Build configuration list for PBXNativeTarget "SampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6369A2911A9322E20015FC5C /* Debug */, + 6369A2921A9322E20015FC5C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6369A2621A9322E20015FC5C /* Project object */; +} diff --git a/src/objective-c/examples/Sample/SampleTests/RemoteTests.m b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m index 7dcc01ae099..6091aa9d31f 100644 --- a/src/objective-c/examples/Sample/SampleTests/RemoteTests.m +++ b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m @@ -36,9 +36,9 @@ #import #import +#import +#import #import -#import -#import @interface RemoteTests : XCTestCase @end From 00b658530d94c5fd827bec793e3448838a6221f1 Mon Sep 17 00:00:00 2001 From: zeliard Date: Wed, 22 Apr 2015 12:42:26 +0900 Subject: [PATCH 42/46] add missing defines on windows (WIN64) --- include/grpc/support/port_platform.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 0bb3e16c8d1..73eedddf445 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -45,8 +45,10 @@ #define GPR_WINSOCK_SOCKET 1 #ifdef __GNUC__ #define GPR_GCC_ATOMIC 1 +#define GPR_GCC_TLS 1 #else #define GPR_WIN32_ATOMIC 1 +#define GPR_MSVC_TLS 1 #endif #elif defined(_WIN32) || defined(WIN32) #define GPR_ARCH_32 1 From 91e97b84cc0fd37362f4b80ecd5492812050a03f Mon Sep 17 00:00:00 2001 From: zeliard Date: Wed, 22 Apr 2015 13:01:08 +0900 Subject: [PATCH 43/46] fix missing pointers on gpr_atm_acq_cas on x64 --- include/grpc/support/atm_win32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index 4a21b5b547c..dcba4d433d5 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -73,7 +73,7 @@ static __inline int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { static __inline int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG) p, + return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG *) p, (LONGLONG) n, (LONGLONG) o); #else return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *) p, From 6e91ffebd849d4d9325e921bee0be91e7c099a8e Mon Sep 17 00:00:00 2001 From: Wojtek Kubiak Date: Wed, 22 Apr 2015 13:55:09 +0200 Subject: [PATCH 44/46] minor fix in TLS error message --- include/grpc/support/port_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 73eedddf445..864d669eda0 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -235,7 +235,7 @@ #endif #if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + defined(GPR_CUSTOM_TLS) != 1 -#error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, defined(GPR_CUSTOM_TLS) +#error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, GPR_CUSTOM_TLS #endif typedef int16_t gpr_int16; From 8cad507126b701b0831d6b39dfbfc5d49aa8590c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 22 Apr 2015 10:22:06 -0700 Subject: [PATCH 45/46] mathserver listens on fixed port --- src/csharp/Grpc.Examples.MathServer/MathServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Examples.MathServer/MathServer.cs b/src/csharp/Grpc.Examples.MathServer/MathServer.cs index 884a84d0a6c..f7429fb43f8 100644 --- a/src/csharp/Grpc.Examples.MathServer/MathServer.cs +++ b/src/csharp/Grpc.Examples.MathServer/MathServer.cs @@ -46,7 +46,7 @@ namespace math Server server = new Server(); server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl())); - int port = server.AddListeningPort(host + ":0"); + int port = server.AddListeningPort(host + ":23456"); server.Start(); Console.WriteLine("MathServer listening on port " + port); From 522528182a8cd31919bccca3db13314dba6993c3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 22 Apr 2015 14:03:06 -0700 Subject: [PATCH 46/46] Update flaky bit for unsecure tests --- test/core/end2end/gen_build_json.py | 1 + tools/run_tests/tests.json | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/test/core/end2end/gen_build_json.py b/test/core/end2end/gen_build_json.py index 51026a81e5b..cb8cf6ce9c5 100755 --- a/test/core/end2end/gen_build_json.py +++ b/test/core/end2end/gen_build_json.py @@ -158,6 +158,7 @@ def main(): 'build': 'test', 'language': 'c', 'src': [], + 'flaky': 'invoke_large_request' in t, 'deps': [ 'end2end_fixture_%s' % f, 'end2end_test_%s' % t, diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 2b4886d4fc1..ad994e99a39 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -4042,7 +4042,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_fullstack_invoke_large_request_unsecure_test", "platforms": [ @@ -4051,7 +4051,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_fullstack_invoke_large_request_legacy_unsecure_test", "platforms": [ @@ -4492,7 +4492,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_fullstack_uds_invoke_large_request_unsecure_test", "platforms": [ @@ -4501,7 +4501,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_fullstack_uds_invoke_large_request_legacy_unsecure_test", "platforms": [ @@ -4942,7 +4942,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_socket_pair_invoke_large_request_unsecure_test", "platforms": [ @@ -4951,7 +4951,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_socket_pair_invoke_large_request_legacy_unsecure_test", "platforms": [ @@ -5392,7 +5392,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_unsecure_test", "platforms": [ @@ -5401,7 +5401,7 @@ ] }, { - "flaky": false, + "flaky": true, "language": "c", "name": "chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_unsecure_test", "platforms": [