clang-format of grpc_csharp_ext.c

pull/505/head
Jan Tattermusch 10 years ago
parent 13b9cfb8de
commit a9edeef4cc
  1. 157
      src/csharp/ext/grpc_csharp_ext.c

@ -27,43 +27,44 @@ grpc_byte_buffer *string_to_byte_buffer(const char *buffer, size_t len) {
/* Init & shutdown */
GPR_EXPORT void GPR_CALLTYPE grpcsharp_init(void) {
grpc_init();
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_init(void) { grpc_init(); }
GPR_EXPORT void GPR_CALLTYPE grpcsharp_shutdown(void) {
grpc_shutdown();
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_shutdown(void) { grpc_shutdown(); }
/* Completion queue */
GPR_EXPORT grpc_completion_queue * GPR_CALLTYPE grpcsharp_completion_queue_create(void) {
GPR_EXPORT grpc_completion_queue *GPR_CALLTYPE
grpcsharp_completion_queue_create(void) {
return grpc_completion_queue_create();
}
GPR_EXPORT grpc_event * GPR_CALLTYPE grpcsharp_completion_queue_next(
grpc_completion_queue *cq, gpr_timespec deadline) {
GPR_EXPORT grpc_event *GPR_CALLTYPE
grpcsharp_completion_queue_next(grpc_completion_queue *cq,
gpr_timespec deadline) {
return grpc_completion_queue_next(cq, deadline);
}
GPR_EXPORT grpc_event * GPR_CALLTYPE grpcsharp_completion_queue_pluck(
grpc_completion_queue *cq, void *tag, gpr_timespec deadline) {
GPR_EXPORT grpc_event *GPR_CALLTYPE
grpcsharp_completion_queue_pluck(grpc_completion_queue *cq, void *tag,
gpr_timespec deadline) {
return grpc_completion_queue_pluck(cq, tag, deadline);
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_completion_queue_shutdown(grpc_completion_queue *cq) {
GPR_EXPORT void GPR_CALLTYPE
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) {
GPR_EXPORT void GPR_CALLTYPE
grpcsharp_completion_queue_destroy(grpc_completion_queue *cq) {
grpc_completion_queue_destroy(cq);
}
GPR_EXPORT grpc_completion_type GPR_CALLTYPE grpcsharp_completion_queue_next_with_callback(
grpc_completion_queue *cq) {
GPR_EXPORT grpc_completion_type GPR_CALLTYPE
grpcsharp_completion_queue_next_with_callback(grpc_completion_queue *cq) {
grpc_event *ev;
grpc_completion_type t;
void (GPR_CALLTYPE *callback)(grpc_event *);
void(GPR_CALLTYPE * callback)(grpc_event *);
ev = grpc_completion_queue_next(cq, gpr_inf_future);
t = ev->type;
@ -72,7 +73,7 @@ GPR_EXPORT grpc_completion_type GPR_CALLTYPE grpcsharp_completion_queue_next_wit
/* C forbids to cast object pointers to function pointers, so
* we cast to intptr first.
*/
callback = (void (GPR_CALLTYPE *)(grpc_event *))(gpr_intptr)ev->tag;
callback = (void(GPR_CALLTYPE *)(grpc_event *))(gpr_intptr)ev->tag;
(*callback)(ev);
}
grpc_event_finish(ev);
@ -85,8 +86,8 @@ GPR_EXPORT grpc_completion_type GPR_CALLTYPE grpcsharp_completion_queue_next_wit
/* Channel */
GPR_EXPORT grpc_channel * GPR_CALLTYPE grpcsharp_channel_create(
const char *target, const grpc_channel_args *args) {
GPR_EXPORT grpc_channel *GPR_CALLTYPE
grpcsharp_channel_create(const char *target, const grpc_channel_args *args) {
return grpc_channel_create(target, args);
}
@ -94,9 +95,9 @@ 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_old(grpc_channel *channel,
const char *method, const char *host,
gpr_timespec deadline) {
GPR_EXPORT grpc_call *GPR_CALLTYPE
grpcsharp_channel_create_call_old(grpc_channel *channel, const char *method,
const char *host, gpr_timespec deadline) {
return grpc_channel_create_call_old(channel, method, host, deadline);
}
@ -106,31 +107,37 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_event_finish(grpc_event *event) {
grpc_event_finish(event);
}
GPR_EXPORT grpc_completion_type GPR_CALLTYPE grpcsharp_event_type(const grpc_event *event) {
GPR_EXPORT grpc_completion_type GPR_CALLTYPE
grpcsharp_event_type(const grpc_event *event) {
return event->type;
}
GPR_EXPORT grpc_op_error GPR_CALLTYPE grpcsharp_event_write_accepted(const grpc_event *event) {
GPR_EXPORT grpc_op_error GPR_CALLTYPE
grpcsharp_event_write_accepted(const grpc_event *event) {
GPR_ASSERT(event->type == GRPC_WRITE_ACCEPTED);
return event->data.invoke_accepted;
}
GPR_EXPORT grpc_op_error GPR_CALLTYPE grpcsharp_event_finish_accepted(const grpc_event *event) {
GPR_EXPORT grpc_op_error GPR_CALLTYPE
grpcsharp_event_finish_accepted(const grpc_event *event) {
GPR_ASSERT(event->type == GRPC_FINISH_ACCEPTED);
return event->data.finish_accepted;
}
GPR_EXPORT grpc_status_code GPR_CALLTYPE grpcsharp_event_finished_status(const grpc_event *event) {
GPR_EXPORT grpc_status_code GPR_CALLTYPE
grpcsharp_event_finished_status(const grpc_event *event) {
GPR_ASSERT(event->type == GRPC_FINISHED);
return event->data.finished.status;
}
GPR_EXPORT const char * GPR_CALLTYPE grpcsharp_event_finished_details(const grpc_event *event) {
GPR_EXPORT const char *GPR_CALLTYPE
grpcsharp_event_finished_details(const grpc_event *event) {
GPR_ASSERT(event->type == GRPC_FINISHED);
return event->data.finished.details;
}
GPR_EXPORT gpr_intptr GPR_CALLTYPE grpcsharp_event_read_length(const grpc_event *event) {
GPR_EXPORT gpr_intptr GPR_CALLTYPE
grpcsharp_event_read_length(const grpc_event *event) {
GPR_ASSERT(event->type == GRPC_READ);
if (!event->data.read) {
return -1;
@ -142,7 +149,8 @@ GPR_EXPORT gpr_intptr GPR_CALLTYPE grpcsharp_event_read_length(const grpc_event
* Copies data from read event to a buffer. Fatal error occurs if
* buffer is too small.
*/
GPR_EXPORT void GPR_CALLTYPE grpcsharp_event_read_copy_to_buffer(const grpc_event *event, char *buffer,
GPR_EXPORT void GPR_CALLTYPE
grpcsharp_event_read_copy_to_buffer(const grpc_event *event, char *buffer,
size_t buffer_len) {
grpc_byte_buffer_reader *reader;
gpr_slice slice;
@ -163,22 +171,22 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_event_read_copy_to_buffer(const grpc_even
grpc_byte_buffer_reader_destroy(reader);
}
GPR_EXPORT grpc_call * GPR_CALLTYPE grpcsharp_event_call(const grpc_event *event) {
GPR_EXPORT grpc_call *GPR_CALLTYPE
grpcsharp_event_call(const grpc_event *event) {
/* we only allow this for newly incoming server calls. */
GPR_ASSERT(event->type == GRPC_SERVER_RPC_NEW);
return event->call;
}
GPR_EXPORT const char * GPR_CALLTYPE grpcsharp_event_server_rpc_new_method(const grpc_event *event) {
GPR_EXPORT const char *GPR_CALLTYPE
grpcsharp_event_server_rpc_new_method(const grpc_event *event) {
GPR_ASSERT(event->type == GRPC_SERVER_RPC_NEW);
return event->data.server_rpc_new.method;
}
/* Timespec */
GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_now(void) {
return gpr_now();
}
GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_now(void) { return gpr_now(); }
GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_inf_future(void) {
return gpr_inf_future;
@ -190,24 +198,28 @@ GPR_EXPORT gpr_int32 GPR_CALLTYPE gprsharp_sizeof_timespec(void) {
/* Call */
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_add_metadata_old(
grpc_call *call, grpc_metadata *metadata, gpr_uint32 flags) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_add_metadata_old(grpc_call *call, grpc_metadata *metadata,
gpr_uint32 flags) {
return grpc_call_add_metadata_old(call, metadata, flags);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_invoke_old(
grpc_call *call, grpc_completion_queue *cq, void *metadata_read_tag,
void *finished_tag, gpr_uint32 flags) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_invoke_old(grpc_call *call, grpc_completion_queue *cq,
void *metadata_read_tag, void *finished_tag,
gpr_uint32 flags) {
return grpc_call_invoke_old(call, cq, metadata_read_tag, finished_tag, flags);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_server_accept_old(
grpc_call *call, grpc_completion_queue *cq, void *finished_tag) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_server_accept_old(grpc_call *call, grpc_completion_queue *cq,
void *finished_tag) {
return grpc_call_server_accept_old(call, cq, finished_tag);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_server_end_initial_metadata_old(
grpc_call *call, gpr_uint32 flags) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_server_end_initial_metadata_old(grpc_call *call,
gpr_uint32 flags) {
return grpc_call_server_end_initial_metadata_old(call, flags);
}
@ -215,30 +227,33 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel(grpc_call *call) {
return grpc_call_cancel(call);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel_with_status(
grpc_call *call, grpc_status_code status, const char *description) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_cancel_with_status(grpc_call *call, grpc_status_code status,
const char *description) {
return grpc_call_cancel_with_status(call, status, description);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_write_old(
grpc_call *call, grpc_byte_buffer *byte_buffer, void *tag, gpr_uint32 flags) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_start_write_old(grpc_call *call, grpc_byte_buffer *byte_buffer,
void *tag, gpr_uint32 flags) {
return grpc_call_start_write_old(call, byte_buffer, tag, flags);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_write_status_old(
grpc_call *call, grpc_status_code status_code, const char *status_message,
void *tag) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_start_write_status_old(grpc_call *call,
grpc_status_code status_code,
const char *status_message, void *tag) {
return grpc_call_start_write_status_old(call, status_code, status_message,
tag);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_writes_done_old(
grpc_call *call, void *tag) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_writes_done_old(grpc_call *call, void *tag) {
return grpc_call_writes_done_old(call, tag);
}
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_read_old(
grpc_call *call, void *tag) {
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_call_start_read_old(grpc_call *call, void *tag) {
return grpc_call_start_read_old(call, tag);
}
@ -246,33 +261,36 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_destroy(grpc_call *call) {
grpc_call_destroy(call);
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_start_write_from_copied_buffer(
grpc_call *call, const char *buffer, size_t len, void *tag,
gpr_uint32 flags) {
GPR_EXPORT void GPR_CALLTYPE
grpcsharp_call_start_write_from_copied_buffer(grpc_call *call,
const char *buffer, size_t len,
void *tag, gpr_uint32 flags) {
grpc_byte_buffer *byte_buffer = string_to_byte_buffer(buffer, len);
GPR_ASSERT(
grpc_call_start_write_old(call, byte_buffer, tag, flags) == GRPC_CALL_OK);
GPR_ASSERT(grpc_call_start_write_old(call, byte_buffer, tag, flags) ==
GRPC_CALL_OK);
grpc_byte_buffer_destroy(byte_buffer);
}
/* Server */
GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_server_request_call_old(grpc_server *server,
void *tag_new) {
return grpc_server_request_call_old(server, tag_new);
GPR_EXPORT grpc_call_error GPR_CALLTYPE
grpcsharp_server_request_call_old(grpc_server *server, void *tag_new) {
return grpc_server_request_call_old(server, tag_new);
}
GPR_EXPORT grpc_server * GPR_CALLTYPE grpcsharp_server_create(grpc_completion_queue *cq,
const grpc_channel_args *args) {
return grpc_server_create(cq, args);
GPR_EXPORT grpc_server *GPR_CALLTYPE
grpcsharp_server_create(grpc_completion_queue *cq,
const grpc_channel_args *args) {
return grpc_server_create(cq, args);
}
GPR_EXPORT int GPR_CALLTYPE grpcsharp_server_add_http2_port(grpc_server *server, const char *addr) {
GPR_EXPORT int GPR_CALLTYPE
grpcsharp_server_add_http2_port(grpc_server *server, const char *addr) {
return grpc_server_add_http2_port(server, addr);
}
GPR_EXPORT int GPR_CALLTYPE grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr) {
GPR_EXPORT int GPR_CALLTYPE
grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr) {
return grpc_server_add_secure_http2_port(server, addr);
}
@ -284,7 +302,8 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_shutdown(grpc_server *server) {
grpc_server_shutdown(server);
}
GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_shutdown_and_notify(grpc_server *server, void *tag) {
GPR_EXPORT void GPR_CALLTYPE
grpcsharp_server_shutdown_and_notify(grpc_server *server, void *tag) {
grpc_server_shutdown_and_notify(server, tag);
}

Loading…
Cancel
Save