|
|
|
@ -906,24 +906,26 @@ GPR_EXPORT grpc_credentials *GPR_CALLTYPE grpcsharp_composite_credentials_create |
|
|
|
|
/* Metadata credentials plugin */ |
|
|
|
|
|
|
|
|
|
GPR_EXPORT void GPR_CALLTYPE grpcsharp_metadata_credentials_notify_from_plugin( |
|
|
|
|
void *callback_ptr, void *user_data, grpc_metadata_array *metadata, |
|
|
|
|
grpc_credentials_plugin_metadata_cb cb, |
|
|
|
|
void *user_data, grpc_metadata_array *metadata, |
|
|
|
|
grpc_status_code status, const char *error_details) { |
|
|
|
|
grpc_credentials_plugin_metadata_cb cb = (grpc_credentials_plugin_metadata_cb)callback_ptr; |
|
|
|
|
cb(user_data, metadata->metadata, metadata->count, status, error_details); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
typedef void(GPR_CALLTYPE *grpcsharp_metadata_interceptor_func)( |
|
|
|
|
void *state, const char *service_url, void *callback_ptr, |
|
|
|
|
void *state, const char *service_url, grpc_credentials_plugin_metadata_cb cb, |
|
|
|
|
void *user_data, gpr_int32 is_destroy); |
|
|
|
|
|
|
|
|
|
static void grpcsharp_get_metadata_handler(void *state, const char *service_url, |
|
|
|
|
grpc_credentials_plugin_metadata_cb cb, void *user_data) { |
|
|
|
|
grpcsharp_metadata_interceptor_func interceptor = (grpcsharp_metadata_interceptor_func)state; |
|
|
|
|
interceptor(state, service_url, (void*)cb, user_data, 0); |
|
|
|
|
grpcsharp_metadata_interceptor_func interceptor = |
|
|
|
|
(grpcsharp_metadata_interceptor_func)(gpr_intptr)state; |
|
|
|
|
interceptor(state, service_url, cb, user_data, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void grpcsharp_metadata_credentials_destroy_handler(void *state) { |
|
|
|
|
grpcsharp_metadata_interceptor_func interceptor = (grpcsharp_metadata_interceptor_func)state; |
|
|
|
|
grpcsharp_metadata_interceptor_func interceptor = |
|
|
|
|
(grpcsharp_metadata_interceptor_func)(gpr_intptr)state; |
|
|
|
|
interceptor(state, NULL, NULL, NULL, 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -932,7 +934,7 @@ GPR_EXPORT grpc_credentials *GPR_CALLTYPE grpcsharp_metadata_credentials_create_ |
|
|
|
|
grpc_metadata_credentials_plugin plugin; |
|
|
|
|
plugin.get_metadata = grpcsharp_get_metadata_handler; |
|
|
|
|
plugin.destroy = grpcsharp_metadata_credentials_destroy_handler; |
|
|
|
|
plugin.state = metadata_interceptor; |
|
|
|
|
plugin.state = (void*)(gpr_intptr)metadata_interceptor; |
|
|
|
|
return grpc_metadata_credentials_create_from_plugin(plugin, NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|