client_channel_factory.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 
20 
22 
25 
26 // Channel arg key for client channel factory.
27 #define GRPC_ARG_CLIENT_CHANNEL_FACTORY "grpc.client_channel_factory"
28 
29 namespace grpc_core {
30 
31 namespace {
32 
33 void* factory_arg_copy(void* f) { return f; }
34 void factory_arg_destroy(void* /*f*/) {}
35 int factory_arg_cmp(void* factory1, void* factory2) {
36  return QsortCompare(factory1, factory2);
37 }
38 const grpc_arg_pointer_vtable factory_arg_vtable = {
39  factory_arg_copy, factory_arg_destroy, factory_arg_cmp};
40 
41 } // namespace
42 
45 }
46 
49  const_cast<char*>(GRPC_ARG_CLIENT_CHANNEL_FACTORY), factory,
50  &factory_arg_vtable);
51 }
52 
54  const grpc_channel_args* args) {
55  const grpc_arg* arg =
57  if (arg == nullptr || arg->type != GRPC_ARG_POINTER) return nullptr;
58  return static_cast<ClientChannelFactory*>(arg->value.pointer.p);
59 }
60 
61 } // namespace grpc_core
grpc_arg
Definition: grpc_types.h:103
grpc_core
Definition: call_metric_recorder.h:31
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
useful.h
arg::value
void * value
Definition: cmdline.cc:44
grpc_arg_pointer_vtable
Definition: grpc_types.h:85
grpc_channel_args
Definition: grpc_types.h:132
grpc_core::ClientChannelFactory
Definition: client_channel_factory.h:32
arg::type
argtype type
Definition: cmdline.cc:43
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
arg
Definition: cmdline.cc:40
client_channel_factory.h
grpc_core::ClientChannelFactory::CreateChannelArg
static grpc_arg CreateChannelArg(ClientChannelFactory *factory)
Definition: client_channel_factory.cc:47
grpc_core::ClientChannelFactory::ChannelArgName
static absl::string_view ChannelArgName()
Definition: client_channel_factory.cc:43
grpc_core::QsortCompare
int QsortCompare(const T &a, const T &b)
Definition: useful.h:95
GRPC_ARG_CLIENT_CHANNEL_FACTORY
#define GRPC_ARG_CLIENT_CHANNEL_FACTORY
Definition: client_channel_factory.cc:27
grpc_core::ClientChannelFactory::GetFromChannelArgs
static ClientChannelFactory * GetFromChannelArgs(const grpc_channel_args *args)
Definition: client_channel_factory.cc:53
channel_args.h
GRPC_ARG_POINTER
@ GRPC_ARG_POINTER
Definition: grpc_types.h:82
grpc_channel_arg_pointer_create
grpc_arg grpc_channel_arg_pointer_create(char *name, void *value, const grpc_arg_pointer_vtable *vtable)
Definition: channel_args.cc:492
grpc_channel_args_find
const grpc_arg * grpc_channel_args_find(const grpc_channel_args *args, const char *name)
Definition: channel_args.cc:393
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:55