diff options
author | Muxi Yan <mxyan@google.com> | 2018-01-26 15:39:32 -0800 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2018-02-15 14:49:34 -0800 |
commit | 0e00c430827e81d61e1e7164ef04ca21ccbfaa77 (patch) | |
tree | 9246301d4f3583a4befd834f7ea426663b8eb622 /include/grpcpp/ext | |
parent | 8224c45866c6a2cfa29ede0c91a6ae9f40572658 (diff) |
Move headers from grpc++ to grpcpp
Diffstat (limited to 'include/grpcpp/ext')
-rw-r--r-- | include/grpcpp/ext/health_check_service_server_builder_option.h | 47 | ||||
-rw-r--r-- | include/grpcpp/ext/proto_server_reflection_plugin.h | 54 |
2 files changed, 101 insertions, 0 deletions
diff --git a/include/grpcpp/ext/health_check_service_server_builder_option.h b/include/grpcpp/ext/health_check_service_server_builder_option.h new file mode 100644 index 0000000000..dd43b05ef0 --- /dev/null +++ b/include/grpcpp/ext/health_check_service_server_builder_option.h @@ -0,0 +1,47 @@ +/* + * + * Copyright 2016 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H +#define GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H + +#include <memory> + +#include <grpcpp/health_check_service_interface.h> +#include <grpcpp/impl/server_builder_option.h> +#include <grpcpp/support/config.h> + +namespace grpc { + +class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { + public: + /// The ownership of \a hc will be taken and transferred to the grpc server. + /// To explicitly disable default service, pass in a nullptr. + explicit HealthCheckServiceServerBuilderOption( + std::unique_ptr<HealthCheckServiceInterface> hc); + ~HealthCheckServiceServerBuilderOption() override {} + void UpdateArguments(ChannelArguments* args) override; + void UpdatePlugins( + std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override; + + private: + std::unique_ptr<HealthCheckServiceInterface> hc_; +}; + +} // namespace grpc + +#endif // GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H diff --git a/include/grpcpp/ext/proto_server_reflection_plugin.h b/include/grpcpp/ext/proto_server_reflection_plugin.h new file mode 100644 index 0000000000..1cfdc1b6cc --- /dev/null +++ b/include/grpcpp/ext/proto_server_reflection_plugin.h @@ -0,0 +1,54 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H +#define GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H + +#include <grpcpp/impl/server_builder_plugin.h> +#include <grpcpp/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() override; + void InitServer(::grpc::ServerInitializer* si) override; + void Finish(::grpc::ServerInitializer* si) override; + void ChangeArguments(const ::grpc::string& name, void* value) override; + bool has_async_methods() const override; + bool has_sync_methods() const override; + + private: + std::shared_ptr<grpc::ProtoServerReflection> reflection_service_; +}; + +/// Add proto reflection plugin to \a ServerBuilder. +/// This function should be called at the static initialization time. +void InitProtoReflectionServerBuilderPlugin(); + +} // namespace reflection +} // namespace grpc + +#endif // GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H |