|
|
|
@ -665,16 +665,16 @@ grpcsharp_call_start_duplex_streaming(grpc_call *call, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata( |
|
|
|
|
grpc_call *call, grpcsharp_batch_context *ctx) { |
|
|
|
|
/* TODO: don't use magic number */ |
|
|
|
|
grpc_op ops[1]; |
|
|
|
|
ops[0].op = GRPC_OP_RECV_INITIAL_METADATA; |
|
|
|
|
ops[0].data.recv_initial_metadata = &(ctx->recv_initial_metadata); |
|
|
|
|
ops[0].flags = 0; |
|
|
|
|
ops[0].reserved = NULL; |
|
|
|
|
grpc_call *call, grpcsharp_batch_context *ctx) { |
|
|
|
|
/* TODO: don't use magic number */ |
|
|
|
|
grpc_op ops[1]; |
|
|
|
|
ops[0].op = GRPC_OP_RECV_INITIAL_METADATA; |
|
|
|
|
ops[0].data.recv_initial_metadata = &(ctx->recv_initial_metadata); |
|
|
|
|
ops[0].flags = 0; |
|
|
|
|
ops[0].reserved = NULL; |
|
|
|
|
|
|
|
|
|
return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx, |
|
|
|
|
NULL); |
|
|
|
|
return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx, |
|
|
|
|
NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GPR_EXPORT grpc_call_error GPR_CALLTYPE |
|
|
|
@ -898,41 +898,43 @@ grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GPR_EXPORT grpc_credentials *GPR_CALLTYPE grpcsharp_composite_credentials_create( |
|
|
|
|
grpc_credentials *creds1, |
|
|
|
|
grpc_credentials *creds2) { |
|
|
|
|
return grpc_composite_credentials_create(creds1, creds2, NULL); |
|
|
|
|
grpc_credentials *creds1, |
|
|
|
|
grpc_credentials *creds2) { |
|
|
|
|
return grpc_composite_credentials_create(creds1, creds2, NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* 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_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); |
|
|
|
|
grpc_credentials_plugin_metadata_cb cb, |
|
|
|
|
void *user_data, grpc_metadata_array *metadata, |
|
|
|
|
grpc_status_code status, const char *error_details) { |
|
|
|
|
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 *user_data, gpr_int32 is_destroy); |
|
|
|
|
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); |
|
|
|
|
grpc_credentials_plugin_metadata_cb cb, void *user_data) { |
|
|
|
|
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; |
|
|
|
|
interceptor(state, NULL, NULL, NULL, 1); |
|
|
|
|
grpcsharp_metadata_interceptor_func interceptor = |
|
|
|
|
(grpcsharp_metadata_interceptor_func)(gpr_intptr)state; |
|
|
|
|
interceptor(state, NULL, NULL, NULL, 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GPR_EXPORT grpc_credentials *GPR_CALLTYPE grpcsharp_metadata_credentials_create_from_plugin( |
|
|
|
|
grpcsharp_metadata_interceptor_func metadata_interceptor) { |
|
|
|
|
grpcsharp_metadata_interceptor_func metadata_interceptor) { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|