create_channel.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <memory>
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
24 #include <grpc/grpc.h>
25 #include <grpc/status.h>
26 #include <grpcpp/channel.h>
27 #include <grpcpp/create_channel.h>
32 #include <grpcpp/support/config.h>
33 
35 
36 namespace grpc {
37 std::shared_ptr<grpc::Channel> CreateChannel(
38  const grpc::string& target,
39  const std::shared_ptr<grpc::ChannelCredentials>& creds) {
41 }
42 
43 std::shared_ptr<grpc::Channel> CreateCustomChannel(
44  const grpc::string& target,
45  const std::shared_ptr<grpc::ChannelCredentials>& creds,
48  init_lib; // We need to call init in case of bad creds.
49  return creds ? creds->CreateChannelImpl(target, args)
51  "",
54  "Invalid credentials."),
55  std::vector<std::unique_ptr<
57  ClientInterceptorFactoryInterface>>());
58 }
59 
60 namespace experimental {
72 std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
73  const std::string& target,
74  const std::shared_ptr<grpc::ChannelCredentials>& creds,
76  std::vector<
77  std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
78  interceptor_creators) {
80  init_lib; // We need to call init in case of bad creds.
81  return creds ? creds->CreateChannelWithInterceptors(
82  target, args, std::move(interceptor_creators))
84  "",
87  "Invalid credentials."),
88  std::move(interceptor_creators));
89 }
90 } // namespace experimental
91 
92 } // namespace grpc
grpc::CreateChannelInternal
std::shared_ptr< Channel > CreateChannelInternal(const std::string &host, grpc_channel *c_channel, std::vector< std::unique_ptr< experimental::ClientInterceptorFactoryInterface >> interceptor_creators)
create_channel_internal.h
grpc
Definition: grpcpp/alarm.h:33
grpc_lame_client_channel_create
GRPCAPI grpc_channel * grpc_lame_client_channel_create(const char *target, grpc_status_code error_code, const char *error_message)
Definition: lame_client.cc:131
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
GRPC_STATUS_INVALID_ARGUMENT
@ GRPC_STATUS_INVALID_ARGUMENT
Definition: include/grpc/impl/codegen/status.h:46
grpc::GrpcLibraryCodegen
Classes that require gRPC to be initialized should inherit from this class.
Definition: grpcpp/impl/codegen/grpc_library.h:40
status.h
client_interceptor.h
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
channel_arguments.h
grpc::experimental
Definition: include/grpcpp/channel.h:46
grpc.h
channel.h
grpc::CreateChannel
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
config.h
grpc::ChannelArguments
Definition: grpcpp/support/channel_arguments.h:39
credentials.h
grpc_library.h
grpc::experimental::CreateCustomChannelWithInterceptors
std::shared_ptr< Channel > CreateCustomChannelWithInterceptors(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds, const ChannelArguments &args, std::vector< std::unique_ptr< experimental::ClientInterceptorFactoryInterface >> interceptor_creators)
grpc::CreateCustomChannel
std::shared_ptr< Channel > CreateCustomChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds, const ChannelArguments &args)
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
create_channel.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:06