#[repr(C)]
pub struct grpc_tls_certificate_verifier_external { pub user_data: *mut c_void, pub verify: Option<unsafe extern "C" fn(user_data: *mut c_void, request: *mut grpc_tls_custom_verification_check_request, callback: grpc_tls_on_custom_verification_check_done_cb, callback_arg: *mut c_void, sync_status: *mut Type, sync_error_details: *mut *mut c_char) -> c_int>, pub cancel: Option<unsafe extern "C" fn(user_data: *mut c_void, request: *mut grpc_tls_custom_verification_check_request)>, pub destruct: Option<unsafe extern "C" fn(user_data: *mut c_void)>, }
Expand description

EXPERIMENTAL API - Subject to change

A struct containing all the necessary functions a custom external verifier needs to implement to be able to be converted to an internal verifier.

Fields§

§user_data: *mut c_void§verify: Option<unsafe extern "C" fn(user_data: *mut c_void, request: *mut grpc_tls_custom_verification_check_request, callback: grpc_tls_on_custom_verification_check_done_cb, callback_arg: *mut c_void, sync_status: *mut Type, sync_error_details: *mut *mut c_char) -> c_int>

A function pointer containing the verification logic that will be performed after the TLS handshake is done. It could be processed synchronously or asynchronously.

  • If expected to be processed synchronously, the implementer should populate the verification result through |sync_status| and |sync_error_details|, and then return true.
  • If expected to be processed asynchronously, the implementer should return false immediately, and then in the asynchronous thread invoke |callback| with the verification result. The implementer MUST NOT invoke the async |callback| in the same thread before |verify| returns, otherwise it can lead to deadlocks.

user_data: any argument that is passed in the user_data of grpc_tls_certificate_verifier_external during construction time can be retrieved later here. request: request information exposed to the function implementer. callback: the callback that the function implementer needs to invoke, if return a non-zero value. It is usually invoked when the asynchronous verification is done, and serves to bring the control back to gRPC. callback_arg: A pointer to the internal ExternalVerifier instance. This is mainly used as an argument in |callback|, if want to invoke |callback| in async mode. sync_status: indicates if a connection should be allowed. This should only be used if the verification check is done synchronously. sync_error_details: the error generated while verifying a connection. This should only be used if the verification check is done synchronously. the implementation must allocate the error string via gpr_malloc() or gpr_strdup(). return: return 0 if |verify| is expected to be executed asynchronously, otherwise return a non-zero value.

§cancel: Option<unsafe extern "C" fn(user_data: *mut c_void, request: *mut grpc_tls_custom_verification_check_request)>

A function pointer that cleans up the caller-specified resources when the verifier is still running but the whole connection got cancelled. This could happen when the verifier is doing some async operations, and the whole handshaker object got destroyed because of connection time limit is reached, or any other reasons. In such cases, function implementers might want to be notified, and properly clean up some resources.

user_data: any argument that is passed in the user_data of grpc_tls_certificate_verifier_external during construction time can be retrieved later here. request: request information exposed to the function implementer. It will be the same request object that was passed to verify(), and it tells the cancel() which request to cancel.

§destruct: Option<unsafe extern "C" fn(user_data: *mut c_void)>

A function pointer that does some additional destruction work when the verifier is destroyed. This is used when the caller wants to associate some objects to the lifetime of external_verifier, and destroy them when external_verifier got destructed. For example, in C++, the class containing user-specified callback functions should not be destroyed before external_verifier, since external_verifier will invoke them while being used. Note that the caller MUST delete the grpc_tls_certificate_verifier_external object itself in this function, otherwise it will cause memory leaks. That also means the user_data has to carries at least a self pointer, for the callers to later delete it in destruct().

user_data: any argument that is passed in the user_data of grpc_tls_certificate_verifier_external during construction time can be retrieved later here.

Trait Implementations§

source§

impl Clone for grpc_tls_certificate_verifier_external

source§

fn clone(&self) -> grpc_tls_certificate_verifier_external

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for grpc_tls_certificate_verifier_external

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for grpc_tls_certificate_verifier_external

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.