GRPC Core  9.0.0
Functions
grpc_tls_credentials_options.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h"
#include <stdlib.h>
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>

Functions

grpc_tls_credentials_optionsgrpc_tls_credentials_options_create ()
 – Wrapper APIs declared in grpc_security.hMore...
 
int grpc_tls_credentials_options_set_cert_request_type (grpc_tls_credentials_options *options, grpc_ssl_client_certificate_request_type type)
 Set grpc_ssl_client_certificate_request_type field in credentials options with the provided type. More...
 
int grpc_tls_credentials_options_set_key_materials_config (grpc_tls_credentials_options *options, grpc_tls_key_materials_config *config)
 Set grpc_tls_key_materials_config field in credentials options with the provided config struct whose ownership is transferred. More...
 
int grpc_tls_credentials_options_set_credential_reload_config (grpc_tls_credentials_options *options, grpc_tls_credential_reload_config *config)
 Set grpc_tls_credential_reload_config field in credentials options with the provided config struct whose ownership is transferred. More...
 
int grpc_tls_credentials_options_set_server_authorization_check_config (grpc_tls_credentials_options *options, grpc_tls_server_authorization_check_config *config)
 Set grpc_tls_server_authorization_check_config field in credentials options with the provided config struct whose ownership is transferred. More...
 
grpc_tls_key_materials_configgrpc_tls_key_materials_config_create ()
 — TLS key materials config. More...
 
int grpc_tls_key_materials_config_set_key_materials (grpc_tls_key_materials_config *config, const char *root_certs, const grpc_ssl_pem_key_cert_pair **key_cert_pairs, size_t num)
 Set grpc_tls_key_materials_config instance with provided a TLS certificate. More...
 
int grpc_tls_key_materials_config_set_version (grpc_tls_key_materials_config *config, int version)
 Set grpc_tls_key_materials_config instance with a provided version number, which is used to keep track of the version of key materials. More...
 
int grpc_tls_key_materials_config_get_version (grpc_tls_key_materials_config *config)
 Get the version number of a grpc_tls_key_materials_config instance. More...
 
grpc_tls_credential_reload_configgrpc_tls_credential_reload_config_create (const void *config_user_data, int(*schedule)(void *config_user_data, grpc_tls_credential_reload_arg *arg), void(*cancel)(void *config_user_data, grpc_tls_credential_reload_arg *arg), void(*destruct)(void *config_user_data))
 Create a grpc_tls_credential_reload_config instance. More...
 
grpc_tls_server_authorization_check_configgrpc_tls_server_authorization_check_config_create (const void *config_user_data, int(*schedule)(void *config_user_data, grpc_tls_server_authorization_check_arg *arg), void(*cancel)(void *config_user_data, grpc_tls_server_authorization_check_arg *arg), void(*destruct)(void *config_user_data))
 Create a grpc_tls_server_authorization_check_config instance. More...
 

Function Documentation

◆ grpc_tls_credential_reload_config_create()

grpc_tls_credential_reload_config* grpc_tls_credential_reload_config_create ( const void *  config_user_data,
int(*)(void *config_user_data, grpc_tls_credential_reload_arg *arg)  schedule,
void(*)(void *config_user_data, grpc_tls_credential_reload_arg *arg)  cancel,
void(*)(void *config_user_data)  destruct 
)

Create a grpc_tls_credential_reload_config instance.

  • config_user_data is config-specific, read-only user data that works for all channels created with a credential using the config.
  • schedule is a pointer to an application-provided callback used to invoke credential reload API. The implementation of this method has to be non-blocking, but can be performed synchronously or asynchronously. 1) If processing occurs synchronously, it populates arg->key_materials, arg->status, and arg->error_details and returns zero. 2) If processing occurs asynchronously, it returns a non-zero value. The application then invokes arg->cb when processing is completed. Note that arg->cb cannot be invoked before schedule API returns.
  • cancel is a pointer to an application-provided callback used to cancel a credential reload request scheduled via an asynchronous schedule API. arg is used to pinpoint an exact reloading request to be cancelled. The operation may not have any effect if the request has already been processed.
  • destruct is a pointer to an application-provided callback used to clean up any data associated with the config. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_credentials_options_create()

grpc_tls_credentials_options* grpc_tls_credentials_options_create ( void  )

– Wrapper APIs declared in grpc_security.h

Create an empty TLS credentials options.

◆ grpc_tls_credentials_options_set_cert_request_type()

int grpc_tls_credentials_options_set_cert_request_type ( grpc_tls_credentials_options options,
grpc_ssl_client_certificate_request_type  type 
)

Set grpc_ssl_client_certificate_request_type field in credentials options with the provided type.

options should not be NULL. It returns 1 on success and 0 on failure. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_credentials_options_set_credential_reload_config()

int grpc_tls_credentials_options_set_credential_reload_config ( grpc_tls_credentials_options options,
grpc_tls_credential_reload_config config 
)

Set grpc_tls_credential_reload_config field in credentials options with the provided config struct whose ownership is transferred.

Both parameters should not be NULL. It returns 1 on success and 0 on failure. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_credentials_options_set_key_materials_config()

int grpc_tls_credentials_options_set_key_materials_config ( grpc_tls_credentials_options options,
grpc_tls_key_materials_config config 
)

Set grpc_tls_key_materials_config field in credentials options with the provided config struct whose ownership is transferred.

Both parameters should not be NULL. It returns 1 on success and 0 on failure. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_credentials_options_set_server_authorization_check_config()

int grpc_tls_credentials_options_set_server_authorization_check_config ( grpc_tls_credentials_options options,
grpc_tls_server_authorization_check_config config 
)

Set grpc_tls_server_authorization_check_config field in credentials options with the provided config struct whose ownership is transferred.

Both parameters should not be NULL. It returns 1 on success and 0 on failure. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_key_materials_config_create()

grpc_tls_key_materials_config* grpc_tls_key_materials_config_create ( void  )

— TLS key materials config.

— It is used for experimental purpose for now and subject to change. Create an empty grpc_tls_key_materials_config instance. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_key_materials_config_get_version()

int grpc_tls_key_materials_config_get_version ( grpc_tls_key_materials_config config)

Get the version number of a grpc_tls_key_materials_config instance.

It returns the version number on success and -1 on failure. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_key_materials_config_set_key_materials()

int grpc_tls_key_materials_config_set_key_materials ( grpc_tls_key_materials_config config,
const char *  pem_root_certs,
const grpc_ssl_pem_key_cert_pair **  pem_key_cert_pairs,
size_t  num_key_cert_pairs 
)

Set grpc_tls_key_materials_config instance with provided a TLS certificate.

config will take the ownership of pem_root_certs and pem_key_cert_pairs. It's valid for the caller to provide nullptr pem_root_certs, in which case the gRPC-provided root cert will be used. pem_key_cert_pairs should not be NULL. It returns 1 on success and 0 on failure. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_key_materials_config_set_version()

int grpc_tls_key_materials_config_set_version ( grpc_tls_key_materials_config config,
int  version 
)

Set grpc_tls_key_materials_config instance with a provided version number, which is used to keep track of the version of key materials.

It returns 1 on success and 0 on failure. It is used for experimental purpose for now and subject to change.

◆ grpc_tls_server_authorization_check_config_create()

grpc_tls_server_authorization_check_config* grpc_tls_server_authorization_check_config_create ( const void *  config_user_data,
int(*)(void *config_user_data, grpc_tls_server_authorization_check_arg *arg)  schedule,
void(*)(void *config_user_data, grpc_tls_server_authorization_check_arg *arg)  cancel,
void(*)(void *config_user_data)  destruct 
)

Create a grpc_tls_server_authorization_check_config instance.

  • config_user_data is config-specific, read-only user data that works for all channels created with a credential using the config.
  • schedule is a pointer to an application-provided callback used to invoke server authorization check API. The implementation of this method has to be non-blocking, but can be performed synchronously or asynchronously. 1)If processing occurs synchronously, it populates arg->result, arg->status, and arg->error_details and returns zero. 2) If processing occurs asynchronously, it returns a non-zero value. The application then invokes arg->cb when processing is completed. Note that arg->cb cannot be invoked before schedule API returns.
  • cancel is a pointer to an application-provided callback used to cancel a server authorization check request scheduled via an asynchronous schedule API. arg is used to pinpoint an exact check request to be cancelled. The operation may not have any effect if the request has already been processed.
  • destruct is a pointer to an application-provided callback used to clean up any data associated with the config. It is used for experimental purpose for now and subject to change.