• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright 2019 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 #ifndef GRPC_INTERNAL_CPP_COMMON_TLS_CREDENTIALS_OPTIONS_UTIL_H
20 #define GRPC_INTERNAL_CPP_COMMON_TLS_CREDENTIALS_OPTIONS_UTIL_H
21 
22 #include <grpc/grpc_security.h>
23 #include <grpcpp/security/tls_credentials_options.h>
24 
25 #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
26 
27 namespace grpc_impl {
28 namespace experimental {
29 
30 /** The following function is exposed for testing purposes. **/
31 grpc_tls_key_materials_config* ConvertToCKeyMaterialsConfig(
32     const std::shared_ptr<TlsKeyMaterialsConfig>& config);
33 
34 /** The following 4 functions convert the user-provided schedule or cancel
35  *  functions into C style schedule or cancel functions. These are internal
36  *  functions, not meant to be accessed by the user. **/
37 int TlsCredentialReloadConfigCSchedule(void* config_user_data,
38                                        grpc_tls_credential_reload_arg* arg);
39 
40 void TlsCredentialReloadConfigCCancel(void* config_user_data,
41                                       grpc_tls_credential_reload_arg* arg);
42 
43 int TlsServerAuthorizationCheckConfigCSchedule(
44     void* config_user_data, grpc_tls_server_authorization_check_arg* arg);
45 
46 void TlsServerAuthorizationCheckConfigCCancel(
47     void* config_user_data, grpc_tls_server_authorization_check_arg* arg);
48 
49 /** The following 2 functions cleanup data created in the above C schedule
50  *  functions. **/
51 void TlsCredentialReloadArgDestroyContext(void* context);
52 
53 void TlsServerAuthorizationCheckArgDestroyContext(void* context);
54 
55 }  //  namespace experimental
56 }  // namespace grpc_impl
57 
58 #endif  // GRPC_INTERNAL_CPP_COMMON_TLS_CREDENTIALS_OPTIONS_UTIL_H
59