From d36fe0708b90491252ce4d192621f36fb39ab2b7 Mon Sep 17 00:00:00 2001 From: Yihua Zhang Date: Tue, 23 Jan 2018 10:40:45 -0800 Subject: rename gts to alts --- .../plugin_registry/grpc_cronet_plugin_registry.cc | 8 ++--- src/core/plugin_registry/grpc_plugin_registry.cc | 8 ++--- src/core/tsi/alts_transport_security.cc | 42 ++++++++++++++++++++++ src/core/tsi/alts_transport_security.h | 37 +++++++++++++++++++ src/core/tsi/gts_transport_security.cc | 40 --------------------- src/core/tsi/gts_transport_security.h | 37 ------------------- 6 files changed, 87 insertions(+), 85 deletions(-) create mode 100644 src/core/tsi/alts_transport_security.cc create mode 100644 src/core/tsi/alts_transport_security.h delete mode 100644 src/core/tsi/gts_transport_security.cc delete mode 100644 src/core/tsi/gts_transport_security.h (limited to 'src/core') diff --git a/src/core/plugin_registry/grpc_cronet_plugin_registry.cc b/src/core/plugin_registry/grpc_cronet_plugin_registry.cc index 101e29c481..fe5eb28f05 100644 --- a/src/core/plugin_registry/grpc_cronet_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_cronet_plugin_registry.cc @@ -26,8 +26,8 @@ void grpc_deadline_filter_init(void); void grpc_deadline_filter_shutdown(void); void grpc_client_channel_init(void); void grpc_client_channel_shutdown(void); -void grpc_tsi_gts_init(void); -void grpc_tsi_gts_shutdown(void); +void grpc_tsi_alts_init(void); +void grpc_tsi_alts_shutdown(void); void grpc_server_load_reporting_plugin_init(void); void grpc_server_load_reporting_plugin_shutdown(void); @@ -40,8 +40,8 @@ void grpc_register_built_in_plugins(void) { grpc_deadline_filter_shutdown); grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown); - grpc_register_plugin(grpc_tsi_gts_init, - grpc_tsi_gts_shutdown); + grpc_register_plugin(grpc_tsi_alts_init, + grpc_tsi_alts_shutdown); grpc_register_plugin(grpc_server_load_reporting_plugin_init, grpc_server_load_reporting_plugin_shutdown); } diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc index 89be351785..fdf9acc09c 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_plugin_registry.cc @@ -22,8 +22,8 @@ void grpc_http_filters_init(void); void grpc_http_filters_shutdown(void); void grpc_chttp2_plugin_init(void); void grpc_chttp2_plugin_shutdown(void); -void grpc_tsi_gts_init(void); -void grpc_tsi_gts_shutdown(void); +void grpc_tsi_alts_init(void); +void grpc_tsi_alts_shutdown(void); void grpc_deadline_filter_init(void); void grpc_deadline_filter_shutdown(void); void grpc_client_channel_init(void); @@ -58,8 +58,8 @@ void grpc_register_built_in_plugins(void) { grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); - grpc_register_plugin(grpc_tsi_gts_init, - grpc_tsi_gts_shutdown); + grpc_register_plugin(grpc_tsi_alts_init, + grpc_tsi_alts_shutdown); grpc_register_plugin(grpc_deadline_filter_init, grpc_deadline_filter_shutdown); grpc_register_plugin(grpc_client_channel_init, diff --git a/src/core/tsi/alts_transport_security.cc b/src/core/tsi/alts_transport_security.cc new file mode 100644 index 0000000000..ddd75cbd02 --- /dev/null +++ b/src/core/tsi/alts_transport_security.cc @@ -0,0 +1,42 @@ +/* + * + * Copyright 2017 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. + * + */ + +#include "src/core/tsi/alts_transport_security.h" + +#include + +static alts_shared_resource g_alts_resource; + +alts_shared_resource* alts_get_shared_resource(void) { + return &g_alts_resource; +} + +void grpc_tsi_alts_init() { + memset(&g_alts_resource, 0, sizeof(alts_shared_resource)); + gpr_mu_init(&g_alts_resource.mu); +} + +void grpc_tsi_alts_shutdown() { + gpr_mu_destroy(&g_alts_resource.mu); + if (g_alts_resource.cq == nullptr) { + return; + } + grpc_completion_queue_destroy(g_alts_resource.cq); + grpc_channel_destroy(g_alts_resource.channel); + gpr_thd_join(g_alts_resource.thread_id); +} diff --git a/src/core/tsi/alts_transport_security.h b/src/core/tsi/alts_transport_security.h new file mode 100644 index 0000000000..c90e31478e --- /dev/null +++ b/src/core/tsi/alts_transport_security.h @@ -0,0 +1,37 @@ +/* + * + * Copyright 2017 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 GRPC_CORE_TSI_ALTS_TRANSPORT_SECURITY_H +#define GRPC_CORE_TSI_ALTS_TRANSPORT_SECURITY_H + +#include +#include +#include + +typedef struct alts_shared_resource { + gpr_thd_id thread_id; + grpc_channel* channel; + grpc_completion_queue* cq; + gpr_mu mu; +} alts_shared_resource; + +/* This method returns the address of alts_shared_resource object shared by all + * TSI handshakes. */ +alts_shared_resource* alts_get_shared_resource(void); + +#endif /* GRPC_CORE_TSI_ALTS_TRANSPORT_SECURITY_H */ diff --git a/src/core/tsi/gts_transport_security.cc b/src/core/tsi/gts_transport_security.cc deleted file mode 100644 index 2b099773c4..0000000000 --- a/src/core/tsi/gts_transport_security.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright 2017 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. - * - */ - -#include "src/core/tsi/gts_transport_security.h" - -#include - -static gts_shared_resource g_gts_resource; - -gts_shared_resource* gts_get_shared_resource(void) { return &g_gts_resource; } - -void grpc_tsi_gts_init() { - memset(&g_gts_resource, 0, sizeof(gts_shared_resource)); - gpr_mu_init(&g_gts_resource.mu); -} - -void grpc_tsi_gts_shutdown() { - gpr_mu_destroy(&g_gts_resource.mu); - if (g_gts_resource.cq == nullptr) { - return; - } - grpc_completion_queue_destroy(g_gts_resource.cq); - grpc_channel_destroy(g_gts_resource.channel); - gpr_thd_join(g_gts_resource.thread_id); -} diff --git a/src/core/tsi/gts_transport_security.h b/src/core/tsi/gts_transport_security.h deleted file mode 100644 index 23b2b66fb3..0000000000 --- a/src/core/tsi/gts_transport_security.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * Copyright 2017 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 GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H -#define GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H - -#include -#include -#include - -typedef struct gts_shared_resource { - gpr_thd_id thread_id; - grpc_channel* channel; - grpc_completion_queue* cq; - gpr_mu mu; -} gts_shared_resource; - -/* This method returns the address of gts_shared_resource object shared by all - * TSI handshakes. */ -gts_shared_resource* gts_get_shared_resource(void); - -#endif /* GRPC_CORE_TSI_GTS_TRANSPORT_SECURITY_H */ -- cgit v1.2.3