aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/ext/grpc_csharp_ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/ext/grpc_csharp_ext.c')
-rw-r--r--src/csharp/ext/grpc_csharp_ext.c371
1 files changed, 185 insertions, 186 deletions
diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c
index 92291f9011..bcb3bfaee5 100644
--- a/src/csharp/ext/grpc_csharp_ext.c
+++ b/src/csharp/ext/grpc_csharp_ext.c
@@ -43,9 +43,9 @@
#define GPR_CALLTYPE
#endif
-grpc_byte_buffer *string_to_byte_buffer(const char *buffer, size_t len) {
+grpc_byte_buffer* string_to_byte_buffer(const char* buffer, size_t len) {
grpc_slice slice = grpc_slice_from_copied_buffer(buffer, len);
- grpc_byte_buffer *bb = grpc_raw_byte_buffer_create(&slice, 1);
+ grpc_byte_buffer* bb = grpc_raw_byte_buffer_create(&slice, 1);
grpc_slice_unref(slice);
return bb;
}
@@ -55,12 +55,12 @@ grpc_byte_buffer *string_to_byte_buffer(const char *buffer, size_t len) {
*/
typedef struct grpcsharp_batch_context {
grpc_metadata_array send_initial_metadata;
- grpc_byte_buffer *send_message;
+ grpc_byte_buffer* send_message;
struct {
grpc_metadata_array trailing_metadata;
} send_status_from_server;
grpc_metadata_array recv_initial_metadata;
- grpc_byte_buffer *recv_message;
+ grpc_byte_buffer* recv_message;
struct {
grpc_metadata_array trailing_metadata;
grpc_status_code status;
@@ -69,22 +69,22 @@ typedef struct grpcsharp_batch_context {
int recv_close_on_server_cancelled;
} grpcsharp_batch_context;
-GPR_EXPORT grpcsharp_batch_context *GPR_CALLTYPE
+GPR_EXPORT grpcsharp_batch_context* GPR_CALLTYPE
grpcsharp_batch_context_create() {
- grpcsharp_batch_context *ctx = gpr_malloc(sizeof(grpcsharp_batch_context));
+ grpcsharp_batch_context* ctx = gpr_malloc(sizeof(grpcsharp_batch_context));
memset(ctx, 0, sizeof(grpcsharp_batch_context));
return ctx;
}
typedef struct {
- grpc_call *call;
+ grpc_call* call;
grpc_call_details call_details;
grpc_metadata_array request_metadata;
} grpcsharp_request_call_context;
-GPR_EXPORT grpcsharp_request_call_context *GPR_CALLTYPE
+GPR_EXPORT grpcsharp_request_call_context* GPR_CALLTYPE
grpcsharp_request_call_context_create() {
- grpcsharp_request_call_context *ctx =
+ grpcsharp_request_call_context* ctx =
gpr_malloc(sizeof(grpcsharp_request_call_context));
memset(ctx, 0, sizeof(grpcsharp_request_call_context));
return ctx;
@@ -95,7 +95,7 @@ grpcsharp_request_call_context_create() {
* The array pointer itself is not freed.
*/
void grpcsharp_metadata_array_destroy_metadata_only(
- grpc_metadata_array *array) {
+ grpc_metadata_array* array) {
gpr_free(array->metadata);
}
@@ -104,7 +104,7 @@ void grpcsharp_metadata_array_destroy_metadata_only(
* The array pointer itself is not freed.
*/
void grpcsharp_metadata_array_destroy_metadata_including_entries(
- grpc_metadata_array *array) {
+ grpc_metadata_array* array) {
size_t i;
if (array->metadata) {
for (i = 0; i < array->count; i++) {
@@ -119,7 +119,7 @@ void grpcsharp_metadata_array_destroy_metadata_including_entries(
* Fully destroys the metadata array.
*/
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_metadata_array_destroy_full(grpc_metadata_array *array) {
+grpcsharp_metadata_array_destroy_full(grpc_metadata_array* array) {
if (!array) {
return;
}
@@ -131,16 +131,16 @@ grpcsharp_metadata_array_destroy_full(grpc_metadata_array *array) {
* Creates an empty metadata array with given capacity.
* Array can later be destroyed by grpc_metadata_array_destroy_full.
*/
-GPR_EXPORT grpc_metadata_array *GPR_CALLTYPE
+GPR_EXPORT grpc_metadata_array* GPR_CALLTYPE
grpcsharp_metadata_array_create(size_t capacity) {
- grpc_metadata_array *array =
- (grpc_metadata_array *)gpr_malloc(sizeof(grpc_metadata_array));
+ grpc_metadata_array* array =
+ (grpc_metadata_array*)gpr_malloc(sizeof(grpc_metadata_array));
grpc_metadata_array_init(array);
array->capacity = capacity;
array->count = 0;
if (capacity > 0) {
array->metadata =
- (grpc_metadata *)gpr_malloc(sizeof(grpc_metadata) * capacity);
+ (grpc_metadata*)gpr_malloc(sizeof(grpc_metadata) * capacity);
memset(array->metadata, 0, sizeof(grpc_metadata) * capacity);
} else {
array->metadata = NULL;
@@ -149,8 +149,8 @@ grpcsharp_metadata_array_create(size_t capacity) {
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_metadata_array_add(grpc_metadata_array *array, const char *key,
- const char *value, size_t value_length) {
+grpcsharp_metadata_array_add(grpc_metadata_array* array, const char* key,
+ const char* value, size_t value_length) {
size_t i = array->count;
GPR_ASSERT(array->count < array->capacity);
array->metadata[i].key = grpc_slice_from_copied_string(key);
@@ -159,27 +159,27 @@ grpcsharp_metadata_array_add(grpc_metadata_array *array, const char *key,
}
GPR_EXPORT intptr_t GPR_CALLTYPE
-grpcsharp_metadata_array_count(grpc_metadata_array *array) {
+grpcsharp_metadata_array_count(grpc_metadata_array* array) {
return (intptr_t)array->count;
}
-GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_metadata_array_get_key(
- grpc_metadata_array *array, size_t index, size_t *key_length) {
+GPR_EXPORT const char* GPR_CALLTYPE grpcsharp_metadata_array_get_key(
+ grpc_metadata_array* array, size_t index, size_t* key_length) {
GPR_ASSERT(index < array->count);
*key_length = GRPC_SLICE_LENGTH(array->metadata[index].key);
- return (char *)GRPC_SLICE_START_PTR(array->metadata[index].key);
+ return (char*)GRPC_SLICE_START_PTR(array->metadata[index].key);
}
-GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_metadata_array_get_value(
- grpc_metadata_array *array, size_t index, size_t *value_length) {
+GPR_EXPORT const char* GPR_CALLTYPE grpcsharp_metadata_array_get_value(
+ grpc_metadata_array* array, size_t index, size_t* value_length) {
GPR_ASSERT(index < array->count);
*value_length = GRPC_SLICE_LENGTH(array->metadata[index].value);
- return (char *)GRPC_SLICE_START_PTR(array->metadata[index].value);
+ return (char*)GRPC_SLICE_START_PTR(array->metadata[index].value);
}
/* Move contents of metadata array */
-void grpcsharp_metadata_array_move(grpc_metadata_array *dest,
- grpc_metadata_array *src) {
+void grpcsharp_metadata_array_move(grpc_metadata_array* dest,
+ grpc_metadata_array* src) {
if (!src) {
dest->capacity = 0;
dest->count = 0;
@@ -197,7 +197,7 @@ void grpcsharp_metadata_array_move(grpc_metadata_array *dest,
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) {
+grpcsharp_batch_context_destroy(grpcsharp_batch_context* ctx) {
if (!ctx) {
return;
}
@@ -221,7 +221,7 @@ grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) {
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_request_call_context_destroy(grpcsharp_request_call_context *ctx) {
+grpcsharp_request_call_context_destroy(grpcsharp_request_call_context* ctx) {
if (!ctx) {
return;
}
@@ -235,14 +235,14 @@ grpcsharp_request_call_context_destroy(grpcsharp_request_call_context *ctx) {
gpr_free(ctx);
}
-GPR_EXPORT const grpc_metadata_array *GPR_CALLTYPE
+GPR_EXPORT const grpc_metadata_array* GPR_CALLTYPE
grpcsharp_batch_context_recv_initial_metadata(
- const grpcsharp_batch_context *ctx) {
+ const grpcsharp_batch_context* ctx) {
return &(ctx->recv_initial_metadata);
}
GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length(
- const grpcsharp_batch_context *ctx) {
+ const grpcsharp_batch_context* ctx) {
grpc_byte_buffer_reader reader;
if (!ctx->recv_message) {
return -1;
@@ -260,7 +260,7 @@ GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length(
* buffer is too small.
*/
GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer(
- const grpcsharp_batch_context *ctx, char *buffer, size_t buffer_len) {
+ const grpcsharp_batch_context* ctx, char* buffer, size_t buffer_len) {
grpc_byte_buffer_reader reader;
grpc_slice slice;
size_t offset = 0;
@@ -281,56 +281,55 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer(
GPR_EXPORT grpc_status_code GPR_CALLTYPE
grpcsharp_batch_context_recv_status_on_client_status(
- const grpcsharp_batch_context *ctx) {
+ const grpcsharp_batch_context* ctx) {
return ctx->recv_status_on_client.status;
}
-GPR_EXPORT const char *GPR_CALLTYPE
+GPR_EXPORT const char* GPR_CALLTYPE
grpcsharp_batch_context_recv_status_on_client_details(
- const grpcsharp_batch_context *ctx, size_t *details_length) {
+ const grpcsharp_batch_context* ctx, size_t* details_length) {
*details_length =
GRPC_SLICE_LENGTH(ctx->recv_status_on_client.status_details);
- return (char *)GRPC_SLICE_START_PTR(
- ctx->recv_status_on_client.status_details);
+ return (char*)GRPC_SLICE_START_PTR(ctx->recv_status_on_client.status_details);
}
-GPR_EXPORT const grpc_metadata_array *GPR_CALLTYPE
+GPR_EXPORT const grpc_metadata_array* GPR_CALLTYPE
grpcsharp_batch_context_recv_status_on_client_trailing_metadata(
- const grpcsharp_batch_context *ctx) {
+ const grpcsharp_batch_context* ctx) {
return &(ctx->recv_status_on_client.trailing_metadata);
}
-GPR_EXPORT grpc_call *GPR_CALLTYPE
-grpcsharp_request_call_context_call(const grpcsharp_request_call_context *ctx) {
+GPR_EXPORT grpc_call* GPR_CALLTYPE
+grpcsharp_request_call_context_call(const grpcsharp_request_call_context* ctx) {
return ctx->call;
}
-GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_request_call_context_method(
- const grpcsharp_request_call_context *ctx, size_t *method_length) {
+GPR_EXPORT const char* GPR_CALLTYPE grpcsharp_request_call_context_method(
+ const grpcsharp_request_call_context* ctx, size_t* method_length) {
*method_length = GRPC_SLICE_LENGTH(ctx->call_details.method);
- return (char *)GRPC_SLICE_START_PTR(ctx->call_details.method);
+ return (char*)GRPC_SLICE_START_PTR(ctx->call_details.method);
}
-GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_request_call_context_host(
- const grpcsharp_request_call_context *ctx, size_t *host_length) {
+GPR_EXPORT const char* GPR_CALLTYPE grpcsharp_request_call_context_host(
+ const grpcsharp_request_call_context* ctx, size_t* host_length) {
*host_length = GRPC_SLICE_LENGTH(ctx->call_details.host);
- return (char *)GRPC_SLICE_START_PTR(ctx->call_details.host);
+ return (char*)GRPC_SLICE_START_PTR(ctx->call_details.host);
}
GPR_EXPORT gpr_timespec GPR_CALLTYPE grpcsharp_request_call_context_deadline(
- const grpcsharp_request_call_context *ctx) {
+ const grpcsharp_request_call_context* ctx) {
return ctx->call_details.deadline;
}
-GPR_EXPORT const grpc_metadata_array *GPR_CALLTYPE
+GPR_EXPORT const grpc_metadata_array* GPR_CALLTYPE
grpcsharp_request_call_context_request_metadata(
- const grpcsharp_request_call_context *ctx) {
+ const grpcsharp_request_call_context* ctx) {
return &(ctx->request_metadata);
}
GPR_EXPORT int32_t GPR_CALLTYPE
grpcsharp_batch_context_recv_close_on_server_cancelled(
- const grpcsharp_batch_context *ctx) {
+ const grpcsharp_batch_context* ctx) {
return (int32_t)ctx->recv_close_on_server_cancelled;
}
@@ -342,63 +341,63 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_shutdown(void) { grpc_shutdown(); }
/* Completion queue */
-GPR_EXPORT grpc_completion_queue *GPR_CALLTYPE
+GPR_EXPORT grpc_completion_queue* GPR_CALLTYPE
grpcsharp_completion_queue_create_async(void) {
return grpc_completion_queue_create_for_next(NULL);
}
-GPR_EXPORT grpc_completion_queue *GPR_CALLTYPE
+GPR_EXPORT grpc_completion_queue* GPR_CALLTYPE
grpcsharp_completion_queue_create_sync(void) {
return grpc_completion_queue_create_for_pluck(NULL);
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_completion_queue_shutdown(grpc_completion_queue *cq) {
+grpcsharp_completion_queue_shutdown(grpc_completion_queue* cq) {
grpc_completion_queue_shutdown(cq);
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_completion_queue_destroy(grpc_completion_queue *cq) {
+grpcsharp_completion_queue_destroy(grpc_completion_queue* cq) {
grpc_completion_queue_destroy(cq);
}
GPR_EXPORT grpc_event GPR_CALLTYPE
-grpcsharp_completion_queue_next(grpc_completion_queue *cq) {
+grpcsharp_completion_queue_next(grpc_completion_queue* cq) {
return grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
NULL);
}
GPR_EXPORT grpc_event GPR_CALLTYPE
-grpcsharp_completion_queue_pluck(grpc_completion_queue *cq, void *tag) {
+grpcsharp_completion_queue_pluck(grpc_completion_queue* cq, void* tag) {
return grpc_completion_queue_pluck(cq, tag,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
}
/* Channel */
-GPR_EXPORT grpc_channel *GPR_CALLTYPE
+GPR_EXPORT grpc_channel* GPR_CALLTYPE
-grpcsharp_insecure_channel_create(const char *target,
- const grpc_channel_args *args) {
+grpcsharp_insecure_channel_create(const char* target,
+ const grpc_channel_args* args) {
return grpc_insecure_channel_create(target, args, NULL);
}
-GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_destroy(grpc_channel *channel) {
+GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_destroy(grpc_channel* channel) {
grpc_channel_destroy(channel);
}
-GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call(
- grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask,
- grpc_completion_queue *cq, const char *method, const char *host,
+GPR_EXPORT grpc_call* GPR_CALLTYPE grpcsharp_channel_create_call(
+ grpc_channel* channel, grpc_call* parent_call, uint32_t propagation_mask,
+ grpc_completion_queue* cq, const char* method, const char* host,
gpr_timespec deadline) {
grpc_slice method_slice = grpc_slice_from_copied_string(method);
- grpc_slice *host_slice_ptr = NULL;
+ grpc_slice* host_slice_ptr = NULL;
grpc_slice host_slice;
if (host != NULL) {
host_slice = grpc_slice_from_copied_string(host);
host_slice_ptr = &host_slice;
}
- grpc_call *ret =
+ grpc_call* ret =
grpc_channel_create_call(channel, parent_call, propagation_mask, cq,
method_slice, host_slice_ptr, deadline, NULL);
grpc_slice_unref(method_slice);
@@ -409,40 +408,40 @@ GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call(
}
GPR_EXPORT grpc_connectivity_state GPR_CALLTYPE
-grpcsharp_channel_check_connectivity_state(grpc_channel *channel,
+grpcsharp_channel_check_connectivity_state(grpc_channel* channel,
int32_t try_to_connect) {
return grpc_channel_check_connectivity_state(channel, try_to_connect);
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_watch_connectivity_state(
- grpc_channel *channel, grpc_connectivity_state last_observed_state,
- gpr_timespec deadline, grpc_completion_queue *cq,
- grpcsharp_batch_context *ctx) {
+ grpc_channel* channel, grpc_connectivity_state last_observed_state,
+ gpr_timespec deadline, grpc_completion_queue* cq,
+ grpcsharp_batch_context* ctx) {
grpc_channel_watch_connectivity_state(channel, last_observed_state, deadline,
cq, ctx);
}
-GPR_EXPORT char *GPR_CALLTYPE
-grpcsharp_channel_get_target(grpc_channel *channel) {
+GPR_EXPORT char* GPR_CALLTYPE
+grpcsharp_channel_get_target(grpc_channel* channel) {
return grpc_channel_get_target(channel);
}
/* Channel args */
-GPR_EXPORT grpc_channel_args *GPR_CALLTYPE
+GPR_EXPORT grpc_channel_args* GPR_CALLTYPE
grpcsharp_channel_args_create(size_t num_args) {
- grpc_channel_args *args =
- (grpc_channel_args *)gpr_malloc(sizeof(grpc_channel_args));
+ grpc_channel_args* args =
+ (grpc_channel_args*)gpr_malloc(sizeof(grpc_channel_args));
memset(args, 0, sizeof(grpc_channel_args));
args->num_args = num_args;
- args->args = (grpc_arg *)gpr_malloc(sizeof(grpc_arg) * num_args);
+ args->args = (grpc_arg*)gpr_malloc(sizeof(grpc_arg) * num_args);
memset(args->args, 0, sizeof(grpc_arg) * num_args);
return args;
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_args_set_string(
- grpc_channel_args *args, size_t index, const char *key, const char *value) {
+ grpc_channel_args* args, size_t index, const char* key, const char* value) {
GPR_ASSERT(args);
GPR_ASSERT(index < args->num_args);
args->args[index].type = GRPC_ARG_STRING;
@@ -451,7 +450,7 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_args_set_string(
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_args_set_integer(
- grpc_channel_args *args, size_t index, const char *key, int value) {
+ grpc_channel_args* args, size_t index, const char* key, int value) {
GPR_ASSERT(args);
GPR_ASSERT(index < args->num_args);
args->args[index].type = GRPC_ARG_INTEGER;
@@ -460,7 +459,7 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_args_set_integer(
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_channel_args_destroy(grpc_channel_args *args) {
+grpcsharp_channel_args_destroy(grpc_channel_args* args) {
size_t i;
if (args) {
for (i = 0; i < args->num_args; i++) {
@@ -501,61 +500,61 @@ GPR_EXPORT int32_t GPR_CALLTYPE gprsharp_sizeof_timespec(void) {
/* Call */
-GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel(grpc_call *call) {
+GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel(grpc_call* call) {
return grpc_call_cancel(call, NULL);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel_with_status(
- grpc_call *call, grpc_status_code status, const char *description) {
+ grpc_call* call, grpc_status_code status, const char* description) {
return grpc_call_cancel_with_status(call, status, description, NULL);
}
-GPR_EXPORT char *GPR_CALLTYPE grpcsharp_call_get_peer(grpc_call *call) {
+GPR_EXPORT char* GPR_CALLTYPE grpcsharp_call_get_peer(grpc_call* call) {
return grpc_call_get_peer(call);
}
-GPR_EXPORT void GPR_CALLTYPE gprsharp_free(void *p) { gpr_free(p); }
+GPR_EXPORT void GPR_CALLTYPE gprsharp_free(void* p) { gpr_free(p); }
-GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_destroy(grpc_call *call) {
+GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_destroy(grpc_call* call) {
grpc_call_unref(call);
}
-typedef grpc_call_error (*grpcsharp_call_start_batch_func)(grpc_call *call,
- const grpc_op *ops,
+typedef grpc_call_error (*grpcsharp_call_start_batch_func)(grpc_call* call,
+ const grpc_op* ops,
size_t nops,
- void *tag,
- void *reserved);
+ void* tag,
+ void* reserved);
/* Only for testing */
-static grpc_call_error grpcsharp_call_start_batch_nop(grpc_call *call,
- const grpc_op *ops,
- size_t nops, void *tag,
- void *reserved) {
+static grpc_call_error grpcsharp_call_start_batch_nop(grpc_call* call,
+ const grpc_op* ops,
+ size_t nops, void* tag,
+ void* reserved) {
return GRPC_CALL_OK;
}
-static grpc_call_error grpcsharp_call_start_batch_default(grpc_call *call,
- const grpc_op *ops,
+static grpc_call_error grpcsharp_call_start_batch_default(grpc_call* call,
+ const grpc_op* ops,
size_t nops,
- void *tag,
- void *reserved) {
+ void* tag,
+ void* reserved) {
return grpc_call_start_batch(call, ops, nops, tag, reserved);
}
static grpcsharp_call_start_batch_func g_call_start_batch_func =
grpcsharp_call_start_batch_default;
-static grpc_call_error grpcsharp_call_start_batch(grpc_call *call,
- const grpc_op *ops,
- size_t nops, void *tag,
- void *reserved) {
+static grpc_call_error grpcsharp_call_start_batch(grpc_call* call,
+ const grpc_op* ops,
+ size_t nops, void* tag,
+ void* reserved) {
return g_call_start_batch_func(call, ops, nops, tag, reserved);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(
- grpc_call *call, grpcsharp_batch_context *ctx, const char *send_buffer,
+ grpc_call* call, grpcsharp_batch_context* ctx, const char* send_buffer,
size_t send_buffer_len, uint32_t write_flags,
- grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) {
+ grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) {
/* TODO: don't use magic number */
grpc_op ops[6];
memset(ops, 0, sizeof(ops));
@@ -604,8 +603,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming(
- grpc_call *call, grpcsharp_batch_context *ctx,
- grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) {
+ grpc_call* call, grpcsharp_batch_context* ctx,
+ grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) {
/* TODO: don't use magic number */
grpc_op ops[4];
memset(ops, 0, sizeof(ops));
@@ -644,9 +643,9 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming(
- grpc_call *call, grpcsharp_batch_context *ctx, const char *send_buffer,
+ grpc_call* call, grpcsharp_batch_context* ctx, const char* send_buffer,
size_t send_buffer_len, uint32_t write_flags,
- grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) {
+ grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) {
/* TODO: don't use magic number */
grpc_op ops[4];
memset(ops, 0, sizeof(ops));
@@ -684,8 +683,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming(
- grpc_call *call, grpcsharp_batch_context *ctx,
- grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) {
+ grpc_call* call, grpcsharp_batch_context* ctx,
+ grpc_metadata_array* initial_metadata, uint32_t initial_metadata_flags) {
/* TODO: don't use magic number */
grpc_op ops[2];
memset(ops, 0, sizeof(ops));
@@ -713,7 +712,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata(
- grpc_call *call, grpcsharp_batch_context *ctx) {
+ 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;
@@ -727,7 +726,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message(
- grpc_call *call, grpcsharp_batch_context *ctx, const char *send_buffer,
+ grpc_call* call, grpcsharp_batch_context* ctx, const char* send_buffer,
size_t send_buffer_len, uint32_t write_flags,
int32_t send_empty_initial_metadata) {
/* TODO: don't use magic number */
@@ -747,7 +746,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client(
- grpc_call *call, grpcsharp_batch_context *ctx) {
+ grpc_call* call, grpcsharp_batch_context* ctx) {
/* TODO: don't use magic number */
grpc_op ops[1];
ops[0].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
@@ -759,10 +758,10 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server(
- grpc_call *call, grpcsharp_batch_context *ctx, grpc_status_code status_code,
- const char *status_details, size_t status_details_len,
- grpc_metadata_array *trailing_metadata, int32_t send_empty_initial_metadata,
- const char *optional_send_buffer, size_t optional_send_buffer_len,
+ grpc_call* call, grpcsharp_batch_context* ctx, grpc_status_code status_code,
+ const char* status_details, size_t status_details_len,
+ grpc_metadata_array* trailing_metadata, int32_t send_empty_initial_metadata,
+ const char* optional_send_buffer, size_t optional_send_buffer_len,
uint32_t write_flags) {
/* TODO: don't use magic number */
grpc_op ops[3];
@@ -802,7 +801,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE
-grpcsharp_call_recv_message(grpc_call *call, grpcsharp_batch_context *ctx) {
+grpcsharp_call_recv_message(grpc_call* call, grpcsharp_batch_context* ctx) {
/* TODO: don't use magic number */
grpc_op ops[1];
ops[0].op = GRPC_OP_RECV_MESSAGE;
@@ -814,7 +813,7 @@ grpcsharp_call_recv_message(grpc_call *call, grpcsharp_batch_context *ctx) {
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE
-grpcsharp_call_start_serverside(grpc_call *call, grpcsharp_batch_context *ctx) {
+grpcsharp_call_start_serverside(grpc_call* call, grpcsharp_batch_context* ctx) {
/* TODO: don't use magic number */
grpc_op ops[1];
ops[0].op = GRPC_OP_RECV_CLOSE_ON_SERVER;
@@ -828,8 +827,8 @@ grpcsharp_call_start_serverside(grpc_call *call, grpcsharp_batch_context *ctx) {
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_initial_metadata(
- grpc_call *call, grpcsharp_batch_context *ctx,
- grpc_metadata_array *initial_metadata) {
+ grpc_call* call, grpcsharp_batch_context* ctx,
+ grpc_metadata_array* initial_metadata) {
/* TODO: don't use magic number */
grpc_op ops[1];
memset(ops, 0, sizeof(ops));
@@ -847,59 +846,59 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_initial_metadata(
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE
-grpcsharp_call_set_credentials(grpc_call *call, grpc_call_credentials *creds) {
+grpcsharp_call_set_credentials(grpc_call* call, grpc_call_credentials* creds) {
return grpc_call_set_credentials(call, creds);
}
/* Server */
-GPR_EXPORT grpc_server *GPR_CALLTYPE
-grpcsharp_server_create(const grpc_channel_args *args) {
+GPR_EXPORT grpc_server* GPR_CALLTYPE
+grpcsharp_server_create(const grpc_channel_args* args) {
return grpc_server_create(args, NULL);
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_register_completion_queue(
- grpc_server *server, grpc_completion_queue *cq) {
+ grpc_server* server, grpc_completion_queue* cq) {
grpc_server_register_completion_queue(server, cq, NULL);
}
GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_server_add_insecure_http2_port(
- grpc_server *server, const char *addr) {
+ grpc_server* server, const char* addr) {
return grpc_server_add_insecure_http2_port(server, addr);
}
-GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_start(grpc_server *server) {
+GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_start(grpc_server* server) {
grpc_server_start(server);
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_shutdown_and_notify_callback(
- grpc_server *server, grpc_completion_queue *cq,
- grpcsharp_batch_context *ctx) {
+ grpc_server* server, grpc_completion_queue* cq,
+ grpcsharp_batch_context* ctx) {
grpc_server_shutdown_and_notify(server, cq, ctx);
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_server_cancel_all_calls(grpc_server *server) {
+grpcsharp_server_cancel_all_calls(grpc_server* server) {
grpc_server_cancel_all_calls(server);
}
-GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_destroy(grpc_server *server) {
+GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_destroy(grpc_server* server) {
grpc_server_destroy(server);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE
-grpcsharp_server_request_call(grpc_server *server, grpc_completion_queue *cq,
- grpcsharp_request_call_context *ctx) {
+grpcsharp_server_request_call(grpc_server* server, grpc_completion_queue* cq,
+ grpcsharp_request_call_context* ctx) {
return grpc_server_request_call(server, &(ctx->call), &(ctx->call_details),
&(ctx->request_metadata), cq, cq, ctx);
}
/* Security */
-static char *default_pem_root_certs = NULL;
+static char* default_pem_root_certs = NULL;
static grpc_ssl_roots_override_result override_ssl_roots_handler(
- char **pem_root_certs) {
+ char** pem_root_certs) {
if (!default_pem_root_certs) {
*pem_root_certs = NULL;
return GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY;
@@ -909,7 +908,7 @@ static grpc_ssl_roots_override_result override_ssl_roots_handler(
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_override_default_ssl_roots(const char *pem_root_certs) {
+grpcsharp_override_default_ssl_roots(const char* pem_root_certs) {
/*
* This currently wastes ~300kB of memory by keeping a copy of roots
* in a static variable, but for desktop/server use, the overhead
@@ -920,10 +919,10 @@ grpcsharp_override_default_ssl_roots(const char *pem_root_certs) {
grpc_set_ssl_roots_override_callback(override_ssl_roots_handler);
}
-GPR_EXPORT grpc_channel_credentials *GPR_CALLTYPE
-grpcsharp_ssl_credentials_create(const char *pem_root_certs,
- const char *key_cert_pair_cert_chain,
- const char *key_cert_pair_private_key) {
+GPR_EXPORT grpc_channel_credentials* GPR_CALLTYPE
+grpcsharp_ssl_credentials_create(const char* pem_root_certs,
+ const char* key_cert_pair_cert_chain,
+ const char* key_cert_pair_private_key) {
grpc_ssl_pem_key_cert_pair key_cert_pair;
if (key_cert_pair_cert_chain || key_cert_pair_private_key) {
key_cert_pair.cert_chain = key_cert_pair_cert_chain;
@@ -937,29 +936,29 @@ grpcsharp_ssl_credentials_create(const char *pem_root_certs,
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_channel_credentials_release(grpc_channel_credentials *creds) {
+grpcsharp_channel_credentials_release(grpc_channel_credentials* creds) {
grpc_channel_credentials_release(creds);
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_call_credentials_release(grpc_call_credentials *creds) {
+grpcsharp_call_credentials_release(grpc_call_credentials* creds) {
grpc_call_credentials_release(creds);
}
-GPR_EXPORT grpc_channel *GPR_CALLTYPE grpcsharp_secure_channel_create(
- grpc_channel_credentials *creds, const char *target,
- const grpc_channel_args *args) {
+GPR_EXPORT grpc_channel* GPR_CALLTYPE grpcsharp_secure_channel_create(
+ grpc_channel_credentials* creds, const char* target,
+ const grpc_channel_args* args) {
return grpc_secure_channel_create(creds, target, args, NULL);
}
-GPR_EXPORT grpc_server_credentials *GPR_CALLTYPE
+GPR_EXPORT grpc_server_credentials* GPR_CALLTYPE
grpcsharp_ssl_server_credentials_create(
- const char *pem_root_certs, const char **key_cert_pair_cert_chain_array,
- const char **key_cert_pair_private_key_array, size_t num_key_cert_pairs,
+ const char* pem_root_certs, const char** key_cert_pair_cert_chain_array,
+ const char** key_cert_pair_private_key_array, size_t num_key_cert_pairs,
int force_client_auth) {
size_t i;
- grpc_server_credentials *creds;
- grpc_ssl_pem_key_cert_pair *key_cert_pairs =
+ grpc_server_credentials* creds;
+ grpc_ssl_pem_key_cert_pair* key_cert_pairs =
gpr_malloc(sizeof(grpc_ssl_pem_key_cert_pair) * num_key_cert_pairs);
memset(key_cert_pairs, 0,
sizeof(grpc_ssl_pem_key_cert_pair) * num_key_cert_pairs);
@@ -982,35 +981,35 @@ grpcsharp_ssl_server_credentials_create(
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_server_credentials_release(grpc_server_credentials *creds) {
+grpcsharp_server_credentials_release(grpc_server_credentials* creds) {
grpc_server_credentials_release(creds);
}
GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_server_add_secure_http2_port(
- grpc_server *server, const char *addr, grpc_server_credentials *creds) {
+ grpc_server* server, const char* addr, grpc_server_credentials* creds) {
return grpc_server_add_secure_http2_port(server, addr, creds);
}
-GPR_EXPORT grpc_channel_credentials *GPR_CALLTYPE
+GPR_EXPORT grpc_channel_credentials* GPR_CALLTYPE
grpcsharp_composite_channel_credentials_create(
- grpc_channel_credentials *channel_creds,
- grpc_call_credentials *call_creds) {
+ grpc_channel_credentials* channel_creds,
+ grpc_call_credentials* call_creds) {
return grpc_composite_channel_credentials_create(channel_creds, call_creds,
NULL);
}
-GPR_EXPORT grpc_call_credentials *GPR_CALLTYPE
-grpcsharp_composite_call_credentials_create(grpc_call_credentials *creds1,
- grpc_call_credentials *creds2) {
+GPR_EXPORT grpc_call_credentials* GPR_CALLTYPE
+grpcsharp_composite_call_credentials_create(grpc_call_credentials* creds1,
+ grpc_call_credentials* creds2) {
return grpc_composite_call_credentials_create(creds1, creds2, NULL);
}
/* Metadata credentials plugin */
GPR_EXPORT void GPR_CALLTYPE grpcsharp_metadata_credentials_notify_from_plugin(
- 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, void* user_data,
+ grpc_metadata_array* metadata, grpc_status_code status,
+ const char* error_details) {
if (metadata) {
cb(user_data, metadata->metadata, metadata->count, status, error_details);
} else {
@@ -1018,17 +1017,17 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_metadata_credentials_notify_from_plugin(
}
}
-typedef void(GPR_CALLTYPE *grpcsharp_metadata_interceptor_func)(
- void *state, const char *service_url, const char *method_name,
- grpc_credentials_plugin_metadata_cb cb, void *user_data,
+typedef void(GPR_CALLTYPE* grpcsharp_metadata_interceptor_func)(
+ void* state, const char* service_url, const char* method_name,
+ grpc_credentials_plugin_metadata_cb cb, void* user_data,
int32_t is_destroy);
static int grpcsharp_get_metadata_handler(
- void *state, grpc_auth_metadata_context context,
- grpc_credentials_plugin_metadata_cb cb, void *user_data,
+ void* state, grpc_auth_metadata_context context,
+ grpc_credentials_plugin_metadata_cb cb, void* user_data,
grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
- size_t *num_creds_md, grpc_status_code *status,
- const char **error_details) {
+ size_t* num_creds_md, grpc_status_code* status,
+ const char** error_details) {
grpcsharp_metadata_interceptor_func interceptor =
(grpcsharp_metadata_interceptor_func)(intptr_t)state;
interceptor(state, context.service_url, context.method_name, cb, user_data,
@@ -1036,61 +1035,61 @@ static int grpcsharp_get_metadata_handler(
return 0; /* Asynchronous return. */
}
-static void grpcsharp_metadata_credentials_destroy_handler(void *state) {
+static void grpcsharp_metadata_credentials_destroy_handler(void* state) {
grpcsharp_metadata_interceptor_func interceptor =
(grpcsharp_metadata_interceptor_func)(intptr_t)state;
interceptor(state, NULL, NULL, NULL, NULL, 1);
}
-GPR_EXPORT grpc_call_credentials *GPR_CALLTYPE
+GPR_EXPORT grpc_call_credentials* GPR_CALLTYPE
grpcsharp_metadata_credentials_create_from_plugin(
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 = (void *)(intptr_t)metadata_interceptor;
+ plugin.state = (void*)(intptr_t)metadata_interceptor;
plugin.type = "";
return grpc_metadata_credentials_create_from_plugin(plugin, NULL);
}
/* Auth context */
-GPR_EXPORT grpc_auth_context *GPR_CALLTYPE
-grpcsharp_call_auth_context(grpc_call *call) {
+GPR_EXPORT grpc_auth_context* GPR_CALLTYPE
+grpcsharp_call_auth_context(grpc_call* call) {
return grpc_call_auth_context(call);
}
-GPR_EXPORT const char *GPR_CALLTYPE
+GPR_EXPORT const char* GPR_CALLTYPE
grpcsharp_auth_context_peer_identity_property_name(
- const grpc_auth_context *ctx) {
+ const grpc_auth_context* ctx) {
return grpc_auth_context_peer_identity_property_name(ctx);
}
GPR_EXPORT grpc_auth_property_iterator GPR_CALLTYPE
-grpcsharp_auth_context_property_iterator(const grpc_auth_context *ctx) {
+grpcsharp_auth_context_property_iterator(const grpc_auth_context* ctx) {
return grpc_auth_context_property_iterator(ctx);
}
-GPR_EXPORT const grpc_auth_property *GPR_CALLTYPE
-grpcsharp_auth_property_iterator_next(grpc_auth_property_iterator *it) {
+GPR_EXPORT const grpc_auth_property* GPR_CALLTYPE
+grpcsharp_auth_property_iterator_next(grpc_auth_property_iterator* it) {
return grpc_auth_property_iterator_next(it);
}
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_auth_context_release(grpc_auth_context *ctx) {
+grpcsharp_auth_context_release(grpc_auth_context* ctx) {
grpc_auth_context_release(ctx);
}
/* Logging */
-typedef void(GPR_CALLTYPE *grpcsharp_log_func)(const char *file, int32_t line,
+typedef void(GPR_CALLTYPE* grpcsharp_log_func)(const char* file, int32_t line,
uint64_t thd_id,
- const char *severity_string,
- const char *msg);
+ const char* severity_string,
+ const char* msg);
static grpcsharp_log_func log_func = NULL;
/* Redirects gpr_log to log_func callback */
-static void grpcsharp_log_handler(gpr_log_func_args *args) {
+static void grpcsharp_log_handler(gpr_log_func_args* args) {
log_func(args->file, args->line, gpr_thd_currentid(),
gpr_log_severity_string(args->severity), args->message);
}
@@ -1101,10 +1100,10 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_redirect_log(grpcsharp_log_func func) {
gpr_set_log_function(grpcsharp_log_handler);
}
-typedef void(GPR_CALLTYPE *test_callback_funcptr)(int32_t success);
+typedef void(GPR_CALLTYPE* test_callback_funcptr)(int32_t success);
/* Version info */
-GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_version_string() {
+GPR_EXPORT const char* GPR_CALLTYPE grpcsharp_version_string() {
return grpc_version_string();
}
@@ -1115,7 +1114,7 @@ grpcsharp_test_callback(test_callback_funcptr callback) {
}
/* For testing */
-GPR_EXPORT void *GPR_CALLTYPE grpcsharp_test_nop(void *ptr) { return ptr; }
+GPR_EXPORT void* GPR_CALLTYPE grpcsharp_test_nop(void* ptr) { return ptr; }
/* For testing */
GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_sizeof_grpc_event(void) {
@@ -1124,7 +1123,7 @@ GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_sizeof_grpc_event(void) {
/* Override a method for testing */
GPR_EXPORT void GPR_CALLTYPE
-grpcsharp_test_override_method(const char *method_name, const char *variant) {
+grpcsharp_test_override_method(const char* method_name, const char* variant) {
if (strcmp("grpcsharp_call_start_batch", method_name) == 0) {
if (strcmp("nop", variant) == 0) {
g_call_start_batch_func = grpcsharp_call_start_batch_nop;