diff options
Diffstat (limited to 'include/grpc++')
28 files changed, 3023 insertions, 96 deletions
diff --git a/include/grpc++/support/config_protobuf.h b/include/grpc++/create_channel_posix.h index 3e7f169652..0d96159942 100644 --- a/include/grpc++/support/config_protobuf.h +++ b/include/grpc++/create_channel_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,9 +31,27 @@ * */ -#ifndef GRPCXX_SUPPORT_CONFIG_PROTOBUF_H -#define GRPCXX_SUPPORT_CONFIG_PROTOBUF_H +#ifndef GRPCXX_CREATE_CHANNEL_POSIX_H +#define GRPCXX_CREATE_CHANNEL_POSIX_H -#include <grpc++/impl/codegen/config_protobuf.h> +#include <memory> -#endif // GRPCXX_SUPPORT_CONFIG_PROTOBUF_H +#include <grpc++/channel.h> +#include <grpc/support/port_platform.h> + +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + +/// Create a new \a Channel communicating over given file descriptor +/// +/// \param target The name of the target. +/// \param fd The file descriptor representing a socket. +std::shared_ptr<Channel> CreateInsecureChannelFromFd(const grpc::string& target, + int fd); + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} // namespace grpc + +#endif // GRPCXX_CREATE_CHANNEL_POSIX_H diff --git a/include/grpc++/ext/proto_server_reflection_plugin.h b/include/grpc++/ext/proto_server_reflection_plugin.h new file mode 100644 index 0000000000..3e54882d41 --- /dev/null +++ b/include/grpc++/ext/proto_server_reflection_plugin.h @@ -0,0 +1,69 @@ +/* + * + * 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. + * + */ + +#ifndef GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H +#define GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H + +#include <grpc++/impl/server_builder_plugin.h> +#include <grpc++/support/config.h> + +namespace grpc { +class ServerInitializer; +class ProtoServerReflection; +} // namespace grpc + +namespace grpc { +namespace reflection { + +class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { + public: + ProtoServerReflectionPlugin(); + ::grpc::string name() GRPC_OVERRIDE; + void InitServer(::grpc::ServerInitializer* si) GRPC_OVERRIDE; + void Finish(::grpc::ServerInitializer* si) GRPC_OVERRIDE; + void ChangeArguments(const ::grpc::string& name, void* value) GRPC_OVERRIDE; + bool has_async_methods() const GRPC_OVERRIDE; + bool has_sync_methods() const GRPC_OVERRIDE; + + private: + std::shared_ptr<grpc::ProtoServerReflection> reflection_service_; +}; + +// Add proto reflection plugin to ServerBuilder. This function should be called +// at the static initialization time. +void InitProtoReflectionServerBuilderPlugin(); + +} // namespace reflection +} // namespace grpc + +#endif // GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H diff --git a/include/grpc++/ext/reflection.grpc.pb.h b/include/grpc++/ext/reflection.grpc.pb.h new file mode 100644 index 0000000000..0b4ef86147 --- /dev/null +++ b/include/grpc++/ext/reflection.grpc.pb.h @@ -0,0 +1,184 @@ +/* + * + * 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. + * + */ + + +// Generated by the gRPC protobuf plugin. +// If you make any local change, they will be lost. +// source: reflection.proto +// Original file comments: +// Copyright 2016, 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. +// +// Service exported by server reflection +// +#ifndef GRPC_reflection_2eproto__INCLUDED +#define GRPC_reflection_2eproto__INCLUDED + +#include <grpc++/ext/reflection.pb.h> + +#include <grpc++/impl/codegen/async_stream.h> +#include <grpc++/impl/codegen/async_unary_call.h> +#include <grpc++/impl/codegen/proto_utils.h> +#include <grpc++/impl/codegen/rpc_method.h> +#include <grpc++/impl/codegen/service_type.h> +#include <grpc++/impl/codegen/status.h> +#include <grpc++/impl/codegen/stub_options.h> +#include <grpc++/impl/codegen/sync_stream.h> + +namespace grpc { +class CompletionQueue; +class Channel; +class RpcService; +class ServerCompletionQueue; +class ServerContext; +} // namespace grpc + +namespace grpc { +namespace reflection { +namespace v1alpha { + +class ServerReflection GRPC_FINAL { + public: + class StubInterface { + public: + virtual ~StubInterface() {} + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> ServerReflectionInfo(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(ServerReflectionInfoRaw(context)); + } + std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> AsyncServerReflectionInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(AsyncServerReflectionInfoRaw(context, cq, tag)); + } + private: + virtual ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflectionInfoRaw(::grpc::ClientContext* context) = 0; + virtual ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0; + }; + class Stub GRPC_FINAL : public StubInterface { + public: + Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); + std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> ServerReflectionInfo(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(ServerReflectionInfoRaw(context)); + } + std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> AsyncServerReflectionInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(AsyncServerReflectionInfoRaw(context, cq, tag)); + } + + private: + std::shared_ptr< ::grpc::ChannelInterface> channel_; + ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflectionInfoRaw(::grpc::ClientContext* context) GRPC_OVERRIDE; + ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE; + const ::grpc::RpcMethod rpcmethod_ServerReflectionInfo_; + }; + static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); + + class Service : public ::grpc::Service { + public: + Service(); + virtual ~Service(); + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + virtual ::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream); + }; + template <class BaseClass> + class WithAsyncMethod_ServerReflectionInfo : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service *service) {} + public: + WithAsyncMethod_ServerReflectionInfo() { + ::grpc::Service::MarkMethodAsync(0); + } + ~WithAsyncMethod_ServerReflectionInfo() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncBidiStreaming(0, context, stream, new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_ServerReflectionInfo<Service > AsyncService; + template <class BaseClass> + class WithGenericMethod_ServerReflectionInfo : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(const Service *service) {} + public: + WithGenericMethod_ServerReflectionInfo() { + ::grpc::Service::MarkMethodGeneric(0); + } + ~WithGenericMethod_ServerReflectionInfo() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; +}; + +} // namespace v1alpha +} // namespace reflection +} // namespace grpc + + +#endif // GRPC_reflection_2eproto__INCLUDED diff --git a/include/grpc++/ext/reflection.pb.h b/include/grpc++/ext/reflection.pb.h new file mode 100644 index 0000000000..00d07735ee --- /dev/null +++ b/include/grpc++/ext/reflection.pb.h @@ -0,0 +1,2035 @@ +/* + * + * 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. + * + */ + + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: reflection.proto + +#ifndef PROTOBUF_reflection_2eproto__INCLUDED +#define PROTOBUF_reflection_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace grpc { +namespace reflection { +namespace v1alpha { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_reflection_2eproto(); +void protobuf_AssignDesc_reflection_2eproto(); +void protobuf_ShutdownFile_reflection_2eproto(); + +class ErrorResponse; +class ExtensionNumberResponse; +class ExtensionRequest; +class FileDescriptorResponse; +class ListServiceResponse; +class ServerReflectionRequest; +class ServerReflectionResponse; +class ServiceResponse; + +// =================================================================== + +class ServerReflectionRequest : public ::google::protobuf::Message { + public: + ServerReflectionRequest(); + virtual ~ServerReflectionRequest(); + + ServerReflectionRequest(const ServerReflectionRequest& from); + + inline ServerReflectionRequest& operator=(const ServerReflectionRequest& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ServerReflectionRequest& default_instance(); + + enum MessageRequestCase { + kFileByFilename = 3, + kFileContainingSymbol = 4, + kFileContainingExtension = 5, + kAllExtensionNumbersOfType = 6, + kListServices = 7, + MESSAGE_REQUEST_NOT_SET = 0, + }; + + void Swap(ServerReflectionRequest* other); + + // implements Message ---------------------------------------------- + + inline ServerReflectionRequest* New() const { return New(NULL); } + + ServerReflectionRequest* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ServerReflectionRequest& from); + void MergeFrom(const ServerReflectionRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ServerReflectionRequest* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string host = 1; + void clear_host(); + static const int kHostFieldNumber = 1; + const ::std::string& host() const; + void set_host(const ::std::string& value); + void set_host(const char* value); + void set_host(const char* value, size_t size); + ::std::string* mutable_host(); + ::std::string* release_host(); + void set_allocated_host(::std::string* host); + + // optional string file_by_filename = 3; + private: + bool has_file_by_filename() const; + public: + void clear_file_by_filename(); + static const int kFileByFilenameFieldNumber = 3; + const ::std::string& file_by_filename() const; + void set_file_by_filename(const ::std::string& value); + void set_file_by_filename(const char* value); + void set_file_by_filename(const char* value, size_t size); + ::std::string* mutable_file_by_filename(); + ::std::string* release_file_by_filename(); + void set_allocated_file_by_filename(::std::string* file_by_filename); + + // optional string file_containing_symbol = 4; + private: + bool has_file_containing_symbol() const; + public: + void clear_file_containing_symbol(); + static const int kFileContainingSymbolFieldNumber = 4; + const ::std::string& file_containing_symbol() const; + void set_file_containing_symbol(const ::std::string& value); + void set_file_containing_symbol(const char* value); + void set_file_containing_symbol(const char* value, size_t size); + ::std::string* mutable_file_containing_symbol(); + ::std::string* release_file_containing_symbol(); + void set_allocated_file_containing_symbol(::std::string* file_containing_symbol); + + // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; + bool has_file_containing_extension() const; + void clear_file_containing_extension(); + static const int kFileContainingExtensionFieldNumber = 5; + const ::grpc::reflection::v1alpha::ExtensionRequest& file_containing_extension() const; + ::grpc::reflection::v1alpha::ExtensionRequest* mutable_file_containing_extension(); + ::grpc::reflection::v1alpha::ExtensionRequest* release_file_containing_extension(); + void set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension); + + // optional string all_extension_numbers_of_type = 6; + private: + bool has_all_extension_numbers_of_type() const; + public: + void clear_all_extension_numbers_of_type(); + static const int kAllExtensionNumbersOfTypeFieldNumber = 6; + const ::std::string& all_extension_numbers_of_type() const; + void set_all_extension_numbers_of_type(const ::std::string& value); + void set_all_extension_numbers_of_type(const char* value); + void set_all_extension_numbers_of_type(const char* value, size_t size); + ::std::string* mutable_all_extension_numbers_of_type(); + ::std::string* release_all_extension_numbers_of_type(); + void set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type); + + // optional string list_services = 7; + private: + bool has_list_services() const; + public: + void clear_list_services(); + static const int kListServicesFieldNumber = 7; + const ::std::string& list_services() const; + void set_list_services(const ::std::string& value); + void set_list_services(const char* value); + void set_list_services(const char* value, size_t size); + ::std::string* mutable_list_services(); + ::std::string* release_list_services(); + void set_allocated_list_services(::std::string* list_services); + + MessageRequestCase message_request_case() const; + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ServerReflectionRequest) + private: + inline void set_has_file_by_filename(); + inline void set_has_file_containing_symbol(); + inline void set_has_file_containing_extension(); + inline void set_has_all_extension_numbers_of_type(); + inline void set_has_list_services(); + + inline bool has_message_request() const; + void clear_message_request(); + inline void clear_has_message_request(); + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr host_; + union MessageRequestUnion { + MessageRequestUnion() {} + ::google::protobuf::internal::ArenaStringPtr file_by_filename_; + ::google::protobuf::internal::ArenaStringPtr file_containing_symbol_; + ::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension_; + ::google::protobuf::internal::ArenaStringPtr all_extension_numbers_of_type_; + ::google::protobuf::internal::ArenaStringPtr list_services_; + } message_request_; + mutable int _cached_size_; + ::google::protobuf::uint32 _oneof_case_[1]; + + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ServerReflectionRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ExtensionRequest : public ::google::protobuf::Message { + public: + ExtensionRequest(); + virtual ~ExtensionRequest(); + + ExtensionRequest(const ExtensionRequest& from); + + inline ExtensionRequest& operator=(const ExtensionRequest& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ExtensionRequest& default_instance(); + + void Swap(ExtensionRequest* other); + + // implements Message ---------------------------------------------- + + inline ExtensionRequest* New() const { return New(NULL); } + + ExtensionRequest* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ExtensionRequest& from); + void MergeFrom(const ExtensionRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ExtensionRequest* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string containing_type = 1; + void clear_containing_type(); + static const int kContainingTypeFieldNumber = 1; + const ::std::string& containing_type() const; + void set_containing_type(const ::std::string& value); + void set_containing_type(const char* value); + void set_containing_type(const char* value, size_t size); + ::std::string* mutable_containing_type(); + ::std::string* release_containing_type(); + void set_allocated_containing_type(::std::string* containing_type); + + // optional int32 extension_number = 2; + void clear_extension_number(); + static const int kExtensionNumberFieldNumber = 2; + ::google::protobuf::int32 extension_number() const; + void set_extension_number(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ExtensionRequest) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr containing_type_; + ::google::protobuf::int32 extension_number_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ExtensionRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ServerReflectionResponse : public ::google::protobuf::Message { + public: + ServerReflectionResponse(); + virtual ~ServerReflectionResponse(); + + ServerReflectionResponse(const ServerReflectionResponse& from); + + inline ServerReflectionResponse& operator=(const ServerReflectionResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ServerReflectionResponse& default_instance(); + + enum MessageResponseCase { + kFileDescriptorResponse = 4, + kAllExtensionNumbersResponse = 5, + kListServicesResponse = 6, + kErrorResponse = 7, + MESSAGE_RESPONSE_NOT_SET = 0, + }; + + void Swap(ServerReflectionResponse* other); + + // implements Message ---------------------------------------------- + + inline ServerReflectionResponse* New() const { return New(NULL); } + + ServerReflectionResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ServerReflectionResponse& from); + void MergeFrom(const ServerReflectionResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ServerReflectionResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string valid_host = 1; + void clear_valid_host(); + static const int kValidHostFieldNumber = 1; + const ::std::string& valid_host() const; + void set_valid_host(const ::std::string& value); + void set_valid_host(const char* value); + void set_valid_host(const char* value, size_t size); + ::std::string* mutable_valid_host(); + ::std::string* release_valid_host(); + void set_allocated_valid_host(::std::string* valid_host); + + // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; + bool has_original_request() const; + void clear_original_request(); + static const int kOriginalRequestFieldNumber = 2; + const ::grpc::reflection::v1alpha::ServerReflectionRequest& original_request() const; + ::grpc::reflection::v1alpha::ServerReflectionRequest* mutable_original_request(); + ::grpc::reflection::v1alpha::ServerReflectionRequest* release_original_request(); + void set_allocated_original_request(::grpc::reflection::v1alpha::ServerReflectionRequest* original_request); + + // optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; + bool has_file_descriptor_response() const; + void clear_file_descriptor_response(); + static const int kFileDescriptorResponseFieldNumber = 4; + const ::grpc::reflection::v1alpha::FileDescriptorResponse& file_descriptor_response() const; + ::grpc::reflection::v1alpha::FileDescriptorResponse* mutable_file_descriptor_response(); + ::grpc::reflection::v1alpha::FileDescriptorResponse* release_file_descriptor_response(); + void set_allocated_file_descriptor_response(::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response); + + // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; + bool has_all_extension_numbers_response() const; + void clear_all_extension_numbers_response(); + static const int kAllExtensionNumbersResponseFieldNumber = 5; + const ::grpc::reflection::v1alpha::ExtensionNumberResponse& all_extension_numbers_response() const; + ::grpc::reflection::v1alpha::ExtensionNumberResponse* mutable_all_extension_numbers_response(); + ::grpc::reflection::v1alpha::ExtensionNumberResponse* release_all_extension_numbers_response(); + void set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response); + + // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; + bool has_list_services_response() const; + void clear_list_services_response(); + static const int kListServicesResponseFieldNumber = 6; + const ::grpc::reflection::v1alpha::ListServiceResponse& list_services_response() const; + ::grpc::reflection::v1alpha::ListServiceResponse* mutable_list_services_response(); + ::grpc::reflection::v1alpha::ListServiceResponse* release_list_services_response(); + void set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response); + + // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; + bool has_error_response() const; + void clear_error_response(); + static const int kErrorResponseFieldNumber = 7; + const ::grpc::reflection::v1alpha::ErrorResponse& error_response() const; + ::grpc::reflection::v1alpha::ErrorResponse* mutable_error_response(); + ::grpc::reflection::v1alpha::ErrorResponse* release_error_response(); + void set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response); + + MessageResponseCase message_response_case() const; + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ServerReflectionResponse) + private: + inline void set_has_file_descriptor_response(); + inline void set_has_all_extension_numbers_response(); + inline void set_has_list_services_response(); + inline void set_has_error_response(); + + inline bool has_message_response() const; + void clear_message_response(); + inline void clear_has_message_response(); + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr valid_host_; + ::grpc::reflection::v1alpha::ServerReflectionRequest* original_request_; + union MessageResponseUnion { + MessageResponseUnion() {} + ::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response_; + ::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response_; + ::grpc::reflection::v1alpha::ListServiceResponse* list_services_response_; + ::grpc::reflection::v1alpha::ErrorResponse* error_response_; + } message_response_; + mutable int _cached_size_; + ::google::protobuf::uint32 _oneof_case_[1]; + + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ServerReflectionResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class FileDescriptorResponse : public ::google::protobuf::Message { + public: + FileDescriptorResponse(); + virtual ~FileDescriptorResponse(); + + FileDescriptorResponse(const FileDescriptorResponse& from); + + inline FileDescriptorResponse& operator=(const FileDescriptorResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FileDescriptorResponse& default_instance(); + + void Swap(FileDescriptorResponse* other); + + // implements Message ---------------------------------------------- + + inline FileDescriptorResponse* New() const { return New(NULL); } + + FileDescriptorResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FileDescriptorResponse& from); + void MergeFrom(const FileDescriptorResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FileDescriptorResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated bytes file_descriptor_proto = 1; + int file_descriptor_proto_size() const; + void clear_file_descriptor_proto(); + static const int kFileDescriptorProtoFieldNumber = 1; + const ::std::string& file_descriptor_proto(int index) const; + ::std::string* mutable_file_descriptor_proto(int index); + void set_file_descriptor_proto(int index, const ::std::string& value); + void set_file_descriptor_proto(int index, const char* value); + void set_file_descriptor_proto(int index, const void* value, size_t size); + ::std::string* add_file_descriptor_proto(); + void add_file_descriptor_proto(const ::std::string& value); + void add_file_descriptor_proto(const char* value); + void add_file_descriptor_proto(const void* value, size_t size); + const ::google::protobuf::RepeatedPtrField< ::std::string>& file_descriptor_proto() const; + ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_file_descriptor_proto(); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.FileDescriptorResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::RepeatedPtrField< ::std::string> file_descriptor_proto_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static FileDescriptorResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ExtensionNumberResponse : public ::google::protobuf::Message { + public: + ExtensionNumberResponse(); + virtual ~ExtensionNumberResponse(); + + ExtensionNumberResponse(const ExtensionNumberResponse& from); + + inline ExtensionNumberResponse& operator=(const ExtensionNumberResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ExtensionNumberResponse& default_instance(); + + void Swap(ExtensionNumberResponse* other); + + // implements Message ---------------------------------------------- + + inline ExtensionNumberResponse* New() const { return New(NULL); } + + ExtensionNumberResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ExtensionNumberResponse& from); + void MergeFrom(const ExtensionNumberResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ExtensionNumberResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string base_type_name = 1; + void clear_base_type_name(); + static const int kBaseTypeNameFieldNumber = 1; + const ::std::string& base_type_name() const; + void set_base_type_name(const ::std::string& value); + void set_base_type_name(const char* value); + void set_base_type_name(const char* value, size_t size); + ::std::string* mutable_base_type_name(); + ::std::string* release_base_type_name(); + void set_allocated_base_type_name(::std::string* base_type_name); + + // repeated int32 extension_number = 2; + int extension_number_size() const; + void clear_extension_number(); + static const int kExtensionNumberFieldNumber = 2; + ::google::protobuf::int32 extension_number(int index) const; + void set_extension_number(int index, ::google::protobuf::int32 value); + void add_extension_number(::google::protobuf::int32 value); + const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + extension_number() const; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_extension_number(); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ExtensionNumberResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr base_type_name_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > extension_number_; + mutable int _extension_number_cached_byte_size_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ExtensionNumberResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ListServiceResponse : public ::google::protobuf::Message { + public: + ListServiceResponse(); + virtual ~ListServiceResponse(); + + ListServiceResponse(const ListServiceResponse& from); + + inline ListServiceResponse& operator=(const ListServiceResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ListServiceResponse& default_instance(); + + void Swap(ListServiceResponse* other); + + // implements Message ---------------------------------------------- + + inline ListServiceResponse* New() const { return New(NULL); } + + ListServiceResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ListServiceResponse& from); + void MergeFrom(const ListServiceResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ListServiceResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; + int service_size() const; + void clear_service(); + static const int kServiceFieldNumber = 1; + const ::grpc::reflection::v1alpha::ServiceResponse& service(int index) const; + ::grpc::reflection::v1alpha::ServiceResponse* mutable_service(int index); + ::grpc::reflection::v1alpha::ServiceResponse* add_service(); + ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >* + mutable_service(); + const ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >& + service() const; + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ListServiceResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse > service_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ListServiceResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ServiceResponse : public ::google::protobuf::Message { + public: + ServiceResponse(); + virtual ~ServiceResponse(); + + ServiceResponse(const ServiceResponse& from); + + inline ServiceResponse& operator=(const ServiceResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ServiceResponse& default_instance(); + + void Swap(ServiceResponse* other); + + // implements Message ---------------------------------------------- + + inline ServiceResponse* New() const { return New(NULL); } + + ServiceResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ServiceResponse& from); + void MergeFrom(const ServiceResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ServiceResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ServiceResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ServiceResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ErrorResponse : public ::google::protobuf::Message { + public: + ErrorResponse(); + virtual ~ErrorResponse(); + + ErrorResponse(const ErrorResponse& from); + + inline ErrorResponse& operator=(const ErrorResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ErrorResponse& default_instance(); + + void Swap(ErrorResponse* other); + + // implements Message ---------------------------------------------- + + inline ErrorResponse* New() const { return New(NULL); } + + ErrorResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ErrorResponse& from); + void MergeFrom(const ErrorResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ErrorResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 error_code = 1; + void clear_error_code(); + static const int kErrorCodeFieldNumber = 1; + ::google::protobuf::int32 error_code() const; + void set_error_code(::google::protobuf::int32 value); + + // optional string error_message = 2; + void clear_error_message(); + static const int kErrorMessageFieldNumber = 2; + const ::std::string& error_message() const; + void set_error_message(const ::std::string& value); + void set_error_message(const char* value); + void set_error_message(const char* value, size_t size); + ::std::string* mutable_error_message(); + ::std::string* release_error_message(); + void set_allocated_error_message(::std::string* error_message); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ErrorResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr error_message_; + ::google::protobuf::int32 error_code_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ErrorResponse* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// ServerReflectionRequest + +// optional string host = 1; +inline void ServerReflectionRequest::clear_host() { + host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ServerReflectionRequest::host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.host) + return host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ServerReflectionRequest::set_host(const ::std::string& value) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.host) +} +inline void ServerReflectionRequest::set_host(const char* value) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.host) +} +inline void ServerReflectionRequest::set_host(const char* value, size_t size) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.host) +} +inline ::std::string* ServerReflectionRequest::mutable_host() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.host) + return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServerReflectionRequest::release_host() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.host) + + return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ServerReflectionRequest::set_allocated_host(::std::string* host) { + if (host != NULL) { + + } else { + + } + host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), host); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.host) +} + +// optional string file_by_filename = 3; +inline bool ServerReflectionRequest::has_file_by_filename() const { + return message_request_case() == kFileByFilename; +} +inline void ServerReflectionRequest::set_has_file_by_filename() { + _oneof_case_[0] = kFileByFilename; +} +inline void ServerReflectionRequest::clear_file_by_filename() { + if (has_file_by_filename()) { + message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} +inline const ::std::string& ServerReflectionRequest::file_by_filename() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) + if (has_file_by_filename()) { + return message_request_.file_by_filename_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void ServerReflectionRequest::set_file_by_filename(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) +} +inline void ServerReflectionRequest::set_file_by_filename(const char* value) { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) +} +inline void ServerReflectionRequest::set_file_by_filename(const char* value, size_t size) { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) +} +inline ::std::string* ServerReflectionRequest::mutable_file_by_filename() { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) + return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServerReflectionRequest::release_file_by_filename() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) + if (has_file_by_filename()) { + clear_has_message_request(); + return message_request_.file_by_filename_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void ServerReflectionRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { + if (!has_file_by_filename()) { + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (file_by_filename != NULL) { + set_has_file_by_filename(); + message_request_.file_by_filename_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_by_filename); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) +} + +// optional string file_containing_symbol = 4; +inline bool ServerReflectionRequest::has_file_containing_symbol() const { + return message_request_case() == kFileContainingSymbol; +} +inline void ServerReflectionRequest::set_has_file_containing_symbol() { + _oneof_case_[0] = kFileContainingSymbol; +} +inline void ServerReflectionRequest::clear_file_containing_symbol() { + if (has_file_containing_symbol()) { + message_request_.file_containing_symbol_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} +inline const ::std::string& ServerReflectionRequest::file_containing_symbol() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) + if (has_file_containing_symbol()) { + return message_request_.file_containing_symbol_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void ServerReflectionRequest::set_file_containing_symbol(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) +} +inline void ServerReflectionRequest::set_file_containing_symbol(const char* value) { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) +} +inline void ServerReflectionRequest::set_file_containing_symbol(const char* value, size_t size) { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) +} +inline ::std::string* ServerReflectionRequest::mutable_file_containing_symbol() { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) + return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServerReflectionRequest::release_file_containing_symbol() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) + if (has_file_containing_symbol()) { + clear_has_message_request(); + return message_request_.file_containing_symbol_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void ServerReflectionRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { + if (!has_file_containing_symbol()) { + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (file_containing_symbol != NULL) { + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_containing_symbol); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) +} + +// optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; +inline bool ServerReflectionRequest::has_file_containing_extension() const { + return message_request_case() == kFileContainingExtension; +} +inline void ServerReflectionRequest::set_has_file_containing_extension() { + _oneof_case_[0] = kFileContainingExtension; +} +inline void ServerReflectionRequest::clear_file_containing_extension() { + if (has_file_containing_extension()) { + delete message_request_.file_containing_extension_; + clear_has_message_request(); + } +} +inline const ::grpc::reflection::v1alpha::ExtensionRequest& ServerReflectionRequest::file_containing_extension() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) + return has_file_containing_extension() + ? *message_request_.file_containing_extension_ + : ::grpc::reflection::v1alpha::ExtensionRequest::default_instance(); +} +inline ::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::mutable_file_containing_extension() { + if (!has_file_containing_extension()) { + clear_message_request(); + set_has_file_containing_extension(); + message_request_.file_containing_extension_ = new ::grpc::reflection::v1alpha::ExtensionRequest; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) + return message_request_.file_containing_extension_; +} +inline ::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::release_file_containing_extension() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) + if (has_file_containing_extension()) { + clear_has_message_request(); + ::grpc::reflection::v1alpha::ExtensionRequest* temp = message_request_.file_containing_extension_; + message_request_.file_containing_extension_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void ServerReflectionRequest::set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension) { + clear_message_request(); + if (file_containing_extension) { + set_has_file_containing_extension(); + message_request_.file_containing_extension_ = file_containing_extension; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) +} + +// optional string all_extension_numbers_of_type = 6; +inline bool ServerReflectionRequest::has_all_extension_numbers_of_type() const { + return message_request_case() == kAllExtensionNumbersOfType; +} +inline void ServerReflectionRequest::set_has_all_extension_numbers_of_type() { + _oneof_case_[0] = kAllExtensionNumbersOfType; +} +inline void ServerReflectionRequest::clear_all_extension_numbers_of_type() { + if (has_all_extension_numbers_of_type()) { + message_request_.all_extension_numbers_of_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} +inline const ::std::string& ServerReflectionRequest::all_extension_numbers_of_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) + if (has_all_extension_numbers_of_type()) { + return message_request_.all_extension_numbers_of_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void ServerReflectionRequest::set_all_extension_numbers_of_type(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) +} +inline void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value) { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) +} +inline void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) +} +inline ::std::string* ServerReflectionRequest::mutable_all_extension_numbers_of_type() { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) + return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServerReflectionRequest::release_all_extension_numbers_of_type() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) + if (has_all_extension_numbers_of_type()) { + clear_has_message_request(); + return message_request_.all_extension_numbers_of_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void ServerReflectionRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { + if (!has_all_extension_numbers_of_type()) { + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (all_extension_numbers_of_type != NULL) { + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + all_extension_numbers_of_type); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) +} + +// optional string list_services = 7; +inline bool ServerReflectionRequest::has_list_services() const { + return message_request_case() == kListServices; +} +inline void ServerReflectionRequest::set_has_list_services() { + _oneof_case_[0] = kListServices; +} +inline void ServerReflectionRequest::clear_list_services() { + if (has_list_services()) { + message_request_.list_services_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} +inline const ::std::string& ServerReflectionRequest::list_services() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) + if (has_list_services()) { + return message_request_.list_services_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void ServerReflectionRequest::set_list_services(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) +} +inline void ServerReflectionRequest::set_list_services(const char* value) { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) +} +inline void ServerReflectionRequest::set_list_services(const char* value, size_t size) { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) +} +inline ::std::string* ServerReflectionRequest::mutable_list_services() { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) + return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServerReflectionRequest::release_list_services() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) + if (has_list_services()) { + clear_has_message_request(); + return message_request_.list_services_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void ServerReflectionRequest::set_allocated_list_services(::std::string* list_services) { + if (!has_list_services()) { + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (list_services != NULL) { + set_has_list_services(); + message_request_.list_services_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + list_services); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) +} + +inline bool ServerReflectionRequest::has_message_request() const { + return message_request_case() != MESSAGE_REQUEST_NOT_SET; +} +inline void ServerReflectionRequest::clear_has_message_request() { + _oneof_case_[0] = MESSAGE_REQUEST_NOT_SET; +} +inline ServerReflectionRequest::MessageRequestCase ServerReflectionRequest::message_request_case() const { + return ServerReflectionRequest::MessageRequestCase(_oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// ExtensionRequest + +// optional string containing_type = 1; +inline void ExtensionRequest::clear_containing_type() { + containing_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ExtensionRequest::containing_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.containing_type) + return containing_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionRequest::set_containing_type(const ::std::string& value) { + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +inline void ExtensionRequest::set_containing_type(const char* value) { + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +inline void ExtensionRequest::set_containing_type(const char* value, size_t size) { + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +inline ::std::string* ExtensionRequest::mutable_containing_type() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionRequest.containing_type) + return containing_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ExtensionRequest::release_containing_type() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionRequest.containing_type) + + return containing_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionRequest::set_allocated_containing_type(::std::string* containing_type) { + if (containing_type != NULL) { + + } else { + + } + containing_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), containing_type); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} + +// optional int32 extension_number = 2; +inline void ExtensionRequest::clear_extension_number() { + extension_number_ = 0; +} +inline ::google::protobuf::int32 ExtensionRequest::extension_number() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.extension_number) + return extension_number_; +} +inline void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { + + extension_number_ = value; + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.extension_number) +} + +// ------------------------------------------------------------------- + +// ServerReflectionResponse + +// optional string valid_host = 1; +inline void ServerReflectionResponse::clear_valid_host() { + valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ServerReflectionResponse::valid_host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) + return valid_host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ServerReflectionResponse::set_valid_host(const ::std::string& value) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) +} +inline void ServerReflectionResponse::set_valid_host(const char* value) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) +} +inline void ServerReflectionResponse::set_valid_host(const char* value, size_t size) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) +} +inline ::std::string* ServerReflectionResponse::mutable_valid_host() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) + return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServerReflectionResponse::release_valid_host() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) + + return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ServerReflectionResponse::set_allocated_valid_host(::std::string* valid_host) { + if (valid_host != NULL) { + + } else { + + } + valid_host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), valid_host); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) +} + +// optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; +inline bool ServerReflectionResponse::has_original_request() const { + return !_is_default_instance_ && original_request_ != NULL; +} +inline void ServerReflectionResponse::clear_original_request() { + if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; + original_request_ = NULL; +} +inline const ::grpc::reflection::v1alpha::ServerReflectionRequest& ServerReflectionResponse::original_request() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) + return original_request_ != NULL ? *original_request_ : *default_instance_->original_request_; +} +inline ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::mutable_original_request() { + + if (original_request_ == NULL) { + original_request_ = new ::grpc::reflection::v1alpha::ServerReflectionRequest; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) + return original_request_; +} +inline ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::release_original_request() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) + + ::grpc::reflection::v1alpha::ServerReflectionRequest* temp = original_request_; + original_request_ = NULL; + return temp; +} +inline void ServerReflectionResponse::set_allocated_original_request(::grpc::reflection::v1alpha::ServerReflectionRequest* original_request) { + delete original_request_; + original_request_ = original_request; + if (original_request) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) +} + +// optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; +inline bool ServerReflectionResponse::has_file_descriptor_response() const { + return message_response_case() == kFileDescriptorResponse; +} +inline void ServerReflectionResponse::set_has_file_descriptor_response() { + _oneof_case_[0] = kFileDescriptorResponse; +} +inline void ServerReflectionResponse::clear_file_descriptor_response() { + if (has_file_descriptor_response()) { + delete message_response_.file_descriptor_response_; + clear_has_message_response(); + } +} +inline const ::grpc::reflection::v1alpha::FileDescriptorResponse& ServerReflectionResponse::file_descriptor_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) + return has_file_descriptor_response() + ? *message_response_.file_descriptor_response_ + : ::grpc::reflection::v1alpha::FileDescriptorResponse::default_instance(); +} +inline ::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::mutable_file_descriptor_response() { + if (!has_file_descriptor_response()) { + clear_message_response(); + set_has_file_descriptor_response(); + message_response_.file_descriptor_response_ = new ::grpc::reflection::v1alpha::FileDescriptorResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) + return message_response_.file_descriptor_response_; +} +inline ::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::release_file_descriptor_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) + if (has_file_descriptor_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::FileDescriptorResponse* temp = message_response_.file_descriptor_response_; + message_response_.file_descriptor_response_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void ServerReflectionResponse::set_allocated_file_descriptor_response(::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response) { + clear_message_response(); + if (file_descriptor_response) { + set_has_file_descriptor_response(); + message_response_.file_descriptor_response_ = file_descriptor_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) +} + +// optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; +inline bool ServerReflectionResponse::has_all_extension_numbers_response() const { + return message_response_case() == kAllExtensionNumbersResponse; +} +inline void ServerReflectionResponse::set_has_all_extension_numbers_response() { + _oneof_case_[0] = kAllExtensionNumbersResponse; +} +inline void ServerReflectionResponse::clear_all_extension_numbers_response() { + if (has_all_extension_numbers_response()) { + delete message_response_.all_extension_numbers_response_; + clear_has_message_response(); + } +} +inline const ::grpc::reflection::v1alpha::ExtensionNumberResponse& ServerReflectionResponse::all_extension_numbers_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) + return has_all_extension_numbers_response() + ? *message_response_.all_extension_numbers_response_ + : ::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance(); +} +inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::mutable_all_extension_numbers_response() { + if (!has_all_extension_numbers_response()) { + clear_message_response(); + set_has_all_extension_numbers_response(); + message_response_.all_extension_numbers_response_ = new ::grpc::reflection::v1alpha::ExtensionNumberResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) + return message_response_.all_extension_numbers_response_; +} +inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::release_all_extension_numbers_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) + if (has_all_extension_numbers_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ExtensionNumberResponse* temp = message_response_.all_extension_numbers_response_; + message_response_.all_extension_numbers_response_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void ServerReflectionResponse::set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response) { + clear_message_response(); + if (all_extension_numbers_response) { + set_has_all_extension_numbers_response(); + message_response_.all_extension_numbers_response_ = all_extension_numbers_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) +} + +// optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; +inline bool ServerReflectionResponse::has_list_services_response() const { + return message_response_case() == kListServicesResponse; +} +inline void ServerReflectionResponse::set_has_list_services_response() { + _oneof_case_[0] = kListServicesResponse; +} +inline void ServerReflectionResponse::clear_list_services_response() { + if (has_list_services_response()) { + delete message_response_.list_services_response_; + clear_has_message_response(); + } +} +inline const ::grpc::reflection::v1alpha::ListServiceResponse& ServerReflectionResponse::list_services_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) + return has_list_services_response() + ? *message_response_.list_services_response_ + : ::grpc::reflection::v1alpha::ListServiceResponse::default_instance(); +} +inline ::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::mutable_list_services_response() { + if (!has_list_services_response()) { + clear_message_response(); + set_has_list_services_response(); + message_response_.list_services_response_ = new ::grpc::reflection::v1alpha::ListServiceResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) + return message_response_.list_services_response_; +} +inline ::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::release_list_services_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) + if (has_list_services_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ListServiceResponse* temp = message_response_.list_services_response_; + message_response_.list_services_response_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void ServerReflectionResponse::set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response) { + clear_message_response(); + if (list_services_response) { + set_has_list_services_response(); + message_response_.list_services_response_ = list_services_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) +} + +// optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; +inline bool ServerReflectionResponse::has_error_response() const { + return message_response_case() == kErrorResponse; +} +inline void ServerReflectionResponse::set_has_error_response() { + _oneof_case_[0] = kErrorResponse; +} +inline void ServerReflectionResponse::clear_error_response() { + if (has_error_response()) { + delete message_response_.error_response_; + clear_has_message_response(); + } +} +inline const ::grpc::reflection::v1alpha::ErrorResponse& ServerReflectionResponse::error_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) + return has_error_response() + ? *message_response_.error_response_ + : ::grpc::reflection::v1alpha::ErrorResponse::default_instance(); +} +inline ::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::mutable_error_response() { + if (!has_error_response()) { + clear_message_response(); + set_has_error_response(); + message_response_.error_response_ = new ::grpc::reflection::v1alpha::ErrorResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) + return message_response_.error_response_; +} +inline ::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::release_error_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) + if (has_error_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ErrorResponse* temp = message_response_.error_response_; + message_response_.error_response_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void ServerReflectionResponse::set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response) { + clear_message_response(); + if (error_response) { + set_has_error_response(); + message_response_.error_response_ = error_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) +} + +inline bool ServerReflectionResponse::has_message_response() const { + return message_response_case() != MESSAGE_RESPONSE_NOT_SET; +} +inline void ServerReflectionResponse::clear_has_message_response() { + _oneof_case_[0] = MESSAGE_RESPONSE_NOT_SET; +} +inline ServerReflectionResponse::MessageResponseCase ServerReflectionResponse::message_response_case() const { + return ServerReflectionResponse::MessageResponseCase(_oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// FileDescriptorResponse + +// repeated bytes file_descriptor_proto = 1; +inline int FileDescriptorResponse::file_descriptor_proto_size() const { + return file_descriptor_proto_.size(); +} +inline void FileDescriptorResponse::clear_file_descriptor_proto() { + file_descriptor_proto_.Clear(); +} +inline const ::std::string& FileDescriptorResponse::file_descriptor_proto(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_.Get(index); +} +inline ::std::string* FileDescriptorResponse::mutable_file_descriptor_proto(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_.Mutable(index); +} +inline void FileDescriptorResponse::set_file_descriptor_proto(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + file_descriptor_proto_.Mutable(index)->assign(value); +} +inline void FileDescriptorResponse::set_file_descriptor_proto(int index, const char* value) { + file_descriptor_proto_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline void FileDescriptorResponse::set_file_descriptor_proto(int index, const void* value, size_t size) { + file_descriptor_proto_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline ::std::string* FileDescriptorResponse::add_file_descriptor_proto() { + // @@protoc_insertion_point(field_add_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_.Add(); +} +inline void FileDescriptorResponse::add_file_descriptor_proto(const ::std::string& value) { + file_descriptor_proto_.Add()->assign(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline void FileDescriptorResponse::add_file_descriptor_proto(const char* value) { + file_descriptor_proto_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline void FileDescriptorResponse::add_file_descriptor_proto(const void* value, size_t size) { + file_descriptor_proto_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +FileDescriptorResponse::file_descriptor_proto() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +FileDescriptorResponse::mutable_file_descriptor_proto() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return &file_descriptor_proto_; +} + +// ------------------------------------------------------------------- + +// ExtensionNumberResponse + +// optional string base_type_name = 1; +inline void ExtensionNumberResponse::clear_base_type_name() { + base_type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ExtensionNumberResponse::base_type_name() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) + return base_type_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionNumberResponse::set_base_type_name(const ::std::string& value) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} +inline void ExtensionNumberResponse::set_base_type_name(const char* value) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} +inline void ExtensionNumberResponse::set_base_type_name(const char* value, size_t size) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} +inline ::std::string* ExtensionNumberResponse::mutable_base_type_name() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) + return base_type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ExtensionNumberResponse::release_base_type_name() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) + + return base_type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionNumberResponse::set_allocated_base_type_name(::std::string* base_type_name) { + if (base_type_name != NULL) { + + } else { + + } + base_type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), base_type_name); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} + +// repeated int32 extension_number = 2; +inline int ExtensionNumberResponse::extension_number_size() const { + return extension_number_.size(); +} +inline void ExtensionNumberResponse::clear_extension_number() { + extension_number_.Clear(); +} +inline ::google::protobuf::int32 ExtensionNumberResponse::extension_number(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_.Get(index); +} +inline void ExtensionNumberResponse::set_extension_number(int index, ::google::protobuf::int32 value) { + extension_number_.Set(index, value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) +} +inline void ExtensionNumberResponse::add_extension_number(::google::protobuf::int32 value) { + extension_number_.Add(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +ExtensionNumberResponse::extension_number() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +ExtensionNumberResponse::mutable_extension_number() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return &extension_number_; +} + +// ------------------------------------------------------------------- + +// ListServiceResponse + +// repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; +inline int ListServiceResponse::service_size() const { + return service_.size(); +} +inline void ListServiceResponse::clear_service() { + service_.Clear(); +} +inline const ::grpc::reflection::v1alpha::ServiceResponse& ListServiceResponse::service(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Get(index); +} +inline ::grpc::reflection::v1alpha::ServiceResponse* ListServiceResponse::mutable_service(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Mutable(index); +} +inline ::grpc::reflection::v1alpha::ServiceResponse* ListServiceResponse::add_service() { + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Add(); +} +inline ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >* +ListServiceResponse::mutable_service() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return &service_; +} +inline const ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >& +ListServiceResponse::service() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_; +} + +// ------------------------------------------------------------------- + +// ServiceResponse + +// optional string name = 1; +inline void ServiceResponse::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ServiceResponse::name() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServiceResponse.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ServiceResponse::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServiceResponse.name) +} +inline void ServiceResponse::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServiceResponse.name) +} +inline void ServiceResponse::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServiceResponse.name) +} +inline ::std::string* ServiceResponse::mutable_name() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServiceResponse.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServiceResponse::release_name() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServiceResponse.name) + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ServiceResponse::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServiceResponse.name) +} + +// ------------------------------------------------------------------- + +// ErrorResponse + +// optional int32 error_code = 1; +inline void ErrorResponse::clear_error_code() { + error_code_ = 0; +} +inline ::google::protobuf::int32 ErrorResponse::error_code() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_code) + return error_code_; +} +inline void ErrorResponse::set_error_code(::google::protobuf::int32 value) { + + error_code_ = value; + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_code) +} + +// optional string error_message = 2; +inline void ErrorResponse::clear_error_message() { + error_message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ErrorResponse::error_message() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_message) + return error_message_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ErrorResponse::set_error_message(const ::std::string& value) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_message) +} +inline void ErrorResponse::set_error_message(const char* value) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ErrorResponse.error_message) +} +inline void ErrorResponse::set_error_message(const char* value, size_t size) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ErrorResponse.error_message) +} +inline ::std::string* ErrorResponse::mutable_error_message() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ErrorResponse.error_message) + return error_message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ErrorResponse::release_error_message() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ErrorResponse.error_message) + + return error_message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ErrorResponse::set_allocated_error_message(::std::string* error_message) { + if (error_message != NULL) { + + } else { + + } + error_message_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), error_message); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ErrorResponse.error_message) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace v1alpha +} // namespace reflection +} // namespace grpc + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_reflection_2eproto__INCLUDED diff --git a/include/grpc++/grpc++.h b/include/grpc++/grpc++.h index b7d5fb0bbc..ef07e19975 100644 --- a/include/grpc++/grpc++.h +++ b/include/grpc++/grpc++.h @@ -57,8 +57,10 @@ #include <grpc++/client_context.h> #include <grpc++/completion_queue.h> #include <grpc++/create_channel.h> +#include <grpc++/create_channel_posix.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> +#include <grpc++/server_posix.h> #endif // GRPCXX_GRPCXX_H diff --git a/include/grpc++/impl/codegen/async_stream.h b/include/grpc++/impl/codegen/async_stream.h index a607a47106..0606441549 100644 --- a/include/grpc++/impl/codegen/async_stream.h +++ b/include/grpc++/impl/codegen/async_stream.h @@ -172,6 +172,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> { R* response, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { finish_ops_.RecvMessage(response); + finish_ops_.AllowNoMessage(); init_ops_.set_output_tag(tag); init_ops_.SendInitialMetadata(context->send_initial_metadata_, @@ -298,8 +299,16 @@ class ClientAsyncReaderWriter GRPC_FINAL }; template <class W, class R> -class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncReaderInterface<R> { +class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface, + public AsyncReaderInterface<R> { + public: + virtual void Finish(const W& msg, const Status& status, void* tag) = 0; + + virtual void FinishWithError(const Status& status, void* tag) = 0; +}; + +template <class W, class R> +class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> { public: explicit ServerAsyncReader(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -320,7 +329,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&read_ops_); } - void Finish(const W& msg, const Status& status, void* tag) { + void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, @@ -337,7 +346,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&finish_ops_); } - void FinishWithError(const Status& status, void* tag) { + void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE { GPR_CODEGEN_ASSERT(!status.ok()); finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { @@ -362,8 +371,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, }; template <class W> -class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface<W> { +class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface<W> { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template <class W> +class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> { public: explicit ServerAsyncWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -390,7 +405,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, @@ -413,9 +428,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, /// Server-side interface for asynchronous bi-directional streaming. template <class W, class R> -class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface<W>, - public AsyncReaderInterface<R> { +class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface<W>, + public AsyncReaderInterface<R> { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template <class W, class R> +class ServerAsyncReaderWriter GRPC_FINAL + : public ServerAsyncReaderWriterInterface<W, R> { public: explicit ServerAsyncReaderWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -448,7 +470,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index 55c9788fbd..47ac5bee92 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -91,6 +91,7 @@ class ClientAsyncResponseReader GRPC_FINAL collection_->finish_buf_.RecvInitialMetadata(context_); } collection_->finish_buf_.RecvMessage(msg); + collection_->finish_buf_.AllowNoMessage(); collection_->finish_buf_.ClientRecvStatus(context_, status); call_.PerformOps(&collection_->finish_buf_); } diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index aea1a6acec..fab85d1517 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -47,7 +47,9 @@ #include <grpc++/impl/codegen/serialization_traits.h> #include <grpc++/impl/codegen/status.h> #include <grpc++/impl/codegen/string_ref.h> + #include <grpc/impl/codegen/alloc.h> +#include <grpc/impl/codegen/compression_types.h> #include <grpc/impl/codegen/grpc_types.h> struct grpc_byte_buffer; @@ -187,6 +189,8 @@ class CallOpSendInitialMetadata { flags_ = flags; initial_metadata_count_ = metadata.size(); initial_metadata_ = FillMetadataArray(metadata); + // TODO(dgq): expose compression level in API so it can be properly set. + maybe_compression_level_.is_set = false; } protected: @@ -198,6 +202,10 @@ class CallOpSendInitialMetadata { op->reserved = NULL; op->data.send_initial_metadata.count = initial_metadata_count_; op->data.send_initial_metadata.metadata = initial_metadata_; + op->data.send_initial_metadata.maybe_compression_level.is_set = + maybe_compression_level_.is_set; + op->data.send_initial_metadata.maybe_compression_level.level = + maybe_compression_level_.level; } void FinishOp(bool* status, int max_message_size) { if (!send_) return; @@ -209,6 +217,10 @@ class CallOpSendInitialMetadata { uint32_t flags_; size_t initial_metadata_count_; grpc_metadata* initial_metadata_; + struct { + bool is_set; + grpc_compression_level level; + } maybe_compression_level_; }; class CallOpSendMessage { @@ -261,10 +273,16 @@ Status CallOpSendMessage::SendMessage(const M& message) { template <class R> class CallOpRecvMessage { public: - CallOpRecvMessage() : got_message(false), message_(nullptr) {} + CallOpRecvMessage() + : got_message(false), + message_(nullptr), + allow_not_getting_message_(false) {} void RecvMessage(R* message) { message_ = message; } + // Do not change status if no message is received. + void AllowNoMessage() { allow_not_getting_message_ = true; } + bool got_message; protected: @@ -281,17 +299,18 @@ class CallOpRecvMessage { if (message_ == nullptr) return; if (recv_buf_) { if (*status) { - got_message = true; - *status = SerializationTraits<R>::Deserialize(recv_buf_, message_, - max_message_size) - .ok(); + got_message = *status = SerializationTraits<R>::Deserialize( + recv_buf_, message_, max_message_size) + .ok(); } else { got_message = false; g_core_codegen_interface->grpc_byte_buffer_destroy(recv_buf_); } } else { got_message = false; - *status = false; + if (!allow_not_getting_message_) { + *status = false; + } } message_ = nullptr; } @@ -299,6 +318,7 @@ class CallOpRecvMessage { private: R* message_; grpc_byte_buffer* recv_buf_; + bool allow_not_getting_message_; }; namespace CallOpGenericRecvMessageHelper { @@ -317,7 +337,7 @@ class DeserializeFuncType GRPC_FINAL : public DeserializeFunc { return SerializationTraits<R>::Deserialize(buf, message_, max_message_size); } - ~DeserializeFuncType() override {} + ~DeserializeFuncType() GRPC_OVERRIDE {} private: R* message_; // Not a managed pointer because management is external to this @@ -326,14 +346,21 @@ class DeserializeFuncType GRPC_FINAL : public DeserializeFunc { class CallOpGenericRecvMessage { public: - CallOpGenericRecvMessage() : got_message(false) {} + CallOpGenericRecvMessage() + : got_message(false), allow_not_getting_message_(false) {} template <class R> void RecvMessage(R* message) { - deserialize_.reset( - new CallOpGenericRecvMessageHelper::DeserializeFuncType<R>(message)); + // Use an explicit base class pointer to avoid resolution error in the + // following unique_ptr::reset for some old implementations. + CallOpGenericRecvMessageHelper::DeserializeFunc* func = + new CallOpGenericRecvMessageHelper::DeserializeFuncType<R>(message); + deserialize_.reset(func); } + // Do not change status if no message is received. + void AllowNoMessage() { allow_not_getting_message_ = true; } + bool got_message; protected: @@ -358,7 +385,9 @@ class CallOpGenericRecvMessage { } } else { got_message = false; - *status = false; + if (!allow_not_getting_message_) { + *status = false; + } } deserialize_.reset(); } @@ -366,6 +395,7 @@ class CallOpGenericRecvMessage { private: std::unique_ptr<CallOpGenericRecvMessageHelper::DeserializeFunc> deserialize_; grpc_byte_buffer* recv_buf_; + bool allow_not_getting_message_; }; class CallOpClientSendClose { diff --git a/include/grpc++/impl/codegen/channel_interface.h b/include/grpc++/impl/codegen/channel_interface.h index 6fcd5c315c..cf78438117 100644 --- a/include/grpc++/impl/codegen/channel_interface.h +++ b/include/grpc++/impl/codegen/channel_interface.h @@ -85,6 +85,16 @@ class ChannelInterface { return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time()); } + /// Wait for this channel to be connected + template <typename T> + bool WaitForConnected(T deadline) { + grpc_connectivity_state state; + while ((state = GetState(true)) != GRPC_CHANNEL_READY) { + if (!WaitForStateChange(state, deadline)) return false; + } + return true; + } + private: template <class R> friend class ::grpc::ClientReader; diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h index e23fd4eda3..a132c9a57a 100644 --- a/include/grpc++/impl/codegen/client_context.h +++ b/include/grpc++/impl/codegen/client_context.h @@ -193,7 +193,7 @@ class ClientContext { /// /// \return A multimap of initial metadata key-value pairs from the server. const std::multimap<grpc::string_ref, grpc::string_ref>& - GetServerInitialMetadata() { + GetServerInitialMetadata() const { GPR_CODEGEN_ASSERT(initial_metadata_received_); return recv_initial_metadata_; } @@ -205,7 +205,7 @@ class ClientContext { /// /// \return A multimap of metadata trailing key-value pairs from the server. const std::multimap<grpc::string_ref, grpc::string_ref>& - GetServerTrailingMetadata() { + GetServerTrailingMetadata() const { // TODO(yangg) check finished return trailing_metadata_; } @@ -230,13 +230,13 @@ class ClientContext { #ifndef GRPC_CXX0X_NO_CHRONO /// Return the deadline for the client call. - std::chrono::system_clock::time_point deadline() { + std::chrono::system_clock::time_point deadline() const { return Timespec2Timepoint(deadline_); } #endif // !GRPC_CXX0X_NO_CHRONO /// Return a \a gpr_timespec representation of the client call's deadline. - gpr_timespec raw_deadline() { return deadline_; } + gpr_timespec raw_deadline() const { return deadline_; } /// Set the per call authority header (see /// https://tools.ietf.org/html/rfc7540#section-8.1.2.3). @@ -337,7 +337,7 @@ class ClientContext { const InputMessage& request, OutputMessage* result); - grpc_call* call() { return call_; } + grpc_call* call() const { return call_; } void set_call(grpc_call* call, const std::shared_ptr<Channel>& channel); uint32_t initial_metadata_flags() const { diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 56864d6d53..1b84b44705 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -222,9 +222,18 @@ class CompletionQueue : private GrpcLibraryCodegen { /// A specific type of completion queue used by the processing of notifications /// by servers. Instantiated by \a ServerBuilder. class ServerCompletionQueue : public CompletionQueue { + public: + bool IsFrequentlyPolled() { return is_frequently_polled_; } + private: + bool is_frequently_polled_; friend class ServerBuilder; - ServerCompletionQueue() {} + /// \param is_frequently_polled Informs the GPRC library about whether the + /// server completion queue would be actively polled (by calling Next() or + /// AsyncNext()). By default all server completion queues are assumed to be + /// frequently polled. + ServerCompletionQueue(bool is_frequently_polled = true) + : is_frequently_polled_(is_frequently_polled) {} }; } // namespace grpc diff --git a/include/grpc++/impl/codegen/config.h b/include/grpc++/impl/codegen/config.h index d782d5f571..0c75438868 100644 --- a/include/grpc++/impl/codegen/config.h +++ b/include/grpc++/impl/codegen/config.h @@ -54,6 +54,7 @@ // nullptr was added in gcc 4.6 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) #define GRPC_CXX0X_NO_NULLPTR 1 +#define GRPC_CXX0X_LIMITED_TOSTRING 1 #endif // final and override were added in gcc 4.7 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 407) @@ -78,6 +79,7 @@ #endif #ifdef GRPC_CXX0X_NO_NULLPTR +#include <functional> #include <memory> namespace grpc { const class { @@ -95,6 +97,10 @@ const class { return std::shared_ptr<T>(static_cast<T *>(0)); } operator bool() const { return false; } + template <class F> + operator std::function<F>() const { + return std::function<F>(); + } private: void operator&() const = delete; @@ -111,6 +117,17 @@ namespace grpc { typedef GRPC_CUSTOM_STRING string; +#ifdef GRPC_CXX0X_LIMITED_TOSTRING +inline grpc::string to_string(const int x) { + return std::to_string(static_cast<const long long int>(x)); +} +inline grpc::string to_string(const unsigned int x) { + return std::to_string(static_cast<const long long unsigned int>(x)); +} +#else +using std::to_string; +#endif + } // namespace grpc #endif // GRPCXX_IMPL_CODEGEN_CONFIG_H diff --git a/include/grpc++/impl/codegen/config_protobuf.h b/include/grpc++/impl/codegen/config_protobuf.h index f1b6beaca7..4bee1bc422 100644 --- a/include/grpc++/impl/codegen/config_protobuf.h +++ b/include/grpc++/impl/codegen/config_protobuf.h @@ -44,6 +44,19 @@ #define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message #endif +#ifndef GRPC_CUSTOM_DESCRIPTOR +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor +#define GRPC_CUSTOM_DESCRIPTORPOOL ::google::protobuf::DescriptorPool +#define GPRC_CUSTOM_FIELDDESCRIPTOR ::google::protobuf::FieldDescriptor +#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor +#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto +#define GRPC_CUSTOM_METHODDESCRIPTOR ::google::protobuf::MethodDescriptor +#define GRPC_CUSTOM_SERVICEDESCRIPTOR ::google::protobuf::ServiceDescriptor +#define GRPC_CUSTOM_SOURCELOCATION ::google::protobuf::SourceLocation +#endif + #ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/zero_copy_stream.h> @@ -60,6 +73,15 @@ namespace protobuf { typedef GRPC_CUSTOM_MESSAGE Message; typedef GRPC_CUSTOM_PROTOBUF_INT64 int64; +typedef GRPC_CUSTOM_DESCRIPTOR Descriptor; +typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool; +typedef GPRC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor; +typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor; +typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto; +typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor; +typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor; +typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation; + namespace io { typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream; diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h new file mode 100644 index 0000000000..b0c4c57e66 --- /dev/null +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -0,0 +1,85 @@ +/* + * + * Copyright 2016, 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. + * + */ + +// This file should be compiled as part of grpc++. + +#include <grpc++/impl/codegen/core_codegen_interface.h> +#include <grpc/byte_buffer.h> +#include <grpc/impl/codegen/grpc_types.h> + +namespace grpc { + +/// Implementation of the core codegen interface. +class CoreCodegen : public CoreCodegenInterface { + private: + grpc_completion_queue* grpc_completion_queue_create(void* reserved) + GRPC_OVERRIDE; + void grpc_completion_queue_destroy(grpc_completion_queue* cq) GRPC_OVERRIDE; + grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, + gpr_timespec deadline, + void* reserved) GRPC_OVERRIDE; + + void* gpr_malloc(size_t size) GRPC_OVERRIDE; + void gpr_free(void* p) GRPC_OVERRIDE; + + void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE; + + void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, + grpc_byte_buffer* buffer) GRPC_OVERRIDE; + void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader) + GRPC_OVERRIDE; + int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, + gpr_slice* slice) GRPC_OVERRIDE; + + grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice, + size_t nslices) GRPC_OVERRIDE; + + gpr_slice gpr_slice_malloc(size_t length) GRPC_OVERRIDE; + void gpr_slice_unref(gpr_slice slice) GRPC_OVERRIDE; + gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) GRPC_OVERRIDE; + void gpr_slice_buffer_add(gpr_slice_buffer* sb, + gpr_slice slice) GRPC_OVERRIDE; + void gpr_slice_buffer_pop(gpr_slice_buffer* sb) GRPC_OVERRIDE; + + void grpc_metadata_array_init(grpc_metadata_array* array) GRPC_OVERRIDE; + void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE; + + gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE; + + virtual const Status& ok() GRPC_OVERRIDE; + virtual const Status& cancelled() GRPC_OVERRIDE; + + void assert_fail(const char* failed_assertion) GRPC_OVERRIDE; +}; + +} // namespace grpc diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 16424bab35..64d882ed5d 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -34,7 +34,7 @@ #ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H #define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H -#include <grpc++/impl/codegen/config_protobuf.h> +#include <grpc++/impl/codegen/config.h> #include <grpc++/impl/codegen/status.h> #include <grpc/impl/codegen/grpc_types.h> @@ -49,18 +49,6 @@ namespace grpc { /// \warning This interface should be considered internal and private. class CoreCodegenInterface { public: - // Serialize the msg into a buffer created inside the function. The caller - // should destroy the returned buffer when done with it. If serialization - // fails, - // false is returned and buffer is left unchanged. - virtual Status SerializeProto(const grpc::protobuf::Message& msg, - grpc_byte_buffer** buffer) = 0; - - // The caller keeps ownership of buffer and msg. - virtual Status DeserializeProto(grpc_byte_buffer* buffer, - grpc::protobuf::Message* msg, - int max_message_size) = 0; - /// Upon a failed assertion, log the error. virtual void assert_fail(const char* failed_assertion) = 0; @@ -76,9 +64,29 @@ class CoreCodegenInterface { virtual void gpr_free(void* p) = 0; virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0; + + virtual void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, + grpc_byte_buffer* buffer) = 0; + virtual void grpc_byte_buffer_reader_destroy( + grpc_byte_buffer_reader* reader) = 0; + virtual int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, + gpr_slice* slice) = 0; + + virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice, + size_t nslices) = 0; + + virtual gpr_slice gpr_slice_malloc(size_t length) = 0; + virtual void gpr_slice_unref(gpr_slice slice) = 0; + virtual gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) = 0; + virtual void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) = 0; + virtual void gpr_slice_buffer_pop(gpr_slice_buffer* sb) = 0; + virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0; virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0; + virtual const Status& ok() = 0; + virtual const Status& cancelled() = 0; + virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0; }; diff --git a/include/grpc++/impl/codegen/impl/async_stream.h b/include/grpc++/impl/codegen/impl/async_stream.h index 8f99e7eea4..7d7a956807 100644 --- a/include/grpc++/impl/codegen/impl/async_stream.h +++ b/include/grpc++/impl/codegen/impl/async_stream.h @@ -295,8 +295,16 @@ class ClientAsyncReaderWriter GRPC_FINAL }; template <class W, class R> -class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncReaderInterface<R> { +class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface, + public AsyncReaderInterface<R> { + public: + virtual void Finish(const W& msg, const Status& status, void* tag) = 0; + + virtual void FinishWithError(const Status& status, void* tag) = 0; +}; + +template <class W, class R> +class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> { public: explicit ServerAsyncReader(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -316,7 +324,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&read_ops_); } - void Finish(const W& msg, const Status& status, void* tag) { + void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); @@ -332,7 +340,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&finish_ops_); } - void FinishWithError(const Status& status, void* tag) { + void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE { GPR_CODEGEN_ASSERT(!status.ok()); finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { @@ -356,8 +364,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, }; template <class W> -class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface<W> { +class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface<W> { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template <class W> +class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> { public: explicit ServerAsyncWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -382,7 +396,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); @@ -404,9 +418,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, /// Server-side interface for asynchronous bi-directional streaming. template <class W, class R> -class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface<W>, - public AsyncReaderInterface<R> { +class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface<W>, + public AsyncReaderInterface<R> { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template <class W, class R> +class ServerAsyncReaderWriter GRPC_FINAL + : public ServerAsyncReaderWriterInterface<W, R> { public: explicit ServerAsyncReaderWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -437,7 +458,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); diff --git a/include/grpc++/impl/codegen/method_handler_impl.h b/include/grpc++/impl/codegen/method_handler_impl.h index ad74efabc4..21ac6c4fb5 100644 --- a/include/grpc++/impl/codegen/method_handler_impl.h +++ b/include/grpc++/impl/codegen/method_handler_impl.h @@ -44,10 +44,10 @@ namespace grpc { template <class ServiceType, class RequestType, class ResponseType> class RpcMethodHandler : public MethodHandler { public: - RpcMethodHandler( - std::function<Status(ServiceType*, ServerContext*, const RequestType*, - ResponseType*)> func, - ServiceType* service) + RpcMethodHandler(std::function<Status(ServiceType*, ServerContext*, + const RequestType*, ResponseType*)> + func, + ServiceType* service) : func_(func), service_(service) {} void RunHandler(const HandlerParameter& param) GRPC_FINAL { @@ -88,7 +88,8 @@ class ClientStreamingHandler : public MethodHandler { public: ClientStreamingHandler( std::function<Status(ServiceType*, ServerContext*, - ServerReader<RequestType>*, ResponseType*)> func, + ServerReader<RequestType>*, ResponseType*)> + func, ServiceType* service) : func_(func), service_(service) {} @@ -124,7 +125,8 @@ class ServerStreamingHandler : public MethodHandler { public: ServerStreamingHandler( std::function<Status(ServiceType*, ServerContext*, const RequestType*, - ServerWriter<ResponseType>*)> func, + ServerWriter<ResponseType>*)> + func, ServiceType* service) : func_(func), service_(service) {} diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h index 2aaa3c3b30..3bad468a74 100644 --- a/include/grpc++/impl/codegen/proto_utils.h +++ b/include/grpc++/impl/codegen/proto_utils.h @@ -41,26 +41,180 @@ #include <grpc++/impl/codegen/serialization_traits.h> #include <grpc++/impl/codegen/status.h> #include <grpc/impl/codegen/byte_buffer.h> +#include <grpc/impl/codegen/byte_buffer_reader.h> #include <grpc/impl/codegen/log.h> +#include <grpc/impl/codegen/slice.h> namespace grpc { extern CoreCodegenInterface* g_core_codegen_interface; +namespace internal { + +const int kGrpcBufferWriterMaxBufferLength = 8192; + +class GrpcBufferWriter GRPC_FINAL + : public ::grpc::protobuf::io::ZeroCopyOutputStream { + public: + explicit GrpcBufferWriter(grpc_byte_buffer** bp, int block_size) + : block_size_(block_size), byte_count_(0), have_backup_(false) { + *bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(NULL, 0); + slice_buffer_ = &(*bp)->data.raw.slice_buffer; + } + + ~GrpcBufferWriter() GRPC_OVERRIDE { + if (have_backup_) { + g_core_codegen_interface->gpr_slice_unref(backup_slice_); + } + } + + bool Next(void** data, int* size) GRPC_OVERRIDE { + if (have_backup_) { + slice_ = backup_slice_; + have_backup_ = false; + } else { + slice_ = g_core_codegen_interface->gpr_slice_malloc(block_size_); + } + *data = GPR_SLICE_START_PTR(slice_); + // On win x64, int is only 32bit + GPR_CODEGEN_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX); + byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_); + g_core_codegen_interface->gpr_slice_buffer_add(slice_buffer_, slice_); + return true; + } + + void BackUp(int count) GRPC_OVERRIDE { + g_core_codegen_interface->gpr_slice_buffer_pop(slice_buffer_); + if (count == block_size_) { + backup_slice_ = slice_; + } else { + backup_slice_ = g_core_codegen_interface->gpr_slice_split_tail( + &slice_, GPR_SLICE_LENGTH(slice_) - count); + g_core_codegen_interface->gpr_slice_buffer_add(slice_buffer_, slice_); + } + have_backup_ = true; + byte_count_ -= count; + } + + grpc::protobuf::int64 ByteCount() const GRPC_OVERRIDE { return byte_count_; } + + private: + const int block_size_; + int64_t byte_count_; + gpr_slice_buffer* slice_buffer_; + bool have_backup_; + gpr_slice backup_slice_; + gpr_slice slice_; +}; + +class GrpcBufferReader GRPC_FINAL + : public ::grpc::protobuf::io::ZeroCopyInputStream { + public: + explicit GrpcBufferReader(grpc_byte_buffer* buffer) + : byte_count_(0), backup_count_(0) { + g_core_codegen_interface->grpc_byte_buffer_reader_init(&reader_, buffer); + } + ~GrpcBufferReader() GRPC_OVERRIDE { + g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_); + } + + bool Next(const void** data, int* size) GRPC_OVERRIDE { + if (backup_count_ > 0) { + *data = GPR_SLICE_START_PTR(slice_) + GPR_SLICE_LENGTH(slice_) - + backup_count_; + GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX); + *size = (int)backup_count_; + backup_count_ = 0; + return true; + } + if (!g_core_codegen_interface->grpc_byte_buffer_reader_next(&reader_, + &slice_)) { + return false; + } + g_core_codegen_interface->gpr_slice_unref(slice_); + *data = GPR_SLICE_START_PTR(slice_); + // On win x64, int is only 32bit + GPR_CODEGEN_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX); + byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_); + return true; + } + + void BackUp(int count) GRPC_OVERRIDE { backup_count_ = count; } + + bool Skip(int count) GRPC_OVERRIDE { + const void* data; + int size; + while (Next(&data, &size)) { + if (size >= count) { + BackUp(size - count); + return true; + } + // size < count; + count -= size; + } + // error or we have too large count; + return false; + } + + grpc::protobuf::int64 ByteCount() const GRPC_OVERRIDE { + return byte_count_ - backup_count_; + } + + private: + int64_t byte_count_; + int64_t backup_count_; + grpc_byte_buffer_reader reader_; + gpr_slice slice_; +}; +} // namespace internal + template <class T> class SerializationTraits<T, typename std::enable_if<std::is_base_of< grpc::protobuf::Message, T>::value>::type> { public: static Status Serialize(const grpc::protobuf::Message& msg, - grpc_byte_buffer** buffer, bool* own_buffer) { + grpc_byte_buffer** bp, bool* own_buffer) { *own_buffer = true; - return g_core_codegen_interface->SerializeProto(msg, buffer); + int byte_size = msg.ByteSize(); + if (byte_size <= internal::kGrpcBufferWriterMaxBufferLength) { + gpr_slice slice = g_core_codegen_interface->gpr_slice_malloc(byte_size); + GPR_CODEGEN_ASSERT( + GPR_SLICE_END_PTR(slice) == + msg.SerializeWithCachedSizesToArray(GPR_SLICE_START_PTR(slice))); + *bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(&slice, 1); + g_core_codegen_interface->gpr_slice_unref(slice); + return g_core_codegen_interface->ok(); + } else { + internal::GrpcBufferWriter writer( + bp, internal::kGrpcBufferWriterMaxBufferLength); + return msg.SerializeToZeroCopyStream(&writer) + ? g_core_codegen_interface->ok() + : Status(StatusCode::INTERNAL, "Failed to serialize message"); + } } + static Status Deserialize(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, int max_message_size) { - return g_core_codegen_interface->DeserializeProto(buffer, msg, - max_message_size); + if (buffer == nullptr) { + return Status(StatusCode::INTERNAL, "No payload"); + } + Status result = g_core_codegen_interface->ok(); + { + internal::GrpcBufferReader reader(buffer); + ::grpc::protobuf::io::CodedInputStream decoder(&reader); + if (max_message_size > 0) { + decoder.SetTotalBytesLimit(max_message_size, max_message_size); + } + if (!msg->ParseFromCodedStream(&decoder)) { + result = Status(StatusCode::INTERNAL, msg->InitializationErrorString()); + } + if (!decoder.ConsumedEntireMessage()) { + result = Status(StatusCode::INTERNAL, "Did not read entire message"); + } + } + g_core_codegen_interface->grpc_byte_buffer_destroy(buffer); + return result; } }; diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h index a1e1ed176f..cea13a513f 100644 --- a/include/grpc++/impl/codegen/server_context.h +++ b/include/grpc++/impl/codegen/server_context.h @@ -94,12 +94,12 @@ class ServerContext { ~ServerContext(); #ifndef GRPC_CXX0X_NO_CHRONO - std::chrono::system_clock::time_point deadline() { + std::chrono::system_clock::time_point deadline() const { return Timespec2Timepoint(deadline_); } #endif // !GRPC_CXX0X_NO_CHRONO - gpr_timespec raw_deadline() { return deadline_; } + gpr_timespec raw_deadline() const { return deadline_; } void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); @@ -122,7 +122,8 @@ class ServerContext { // was called. void TryCancel() const; - const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata() { + const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata() + const { return client_metadata_; } diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 7b7d5aa90b..3a3e052d9e 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -62,6 +62,10 @@ class ServerInterface : public CallHook { /// Shutdown the server, blocking until all rpc processing finishes. /// Forcefully terminate pending calls after \a deadline expires. /// + /// All completion queue associated with the server (for example, for async + /// serving) must be shutdown *after* this method has returned: + /// See \a ServerBuilder::AddCompletionQueue for details. + /// /// \param deadline How long to wait until pending rpcs are forcefully /// terminated. template <class T> @@ -70,6 +74,10 @@ class ServerInterface : public CallHook { } /// Shutdown the server, waiting for all rpc processing to finish. + /// + /// All completion queue associated with the server (for example, for async + /// serving) must be shutdown *after* this method has returned: + /// See \a ServerBuilder::AddCompletionQueue for details. void Shutdown() { ShutdownInternal(gpr_inf_future(GPR_CLOCK_MONOTONIC)); } /// Block waiting for all work to complete. diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 9100ce09a2..e94ffe5842 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -189,6 +189,7 @@ class ClientWriter : public ClientWriterInterface<W> { ClientContext* context, R* response) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); + finish_ops_.AllowNoMessage(); CallOpSet<CallOpSendInitialMetadata> ops; ops.SendInitialMetadata(context->send_initial_metadata_, diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h index 175cf99a82..1184d1bf09 100644 --- a/include/grpc++/impl/grpc_library.h +++ b/include/grpc++/impl/grpc_library.h @@ -37,11 +37,10 @@ #include <iostream> #include <grpc++/impl/codegen/config.h> +#include <grpc++/impl/codegen/core_codegen.h> #include <grpc++/impl/codegen/grpc_library.h> #include <grpc/grpc.h> -#include "src/cpp/common/core_codegen.h" - namespace grpc { namespace internal { diff --git a/include/grpc++/impl/server_builder_option.h b/include/grpc++/impl/server_builder_option.h index bcb19824fd..bd2018fa6b 100644 --- a/include/grpc++/impl/server_builder_option.h +++ b/include/grpc++/impl/server_builder_option.h @@ -34,6 +34,10 @@ #ifndef GRPCXX_IMPL_SERVER_BUILDER_OPTION_H #define GRPCXX_IMPL_SERVER_BUILDER_OPTION_H +#include <map> +#include <memory> + +#include <grpc++/impl/server_builder_plugin.h> #include <grpc++/support/channel_arguments.h> namespace grpc { @@ -44,6 +48,9 @@ class ServerBuilderOption { virtual ~ServerBuilderOption() {} /// Alter the \a ChannelArguments used to create the gRPC server. virtual void UpdateArguments(ChannelArguments* args) = 0; + /// Alter the ServerBuilderPlugin map that will be added into ServerBuilder. + virtual void UpdatePlugins( + std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) = 0; }; } // namespace grpc diff --git a/include/grpc++/impl/server_builder_plugin.h b/include/grpc++/impl/server_builder_plugin.h new file mode 100644 index 0000000000..1e157efa11 --- /dev/null +++ b/include/grpc++/impl/server_builder_plugin.h @@ -0,0 +1,67 @@ +/* + * + * Copyright 2016, 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. + * + */ + +#ifndef GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H +#define GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H + +#include <memory> + +#include <grpc++/support/config.h> + +namespace grpc { + +class ServerInitializer; + +class ServerBuilderPlugin { + public: + virtual ~ServerBuilderPlugin() {} + virtual grpc::string name() = 0; + + // InitServer will be called in ServerBuilder::BuildAndStart(), after the + // Server instance is created. + virtual void InitServer(ServerInitializer* si) = 0; + + // Finish will be called at the end of ServerBuilder::BuildAndStart(). + virtual void Finish(ServerInitializer* si) = 0; + + // ChangeArguments is an interface that can be used in + // ServerBuilderOption::UpdatePlugins + virtual void ChangeArguments(const grpc::string& name, void* value) = 0; + + virtual bool has_sync_methods() const { return false; } + virtual bool has_async_methods() const { return false; } +}; + +} // namespace grpc + +#endif // GRPCXX_IMPL_SERVER_BUILDER_PLUGIN_H diff --git a/include/grpc++/impl/server_initializer.h b/include/grpc++/impl/server_initializer.h new file mode 100644 index 0000000000..dbcecc7026 --- /dev/null +++ b/include/grpc++/impl/server_initializer.h @@ -0,0 +1,70 @@ +/* + * + * Copyright 2016, 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. + * + */ + +#ifndef GRPCXX_IMPL_SERVER_INITIALIZER_H +#define GRPCXX_IMPL_SERVER_INITIALIZER_H + +#include <memory> +#include <vector> + +#include <grpc++/server.h> + +namespace grpc { + +class Server; +class Service; + +class ServerInitializer { + public: + ServerInitializer(Server* server) : server_(server) {} + + bool RegisterService(std::shared_ptr<Service> service) { + if (!server_->RegisterService(nullptr, service.get())) { + return false; + } + default_services_.push_back(service); + return true; + } + + const std::vector<grpc::string>* GetServiceList() { + return &server_->services_; + } + + private: + Server* server_; + std::vector<std::shared_ptr<Service> > default_services_; +}; + +} // namespace grpc + +#endif // GRPCXX_IMPL_SERVER_INITIALIZER_H diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 729a5143bf..7a8858ef19 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -36,6 +36,7 @@ #include <list> #include <memory> +#include <vector> #include <grpc++/completion_queue.h> #include <grpc++/impl/call.h> @@ -57,6 +58,7 @@ class GenericServerContext; class AsyncGenericService; class ServerAsyncStreamingInterface; class ServerContext; +class ServerInitializer; class ThreadPoolInterface; /// Models a gRPC server. @@ -91,9 +93,16 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { /// until all server objects in the process have been destroyed. static void SetGlobalCallbacks(GlobalCallbacks* callbacks); + // Returns a \em raw pointer to the underlying grpc_server instance. + grpc_server* c_server(); + + // Returns a \em raw pointer to the underlying CompletionQueue. + CompletionQueue* completion_queue(); + private: friend class AsyncGenericService; friend class ServerBuilder; + friend class ServerInitializer; class SyncRequest; class AsyncRequest; @@ -159,6 +168,8 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { grpc_server* server() GRPC_OVERRIDE { return server_; }; + ServerInitializer* initializer(); + const int max_message_size_; // Completion queue. @@ -175,6 +186,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { std::shared_ptr<GlobalCallbacks> global_callbacks_; std::list<SyncRequest>* sync_methods_; + std::vector<grpc::string> services_; std::unique_ptr<RpcServiceMethod> unknown_method_; bool has_generic_service_; @@ -184,6 +196,8 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { ThreadPoolInterface* thread_pool_; // Whether the thread pool is created and owned by the server. bool thread_pool_owned_; + + std::unique_ptr<ServerInitializer> server_initializer_; }; } // namespace grpc diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 86c7fecef5..b9c49f0b19 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +34,12 @@ #ifndef GRPCXX_SERVER_BUILDER_H #define GRPCXX_SERVER_BUILDER_H +#include <map> #include <memory> #include <vector> #include <grpc++/impl/server_builder_option.h> +#include <grpc++/impl/server_builder_plugin.h> #include <grpc++/support/config.h> #include <grpc/compression.h> @@ -51,6 +53,10 @@ class ServerCompletionQueue; class ServerCredentials; class Service; +namespace testing { +class ServerBuilderPluginTest; +} // namespace testing + /// A builder class for the creation and startup of \a grpc::Server instances. class ServerBuilder { public: @@ -60,29 +66,43 @@ class ServerBuilder { /// The service must exist for the lifetime of the \a Server instance returned /// by \a BuildAndStart(). /// Matches requests with any :authority - void RegisterService(Service* service); + ServerBuilder& RegisterService(Service* service); /// Register a generic service. /// Matches requests with any :authority - void RegisterAsyncGenericService(AsyncGenericService* service); + ServerBuilder& RegisterAsyncGenericService(AsyncGenericService* service); /// Register a service. This call does not take ownership of the service. /// The service must exist for the lifetime of the \a Server instance returned /// by BuildAndStart(). /// Only matches requests with :authority \a host - void RegisterService(const grpc::string& host, Service* service); + ServerBuilder& RegisterService(const grpc::string& host, Service* service); /// Set max message size in bytes. - void SetMaxMessageSize(int max_message_size) { + ServerBuilder& SetMaxMessageSize(int max_message_size) { max_message_size_ = max_message_size; + return *this; } - /// Set the compression options to be used by the server. - void SetCompressionOptions(const grpc_compression_options& options) { - compression_options_ = options; - } + /// Set the support status for compression algorithms. All algorithms are + /// enabled by default. + /// + /// Incoming calls compressed with an unsupported algorithm will fail with + /// GRPC_STATUS_UNIMPLEMENTED. + ServerBuilder& SetCompressionAlgorithmSupportStatus( + grpc_compression_algorithm algorithm, bool enabled); - void SetOption(std::unique_ptr<ServerBuilderOption> option); + /// The default compression level to use for all channel calls in the + /// absence of a call-specific level. + ServerBuilder& SetDefaultCompressionLevel(grpc_compression_level level); + + /// The default compression algorithm to use for all channel calls in the + /// absence of a call-specific level. Note that it overrides any compression + /// level set by \a SetDefaultCompressionLevel. + ServerBuilder& SetDefaultCompressionAlgorithm( + grpc_compression_algorithm algorithm); + + ServerBuilder& SetOption(std::unique_ptr<ServerBuilderOption> option); /// Tries to bind \a server to the given \a addr. /// @@ -95,19 +115,44 @@ class ServerBuilder { /// number. \a nullptr otherwise. /// // TODO(dgq): the "port" part seems to be a misnomer. - void AddListeningPort(const grpc::string& addr, - std::shared_ptr<ServerCredentials> creds, - int* selected_port = nullptr); + ServerBuilder& AddListeningPort(const grpc::string& addr, + std::shared_ptr<ServerCredentials> creds, + int* selected_port = nullptr); - /// Add a completion queue for handling asynchronous services - /// Caller is required to keep this completion queue live until - /// the server is destroyed. - std::unique_ptr<ServerCompletionQueue> AddCompletionQueue(); + /// Add a completion queue for handling asynchronous services. + /// + /// Caller is required to shutdown the server prior to shutting down the + /// returned completion queue. A typical usage scenario: + /// + /// // While building the server: + /// ServerBuilder builder; + /// ... + /// cq_ = builder.AddCompletionQueue(); + /// server_ = builder.BuildAndStart(); + /// + /// // While shutting down the server; + /// server_->Shutdown(); + /// cq_->Shutdown(); // Always *after* the associated server's Shutdown()! + /// + /// \param is_frequently_polled This is an optional parameter to inform GRPC + /// library about whether this completion queue would be frequently polled + /// (i.e by calling Next() or AsyncNext()). The default value is 'true' and is + /// the recommended setting. Setting this to 'false' (i.e not polling the + /// completion queue frequently) will have a significantly negative + /// performance impact and hence should not be used in production use cases. + std::unique_ptr<ServerCompletionQueue> AddCompletionQueue( + bool is_frequently_polled = true); /// Return a running server which is ready for processing calls. std::unique_ptr<Server> BuildAndStart(); + /// For internal use only: Register a ServerBuilderPlugin factory function. + static void InternalAddPluginFactory( + std::unique_ptr<ServerBuilderPlugin> (*CreatePlugin)()); + private: + friend class ::grpc::testing::ServerBuilderPluginTest; + struct Port { grpc::string addr; std::shared_ptr<ServerCredentials> creds; @@ -124,13 +169,22 @@ class ServerBuilder { }; int max_message_size_; - grpc_compression_options compression_options_; std::vector<std::unique_ptr<ServerBuilderOption>> options_; std::vector<std::unique_ptr<NamedService>> services_; std::vector<Port> ports_; std::vector<ServerCompletionQueue*> cqs_; std::shared_ptr<ServerCredentials> creds_; + std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_; AsyncGenericService* generic_service_; + struct { + bool is_set; + grpc_compression_level level; + } maybe_default_compression_level_; + struct { + bool is_set; + grpc_compression_algorithm algorithm; + } maybe_default_compression_algorithm_; + uint32_t enabled_compression_algorithms_bitset_; }; } // namespace grpc diff --git a/include/grpc++/impl/proto_utils.h b/include/grpc++/server_posix.h index a34cf9bd6c..e6066d4eaa 100644 --- a/include/grpc++/impl/proto_utils.h +++ b/include/grpc++/server_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,9 +31,26 @@ * */ -#ifndef GRPCXX_IMPL_PROTO_UTILS_H -#define GRPCXX_IMPL_PROTO_UTILS_H +#ifndef GRPCXX_SERVER_POSIX_H +#define GRPCXX_SERVER_POSIX_H -#include <grpc++/impl/codegen/proto_utils.h> +#include <memory> -#endif // GRPCXX_IMPL_PROTO_UTILS_H +#include <grpc++/server.h> +#include <grpc/support/port_platform.h> + +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + +/// Adds new client to a \a Server communicating over given file descriptor +/// +/// \param server The server to add a client to. +/// \param fd The file descriptor representing a socket. +void AddInsecureChannelFromFd(Server* server, int fd); + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} // namespace grpc + +#endif // GRPCXX_SERVER_POSIX_H |