From 88e0bb1b34d210a5def7164ed4a7cc66824df69d Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Thu, 3 Mar 2016 23:42:17 -0800 Subject: [PATCH 001/175] Update Podfile for CocoaPods 1.0 changes requiring more fields and the removal of link_with in podspec. --- src/objective-c/tests/Podfile | 22 ++++++++++--------- .../tests/RemoteTestClient/RemoteTest.podspec | 4 ++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 7ec7a258982..30725a0f781 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -1,31 +1,33 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' -pod 'Protobuf', :path => "../../../third_party/protobuf" -pod 'BoringSSL', :podspec => ".." -pod 'gRPC', :path => "../../.." -pod 'RemoteTest', :path => "RemoteTestClient" - -link_with 'AllTests', - 'RxLibraryUnitTests', - 'InteropTests', - 'InteropTestsLocalSSL', - 'InteropTestsLocalCleartext' +def shared_pods + pod 'Protobuf', :path => "../../../third_party/protobuf" + pod 'BoringSSL', :podspec => ".." + pod 'gRPC', :path => "../../.." + pod 'RemoteTest', :path => "RemoteTestClient" +end target 'Tests' do + shared_pods end target 'AllTests' do + shared_pods end target 'RxLibraryUnitTests' do + shared_pods end target 'InteropTestsRemote' do + shared_pods end target 'InteropTestsLocalSSL' do + shared_pods end target 'InteropTestsLocalCleartext' do + shared_pods end diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index 6ecef0593b7..e1fd9910389 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -2,6 +2,10 @@ Pod::Spec.new do |s| s.name = "RemoteTest" s.version = "0.0.1" s.license = "New BSD" + s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' } + s.homepage = "http://www.grpc.io/" + s.summary = "RemoteTest example" + s.source = { :git => 'https://github.com/grpc/grpc.git' } s.ios.deployment_target = '7.1' s.osx.deployment_target = '10.9' From aed11dd7562fd689f11723e5d2385e1c6dcf7197 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Fri, 4 Mar 2016 08:21:58 -0800 Subject: [PATCH 002/175] Update cocoapods in travis to 1.0.0beta4 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 004d44f3a55..feee271383b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ env: - TEST=objc - JOBS=1 before_install: + - gem install cocoapods -v '1.0.0.beta.4' - brew install gflags # Pod install does this too, but we don't want the output. - pod repo update --silent From 8ee9c7e85c502d3716e256176fce6942fb26b2c0 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Fri, 4 Mar 2016 09:00:29 -0800 Subject: [PATCH 003/175] print cocoapods version before pod install --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index feee271383b..1966d30f74d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ install: - pushd src/objective-c/tests # Needs to be verbose, or otherwise OpenSSL's prepare_command makes Travis # time out: + - pod --version - pod install --verbose - popd before_script: From 73dcbda5b006fac4651480f7692b30db993b79b9 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Sat, 23 Apr 2016 00:17:05 -0700 Subject: [PATCH 004/175] Validation for incoming compressed data --- include/grpc/compression.h | 3 +- src/core/lib/channel/channel_args.c | 12 +- src/core/lib/surface/call.c | 133 +++++++++++--- src/core/lib/surface/channel.c | 16 +- src/core/lib/surface/channel.h | 4 + test/core/channel/channel_args_test.c | 2 + test/core/end2end/tests/compressed_payload.c | 178 ++++++++++++++++++- 7 files changed, 318 insertions(+), 30 deletions(-) diff --git a/include/grpc/compression.h b/include/grpc/compression.h index 8de4b133d4c..22bcf0e3020 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -51,7 +51,8 @@ GRPCAPI int grpc_compression_algorithm_parse( grpc_compression_algorithm *algorithm); /** Updates \a name with the encoding name corresponding to a valid \a - * algorithm. Returns 1 upon success, 0 otherwise. */ + * algorithm. Note that \a name is statically allocated and must *not* be freed. + * Returns 1 upon success, 0 otherwise. */ GRPCAPI int grpc_compression_algorithm_name( grpc_compression_algorithm algorithm, char **name); diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 28d2d78d00f..d6b95fe6449 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -35,6 +35,7 @@ #include #include "src/core/lib/support/string.h" +#include #include #include #include @@ -180,6 +181,7 @@ grpc_compression_algorithm grpc_channel_args_get_compression_algorithm( grpc_channel_args *grpc_channel_args_set_compression_algorithm( grpc_channel_args *a, grpc_compression_algorithm algorithm) { + GPR_ASSERT(algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT); grpc_arg tmp; tmp.type = GRPC_ARG_INTEGER; tmp.key = GRPC_COMPRESSION_ALGORITHM_ARG; @@ -212,7 +214,15 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( const int states_arg_found = find_compression_algorithm_states_bitset(*a, &states_arg); - if (states_arg_found) { + if (grpc_channel_args_get_compression_algorithm(*a) == algorithm && + state == 0) { + char *algo_name = NULL; + GPR_ASSERT(grpc_compression_algorithm_name(algorithm, &algo_name) != 0); + gpr_log(GPR_ERROR, + "Tried to disable default compression algorithm '%s'. The " + "operation has been ignored.", + algo_name); + } else if (states_arg_found) { if (state != 0) { GPR_BITSET((unsigned *)states_arg, algorithm); } else { diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 6581bbd3d1d..2462adc26a0 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -52,7 +53,9 @@ #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/completion_queue.h" +#include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" +#include "src/core/lib/transport/transport.h" /** The maximum number of concurrent batches possible. Based upon the maximum number of individually queueable ops in the batch @@ -240,6 +243,9 @@ static void execute_op(grpc_exec_ctx *exec_ctx, grpc_call *call, static grpc_call_error cancel_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c, grpc_status_code status, const char *description); +static grpc_call_error close_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c, + grpc_status_code status, + const char *description); static void destroy_call(grpc_exec_ctx *exec_ctx, void *call_stack, bool success); static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, @@ -410,7 +416,30 @@ static void set_status_code(grpc_call *call, status_source source, static void set_compression_algorithm(grpc_call *call, grpc_compression_algorithm algo) { - call->compression_algorithm = algo; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + char *error_msg = NULL; + const grpc_compression_options compression_options = + grpc_channel_get_compression_options(call->channel); + + /* check if algorithm is known */ + if (algo >= GRPC_COMPRESS_ALGORITHMS_COUNT) { + gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.", algo); + gpr_log(GPR_ERROR, error_msg); + close_with_status(&exec_ctx, call, GRPC_STATUS_INTERNAL, error_msg); + } else if (grpc_compression_options_is_algorithm_enabled(&compression_options, + algo) == 0) { + /* check if algorithm is supported by current channel config */ + char *algo_name; + grpc_compression_algorithm_name(algo, &algo_name); + gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.", + algo_name); + gpr_log(GPR_ERROR, error_msg); + close_with_status(&exec_ctx, call, GRPC_STATUS_INTERNAL, error_msg); + } else { + call->compression_algorithm = algo; + } + gpr_free(error_msg); + grpc_exec_ctx_finish(&exec_ctx); } grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm( @@ -694,48 +723,102 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *c, return r; } -typedef struct cancel_closure { +typedef struct termination_closure { grpc_closure closure; grpc_call *call; grpc_status_code status; -} cancel_closure; + gpr_slice optional_message; + grpc_closure *op_closure; + enum { TC_CANCEL, TC_CLOSE } type; +} termination_closure; + +static void done_termination(grpc_exec_ctx *exec_ctx, void *tcp, bool success) { + termination_closure *tc = tcp; + if (tc->type == TC_CANCEL) { + GRPC_CALL_INTERNAL_UNREF(exec_ctx, tc->call, "cancel"); + } + if (tc->type == TC_CLOSE) { + GRPC_CALL_INTERNAL_UNREF(exec_ctx, tc->call, "close"); + } + gpr_slice_unref(tc->optional_message); + if (tc->op_closure != NULL) { + grpc_exec_ctx_enqueue(exec_ctx, tc->op_closure, false, NULL); + } + gpr_free(tc); +} -static void done_cancel(grpc_exec_ctx *exec_ctx, void *ccp, bool success) { - cancel_closure *cc = ccp; - GRPC_CALL_INTERNAL_UNREF(exec_ctx, cc->call, "cancel"); - gpr_free(cc); +static void send_cancel(grpc_exec_ctx *exec_ctx, void *tcp, bool success) { + grpc_transport_stream_op op; + termination_closure *tc = tcp; + memset(&op, 0, sizeof(op)); + op.cancel_with_status = tc->status; + /* reuse closure to catch completion */ + grpc_closure_init(&tc->closure, done_termination, tc); + op.on_complete = &tc->closure; + execute_op(exec_ctx, tc->call, &op); } -static void send_cancel(grpc_exec_ctx *exec_ctx, void *ccp, bool success) { +static void send_close(grpc_exec_ctx *exec_ctx, void *tcp, bool success) { grpc_transport_stream_op op; - cancel_closure *cc = ccp; + termination_closure *tc = tcp; memset(&op, 0, sizeof(op)); - op.cancel_with_status = cc->status; + tc->optional_message = gpr_slice_ref(tc->optional_message); + grpc_transport_stream_op_add_close(&op, tc->status, &tc->optional_message); /* reuse closure to catch completion */ - grpc_closure_init(&cc->closure, done_cancel, cc); - op.on_complete = &cc->closure; - execute_op(exec_ctx, cc->call, &op); + grpc_closure_init(&tc->closure, done_termination, tc); + tc->op_closure = op.on_complete; + op.on_complete = &tc->closure; + execute_op(exec_ctx, tc->call, &op); +} + +static grpc_call_error terminate_with_status(grpc_exec_ctx *exec_ctx, + termination_closure *tc) { + grpc_mdstr *details = NULL; + if (GPR_SLICE_LENGTH(tc->optional_message) > 0) { + tc->optional_message = gpr_slice_ref(tc->optional_message); + details = grpc_mdstr_from_slice(tc->optional_message); + } + + set_status_code(tc->call, STATUS_FROM_API_OVERRIDE, (uint32_t)tc->status); + set_status_details(tc->call, STATUS_FROM_API_OVERRIDE, details); + + if (tc->type == TC_CANCEL) { + grpc_closure_init(&tc->closure, send_cancel, tc); + GRPC_CALL_INTERNAL_REF(tc->call, "cancel"); + } else if (tc->type == TC_CLOSE) { + grpc_closure_init(&tc->closure, send_close, tc); + GRPC_CALL_INTERNAL_REF(tc->call, "close"); + } + grpc_exec_ctx_enqueue(exec_ctx, &tc->closure, true, NULL); + return GRPC_CALL_OK; } static grpc_call_error cancel_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c, grpc_status_code status, const char *description) { - grpc_mdstr *details = - description ? grpc_mdstr_from_string(description) : NULL; - cancel_closure *cc = gpr_malloc(sizeof(*cc)); - + termination_closure *tc = gpr_malloc(sizeof(*tc)); + memset(tc, 0, sizeof(termination_closure)); + tc->type = TC_CANCEL; + tc->call = c; + tc->optional_message = gpr_slice_from_copied_string(description); GPR_ASSERT(status != GRPC_STATUS_OK); + tc->status = status; - set_status_code(c, STATUS_FROM_API_OVERRIDE, (uint32_t)status); - set_status_details(c, STATUS_FROM_API_OVERRIDE, details); + return terminate_with_status(exec_ctx, tc); +} - grpc_closure_init(&cc->closure, send_cancel, cc); - cc->call = c; - cc->status = status; - GRPC_CALL_INTERNAL_REF(c, "cancel"); - grpc_exec_ctx_enqueue(exec_ctx, &cc->closure, true, NULL); +static grpc_call_error close_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c, + grpc_status_code status, + const char *description) { + termination_closure *tc = gpr_malloc(sizeof(*tc)); + memset(tc, 0, sizeof(termination_closure)); + tc->type = TC_CLOSE; + tc->call = c; + tc->optional_message = gpr_slice_from_copied_string(description); + GPR_ASSERT(status != GRPC_STATUS_OK); + tc->status = status; - return GRPC_CALL_OK; + return terminate_with_status(exec_ctx, tc); } static void execute_op(grpc_exec_ctx *exec_ctx, grpc_call *call, diff --git a/src/core/lib/surface/channel.c b/src/core/lib/surface/channel.c index b6b760b5d8d..72d0cfab2b0 100644 --- a/src/core/lib/surface/channel.c +++ b/src/core/lib/surface/channel.c @@ -36,16 +36,17 @@ #include #include +#include #include #include #include +#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/support/string.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel_init.h" -#include "src/core/lib/surface/init.h" #include "src/core/lib/transport/static_metadata.h" /** Cache grpc-status: X mdelems for X = 0..NUM_CACHED_STATUS_ELEMS. @@ -64,6 +65,7 @@ typedef struct registered_call { struct grpc_channel { int is_client; uint32_t max_message_length; + grpc_compression_options compression_options; grpc_mdelem *default_authority; gpr_mu registered_call_mu; @@ -111,6 +113,7 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target, channel->registered_calls = NULL; channel->max_message_length = DEFAULT_MAX_MESSAGE_LENGTH; + grpc_compression_options_init(&channel->compression_options); if (args) { for (size_t i = 0; i < args->num_args; i++) { if (0 == strcmp(args->args[i].key, GRPC_ARG_MAX_MESSAGE_LENGTH)) { @@ -153,6 +156,12 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target, } } } + /* extract compression options */ + channel->compression_options.enabled_algorithms_bitset = + (uint32_t)grpc_channel_args_compression_algorithm_get_states(args); + channel->compression_options.default_compression_algorithm = + grpc_channel_args_get_compression_algorithm(args); + grpc_channel_args_destroy(args); } @@ -306,6 +315,11 @@ grpc_channel_stack *grpc_channel_get_channel_stack(grpc_channel *channel) { return CHANNEL_STACK_FROM_CHANNEL(channel); } +grpc_compression_options grpc_channel_get_compression_options( + const grpc_channel *channel) { + return channel->compression_options; +} + grpc_mdelem *grpc_channel_get_reffed_status_elem(grpc_channel *channel, int i) { char tmp[GPR_LTOA_MIN_BUFSIZE]; switch (i) { diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h index 22dae930e4c..8f153fbc558 100644 --- a/src/core/lib/surface/channel.h +++ b/src/core/lib/surface/channel.h @@ -45,6 +45,10 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target, /** Get a (borrowed) pointer to this channels underlying channel stack */ grpc_channel_stack *grpc_channel_get_channel_stack(grpc_channel *channel); +/** Return the compression options for \a channel */ +grpc_compression_options grpc_channel_get_compression_options( + const grpc_channel *channel); + /** Get a grpc_mdelem of grpc-status: X where X is the numeric value of status_code. diff --git a/test/core/channel/channel_args_test.c b/test/core/channel/channel_args_test.c index c7fc25960c0..1aa8c5dd2ae 100644 --- a/test/core/channel/channel_args_test.c +++ b/test/core/channel/channel_args_test.c @@ -135,8 +135,10 @@ static void test_compression_algorithm_states(void) { int main(int argc, char **argv) { grpc_test_init(argc, argv); + grpc_init(); test_create(); test_set_compression_algorithm(); test_compression_algorithm_states(); + grpc_shutdown(); return 0; } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 589bc314f8e..b713d399c0c 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -38,8 +38,10 @@ #include #include +#include #include #include +#include #include #include @@ -102,6 +104,170 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } +static void request_for_disabled_algorithm( + grpc_end2end_test_config config, const char *test_name, + uint32_t send_flags_bitmask, + grpc_compression_algorithm algorithm_to_disable, + grpc_compression_algorithm requested_client_compression_algorithm, + grpc_status_code expected_error, grpc_metadata *client_metadata) { + grpc_call *c; + grpc_call *s; + gpr_slice request_payload_slice; + grpc_byte_buffer *request_payload; + gpr_timespec deadline = five_seconds_time(); + grpc_channel_args *client_args; + grpc_channel_args *server_args; + grpc_end2end_test_fixture f; + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + char *details = NULL; + size_t details_capacity = 0; + int was_cancelled = 2; + cq_verifier *cqv; + char str[1024]; + + memset(str, 'x', 1023); + str[1023] = '\0'; + request_payload_slice = gpr_slice_from_copied_string(str); + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + + client_args = grpc_channel_args_set_compression_algorithm( + NULL, requested_client_compression_algorithm); + server_args = + grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_NONE); + server_args = grpc_channel_args_compression_algorithm_set_state( + &server_args, algorithm_to_disable, false); + + f = begin_test(config, test_name, client_args, server_args); + cqv = cq_verifier_create(f.cq); + + c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + "/foo", "foo.test.google.fr", deadline, NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + if (client_metadata != NULL) { + op->data.send_initial_metadata.count = 1; + op->data.send_initial_metadata.metadata = client_metadata; + } else { + op->data.send_initial_metadata.count = 0; + } + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message = request_payload; + op->flags = send_flags_bitmask; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.status_details_capacity = &details_capacity; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + cq_expect_completion(cqv, tag(101), 1); + cq_verify(cqv); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message = &request_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + cq_expect_completion(cqv, tag(102), 0); + cq_verify(cqv); + + op = ops; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + cq_expect_completion(cqv, tag(103), 1); + cq_expect_completion(cqv, tag(1), 1); + cq_verify(cqv); + + /* call was cancelled (closed) ... */ + GPR_ASSERT(was_cancelled != 0); + /* with a certain error */ + GPR_ASSERT(status == expected_error); + + char *algo_name = NULL; + GPR_ASSERT(grpc_compression_algorithm_name(algorithm_to_disable, &algo_name)); + char *expected_details = NULL; + gpr_asprintf(&expected_details, "Compression algorithm '%s' is disabled.", + algo_name); + /* and we expect a specific reason for it */ + GPR_ASSERT(0 == strcmp(details, expected_details)); + gpr_free(expected_details); + GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); + + gpr_free(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + grpc_call_destroy(s); + + cq_verifier_destroy(cqv); + + gpr_slice_unref(request_payload_slice); + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(request_payload_recv); + + grpc_channel_args_destroy(client_args); + grpc_channel_args_destroy(server_args); + + end_test(&f); + config.tear_down_data(&f); +} + static void request_with_payload_template( grpc_end2end_test_config config, const char *test_name, uint32_t send_flags_bitmask, @@ -196,8 +362,8 @@ static void request_with_payload_template( cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); - GPR_ASSERT( - GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer(s)) == 3); + GPR_ASSERT(GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer( + s)) == GRPC_COMPRESS_ALGORITHMS_COUNT); GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), GRPC_COMPRESS_NONE) != 0); GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), @@ -330,11 +496,19 @@ static void test_invoke_request_with_compressed_payload_md_override( GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, &none_compression_override); } +static void test_invoke_request_with_invalid_algorithm( + grpc_end2end_test_config config) { + request_for_disabled_algorithm( + config, "test_invoke_request_with_invalid_algorithm", 0, + GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_STATUS_INTERNAL, NULL); +} + void compressed_payload(grpc_end2end_test_config config) { test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); test_invoke_request_with_compressed_payload_md_override(config); + test_invoke_request_with_invalid_algorithm(config); } void compressed_payload_pre_init(void) {} From cb2125577c3ab81aab3554221dc9171904ac231e Mon Sep 17 00:00:00 2001 From: Tamas Berghammer Date: Thu, 28 Apr 2016 10:35:34 +0100 Subject: [PATCH 005/175] Add 64bit Android support Since Android Lollipop (5.0) Android has 64bit support. This config change is needed to support these configurations. The code have been tested with AArch64 and no other changes needed to get the helloworld example working. --- include/grpc/impl/codegen/port_platform.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index 1229d488edb..0ac9324b389 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -117,7 +117,11 @@ #elif defined(ANDROID) || defined(__ANDROID__) #define GPR_PLATFORM_STRING "android" #define GPR_ANDROID 1 +#ifdef _LP64 +#define GPR_ARCH_64 1 +#else /* _LP64 */ #define GPR_ARCH_32 1 +#endif /* _LP64 */ #define GPR_CPU_LINUX 1 #define GPR_GCC_SYNC 1 #define GPR_GCC_TLS 1 From c84ed6813e24b6d64d2eea7e39188ddae11528c6 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 4 May 2016 16:30:11 -0700 Subject: [PATCH 006/175] Proto server reflection --- BUILD | 24 + Makefile | 155 +- build.yaml | 27 + .../impl/proto_server_reflection_plugin.h | 74 + .../include/grpc++/impl/reflection.grpc.pb.h | 555 ++++ .../include/grpc++/impl/reflection.pb.h | 1128 ++++++++ .../reflection/proto_server_reflection.cc | 172 ++ .../reflection/proto_server_reflection.h | 92 + .../proto_server_reflection_plugin.cc | 89 + extensions/reflection/reflection.grpc.pb.cc | 245 ++ extensions/reflection/reflection.pb.cc | 2448 +++++++++++++++++ .../grpc/reflection/v1alpha/reflection.proto | 118 + templates/Makefile.template | 7 +- .../proto_reflection_descriptor_database.cc | 238 ++ .../proto_reflection_descriptor_database.h | 95 + test/cpp/util/reflection_debug/Makefile | 50 + .../reflection_debug/reflection_client.cc | 216 ++ .../extensions/gen_reflection_proto.sh | 33 + tools/run_tests/sources_and_headers.json | 43 + tools/run_tests/tests.json | 21 + vsprojects/grpc.sln | 21 + .../grpc++_reflection.vcxproj | 176 ++ .../grpc++_reflection.vcxproj.filters | 52 + .../reflection_debug_test.vcxproj | 206 ++ .../reflection_debug_test.vcxproj.filters | 32 + 25 files changed, 6309 insertions(+), 8 deletions(-) create mode 100644 extensions/include/grpc++/impl/proto_server_reflection_plugin.h create mode 100644 extensions/include/grpc++/impl/reflection.grpc.pb.h create mode 100644 extensions/include/grpc++/impl/reflection.pb.h create mode 100644 extensions/reflection/proto_server_reflection.cc create mode 100644 extensions/reflection/proto_server_reflection.h create mode 100644 extensions/reflection/proto_server_reflection_plugin.cc create mode 100644 extensions/reflection/reflection.grpc.pb.cc create mode 100644 extensions/reflection/reflection.pb.cc create mode 100644 src/proto/grpc/reflection/v1alpha/reflection.proto create mode 100644 test/cpp/util/proto_reflection_descriptor_database.cc create mode 100644 test/cpp/util/proto_reflection_descriptor_database.h create mode 100644 test/cpp/util/reflection_debug/Makefile create mode 100644 test/cpp/util/reflection_debug/reflection_client.cc create mode 100755 tools/codegen/extensions/gen_reflection_proto.sh create mode 100644 vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj create mode 100644 vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj create mode 100644 vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters diff --git a/BUILD b/BUILD index b4b10b535e8..a885f3ca8c4 100644 --- a/BUILD +++ b/BUILD @@ -983,6 +983,30 @@ cc_library( +cc_library( + name = "grpc++_reflection", + srcs = [ + "extensions/reflection/proto_server_reflection.h", + "extensions/reflection/proto_server_reflection.cc", + "extensions/reflection/proto_server_reflection_plugin.cc", + "extensions/reflection/reflection.grpc.pb.cc", + "extensions/reflection/reflection.pb.cc", + ], + hdrs = [ + "extensions/include/grpc++/impl/proto_server_reflection_plugin.h", + "extensions/include/grpc++/impl/reflection.grpc.pb.h", + "extensions/include/grpc++/impl/reflection.pb.h", + ], + includes = [ + "include", + ".", + ], + deps = [ + ], +) + + + cc_library( name = "grpc++_unsecure", srcs = [ diff --git a/Makefile b/Makefile index 922e0b0568f..aca0fb2c3fe 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,7 @@ BINDIR = $(BUILDDIR_ABSOLUTE)/bins OBJDIR = $(BUILDDIR_ABSOLUTE)/objs LIBDIR = $(BUILDDIR_ABSOLUTE)/libs GENDIR = $(BUILDDIR_ABSOLUTE)/gens +EXTDIR = $(BUILDDIR_ABSOLUTE)/extensions # Configurations @@ -362,7 +363,7 @@ CPPFLAGS += -fPIC LDFLAGS += -fPIC endif -INCLUDES = . include $(GENDIR) +INCLUDES = . include $(GENDIR) $(EXTDIR) $(EXTDIR)/include LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) @@ -1033,6 +1034,7 @@ qps_test: $(BINDIR)/$(CONFIG)/qps_test qps_worker: $(BINDIR)/$(CONFIG)/qps_worker reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server +reflection_debug_test: $(BINDIR)/$(CONFIG)/reflection_debug_test secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test server_crash_test: $(BINDIR)/$(CONFIG)/server_crash_test @@ -1161,13 +1163,13 @@ static: static_c static_cxx static_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a static_zookeeper_libs -static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a +static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a shared: shared_c shared_cxx shared_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT) shared_zookeeper_libs -shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) +shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT) ifeq ($(HAS_ZOOKEEPER),true) @@ -1399,6 +1401,7 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ + $(BINDIR)/$(CONFIG)/reflection_debug_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/server_crash_test \ @@ -1728,6 +1731,8 @@ test_cxx: test_zookeeper buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 ) $(E) "[RUN] Testing qps_test" $(Q) $(BINDIR)/$(CONFIG)/qps_test || ( echo test qps_test failed ; exit 1 ) + $(E) "[RUN] Testing reflection_debug_test" + $(Q) $(BINDIR)/$(CONFIG)/reflection_debug_test || ( echo test reflection_debug_test failed ; exit 1 ) $(E) "[RUN] Testing secure_auth_context_test" $(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 ) $(E) "[RUN] Testing secure_sync_unary_ping_pong_test" @@ -1808,6 +1813,8 @@ strip-static_cxx: static_cxx ifeq ($(CONFIG),opt) $(E) "[STRIP] Stripping libgrpc++.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++.a + $(E) "[STRIP] Stripping libgrpc++_reflection.a" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(E) "[STRIP] Stripping libgrpc++_unsecure.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a endif @@ -1830,6 +1837,8 @@ strip-shared_cxx: shared_cxx ifeq ($(CONFIG),opt) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) + $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT)" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) endif @@ -2131,8 +2140,8 @@ install-headers_c: install-headers_cxx: $(E) "[INSTALL] Installing public C++ headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(patsubst extensions/%,%,$(dir $(h))) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(patsubst extensions/%,%,$(h)) && ) exit 0 || exit 1 install-static: install-static_c install-static_cxx @@ -2156,6 +2165,9 @@ install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx $(E) "[INSTALL] Installing libgrpc++.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(prefix)/lib/libgrpc++.a + $(E) "[INSTALL] Installing libgrpc++_reflection.a" + $(Q) $(INSTALL) -d $(prefix)/lib + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(prefix)/lib/libgrpc++_reflection.a $(E) "[INSTALL] Installing libgrpc++_unsecure.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(prefix)/lib/libgrpc++_unsecure.a @@ -2217,6 +2229,15 @@ ifeq ($(SYSTEM),MINGW32) else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++.so.0 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++.so +endif + $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT)" + $(Q) $(INSTALL) -d $(prefix)/lib + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) +ifeq ($(SYSTEM),MINGW32) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection-imp.a $(prefix)/lib/libgrpc++_reflection-imp.a +else ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++_reflection.so.0 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++_reflection.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib @@ -3343,6 +3364,80 @@ endif endif +LIBGRPC++_REFLECTION_SRC = \ + extensions/reflection/proto_server_reflection.cc \ + extensions/reflection/proto_server_reflection_plugin.cc \ + extensions/reflection/reflection.grpc.pb.cc \ + extensions/reflection/reflection.pb.cc \ + +PUBLIC_HEADERS_CXX += \ + extensions/include/grpc++/impl/proto_server_reflection_plugin.h \ + extensions/include/grpc++/impl/reflection.grpc.pb.h \ + extensions/include/grpc++/impl/reflection.pb.h \ + +LIBGRPC++_REFLECTION_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_REFLECTION_SRC)))) + + +ifeq ($(NO_SECURE),true) + +# You can't build secure libraries if you don't have OpenSSL. + +$(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a: openssl_dep_error + +$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): openssl_dep_error + +else + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a: protobuf_dep_error + +$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): protobuf_dep_error + +else + +$(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_REFLECTION_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a + $(Q) $(AR) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBGRPC++_REFLECTION_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a +endif + + + +ifeq ($(SYSTEM),MINGW32) +$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(OPENSSL_DEP) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++_reflection.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) +else +$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(OPENSSL_DEP) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` +ifeq ($(SYSTEM),Darwin) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) +else + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) + $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).so.0 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).so +endif +endif + +endif + +endif + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(LIBGRPC++_REFLECTION_OBJS:.o=.dep) +endif +endif + + LIBGRPC++_TEST_CONFIG_SRC = \ test/cpp/util/test_config.cc \ @@ -11393,6 +11488,52 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc +REFLECTION_DEBUG_TEST_SRC = \ + test/cpp/util/proto_reflection_descriptor_database.cc \ + test/cpp/util/reflection_debug/reflection_client.cc \ + +REFLECTION_DEBUG_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFLECTION_DEBUG_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/reflection_debug_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/reflection_debug_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/reflection_debug_test: $(PROTOBUF_DEP) $(REFLECTION_DEBUG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(REFLECTION_DEBUG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reflection_debug_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/util/proto_reflection_descriptor_database.o: $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + +$(OBJDIR)/$(CONFIG)/test/cpp/util/reflection_debug/reflection_client.o: $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_reflection_debug_test: $(REFLECTION_DEBUG_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(REFLECTION_DEBUG_TEST_OBJS:.o=.dep) +endif +endif + + SECURE_AUTH_CONTEXT_TEST_SRC = \ test/cpp/common/secure_auth_context_test.cc \ @@ -14311,6 +14452,10 @@ ifneq ($(OPENSSL_DEP),) # This is to ensure the embedded OpenSSL is built beforehand, properly # installing headers to their final destination on the drive. We need this # otherwise parallel compilation will fail if a source is compiled first. +extensions/reflection/proto_server_reflection.cc: $(OPENSSL_DEP) +extensions/reflection/proto_server_reflection_plugin.cc: $(OPENSSL_DEP) +extensions/reflection/reflection.grpc.pb.cc: $(OPENSSL_DEP) +extensions/reflection/reflection.pb.cc: $(OPENSSL_DEP) src/core/ext/transport/chttp2/client/secure/secure_channel_create.c: $(OPENSSL_DEP) src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c: $(OPENSSL_DEP) src/core/lib/http/httpcli_security_connector.c: $(OPENSSL_DEP) diff --git a/build.yaml b/build.yaml index 441752dc3dc..deae7444dc8 100644 --- a/build.yaml +++ b/build.yaml @@ -883,6 +883,20 @@ libs: - grpc++_codegen secure: check vs_project_guid: '{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}' +- name: grpc++_reflection + build: all + language: c++ + public_headers: + - extensions/include/grpc++/impl/proto_server_reflection_plugin.h + - extensions/include/grpc++/impl/reflection.grpc.pb.h + - extensions/include/grpc++/impl/reflection.pb.h + headers: + - extensions/reflection/proto_server_reflection.h + src: + - extensions/reflection/proto_server_reflection.cc + - extensions/reflection/proto_server_reflection_plugin.cc + - extensions/reflection/reflection.grpc.pb.cc + - extensions/reflection/reflection.pb.cc - name: grpc++_test_config build: private language: c++ @@ -2884,6 +2898,19 @@ targets: - gpr_test_util - gpr - grpc++_test_config +- name: reflection_debug_test + build: test + language: c++ + headers: + - test/cpp/util/proto_reflection_descriptor_database.h + src: + - test/cpp/util/proto_reflection_descriptor_database.cc + - test/cpp/util/reflection_debug/reflection_client.cc + deps: + - grpc++_reflection + - grpc++ + - grpc + - gpr - name: secure_auth_context_test gtest: true build: test diff --git a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h new file mode 100644 index 00000000000..adc6eb7bc3f --- /dev/null +++ b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h @@ -0,0 +1,74 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H +#define GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H + +#include + +#include +#include + +namespace grpc { +class ServerInitializer; +class ProtoServerReflection; +} // namespace grpc + +namespace grpc { +namespace reflection { + +class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { + public: + ProtoServerReflectionPlugin(); + ::grpc::string name() GRPC_OVERRIDE; + void InitServer(::grpc::ServerInitializer* si) GRPC_OVERRIDE; + void Finish(::grpc::ServerInitializer* si) GRPC_OVERRIDE; + void ChangeArguments(const ::grpc::string& name, void* value) GRPC_OVERRIDE; + bool has_async_methods() const GRPC_OVERRIDE; + bool has_sync_methods() const GRPC_OVERRIDE; + + private: + std::shared_ptr<::grpc::ProtoServerReflection> reflection_service; +}; + +std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { + return std::unique_ptr<::grpc::ServerBuilderPlugin>( + new ProtoServerReflectionPlugin()); +} + +void grpc_AddServerBuilderPlugin_reflection(); + +} // namespace reflection +} // namespace grpc + +#endif // GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H diff --git a/extensions/include/grpc++/impl/reflection.grpc.pb.h b/extensions/include/grpc++/impl/reflection.grpc.pb.h new file mode 100644 index 00000000000..f6009296366 --- /dev/null +++ b/extensions/include/grpc++/impl/reflection.grpc.pb.h @@ -0,0 +1,555 @@ +// Generated by the gRPC protobuf plugin. +// If you make any local change, they will be lost. +// source: reflection.proto +#ifndef GRPC_reflection_2eproto__INCLUDED +#define GRPC_reflection_2eproto__INCLUDED + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace grpc { +class CompletionQueue; +class Channel; +class RpcService; +class ServerCompletionQueue; +class ServerContext; +} // namespace grpc + +namespace grpc { +namespace reflection { +namespace v1alpha { + +class ServerReflection GRPC_FINAL { + public: + class StubInterface { + public: + virtual ~StubInterface() {} + virtual ::grpc::Status ListService( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::reflection::v1alpha::ListServiceResponse* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::ListServiceResponse>> + AsyncListService(::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::ListServiceResponse>>( + AsyncListServiceRaw(context, request, cq)); + } + virtual ::grpc::Status GetFileByName( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> + AsyncGetFileByName( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( + AsyncGetFileByNameRaw(context, request, cq)); + } + virtual ::grpc::Status GetFileContainingSymbol( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> + AsyncGetFileContainingSymbol( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( + AsyncGetFileContainingSymbolRaw(context, request, cq)); + } + virtual ::grpc::Status GetFileContainingExtension( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> + AsyncGetFileContainingExtension( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( + AsyncGetFileContainingExtensionRaw(context, request, cq)); + } + virtual ::grpc::Status GetAllExtensionNumbers( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) = 0; + std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>> + AsyncGetAllExtensionNumbers( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>>( + AsyncGetAllExtensionNumbersRaw(context, request, cq)); + } + + private: + virtual ::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::ListServiceResponse>* + AsyncListServiceRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* + AsyncGetFileByNameRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* + AsyncGetFileContainingSymbolRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* + AsyncGetFileContainingExtensionRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::CompletionQueue* cq) = 0; + virtual ::grpc::ClientAsyncResponseReaderInterface< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>* + AsyncGetAllExtensionNumbersRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::CompletionQueue* cq) = 0; + }; + class Stub GRPC_FINAL : public StubInterface { + public: + Stub(const std::shared_ptr<::grpc::ChannelInterface>& channel); + ::grpc::Status ListService( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::reflection::v1alpha::ListServiceResponse* response) + GRPC_OVERRIDE; + std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ListServiceResponse>> + AsyncListService(::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ListServiceResponse>>( + AsyncListServiceRaw(context, request, cq)); + } + ::grpc::Status GetFileByName( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_OVERRIDE; + std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> + AsyncGetFileByName( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( + AsyncGetFileByNameRaw(context, request, cq)); + } + ::grpc::Status GetFileContainingSymbol( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_OVERRIDE; + std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> + AsyncGetFileContainingSymbol( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( + AsyncGetFileContainingSymbolRaw(context, request, cq)); + } + ::grpc::Status GetFileContainingExtension( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_OVERRIDE; + std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> + AsyncGetFileContainingExtension( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( + AsyncGetFileContainingExtensionRaw(context, request, cq)); + } + ::grpc::Status GetAllExtensionNumbers( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) + GRPC_OVERRIDE; + std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>> + AsyncGetAllExtensionNumbers( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::CompletionQueue* cq) { + return std::unique_ptr<::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>>( + AsyncGetAllExtensionNumbersRaw(context, request, cq)); + } + + private: + std::shared_ptr<::grpc::ChannelInterface> channel_; + ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ListServiceResponse>* + AsyncListServiceRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; + ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* + AsyncGetFileByNameRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; + ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* + AsyncGetFileContainingSymbolRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; + ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* + AsyncGetFileContainingExtensionRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; + ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>* + AsyncGetAllExtensionNumbersRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; + const ::grpc::RpcMethod rpcmethod_ListService_; + const ::grpc::RpcMethod rpcmethod_GetFileByName_; + const ::grpc::RpcMethod rpcmethod_GetFileContainingSymbol_; + const ::grpc::RpcMethod rpcmethod_GetFileContainingExtension_; + const ::grpc::RpcMethod rpcmethod_GetAllExtensionNumbers_; + }; + static std::unique_ptr NewStub( + const std::shared_ptr<::grpc::ChannelInterface>& channel, + const ::grpc::StubOptions& options = ::grpc::StubOptions()); + + class Service : public ::grpc::Service { + public: + Service(); + virtual ~Service(); + virtual ::grpc::Status ListService( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest* request, + ::grpc::reflection::v1alpha::ListServiceResponse* response); + virtual ::grpc::Status GetFileByName( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response); + virtual ::grpc::Status GetFileContainingSymbol( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response); + virtual ::grpc::Status GetFileContainingExtension( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response); + virtual ::grpc::Status GetAllExtensionNumbers( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::TypeRequest* request, + ::grpc::reflection::v1alpha::ExtensionNumberResponse* response); + }; + template + class WithAsyncMethod_ListService : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithAsyncMethod_ListService() { ::grpc::Service::MarkMethodAsync(0); } + ~WithAsyncMethod_ListService() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ListService( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest* request, + ::grpc::reflection::v1alpha::ListServiceResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestListService( + ::grpc::ServerContext* context, + ::grpc::reflection::v1alpha::EmptyRequest* request, + ::grpc::ServerAsyncResponseWriter< + ::grpc::reflection::v1alpha::ListServiceResponse>* response, + ::grpc::CompletionQueue* new_call_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::Service::RequestAsyncUnary(0, context, request, response, + new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_GetFileByName : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithAsyncMethod_GetFileByName() { ::grpc::Service::MarkMethodAsync(1); } + ~WithAsyncMethod_GetFileByName() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetFileByName( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetFileByName( + ::grpc::ServerContext* context, + ::grpc::reflection::v1alpha::FileNameRequest* request, + ::grpc::ServerAsyncResponseWriter< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* response, + ::grpc::CompletionQueue* new_call_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::Service::RequestAsyncUnary(1, context, request, response, + new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_GetFileContainingSymbol : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithAsyncMethod_GetFileContainingSymbol() { + ::grpc::Service::MarkMethodAsync(2); + } + ~WithAsyncMethod_GetFileContainingSymbol() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetFileContainingSymbol( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetFileContainingSymbol( + ::grpc::ServerContext* context, + ::grpc::reflection::v1alpha::SymbolRequest* request, + ::grpc::ServerAsyncResponseWriter< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* response, + ::grpc::CompletionQueue* new_call_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::Service::RequestAsyncUnary(2, context, request, response, + new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_GetFileContainingExtension : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithAsyncMethod_GetFileContainingExtension() { + ::grpc::Service::MarkMethodAsync(3); + } + ~WithAsyncMethod_GetFileContainingExtension() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetFileContainingExtension( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetFileContainingExtension( + ::grpc::ServerContext* context, + ::grpc::reflection::v1alpha::ExtensionRequest* request, + ::grpc::ServerAsyncResponseWriter< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* response, + ::grpc::CompletionQueue* new_call_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::Service::RequestAsyncUnary(3, context, request, response, + new_call_cq, notification_cq, tag); + } + }; + template + class WithAsyncMethod_GetAllExtensionNumbers : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithAsyncMethod_GetAllExtensionNumbers() { + ::grpc::Service::MarkMethodAsync(4); + } + ~WithAsyncMethod_GetAllExtensionNumbers() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetAllExtensionNumbers( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::TypeRequest* request, + ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + void RequestGetAllExtensionNumbers( + ::grpc::ServerContext* context, + ::grpc::reflection::v1alpha::TypeRequest* request, + ::grpc::ServerAsyncResponseWriter< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>* response, + ::grpc::CompletionQueue* new_call_cq, + ::grpc::ServerCompletionQueue* notification_cq, void* tag) { + ::grpc::Service::RequestAsyncUnary(4, context, request, response, + new_call_cq, notification_cq, tag); + } + }; + typedef WithAsyncMethod_ListService< + WithAsyncMethod_GetFileByName>>>> + AsyncService; + template + class WithGenericMethod_ListService : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithGenericMethod_ListService() { ::grpc::Service::MarkMethodGeneric(0); } + ~WithGenericMethod_ListService() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status ListService( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest* request, + ::grpc::reflection::v1alpha::ListServiceResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_GetFileByName : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithGenericMethod_GetFileByName() { ::grpc::Service::MarkMethodGeneric(1); } + ~WithGenericMethod_GetFileByName() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetFileByName( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_GetFileContainingSymbol : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithGenericMethod_GetFileContainingSymbol() { + ::grpc::Service::MarkMethodGeneric(2); + } + ~WithGenericMethod_GetFileContainingSymbol() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetFileContainingSymbol( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_GetFileContainingExtension : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithGenericMethod_GetFileContainingExtension() { + ::grpc::Service::MarkMethodGeneric(3); + } + ~WithGenericMethod_GetFileContainingExtension() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetFileContainingExtension( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; + template + class WithGenericMethod_GetAllExtensionNumbers : public BaseClass { + private: + void BaseClassMustBeDerivedFromService(Service* service) {} + + public: + WithGenericMethod_GetAllExtensionNumbers() { + ::grpc::Service::MarkMethodGeneric(4); + } + ~WithGenericMethod_GetAllExtensionNumbers() GRPC_OVERRIDE { + BaseClassMustBeDerivedFromService(this); + } + // disable synchronous version of this method + ::grpc::Status GetAllExtensionNumbers( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::TypeRequest* request, + ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) + GRPC_FINAL GRPC_OVERRIDE { + abort(); + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + } + }; +}; + +} // namespace v1alpha +} // namespace reflection +} // namespace grpc + +#endif // GRPC_reflection_2eproto__INCLUDED diff --git a/extensions/include/grpc++/impl/reflection.pb.h b/extensions/include/grpc++/impl/reflection.pb.h new file mode 100644 index 00000000000..b054e28de97 --- /dev/null +++ b/extensions/include/grpc++/impl/reflection.pb.h @@ -0,0 +1,1128 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: reflection.proto + +#ifndef PROTOBUF_reflection_2eproto__INCLUDED +#define PROTOBUF_reflection_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace grpc { +namespace reflection { +namespace v1alpha { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_reflection_2eproto(); +void protobuf_AssignDesc_reflection_2eproto(); +void protobuf_ShutdownFile_reflection_2eproto(); + +class EmptyRequest; +class ExtensionNumberResponse; +class ExtensionRequest; +class FileDescriptorProtoResponse; +class FileNameRequest; +class ListServiceResponse; +class SymbolRequest; +class TypeRequest; + +// =================================================================== + +class EmptyRequest : public ::google::protobuf::Message { + public: + EmptyRequest(); + virtual ~EmptyRequest(); + + EmptyRequest(const EmptyRequest& from); + + inline EmptyRequest& operator=(const EmptyRequest& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const EmptyRequest& default_instance(); + + void Swap(EmptyRequest* other); + + // implements Message ---------------------------------------------- + + inline EmptyRequest* New() const { return New(NULL); } + + EmptyRequest* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const EmptyRequest& from); + void MergeFrom(const EmptyRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(EmptyRequest* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.EmptyRequest) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static EmptyRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class FileNameRequest : public ::google::protobuf::Message { + public: + FileNameRequest(); + virtual ~FileNameRequest(); + + FileNameRequest(const FileNameRequest& from); + + inline FileNameRequest& operator=(const FileNameRequest& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FileNameRequest& default_instance(); + + void Swap(FileNameRequest* other); + + // implements Message ---------------------------------------------- + + inline FileNameRequest* New() const { return New(NULL); } + + FileNameRequest* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FileNameRequest& from); + void MergeFrom(const FileNameRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FileNameRequest* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string filename = 1; + void clear_filename(); + static const int kFilenameFieldNumber = 1; + const ::std::string& filename() const; + void set_filename(const ::std::string& value); + void set_filename(const char* value); + void set_filename(const char* value, size_t size); + ::std::string* mutable_filename(); + ::std::string* release_filename(); + void set_allocated_filename(::std::string* filename); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.FileNameRequest) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr filename_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static FileNameRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class SymbolRequest : public ::google::protobuf::Message { + public: + SymbolRequest(); + virtual ~SymbolRequest(); + + SymbolRequest(const SymbolRequest& from); + + inline SymbolRequest& operator=(const SymbolRequest& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SymbolRequest& default_instance(); + + void Swap(SymbolRequest* other); + + // implements Message ---------------------------------------------- + + inline SymbolRequest* New() const { return New(NULL); } + + SymbolRequest* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SymbolRequest& from); + void MergeFrom(const SymbolRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SymbolRequest* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string symbol = 1; + void clear_symbol(); + static const int kSymbolFieldNumber = 1; + const ::std::string& symbol() const; + void set_symbol(const ::std::string& value); + void set_symbol(const char* value); + void set_symbol(const char* value, size_t size); + ::std::string* mutable_symbol(); + ::std::string* release_symbol(); + void set_allocated_symbol(::std::string* symbol); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.SymbolRequest) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr symbol_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static SymbolRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ExtensionRequest : public ::google::protobuf::Message { + public: + ExtensionRequest(); + virtual ~ExtensionRequest(); + + ExtensionRequest(const ExtensionRequest& from); + + inline ExtensionRequest& operator=(const ExtensionRequest& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ExtensionRequest& default_instance(); + + void Swap(ExtensionRequest* other); + + // implements Message ---------------------------------------------- + + inline ExtensionRequest* New() const { return New(NULL); } + + ExtensionRequest* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ExtensionRequest& from); + void MergeFrom(const ExtensionRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ExtensionRequest* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string containing_type = 1; + void clear_containing_type(); + static const int kContainingTypeFieldNumber = 1; + const ::std::string& containing_type() const; + void set_containing_type(const ::std::string& value); + void set_containing_type(const char* value); + void set_containing_type(const char* value, size_t size); + ::std::string* mutable_containing_type(); + ::std::string* release_containing_type(); + void set_allocated_containing_type(::std::string* containing_type); + + // optional int32 extension_number = 2; + void clear_extension_number(); + static const int kExtensionNumberFieldNumber = 2; + ::google::protobuf::int32 extension_number() const; + void set_extension_number(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ExtensionRequest) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr containing_type_; + ::google::protobuf::int32 extension_number_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ExtensionRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class TypeRequest : public ::google::protobuf::Message { + public: + TypeRequest(); + virtual ~TypeRequest(); + + TypeRequest(const TypeRequest& from); + + inline TypeRequest& operator=(const TypeRequest& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const TypeRequest& default_instance(); + + void Swap(TypeRequest* other); + + // implements Message ---------------------------------------------- + + inline TypeRequest* New() const { return New(NULL); } + + TypeRequest* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const TypeRequest& from); + void MergeFrom(const TypeRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(TypeRequest* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string type = 1; + void clear_type(); + static const int kTypeFieldNumber = 1; + const ::std::string& type() const; + void set_type(const ::std::string& value); + void set_type(const char* value); + void set_type(const char* value, size_t size); + ::std::string* mutable_type(); + ::std::string* release_type(); + void set_allocated_type(::std::string* type); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.TypeRequest) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr type_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static TypeRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ListServiceResponse : public ::google::protobuf::Message { + public: + ListServiceResponse(); + virtual ~ListServiceResponse(); + + ListServiceResponse(const ListServiceResponse& from); + + inline ListServiceResponse& operator=(const ListServiceResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ListServiceResponse& default_instance(); + + void Swap(ListServiceResponse* other); + + // implements Message ---------------------------------------------- + + inline ListServiceResponse* New() const { return New(NULL); } + + ListServiceResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ListServiceResponse& from); + void MergeFrom(const ListServiceResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ListServiceResponse* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated string services = 1; + int services_size() const; + void clear_services(); + static const int kServicesFieldNumber = 1; + const ::std::string& services(int index) const; + ::std::string* mutable_services(int index); + void set_services(int index, const ::std::string& value); + void set_services(int index, const char* value); + void set_services(int index, const char* value, size_t size); + ::std::string* add_services(); + void add_services(const ::std::string& value); + void add_services(const char* value); + void add_services(const char* value, size_t size); + const ::google::protobuf::RepeatedPtrField< ::std::string>& services() const; + ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_services(); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ListServiceResponse) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::RepeatedPtrField< ::std::string> services_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ListServiceResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class FileDescriptorProtoResponse : public ::google::protobuf::Message { + public: + FileDescriptorProtoResponse(); + virtual ~FileDescriptorProtoResponse(); + + FileDescriptorProtoResponse(const FileDescriptorProtoResponse& from); + + inline FileDescriptorProtoResponse& operator=( + const FileDescriptorProtoResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FileDescriptorProtoResponse& default_instance(); + + void Swap(FileDescriptorProtoResponse* other); + + // implements Message ---------------------------------------------- + + inline FileDescriptorProtoResponse* New() const { return New(NULL); } + + FileDescriptorProtoResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FileDescriptorProtoResponse& from); + void MergeFrom(const FileDescriptorProtoResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FileDescriptorProtoResponse* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bytes file_descriptor_proto = 1; + void clear_file_descriptor_proto(); + static const int kFileDescriptorProtoFieldNumber = 1; + const ::std::string& file_descriptor_proto() const; + void set_file_descriptor_proto(const ::std::string& value); + void set_file_descriptor_proto(const char* value); + void set_file_descriptor_proto(const void* value, size_t size); + ::std::string* mutable_file_descriptor_proto(); + ::std::string* release_file_descriptor_proto(); + void set_allocated_file_descriptor_proto( + ::std::string* file_descriptor_proto); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr file_descriptor_proto_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static FileDescriptorProtoResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ExtensionNumberResponse : public ::google::protobuf::Message { + public: + ExtensionNumberResponse(); + virtual ~ExtensionNumberResponse(); + + ExtensionNumberResponse(const ExtensionNumberResponse& from); + + inline ExtensionNumberResponse& operator=( + const ExtensionNumberResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ExtensionNumberResponse& default_instance(); + + void Swap(ExtensionNumberResponse* other); + + // implements Message ---------------------------------------------- + + inline ExtensionNumberResponse* New() const { return New(NULL); } + + ExtensionNumberResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ExtensionNumberResponse& from); + void MergeFrom(const ExtensionNumberResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ExtensionNumberResponse* other); + + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated int32 extension_number = 1; + int extension_number_size() const; + void clear_extension_number(); + static const int kExtensionNumberFieldNumber = 1; + ::google::protobuf::int32 extension_number(int index) const; + void set_extension_number(int index, ::google::protobuf::int32 value); + void add_extension_number(::google::protobuf::int32 value); + const ::google::protobuf::RepeatedField< ::google::protobuf::int32>& + extension_number() const; + ::google::protobuf::RepeatedField< ::google::protobuf::int32>* + mutable_extension_number(); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ExtensionNumberResponse) + private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32> + extension_number_; + mutable int _extension_number_cached_byte_size_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ExtensionNumberResponse* default_instance_; +}; +// =================================================================== + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// EmptyRequest + +// ------------------------------------------------------------------- + +// FileNameRequest + +// optional string filename = 1; +inline void FileNameRequest::clear_filename() { + filename_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& FileNameRequest::filename() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileNameRequest.filename) + return filename_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileNameRequest::set_filename(const ::std::string& value) { + filename_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileNameRequest.filename) +} +inline void FileNameRequest::set_filename(const char* value) { + filename_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileNameRequest.filename) +} +inline void FileNameRequest::set_filename(const char* value, size_t size) { + filename_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileNameRequest.filename) +} +inline ::std::string* FileNameRequest::mutable_filename() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileNameRequest.filename) + return filename_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* FileNameRequest::release_filename() { + return filename_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileNameRequest::set_allocated_filename(::std::string* filename) { + if (filename != NULL) { + } else { + } + filename_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), filename); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileNameRequest.filename) +} + +// ------------------------------------------------------------------- + +// SymbolRequest + +// optional string symbol = 1; +inline void SymbolRequest::clear_symbol() { + symbol_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& SymbolRequest::symbol() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.SymbolRequest.symbol) + return symbol_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void SymbolRequest::set_symbol(const ::std::string& value) { + symbol_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.SymbolRequest.symbol) +} +inline void SymbolRequest::set_symbol(const char* value) { + symbol_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.SymbolRequest.symbol) +} +inline void SymbolRequest::set_symbol(const char* value, size_t size) { + symbol_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.SymbolRequest.symbol) +} +inline ::std::string* SymbolRequest::mutable_symbol() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.SymbolRequest.symbol) + return symbol_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* SymbolRequest::release_symbol() { + return symbol_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void SymbolRequest::set_allocated_symbol(::std::string* symbol) { + if (symbol != NULL) { + } else { + } + symbol_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), symbol); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.SymbolRequest.symbol) +} + +// ------------------------------------------------------------------- + +// ExtensionRequest + +// optional string containing_type = 1; +inline void ExtensionRequest::clear_containing_type() { + containing_type_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ExtensionRequest::containing_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.containing_type) + return containing_type_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionRequest::set_containing_type(const ::std::string& value) { + containing_type_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +inline void ExtensionRequest::set_containing_type(const char* value) { + containing_type_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +inline void ExtensionRequest::set_containing_type(const char* value, + size_t size) { + containing_type_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +inline ::std::string* ExtensionRequest::mutable_containing_type() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionRequest.containing_type) + return containing_type_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ExtensionRequest::release_containing_type() { + return containing_type_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionRequest::set_allocated_containing_type( + ::std::string* containing_type) { + if (containing_type != NULL) { + } else { + } + containing_type_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + containing_type); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} + +// optional int32 extension_number = 2; +inline void ExtensionRequest::clear_extension_number() { + extension_number_ = 0; +} +inline ::google::protobuf::int32 ExtensionRequest::extension_number() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.extension_number) + return extension_number_; +} +inline void ExtensionRequest::set_extension_number( + ::google::protobuf::int32 value) { + extension_number_ = value; + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.extension_number) +} + +// ------------------------------------------------------------------- + +// TypeRequest + +// optional string type = 1; +inline void TypeRequest::clear_type() { + type_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& TypeRequest::type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.TypeRequest.type) + return type_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void TypeRequest::set_type(const ::std::string& value) { + type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.TypeRequest.type) +} +inline void TypeRequest::set_type(const char* value) { + type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.TypeRequest.type) +} +inline void TypeRequest::set_type(const char* value, size_t size) { + type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.TypeRequest.type) +} +inline ::std::string* TypeRequest::mutable_type() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.TypeRequest.type) + return type_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* TypeRequest::release_type() { + return type_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void TypeRequest::set_allocated_type(::std::string* type) { + if (type != NULL) { + } else { + } + type_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.TypeRequest.type) +} + +// ------------------------------------------------------------------- + +// ListServiceResponse + +// repeated string services = 1; +inline int ListServiceResponse::services_size() const { + return services_.size(); +} +inline void ListServiceResponse::clear_services() { services_.Clear(); } +inline const ::std::string& ListServiceResponse::services(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.services) + return services_.Get(index); +} +inline ::std::string* ListServiceResponse::mutable_services(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.services) + return services_.Mutable(index); +} +inline void ListServiceResponse::set_services(int index, + const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.services) + services_.Mutable(index)->assign(value); +} +inline void ListServiceResponse::set_services(int index, const char* value) { + services_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.services) +} +inline void ListServiceResponse::set_services(int index, const char* value, + size_t size) { + services_.Mutable(index)->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) +} +inline ::std::string* ListServiceResponse::add_services() { + return services_.Add(); +} +inline void ListServiceResponse::add_services(const ::std::string& value) { + services_.Add()->assign(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.services) +} +inline void ListServiceResponse::add_services(const char* value) { + services_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.services) +} +inline void ListServiceResponse::add_services(const char* value, size_t size) { + services_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +ListServiceResponse::services() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.services) + return services_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +ListServiceResponse::mutable_services() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.services) + return &services_; +} + +// ------------------------------------------------------------------- + +// FileDescriptorProtoResponse + +// optional bytes file_descriptor_proto = 1; +inline void FileDescriptorProtoResponse::clear_file_descriptor_proto() { + file_descriptor_proto_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& FileDescriptorProtoResponse::file_descriptor_proto() + const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) + return file_descriptor_proto_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileDescriptorProtoResponse::set_file_descriptor_proto( + const ::std::string& value) { + file_descriptor_proto_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} +inline void FileDescriptorProtoResponse::set_file_descriptor_proto( + const char* value) { + file_descriptor_proto_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} +inline void FileDescriptorProtoResponse::set_file_descriptor_proto( + const void* value, size_t size) { + file_descriptor_proto_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} +inline ::std::string* +FileDescriptorProtoResponse::mutable_file_descriptor_proto() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) + return file_descriptor_proto_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* +FileDescriptorProtoResponse::release_file_descriptor_proto() { + return file_descriptor_proto_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileDescriptorProtoResponse::set_allocated_file_descriptor_proto( + ::std::string* file_descriptor_proto) { + if (file_descriptor_proto != NULL) { + } else { + } + file_descriptor_proto_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_descriptor_proto); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} + +// ------------------------------------------------------------------- + +// ExtensionNumberResponse + +// repeated int32 extension_number = 1; +inline int ExtensionNumberResponse::extension_number_size() const { + return extension_number_.size(); +} +inline void ExtensionNumberResponse::clear_extension_number() { + extension_number_.Clear(); +} +inline ::google::protobuf::int32 ExtensionNumberResponse::extension_number( + int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_.Get(index); +} +inline void ExtensionNumberResponse::set_extension_number( + int index, ::google::protobuf::int32 value) { + extension_number_.Set(index, value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) +} +inline void ExtensionNumberResponse::add_extension_number( + ::google::protobuf::int32 value) { + extension_number_.Add(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32>& +ExtensionNumberResponse::extension_number() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32>* +ExtensionNumberResponse::mutable_extension_number() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return &extension_number_; +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// @@protoc_insertion_point(namespace_scope) + +} // namespace v1alpha +} // namespace reflection +} // namespace grpc + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_reflection_2eproto__INCLUDED diff --git a/extensions/reflection/proto_server_reflection.cc b/extensions/reflection/proto_server_reflection.cc new file mode 100644 index 00000000000..0662bb595a1 --- /dev/null +++ b/extensions/reflection/proto_server_reflection.cc @@ -0,0 +1,172 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include "reflection/proto_server_reflection.h" + +using grpc::Status; +using grpc::StatusCode; +using google::protobuf::MethodDescriptor; +using google::protobuf::ServiceDescriptor; +using google::protobuf::Descriptor; +using google::protobuf::FileDescriptor; +using google::protobuf::FieldDescriptor; +using google::protobuf::DescriptorPool; +using google::protobuf::FileDescriptorProto; +using grpc::reflection::v1alpha::EmptyRequest; +using grpc::reflection::v1alpha::ListServiceResponse; +using grpc::reflection::v1alpha::FileNameRequest; +using grpc::reflection::v1alpha::SymbolRequest; +using grpc::reflection::v1alpha::ExtensionRequest; +using grpc::reflection::v1alpha::TypeRequest; +using grpc::reflection::v1alpha::FileDescriptorProtoResponse; +using grpc::reflection::v1alpha::ExtensionNumberResponse; + +namespace grpc { + +ProtoServerReflection::ProtoServerReflection() + : descriptor_pool_(DescriptorPool::generated_pool()) {} + +void ProtoServerReflection::SetServiceList( + const std::vector* services) { + services_ = services; +} + +Status ProtoServerReflection::ListService(ServerContext* context, + const EmptyRequest* request, + ListServiceResponse* response) { + if (services_ == nullptr) { + return Status(StatusCode::NOT_FOUND, "Services not found."); + } + for (auto it = services_->begin(); it != services_->end(); ++it) { + response->add_services(*it); + } + return Status::OK; +} + +Status ProtoServerReflection::GetFileByName( + ServerContext* context, const FileNameRequest* request, + FileDescriptorProtoResponse* response) { + if (descriptor_pool_ == nullptr) { + return Status::CANCELLED; + } + + const FileDescriptor* file_desc = + descriptor_pool_->FindFileByName(request->filename()); + if (file_desc == nullptr) { + return Status(StatusCode::NOT_FOUND, "File not found."); + } + FillFileDescriptorProtoResponse(file_desc, response); + // file_desc->CopyTo(response->mutable_file_descriptor_proto()); + return Status::OK; +} + +Status ProtoServerReflection::GetFileContainingSymbol( + ServerContext* context, const SymbolRequest* request, + FileDescriptorProtoResponse* response) { + if (descriptor_pool_ == nullptr) { + return Status::CANCELLED; + } + + const FileDescriptor* file_desc = + descriptor_pool_->FindFileContainingSymbol(request->symbol()); + if (file_desc == nullptr) { + return Status(StatusCode::NOT_FOUND, "Symbol not found."); + } + FillFileDescriptorProtoResponse(file_desc, response); + // file_desc->CopyTo(response->mutable_file_descriptor_proto()); + return Status::OK; +} + +Status ProtoServerReflection::GetFileContainingExtension( + ServerContext* context, const ExtensionRequest* request, + FileDescriptorProtoResponse* response) { + if (descriptor_pool_ == nullptr) { + return Status::CANCELLED; + } + + const Descriptor* desc = + descriptor_pool_->FindMessageTypeByName(request->containing_type()); + if (desc == nullptr) { + return Status(StatusCode::NOT_FOUND, "Type not found."); + } + + const FieldDescriptor* field_desc = descriptor_pool_->FindExtensionByNumber( + desc, request->extension_number()); + if (field_desc == nullptr) { + return Status(StatusCode::NOT_FOUND, "Extension not found."); + } + FillFileDescriptorProtoResponse(field_desc->file(), response); + // field_desc->file()->CopyTo(response->mutable_file_descriptor_proto()); + return Status::OK; +} + +Status ProtoServerReflection::GetAllExtensionNumbers( + ServerContext* context, const TypeRequest* request, + ExtensionNumberResponse* response) { + if (descriptor_pool_ == nullptr) { + return Status::CANCELLED; + } + + const Descriptor* desc = + descriptor_pool_->FindMessageTypeByName(request->type()); + if (desc == nullptr) { + return Status(StatusCode::NOT_FOUND, "Type not found."); + } + + std::vector extensions; + descriptor_pool_->FindAllExtensions(desc, &extensions); + for (auto extension : extensions) { + response->add_extension_number(extension->number()); + } + return Status::OK; +} + +void ProtoServerReflection::FillFileDescriptorProtoResponse( + const FileDescriptor* file_desc, FileDescriptorProtoResponse* response) { + FileDescriptorProto file_desc_proto; + grpc::string data; + file_desc->CopyTo(&file_desc_proto); + file_desc_proto.SerializeToString(&data); + response->set_file_descriptor_proto(data); +} + +} // namespace grpc diff --git a/extensions/reflection/proto_server_reflection.h b/extensions/reflection/proto_server_reflection.h new file mode 100644 index 00000000000..5fe23191ff8 --- /dev/null +++ b/extensions/reflection/proto_server_reflection.h @@ -0,0 +1,92 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H +#define GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H + +#include +#include +#include +#include + +#include +#include +#include + +#include + +namespace grpc { + +class ProtoServerReflection GRPC_FINAL + : public reflection::v1alpha::ServerReflection::Service { + public: + ProtoServerReflection(); + + ProtoServerReflection(const Server* server); + + void SetServiceList(const std::vector* services); + + Status ListService( + ServerContext* context, const reflection::v1alpha::EmptyRequest* request, + reflection::v1alpha::ListServiceResponse* response) GRPC_OVERRIDE; + + Status GetFileByName( + ServerContext* context, + const reflection::v1alpha::FileNameRequest* request, + reflection::v1alpha::FileDescriptorProtoResponse* response) GRPC_OVERRIDE; + + Status GetFileContainingSymbol( + ServerContext* context, const reflection::v1alpha::SymbolRequest* request, + reflection::v1alpha::FileDescriptorProtoResponse* response) GRPC_OVERRIDE; + + Status GetFileContainingExtension( + ServerContext* context, + const reflection::v1alpha::ExtensionRequest* request, + reflection::v1alpha::FileDescriptorProtoResponse* response) GRPC_OVERRIDE; + + Status GetAllExtensionNumbers( + ServerContext* context, const reflection::v1alpha::TypeRequest* request, + reflection::v1alpha::ExtensionNumberResponse* response) GRPC_OVERRIDE; + + private: + void FillFileDescriptorProtoResponse( + const google::protobuf::FileDescriptor* file_desc, + reflection::v1alpha::FileDescriptorProtoResponse* response); + + const google::protobuf::DescriptorPool* descriptor_pool_; + const std::vector* services_; +}; + +} // namespace grpc + +#endif // GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H diff --git a/extensions/reflection/proto_server_reflection_plugin.cc b/extensions/reflection/proto_server_reflection_plugin.cc new file mode 100644 index 00000000000..6adfa450473 --- /dev/null +++ b/extensions/reflection/proto_server_reflection_plugin.cc @@ -0,0 +1,89 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include + +#include "reflection/proto_server_reflection.h" + +namespace grpc { +namespace reflection { + +ProtoServerReflectionPlugin::ProtoServerReflectionPlugin() + : reflection_service(new grpc::ProtoServerReflection()) {} + +grpc::string ProtoServerReflectionPlugin::name() { return "p1"; } + +void ProtoServerReflectionPlugin::InitServer(grpc::ServerInitializer* si) { + si->RegisterService(reflection_service); +} + +void ProtoServerReflectionPlugin::Finish(grpc::ServerInitializer* si) { + reflection_service->SetServiceList(si->GetServiceList()); +} + +void ProtoServerReflectionPlugin::ChangeArguments(const grpc::string& name, + void* value) {} + +bool ProtoServerReflectionPlugin::has_sync_methods() const { + if (reflection_service != nullptr) { + return reflection_service->has_synchronous_methods(); + } + return false; +} + +bool ProtoServerReflectionPlugin::has_async_methods() const { + if (reflection_service != nullptr) { + return reflection_service->has_async_methods(); + } + return false; +} + +void grpc_AddServerBuilderPlugin_reflection() { + static bool already_here = false; + if (already_here) return; + already_here = true; + ::grpc::ServerBuilder::InternalAddPluginFactory(&CreateProtoReflection); +} + +// Force AddServerBuilderPlugin() to be called at static initialization time. +struct StaticPluginInitializer_reflection { + StaticPluginInitializer_reflection() { + grpc_AddServerBuilderPlugin_reflection(); + } +} static_plugin_initializer_reflection_; + +} // namespace reflection +} // namespace grpc diff --git a/extensions/reflection/reflection.grpc.pb.cc b/extensions/reflection/reflection.grpc.pb.cc new file mode 100644 index 00000000000..c098e52752f --- /dev/null +++ b/extensions/reflection/reflection.grpc.pb.cc @@ -0,0 +1,245 @@ +// Generated by the gRPC protobuf plugin. +// If you make any local change, they will be lost. +// source: reflection.proto + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +namespace grpc { +namespace reflection { +namespace v1alpha { + +static const char* ServerReflection_method_names[] = { + "/grpc.reflection.v1alpha.ServerReflection/ListService", + "/grpc.reflection.v1alpha.ServerReflection/GetFileByName", + "/grpc.reflection.v1alpha.ServerReflection/GetFileContainingSymbol", + "/grpc.reflection.v1alpha.ServerReflection/GetFileContainingExtension", + "/grpc.reflection.v1alpha.ServerReflection/GetAllExtensionNumbers", +}; + +std::unique_ptr ServerReflection::NewStub( + const std::shared_ptr< ::grpc::ChannelInterface>& channel, + const ::grpc::StubOptions& options) { + std::unique_ptr stub( + new ServerReflection::Stub(channel)); + return stub; +} + +ServerReflection::Stub::Stub( + const std::shared_ptr< ::grpc::ChannelInterface>& channel) + : channel_(channel), + rpcmethod_ListService_(ServerReflection_method_names[0], + ::grpc::RpcMethod::NORMAL_RPC, channel), + rpcmethod_GetFileByName_(ServerReflection_method_names[1], + ::grpc::RpcMethod::NORMAL_RPC, channel), + rpcmethod_GetFileContainingSymbol_(ServerReflection_method_names[2], + ::grpc::RpcMethod::NORMAL_RPC, + channel), + rpcmethod_GetFileContainingExtension_(ServerReflection_method_names[3], + ::grpc::RpcMethod::NORMAL_RPC, + channel), + rpcmethod_GetAllExtensionNumbers_(ServerReflection_method_names[4], + ::grpc::RpcMethod::NORMAL_RPC, + channel) {} + +::grpc::Status ServerReflection::Stub::ListService( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::reflection::v1alpha::ListServiceResponse* response) { + return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_ListService_, + context, request, response); +} + +::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ListServiceResponse>* +ServerReflection::Stub::AsyncListServiceRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest& request, + ::grpc::CompletionQueue* cq) { + return new ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ListServiceResponse>( + channel_.get(), cq, rpcmethod_ListService_, context, request); +} + +::grpc::Status ServerReflection::Stub::GetFileByName( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { + return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_GetFileByName_, + context, request, response); +} + +::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* +ServerReflection::Stub::AsyncGetFileByNameRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest& request, + ::grpc::CompletionQueue* cq) { + return new ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( + channel_.get(), cq, rpcmethod_GetFileByName_, context, request); +} + +::grpc::Status ServerReflection::Stub::GetFileContainingSymbol( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { + return ::grpc::BlockingUnaryCall(channel_.get(), + rpcmethod_GetFileContainingSymbol_, context, + request, response); +} + +::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* +ServerReflection::Stub::AsyncGetFileContainingSymbolRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest& request, + ::grpc::CompletionQueue* cq) { + return new ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( + channel_.get(), cq, rpcmethod_GetFileContainingSymbol_, context, request); +} + +::grpc::Status ServerReflection::Stub::GetFileContainingExtension( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { + return ::grpc::BlockingUnaryCall(channel_.get(), + rpcmethod_GetFileContainingExtension_, + context, request, response); +} + +::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* +ServerReflection::Stub::AsyncGetFileContainingExtensionRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest& request, + ::grpc::CompletionQueue* cq) { + return new ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( + channel_.get(), cq, rpcmethod_GetFileContainingExtension_, context, + request); +} + +::grpc::Status ServerReflection::Stub::GetAllExtensionNumbers( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) { + return ::grpc::BlockingUnaryCall(channel_.get(), + rpcmethod_GetAllExtensionNumbers_, context, + request, response); +} + +::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>* +ServerReflection::Stub::AsyncGetAllExtensionNumbersRaw( + ::grpc::ClientContext* context, + const ::grpc::reflection::v1alpha::TypeRequest& request, + ::grpc::CompletionQueue* cq) { + return new ::grpc::ClientAsyncResponseReader< + ::grpc::reflection::v1alpha::ExtensionNumberResponse>( + channel_.get(), cq, rpcmethod_GetAllExtensionNumbers_, context, request); +} + +ServerReflection::Service::Service() { + (void)ServerReflection_method_names; + AddMethod(new ::grpc::RpcServiceMethod( + ServerReflection_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, + new ::grpc::RpcMethodHandler< + ServerReflection::Service, ::grpc::reflection::v1alpha::EmptyRequest, + ::grpc::reflection::v1alpha::ListServiceResponse>( + std::mem_fn(&ServerReflection::Service::ListService), this))); + AddMethod(new ::grpc::RpcServiceMethod( + ServerReflection_method_names[1], ::grpc::RpcMethod::NORMAL_RPC, + new ::grpc::RpcMethodHandler< + ServerReflection::Service, + ::grpc::reflection::v1alpha::FileNameRequest, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( + std::mem_fn(&ServerReflection::Service::GetFileByName), this))); + AddMethod(new ::grpc::RpcServiceMethod( + ServerReflection_method_names[2], ::grpc::RpcMethod::NORMAL_RPC, + new ::grpc::RpcMethodHandler< + ServerReflection::Service, ::grpc::reflection::v1alpha::SymbolRequest, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( + std::mem_fn(&ServerReflection::Service::GetFileContainingSymbol), + this))); + AddMethod(new ::grpc::RpcServiceMethod( + ServerReflection_method_names[3], ::grpc::RpcMethod::NORMAL_RPC, + new ::grpc::RpcMethodHandler< + ServerReflection::Service, + ::grpc::reflection::v1alpha::ExtensionRequest, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( + std::mem_fn(&ServerReflection::Service::GetFileContainingExtension), + this))); + AddMethod(new ::grpc::RpcServiceMethod( + ServerReflection_method_names[4], ::grpc::RpcMethod::NORMAL_RPC, + new ::grpc::RpcMethodHandler< + ServerReflection::Service, ::grpc::reflection::v1alpha::TypeRequest, + ::grpc::reflection::v1alpha::ExtensionNumberResponse>( + std::mem_fn(&ServerReflection::Service::GetAllExtensionNumbers), + this))); +} + +ServerReflection::Service::~Service() {} + +::grpc::Status ServerReflection::Service::ListService( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::EmptyRequest* request, + ::grpc::reflection::v1alpha::ListServiceResponse* response) { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status ServerReflection::Service::GetFileByName( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::FileNameRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status ServerReflection::Service::GetFileContainingSymbol( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::SymbolRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status ServerReflection::Service::GetFileContainingExtension( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::ExtensionRequest* request, + ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +::grpc::Status ServerReflection::Service::GetAllExtensionNumbers( + ::grpc::ServerContext* context, + const ::grpc::reflection::v1alpha::TypeRequest* request, + ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) { + (void)context; + (void)request; + (void)response; + return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +} + +} // namespace grpc +} // namespace reflection +} // namespace v1alpha diff --git a/extensions/reflection/reflection.pb.cc b/extensions/reflection/reflection.pb.cc new file mode 100644 index 00000000000..97b3cb87916 --- /dev/null +++ b/extensions/reflection/reflection.pb.cc @@ -0,0 +1,2448 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: reflection.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace grpc { +namespace reflection { +namespace v1alpha { + +namespace { + +const ::google::protobuf::Descriptor* EmptyRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + EmptyRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* FileNameRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FileNameRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* SymbolRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + SymbolRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* ExtensionRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ExtensionRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* TypeRequest_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + TypeRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* ListServiceResponse_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ListServiceResponse_reflection_ = NULL; +const ::google::protobuf::Descriptor* FileDescriptorProtoResponse_descriptor_ = + NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FileDescriptorProtoResponse_reflection_ = NULL; +const ::google::protobuf::Descriptor* ExtensionNumberResponse_descriptor_ = + NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ExtensionNumberResponse_reflection_ = NULL; + +} // namespace + +void protobuf_AssignDesc_reflection_2eproto() { + protobuf_AddDesc_reflection_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "reflection.proto"); + GOOGLE_CHECK(file != NULL); + EmptyRequest_descriptor_ = file->message_type(0); + static const int EmptyRequest_offsets_[1] = {}; + EmptyRequest_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + EmptyRequest_descriptor_, EmptyRequest::default_instance_, + EmptyRequest_offsets_, -1, -1, -1, sizeof(EmptyRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmptyRequest, + _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + EmptyRequest, _is_default_instance_)); + FileNameRequest_descriptor_ = file->message_type(1); + static const int FileNameRequest_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileNameRequest, + filename_), + }; + FileNameRequest_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + FileNameRequest_descriptor_, FileNameRequest::default_instance_, + FileNameRequest_offsets_, -1, -1, -1, sizeof(FileNameRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileNameRequest, + _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + FileNameRequest, _is_default_instance_)); + SymbolRequest_descriptor_ = file->message_type(2); + static const int SymbolRequest_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SymbolRequest, symbol_), + }; + SymbolRequest_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + SymbolRequest_descriptor_, SymbolRequest::default_instance_, + SymbolRequest_offsets_, -1, -1, -1, sizeof(SymbolRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SymbolRequest, + _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + SymbolRequest, _is_default_instance_)); + ExtensionRequest_descriptor_ = file->message_type(3); + static const int ExtensionRequest_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, + containing_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, + extension_number_), + }; + ExtensionRequest_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + ExtensionRequest_descriptor_, ExtensionRequest::default_instance_, + ExtensionRequest_offsets_, -1, -1, -1, sizeof(ExtensionRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, + _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + ExtensionRequest, _is_default_instance_)); + TypeRequest_descriptor_ = file->message_type(4); + static const int TypeRequest_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TypeRequest, type_), + }; + TypeRequest_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + TypeRequest_descriptor_, TypeRequest::default_instance_, + TypeRequest_offsets_, -1, -1, -1, sizeof(TypeRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TypeRequest, + _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + TypeRequest, _is_default_instance_)); + ListServiceResponse_descriptor_ = file->message_type(5); + static const int ListServiceResponse_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, + services_), + }; + ListServiceResponse_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + ListServiceResponse_descriptor_, + ListServiceResponse::default_instance_, ListServiceResponse_offsets_, + -1, -1, -1, sizeof(ListServiceResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, + _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + ListServiceResponse, _is_default_instance_)); + FileDescriptorProtoResponse_descriptor_ = file->message_type(6); + static const int FileDescriptorProtoResponse_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + FileDescriptorProtoResponse, file_descriptor_proto_), + }; + FileDescriptorProtoResponse_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + FileDescriptorProtoResponse_descriptor_, + FileDescriptorProtoResponse::default_instance_, + FileDescriptorProtoResponse_offsets_, -1, -1, -1, + sizeof(FileDescriptorProtoResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + FileDescriptorProtoResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + FileDescriptorProtoResponse, _is_default_instance_)); + ExtensionNumberResponse_descriptor_ = file->message_type(7); + static const int ExtensionNumberResponse_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, + extension_number_), + }; + ExtensionNumberResponse_reflection_ = ::google::protobuf::internal:: + GeneratedMessageReflection::NewGeneratedMessageReflection( + ExtensionNumberResponse_descriptor_, + ExtensionNumberResponse::default_instance_, + ExtensionNumberResponse_offsets_, -1, -1, -1, + sizeof(ExtensionNumberResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + ExtensionNumberResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( + ExtensionNumberResponse, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_reflection_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + EmptyRequest_descriptor_, &EmptyRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FileNameRequest_descriptor_, &FileNameRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + SymbolRequest_descriptor_, &SymbolRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ExtensionRequest_descriptor_, &ExtensionRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + TypeRequest_descriptor_, &TypeRequest::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ListServiceResponse_descriptor_, + &ListServiceResponse::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FileDescriptorProtoResponse_descriptor_, + &FileDescriptorProtoResponse::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ExtensionNumberResponse_descriptor_, + &ExtensionNumberResponse::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_reflection_2eproto() { + delete EmptyRequest::default_instance_; + delete EmptyRequest_reflection_; + delete FileNameRequest::default_instance_; + delete FileNameRequest_reflection_; + delete SymbolRequest::default_instance_; + delete SymbolRequest_reflection_; + delete ExtensionRequest::default_instance_; + delete ExtensionRequest_reflection_; + delete TypeRequest::default_instance_; + delete TypeRequest_reflection_; + delete ListServiceResponse::default_instance_; + delete ListServiceResponse_reflection_; + delete FileDescriptorProtoResponse::default_instance_; + delete FileDescriptorProtoResponse_reflection_; + delete ExtensionNumberResponse::default_instance_; + delete ExtensionNumberResponse_reflection_; +} + +void protobuf_AddDesc_reflection_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\020reflection.proto\022\027grpc.reflection.v1al" + "pha\"\016\n\014EmptyRequest\"#\n\017FileNameRequest\022\020" + "\n\010filename\030\001 \001(\t\"\037\n\rSymbolRequest\022\016\n\006sym" + "bol\030\001 \001(\t\"E\n\020ExtensionRequest\022\027\n\017contain" + "ing_type\030\001 \001(\t\022\030\n\020extension_number\030\002 \001(\005" + "\"\033\n\013TypeRequest\022\014\n\004type\030\001 " + "\001(\t\"\'\n\023ListSer" + "viceResponse\022\020\n\010services\030\001 \003(\t\"<\n\033FileDe" + "scriptorProtoResponse\022\035\n\025file_descriptor" + "_proto\030\001 \001(\014\"3\n\027ExtensionNumberResponse\022" + "\030\n\020extension_number\030\001 \003(\0052\333\004\n\020ServerRefl" + "ection\022d\n\013ListService\022%.grpc.reflection." + "v1alpha.EmptyRequest\032,.grpc.reflection.v" + "1alpha.ListServiceResponse\"\000\022q\n\rGetFileB" + "yName\022(.grpc.reflection.v1alpha.FileName" + "Request\0324.grpc.reflection.v1alpha.FileDe" + "scriptorProtoResponse\"\000\022y\n\027GetFileContai" + "ningSymbol\022&.grpc.reflection.v1alpha.Sym" + "bolRequest\0324.grpc.reflection.v1alpha.Fil" + "eDescriptorProtoResponse\"\000\022\177\n\032GetFileCon" + "tainingExtension\022).grpc.reflection.v1alp" + "ha.ExtensionRequest\0324.grpc.reflection.v1" + "alpha.FileDescriptorProtoResponse\"\000\022r\n\026G" + "etAllExtensionNumbers\022$.grpc.reflection." + "v1alpha.TypeRequest\0320.grpc.reflection.v1" + "alpha.ExtensionNumberResponse\"\000b\006proto3", + 999); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "reflection.proto", &protobuf_RegisterTypes); + EmptyRequest::default_instance_ = new EmptyRequest(); + FileNameRequest::default_instance_ = new FileNameRequest(); + SymbolRequest::default_instance_ = new SymbolRequest(); + ExtensionRequest::default_instance_ = new ExtensionRequest(); + TypeRequest::default_instance_ = new TypeRequest(); + ListServiceResponse::default_instance_ = new ListServiceResponse(); + FileDescriptorProtoResponse::default_instance_ = + new FileDescriptorProtoResponse(); + ExtensionNumberResponse::default_instance_ = new ExtensionNumberResponse(); + EmptyRequest::default_instance_->InitAsDefaultInstance(); + FileNameRequest::default_instance_->InitAsDefaultInstance(); + SymbolRequest::default_instance_->InitAsDefaultInstance(); + ExtensionRequest::default_instance_->InitAsDefaultInstance(); + TypeRequest::default_instance_->InitAsDefaultInstance(); + ListServiceResponse::default_instance_->InitAsDefaultInstance(); + FileDescriptorProtoResponse::default_instance_->InitAsDefaultInstance(); + ExtensionNumberResponse::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown( + &protobuf_ShutdownFile_reflection_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_reflection_2eproto { + StaticDescriptorInitializer_reflection_2eproto() { + protobuf_AddDesc_reflection_2eproto(); + } +} static_descriptor_initializer_reflection_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +EmptyRequest::EmptyRequest() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.EmptyRequest) +} + +void EmptyRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } + +EmptyRequest::EmptyRequest(const EmptyRequest& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.EmptyRequest) +} + +void EmptyRequest::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; +} + +EmptyRequest::~EmptyRequest() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.EmptyRequest) + SharedDtor(); +} + +void EmptyRequest::SharedDtor() { + if (this != default_instance_) { + } +} + +void EmptyRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* EmptyRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return EmptyRequest_descriptor_; +} + +const EmptyRequest& EmptyRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +EmptyRequest* EmptyRequest::default_instance_ = NULL; + +EmptyRequest* EmptyRequest::New(::google::protobuf::Arena* arena) const { + EmptyRequest* n = new EmptyRequest; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void EmptyRequest::Clear() {} + +bool EmptyRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.EmptyRequest) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.EmptyRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.EmptyRequest) + return false; +#undef DO_ +} + +void EmptyRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.EmptyRequest) + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.EmptyRequest) +} + +::google::protobuf::uint8* EmptyRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.EmptyRequest) + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.EmptyRequest) + return target; +} + +int EmptyRequest::ByteSize() const { + int total_size = 0; + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void EmptyRequest::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const EmptyRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void EmptyRequest::MergeFrom(const EmptyRequest& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); +} + +void EmptyRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void EmptyRequest::CopyFrom(const EmptyRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EmptyRequest::IsInitialized() const { return true; } + +void EmptyRequest::Swap(EmptyRequest* other) { + if (other == this) return; + InternalSwap(other); +} +void EmptyRequest::InternalSwap(EmptyRequest* other) { + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata EmptyRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = EmptyRequest_descriptor_; + metadata.reflection = EmptyRequest_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// EmptyRequest + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int FileNameRequest::kFilenameFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +FileNameRequest::FileNameRequest() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.FileNameRequest) +} + +void FileNameRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } + +FileNameRequest::FileNameRequest(const FileNameRequest& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.FileNameRequest) +} + +void FileNameRequest::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + filename_.UnsafeSetDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +FileNameRequest::~FileNameRequest() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.FileNameRequest) + SharedDtor(); +} + +void FileNameRequest::SharedDtor() { + filename_.DestroyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void FileNameRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FileNameRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FileNameRequest_descriptor_; +} + +const FileNameRequest& FileNameRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +FileNameRequest* FileNameRequest::default_instance_ = NULL; + +FileNameRequest* FileNameRequest::New(::google::protobuf::Arena* arena) const { + FileNameRequest* n = new FileNameRequest; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void FileNameRequest::Clear() { + filename_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool FileNameRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.FileNameRequest) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch ( + ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string filename = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_filename())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->filename().data(), this->filename().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.FileNameRequest.filename")); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, + tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.FileNameRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.FileNameRequest) + return false; +#undef DO_ +} + +void FileNameRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.FileNameRequest) + // optional string filename = 1; + if (this->filename().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->filename().data(), this->filename().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.FileNameRequest.filename"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->filename(), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.FileNameRequest) +} + +::google::protobuf::uint8* FileNameRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.FileNameRequest) + // optional string filename = 1; + if (this->filename().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->filename().data(), this->filename().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.FileNameRequest.filename"); + target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->filename(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.FileNameRequest) + return target; +} + +int FileNameRequest::ByteSize() const { + int total_size = 0; + + // optional string filename = 1; + if (this->filename().size() > 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->filename()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FileNameRequest::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const FileNameRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated< + const FileNameRequest>(&from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FileNameRequest::MergeFrom(const FileNameRequest& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.filename().size() > 0) { + filename_.AssignWithDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + from.filename_); + } +} + +void FileNameRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FileNameRequest::CopyFrom(const FileNameRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FileNameRequest::IsInitialized() const { return true; } + +void FileNameRequest::Swap(FileNameRequest* other) { + if (other == this) return; + InternalSwap(other); +} +void FileNameRequest::InternalSwap(FileNameRequest* other) { + filename_.Swap(&other->filename_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata FileNameRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FileNameRequest_descriptor_; + metadata.reflection = FileNameRequest_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// FileNameRequest + +// optional string filename = 1; +void FileNameRequest::clear_filename() { + filename_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& FileNameRequest::filename() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileNameRequest.filename) + return filename_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void FileNameRequest::set_filename(const ::std::string& value) { + filename_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileNameRequest.filename) +} +void FileNameRequest::set_filename(const char* value) { + filename_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileNameRequest.filename) +} +void FileNameRequest::set_filename(const char* value, size_t size) { + filename_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileNameRequest.filename) +} +::std::string* FileNameRequest::mutable_filename() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileNameRequest.filename) + return filename_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* FileNameRequest::release_filename() { + return filename_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void FileNameRequest::set_allocated_filename(::std::string* filename) { + if (filename != NULL) { + } else { + } + filename_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), filename); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileNameRequest.filename) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int SymbolRequest::kSymbolFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +SymbolRequest::SymbolRequest() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.SymbolRequest) +} + +void SymbolRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } + +SymbolRequest::SymbolRequest(const SymbolRequest& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.SymbolRequest) +} + +void SymbolRequest::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + symbol_.UnsafeSetDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +SymbolRequest::~SymbolRequest() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.SymbolRequest) + SharedDtor(); +} + +void SymbolRequest::SharedDtor() { + symbol_.DestroyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void SymbolRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* SymbolRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return SymbolRequest_descriptor_; +} + +const SymbolRequest& SymbolRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +SymbolRequest* SymbolRequest::default_instance_ = NULL; + +SymbolRequest* SymbolRequest::New(::google::protobuf::Arena* arena) const { + SymbolRequest* n = new SymbolRequest; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void SymbolRequest::Clear() { + symbol_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool SymbolRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.SymbolRequest) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch ( + ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string symbol = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_symbol())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->symbol().data(), this->symbol().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.SymbolRequest.symbol")); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, + tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.SymbolRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.SymbolRequest) + return false; +#undef DO_ +} + +void SymbolRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.SymbolRequest) + // optional string symbol = 1; + if (this->symbol().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->symbol().data(), this->symbol().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.SymbolRequest.symbol"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->symbol(), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.SymbolRequest) +} + +::google::protobuf::uint8* SymbolRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.SymbolRequest) + // optional string symbol = 1; + if (this->symbol().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->symbol().data(), this->symbol().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.SymbolRequest.symbol"); + target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->symbol(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.SymbolRequest) + return target; +} + +int SymbolRequest::ByteSize() const { + int total_size = 0; + + // optional string symbol = 1; + if (this->symbol().size() > 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->symbol()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void SymbolRequest::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const SymbolRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void SymbolRequest::MergeFrom(const SymbolRequest& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.symbol().size() > 0) { + symbol_.AssignWithDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + from.symbol_); + } +} + +void SymbolRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void SymbolRequest::CopyFrom(const SymbolRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SymbolRequest::IsInitialized() const { return true; } + +void SymbolRequest::Swap(SymbolRequest* other) { + if (other == this) return; + InternalSwap(other); +} +void SymbolRequest::InternalSwap(SymbolRequest* other) { + symbol_.Swap(&other->symbol_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata SymbolRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = SymbolRequest_descriptor_; + metadata.reflection = SymbolRequest_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// SymbolRequest + +// optional string symbol = 1; +void SymbolRequest::clear_symbol() { + symbol_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& SymbolRequest::symbol() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.SymbolRequest.symbol) + return symbol_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void SymbolRequest::set_symbol(const ::std::string& value) { + symbol_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.SymbolRequest.symbol) +} +void SymbolRequest::set_symbol(const char* value) { + symbol_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.SymbolRequest.symbol) +} +void SymbolRequest::set_symbol(const char* value, size_t size) { + symbol_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.SymbolRequest.symbol) +} +::std::string* SymbolRequest::mutable_symbol() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.SymbolRequest.symbol) + return symbol_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* SymbolRequest::release_symbol() { + return symbol_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void SymbolRequest::set_allocated_symbol(::std::string* symbol) { + if (symbol != NULL) { + } else { + } + symbol_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), symbol); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.SymbolRequest.symbol) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int ExtensionRequest::kContainingTypeFieldNumber; +const int ExtensionRequest::kExtensionNumberFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +ExtensionRequest::ExtensionRequest() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ExtensionRequest) +} + +void ExtensionRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } + +ExtensionRequest::ExtensionRequest(const ExtensionRequest& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ExtensionRequest) +} + +void ExtensionRequest::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + containing_type_.UnsafeSetDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + extension_number_ = 0; +} + +ExtensionRequest::~ExtensionRequest() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ExtensionRequest) + SharedDtor(); +} + +void ExtensionRequest::SharedDtor() { + containing_type_.DestroyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void ExtensionRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ExtensionRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ExtensionRequest_descriptor_; +} + +const ExtensionRequest& ExtensionRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +ExtensionRequest* ExtensionRequest::default_instance_ = NULL; + +ExtensionRequest* ExtensionRequest::New( + ::google::protobuf::Arena* arena) const { + ExtensionRequest* n = new ExtensionRequest; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void ExtensionRequest::Clear() { + containing_type_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + extension_number_ = 0; +} + +bool ExtensionRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ExtensionRequest) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch ( + ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string containing_type = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_containing_type())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->containing_type().data(), this->containing_type().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.ExtensionRequest.containing_type")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(16)) goto parse_extension_number; + break; + } + + // optional int32 extension_number = 2; + case 2: { + if (tag == 16) { + parse_extension_number: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &extension_number_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, + tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ExtensionRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ExtensionRequest) + return false; +#undef DO_ +} + +void ExtensionRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ExtensionRequest) + // optional string containing_type = 1; + if (this->containing_type().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->containing_type().data(), this->containing_type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ExtensionRequest.containing_type"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->containing_type(), output); + } + + // optional int32 extension_number = 2; + if (this->extension_number() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 2, this->extension_number(), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ExtensionRequest) +} + +::google::protobuf::uint8* ExtensionRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ExtensionRequest) + // optional string containing_type = 1; + if (this->containing_type().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->containing_type().data(), this->containing_type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ExtensionRequest.containing_type"); + target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->containing_type(), target); + } + + // optional int32 extension_number = 2; + if (this->extension_number() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray( + 2, this->extension_number(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ExtensionRequest) + return target; +} + +int ExtensionRequest::ByteSize() const { + int total_size = 0; + + // optional string containing_type = 1; + if (this->containing_type().size() > 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->containing_type()); + } + + // optional int32 extension_number = 2; + if (this->extension_number() != 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->extension_number()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ExtensionRequest::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ExtensionRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated< + const ExtensionRequest>(&from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ExtensionRequest::MergeFrom(const ExtensionRequest& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.containing_type().size() > 0) { + containing_type_.AssignWithDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + from.containing_type_); + } + if (from.extension_number() != 0) { + set_extension_number(from.extension_number()); + } +} + +void ExtensionRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ExtensionRequest::CopyFrom(const ExtensionRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ExtensionRequest::IsInitialized() const { return true; } + +void ExtensionRequest::Swap(ExtensionRequest* other) { + if (other == this) return; + InternalSwap(other); +} +void ExtensionRequest::InternalSwap(ExtensionRequest* other) { + containing_type_.Swap(&other->containing_type_); + std::swap(extension_number_, other->extension_number_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata ExtensionRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ExtensionRequest_descriptor_; + metadata.reflection = ExtensionRequest_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// ExtensionRequest + +// optional string containing_type = 1; +void ExtensionRequest::clear_containing_type() { + containing_type_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& ExtensionRequest::containing_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.containing_type) + return containing_type_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void ExtensionRequest::set_containing_type(const ::std::string& value) { + containing_type_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +void ExtensionRequest::set_containing_type(const char* value) { + containing_type_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +void ExtensionRequest::set_containing_type(const char* value, size_t size) { + containing_type_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} +::std::string* ExtensionRequest::mutable_containing_type() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionRequest.containing_type) + return containing_type_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* ExtensionRequest::release_containing_type() { + return containing_type_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void ExtensionRequest::set_allocated_containing_type( + ::std::string* containing_type) { + if (containing_type != NULL) { + } else { + } + containing_type_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + containing_type); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionRequest.containing_type) +} + +// optional int32 extension_number = 2; +void ExtensionRequest::clear_extension_number() { extension_number_ = 0; } +::google::protobuf::int32 ExtensionRequest::extension_number() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.extension_number) + return extension_number_; +} +void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { + extension_number_ = value; + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.extension_number) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int TypeRequest::kTypeFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +TypeRequest::TypeRequest() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.TypeRequest) +} + +void TypeRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } + +TypeRequest::TypeRequest(const TypeRequest& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.TypeRequest) +} + +void TypeRequest::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + type_.UnsafeSetDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +TypeRequest::~TypeRequest() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.TypeRequest) + SharedDtor(); +} + +void TypeRequest::SharedDtor() { + type_.DestroyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void TypeRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* TypeRequest::descriptor() { + protobuf_AssignDescriptorsOnce(); + return TypeRequest_descriptor_; +} + +const TypeRequest& TypeRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +TypeRequest* TypeRequest::default_instance_ = NULL; + +TypeRequest* TypeRequest::New(::google::protobuf::Arena* arena) const { + TypeRequest* n = new TypeRequest; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void TypeRequest::Clear() { + type_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool TypeRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.TypeRequest) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch ( + ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string type = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_type())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->type().data(), this->type().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.TypeRequest.type")); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, + tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.TypeRequest) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.TypeRequest) + return false; +#undef DO_ +} + +void TypeRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.TypeRequest) + // optional string type = 1; + if (this->type().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->type().data(), this->type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.TypeRequest.type"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->type(), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.TypeRequest) +} + +::google::protobuf::uint8* TypeRequest::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.TypeRequest) + // optional string type = 1; + if (this->type().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->type().data(), this->type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.TypeRequest.type"); + target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->type(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.TypeRequest) + return target; +} + +int TypeRequest::ByteSize() const { + int total_size = 0; + + // optional string type = 1; + if (this->type().size() > 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( + this->type()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void TypeRequest::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const TypeRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void TypeRequest::MergeFrom(const TypeRequest& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.type().size() > 0) { + type_.AssignWithDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + from.type_); + } +} + +void TypeRequest::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void TypeRequest::CopyFrom(const TypeRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool TypeRequest::IsInitialized() const { return true; } + +void TypeRequest::Swap(TypeRequest* other) { + if (other == this) return; + InternalSwap(other); +} +void TypeRequest::InternalSwap(TypeRequest* other) { + type_.Swap(&other->type_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata TypeRequest::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = TypeRequest_descriptor_; + metadata.reflection = TypeRequest_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// TypeRequest + +// optional string type = 1; +void TypeRequest::clear_type() { + type_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& TypeRequest::type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.TypeRequest.type) + return type_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void TypeRequest::set_type(const ::std::string& value) { + type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.TypeRequest.type) +} +void TypeRequest::set_type(const char* value) { + type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.TypeRequest.type) +} +void TypeRequest::set_type(const char* value, size_t size) { + type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.TypeRequest.type) +} +::std::string* TypeRequest::mutable_type() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.TypeRequest.type) + return type_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* TypeRequest::release_type() { + return type_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void TypeRequest::set_allocated_type(::std::string* type) { + if (type != NULL) { + } else { + } + type_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.TypeRequest.type) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int ListServiceResponse::kServicesFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +ListServiceResponse::ListServiceResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ListServiceResponse) +} + +void ListServiceResponse::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +ListServiceResponse::ListServiceResponse(const ListServiceResponse& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ListServiceResponse) +} + +void ListServiceResponse::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; +} + +ListServiceResponse::~ListServiceResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ListServiceResponse) + SharedDtor(); +} + +void ListServiceResponse::SharedDtor() { + if (this != default_instance_) { + } +} + +void ListServiceResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ListServiceResponse::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ListServiceResponse_descriptor_; +} + +const ListServiceResponse& ListServiceResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +ListServiceResponse* ListServiceResponse::default_instance_ = NULL; + +ListServiceResponse* ListServiceResponse::New( + ::google::protobuf::Arena* arena) const { + ListServiceResponse* n = new ListServiceResponse; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void ListServiceResponse::Clear() { services_.Clear(); } + +bool ListServiceResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ListServiceResponse) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch ( + ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated string services = 1; + case 1: { + if (tag == 10) { + parse_services: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_services())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->services(this->services_size() - 1).data(), + this->services(this->services_size() - 1).length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.ListServiceResponse.services")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(10)) goto parse_services; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, + tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ListServiceResponse) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ListServiceResponse) + return false; +#undef DO_ +} + +void ListServiceResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ListServiceResponse) + // repeated string services = 1; + for (int i = 0; i < this->services_size(); i++) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->services(i).data(), this->services(i).length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ListServiceResponse.services"); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->services(i), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ListServiceResponse) +} + +::google::protobuf::uint8* ListServiceResponse::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ListServiceResponse) + // repeated string services = 1; + for (int i = 0; i < this->services_size(); i++) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->services(i).data(), this->services(i).length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ListServiceResponse.services"); + target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->services(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ListServiceResponse) + return target; +} + +int ListServiceResponse::ByteSize() const { + int total_size = 0; + + // repeated string services = 1; + total_size += 1 * this->services_size(); + for (int i = 0; i < this->services_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->services(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ListServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ListServiceResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated< + const ListServiceResponse>(&from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ListServiceResponse::MergeFrom(const ListServiceResponse& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + services_.MergeFrom(from.services_); +} + +void ListServiceResponse::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ListServiceResponse::CopyFrom(const ListServiceResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ListServiceResponse::IsInitialized() const { return true; } + +void ListServiceResponse::Swap(ListServiceResponse* other) { + if (other == this) return; + InternalSwap(other); +} +void ListServiceResponse::InternalSwap(ListServiceResponse* other) { + services_.UnsafeArenaSwap(&other->services_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata ListServiceResponse::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ListServiceResponse_descriptor_; + metadata.reflection = ListServiceResponse_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// ListServiceResponse + +// repeated string services = 1; +int ListServiceResponse::services_size() const { return services_.size(); } +void ListServiceResponse::clear_services() { services_.Clear(); } +const ::std::string& ListServiceResponse::services(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.services) + return services_.Get(index); +} +::std::string* ListServiceResponse::mutable_services(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.services) + return services_.Mutable(index); +} +void ListServiceResponse::set_services(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.services) + services_.Mutable(index)->assign(value); +} +void ListServiceResponse::set_services(int index, const char* value) { + services_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.services) +} +void ListServiceResponse::set_services(int index, const char* value, + size_t size) { + services_.Mutable(index)->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) +} +::std::string* ListServiceResponse::add_services() { return services_.Add(); } +void ListServiceResponse::add_services(const ::std::string& value) { + services_.Add()->assign(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.services) +} +void ListServiceResponse::add_services(const char* value) { + services_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.services) +} +void ListServiceResponse::add_services(const char* value, size_t size) { + services_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) +} +const ::google::protobuf::RepeatedPtrField< ::std::string>& +ListServiceResponse::services() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.services) + return services_; +} +::google::protobuf::RepeatedPtrField< ::std::string>* +ListServiceResponse::mutable_services() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.services) + return &services_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int FileDescriptorProtoResponse::kFileDescriptorProtoFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +FileDescriptorProtoResponse::FileDescriptorProtoResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.FileDescriptorProtoResponse) +} + +void FileDescriptorProtoResponse::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +FileDescriptorProtoResponse::FileDescriptorProtoResponse( + const FileDescriptorProtoResponse& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.FileDescriptorProtoResponse) +} + +void FileDescriptorProtoResponse::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + file_descriptor_proto_.UnsafeSetDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +FileDescriptorProtoResponse::~FileDescriptorProtoResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + SharedDtor(); +} + +void FileDescriptorProtoResponse::SharedDtor() { + file_descriptor_proto_.DestroyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void FileDescriptorProtoResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* +FileDescriptorProtoResponse::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FileDescriptorProtoResponse_descriptor_; +} + +const FileDescriptorProtoResponse& +FileDescriptorProtoResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +FileDescriptorProtoResponse* FileDescriptorProtoResponse::default_instance_ = + NULL; + +FileDescriptorProtoResponse* FileDescriptorProtoResponse::New( + ::google::protobuf::Arena* arena) const { + FileDescriptorProtoResponse* n = new FileDescriptorProtoResponse; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void FileDescriptorProtoResponse::Clear() { + file_descriptor_proto_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool FileDescriptorProtoResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch ( + ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bytes file_descriptor_proto = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_file_descriptor_proto())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, + tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + return false; +#undef DO_ +} + +void FileDescriptorProtoResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // optional bytes file_descriptor_proto = 1; + if (this->file_descriptor_proto().size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 1, this->file_descriptor_proto(), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.FileDescriptorProtoResponse) +} + +::google::protobuf::uint8* +FileDescriptorProtoResponse::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // optional bytes file_descriptor_proto = 1; + if (this->file_descriptor_proto().size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 1, this->file_descriptor_proto(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + return target; +} + +int FileDescriptorProtoResponse::ByteSize() const { + int total_size = 0; + + // optional bytes file_descriptor_proto = 1; + if (this->file_descriptor_proto().size() > 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->file_descriptor_proto()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FileDescriptorProtoResponse::MergeFrom( + const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const FileDescriptorProtoResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated< + const FileDescriptorProtoResponse>(&from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FileDescriptorProtoResponse::MergeFrom( + const FileDescriptorProtoResponse& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.file_descriptor_proto().size() > 0) { + file_descriptor_proto_.AssignWithDefault( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + from.file_descriptor_proto_); + } +} + +void FileDescriptorProtoResponse::CopyFrom( + const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FileDescriptorProtoResponse::CopyFrom( + const FileDescriptorProtoResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FileDescriptorProtoResponse::IsInitialized() const { return true; } + +void FileDescriptorProtoResponse::Swap(FileDescriptorProtoResponse* other) { + if (other == this) return; + InternalSwap(other); +} +void FileDescriptorProtoResponse::InternalSwap( + FileDescriptorProtoResponse* other) { + file_descriptor_proto_.Swap(&other->file_descriptor_proto_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata FileDescriptorProtoResponse::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FileDescriptorProtoResponse_descriptor_; + metadata.reflection = FileDescriptorProtoResponse_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// FileDescriptorProtoResponse + +// optional bytes file_descriptor_proto = 1; +void FileDescriptorProtoResponse::clear_file_descriptor_proto() { + file_descriptor_proto_.ClearToEmptyNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +const ::std::string& FileDescriptorProtoResponse::file_descriptor_proto() + const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) + return file_descriptor_proto_.GetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void FileDescriptorProtoResponse::set_file_descriptor_proto( + const ::std::string& value) { + file_descriptor_proto_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} +void FileDescriptorProtoResponse::set_file_descriptor_proto(const char* value) { + file_descriptor_proto_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} +void FileDescriptorProtoResponse::set_file_descriptor_proto(const void* value, + size_t size) { + file_descriptor_proto_.SetNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} +::std::string* FileDescriptorProtoResponse::mutable_file_descriptor_proto() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) + return file_descriptor_proto_.MutableNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +::std::string* FileDescriptorProtoResponse::release_file_descriptor_proto() { + return file_descriptor_proto_.ReleaseNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +void FileDescriptorProtoResponse::set_allocated_file_descriptor_proto( + ::std::string* file_descriptor_proto) { + if (file_descriptor_proto != NULL) { + } else { + } + file_descriptor_proto_.SetAllocatedNoArena( + &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_descriptor_proto); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int ExtensionNumberResponse::kExtensionNumberFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +ExtensionNumberResponse::ExtensionNumberResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) +} + +void ExtensionNumberResponse::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +ExtensionNumberResponse::ExtensionNumberResponse( + const ExtensionNumberResponse& from) + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) +} + +void ExtensionNumberResponse::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; +} + +ExtensionNumberResponse::~ExtensionNumberResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ExtensionNumberResponse) + SharedDtor(); +} + +void ExtensionNumberResponse::SharedDtor() { + if (this != default_instance_) { + } +} + +void ExtensionNumberResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ExtensionNumberResponse::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ExtensionNumberResponse_descriptor_; +} + +const ExtensionNumberResponse& ExtensionNumberResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +ExtensionNumberResponse* ExtensionNumberResponse::default_instance_ = NULL; + +ExtensionNumberResponse* ExtensionNumberResponse::New( + ::google::protobuf::Arena* arena) const { + ExtensionNumberResponse* n = new ExtensionNumberResponse; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void ExtensionNumberResponse::Clear() { extension_number_.Clear(); } + +bool ExtensionNumberResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) \ + if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ExtensionNumberResponse) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch ( + ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated int32 extension_number = 1; + case 1: { + if (tag == 10) { + DO_(( + ::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_extension_number()))); + } else if (tag == 8) { + DO_(( + ::google::protobuf::internal::WireFormatLite:: + ReadRepeatedPrimitiveNoInline< + ::google::protobuf::int32, + ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 10, input, this->mutable_extension_number()))); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, + tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ExtensionNumberResponse) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ExtensionNumberResponse) + return false; +#undef DO_ +} + +void ExtensionNumberResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ExtensionNumberResponse) + // repeated int32 extension_number = 1; + if (this->extension_number_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag( + 1, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + output); + output->WriteVarint32(_extension_number_cached_byte_size_); + } + for (int i = 0; i < this->extension_number_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( + this->extension_number(i), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ExtensionNumberResponse) +} + +::google::protobuf::uint8* +ExtensionNumberResponse::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ExtensionNumberResponse) + // repeated int32 extension_number = 1; + if (this->extension_number_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 1, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + _extension_number_cached_byte_size_, target); + } + for (int i = 0; i < this->extension_number_size(); i++) { + target = + ::google::protobuf::internal::WireFormatLite::WriteInt32NoTagToArray( + this->extension_number(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ExtensionNumberResponse) + return target; +} + +int ExtensionNumberResponse::ByteSize() const { + int total_size = 0; + + // repeated int32 extension_number = 1; + { + int data_size = 0; + for (int i = 0; i < this->extension_number_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite::Int32Size( + this->extension_number(i)); + } + if (data_size > 0) { + total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( + data_size); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _extension_number_cached_byte_size_ = data_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ExtensionNumberResponse::MergeFrom( + const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ExtensionNumberResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated< + const ExtensionNumberResponse>(&from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ExtensionNumberResponse::MergeFrom(const ExtensionNumberResponse& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + extension_number_.MergeFrom(from.extension_number_); +} + +void ExtensionNumberResponse::CopyFrom( + const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ExtensionNumberResponse::CopyFrom(const ExtensionNumberResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ExtensionNumberResponse::IsInitialized() const { return true; } + +void ExtensionNumberResponse::Swap(ExtensionNumberResponse* other) { + if (other == this) return; + InternalSwap(other); +} +void ExtensionNumberResponse::InternalSwap(ExtensionNumberResponse* other) { + extension_number_.UnsafeArenaSwap(&other->extension_number_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata ExtensionNumberResponse::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ExtensionNumberResponse_descriptor_; + metadata.reflection = ExtensionNumberResponse_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// ExtensionNumberResponse + +// repeated int32 extension_number = 1; +int ExtensionNumberResponse::extension_number_size() const { + return extension_number_.size(); +} +void ExtensionNumberResponse::clear_extension_number() { + extension_number_.Clear(); +} +::google::protobuf::int32 ExtensionNumberResponse::extension_number( + int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_.Get(index); +} +void ExtensionNumberResponse::set_extension_number( + int index, ::google::protobuf::int32 value) { + extension_number_.Set(index, value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) +} +void ExtensionNumberResponse::add_extension_number( + ::google::protobuf::int32 value) { + extension_number_.Add(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) +} +const ::google::protobuf::RepeatedField< ::google::protobuf::int32>& +ExtensionNumberResponse::extension_number() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_; +} +::google::protobuf::RepeatedField< ::google::protobuf::int32>* +ExtensionNumberResponse::mutable_extension_number() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return &extension_number_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace v1alpha +} // namespace reflection +} // namespace grpc + +// @@protoc_insertion_point(global_scope) diff --git a/src/proto/grpc/reflection/v1alpha/reflection.proto b/src/proto/grpc/reflection/v1alpha/reflection.proto new file mode 100644 index 00000000000..4b13bd1e51c --- /dev/null +++ b/src/proto/grpc/reflection/v1alpha/reflection.proto @@ -0,0 +1,118 @@ +// Copyright 2016, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Service exported by server reflection + +syntax = "proto3"; + +package grpc.reflection.v1alpha; + +service ServerReflection { + // List the full names of registered services. + rpc ListService(EmptyRequest) returns (ListServiceResponse) { + } + + // Find a proto file by file name. + rpc GetFileByName(FileNameRequest) returns (FileDescriptorProtoResponse) { + } + + // Find the proto file that declares the given fully-qualified symbol name. + rpc GetFileContainingSymbol(SymbolRequest) + returns (FileDescriptorProtoResponse) { + } + + // Find the proto file which defines an extension extending the given message + // type with the given field number. + rpc GetFileContainingExtension(ExtensionRequest) + returns (FileDescriptorProtoResponse) { + } + + // Finds the tag numbers used by all known extensions of extendee_type, and + // appends them to ExtensionNumberResponse in an undefined order. + // This method is best-effort: it's not guaranteed that the reflection service + // will implement this method, and it's not guaranteed that this method will + // provide all extensions. Returns StatusCode::UNIMPLEMENTED if it's not + // implemented. + rpc GetAllExtensionNumbers(TypeRequest) returns (ExtensionNumberResponse) { + } +} + +// An empty message sent by the client when calling ListService method. +message EmptyRequest { +} + +// The filename sent by the client when calling GetFileByName method. +message FileNameRequest { + // Name of the proto file. + string filename = 1; +} + +// The symbol name sent by the client when calling GetFileContainingSymbol +// method. +message SymbolRequest { + // Fully-qualified symbol name (e.g. .[.] or + // .). + string symbol = 1; +} + +// The type name and extension number sent by the client when calling +// GetFileContainingExtension method. +message ExtensionRequest { + // Fully-qualified type name. The format should be . + string containing_type = 1; + int32 extension_number = 2; +} + +// The type name sent by the client when calling GetAllExtensionNumbers method. +message TypeRequest { + // Fully-qualified type name. The format should be . + string type = 1; +} + +// A list of service names sent by the server answering ListService method. +message ListServiceResponse { + // Full names of registered services, including package names. The format + // is . + repeated string services = 1; +} + +// A serialized FileDescriptorProto sent by the server answering +// GetFileByName, GetFileContainingSymbol, GetFileContainingExtension methods. +message FileDescriptorProtoResponse { + // Serialized FileDescriptorProto message. Some languages have limited support + // for working with descriptors. The can only obtain an opaque binary blob + // that contains serialized FileDescriptorProto message. + bytes file_descriptor_proto = 1; +} + +// A list of extension numbers sent by the server answering +// GetAllExtensionNumbers method. +message ExtensionNumberResponse { + repeated int32 extension_number = 1; +} diff --git a/templates/Makefile.template b/templates/Makefile.template index e84ceebf221..1d8183edb16 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -100,6 +100,7 @@ OBJDIR = $(BUILDDIR_ABSOLUTE)/objs LIBDIR = $(BUILDDIR_ABSOLUTE)/libs GENDIR = $(BUILDDIR_ABSOLUTE)/gens + EXTDIR = $(BUILDDIR_ABSOLUTE)/extensions # Configurations @@ -237,7 +238,7 @@ LDFLAGS += -fPIC endif - INCLUDES = . include $(GENDIR) + INCLUDES = . include $(GENDIR) $(EXTDIR) $(EXTDIR)/include LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) @@ -1278,8 +1279,8 @@ install-headers_cxx: $(E) "[INSTALL] Installing public C++ headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(patsubst extensions/%,%,$(dir $(h))) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(patsubst extensions/%,%,$(h)) && ) exit 0 || exit 1 install-static: install-static_c install-static_cxx diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc new file mode 100644 index 00000000000..c2ed93c12b6 --- /dev/null +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -0,0 +1,238 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "proto_reflection_descriptor_database.h" + +#include + +#include + +namespace grpc { + +ProtoReflectionDescriptorDatabase::ProtoReflectionDescriptorDatabase( + std::unique_ptr stub) + : stub_(std::move(stub)) {} + +ProtoReflectionDescriptorDatabase::ProtoReflectionDescriptorDatabase( + std::shared_ptr channel) + : stub_(reflection::v1alpha::ServerReflection::NewStub(channel)) {} + +ProtoReflectionDescriptorDatabase::~ProtoReflectionDescriptorDatabase() {} + +bool ProtoReflectionDescriptorDatabase::FindFileByName( + const string& filename, google::protobuf::FileDescriptorProto* output) { + if (cached_db_.FindFileByName(filename, output)) { + return true; + } + + if (known_files_.find(filename) != known_files_.end()) { + return false; + } + + ClientContext ctx; + reflection::v1alpha::FileNameRequest request; + request.set_filename(filename); + reflection::v1alpha::FileDescriptorProtoResponse response; + + Status status = stub_->GetFileByName(&ctx, request, &response); + if (status.ok()) { + // const google::protobuf::FileDescriptorProto* file_proto = + // response.mutable_file_descriptor_proto(); + const google::protobuf::FileDescriptorProto file_proto = + ParseFileDescriptorProtoResponse(&response); + known_files_.insert(file_proto.name()); + cached_db_.Add(file_proto); + } else if (status.error_code() == StatusCode::NOT_FOUND) { + gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileByName(%s)", + filename.c_str()); + } else { + gpr_log(GPR_INFO, + "Error on FindFileByName(%s)\n\tError code: %d\n" + "\tError Message: %s", + filename.c_str(), status.error_code(), + status.error_message().c_str()); + } + + return cached_db_.FindFileByName(filename, output); +} + +bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( + const string& symbol_name, google::protobuf::FileDescriptorProto* output) { + if (cached_db_.FindFileContainingSymbol(symbol_name, output)) { + return true; + } + + if (missing_symbols_.find(symbol_name) != missing_symbols_.end()) { + return false; + } + + ClientContext ctx; + reflection::v1alpha::SymbolRequest request; + request.set_symbol(symbol_name); + reflection::v1alpha::FileDescriptorProtoResponse response; + + Status status = stub_->GetFileContainingSymbol(&ctx, request, &response); + if (status.ok()) { + const google::protobuf::FileDescriptorProto file_proto = + ParseFileDescriptorProtoResponse(&response); + if (known_files_.find(file_proto.name()) == known_files_.end()) { + known_files_.insert(file_proto.name()); + cached_db_.Add(file_proto); + } + } else if (status.error_code() == StatusCode::NOT_FOUND) { + missing_symbols_.insert(symbol_name); + gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileContainingSymbol(%s)", + symbol_name.c_str()); + } else { + gpr_log(GPR_INFO, + "Error on FindFileContainingSymbol(%s)\n" + "\tError code: %d\n\tError Message: %s", + symbol_name.c_str(), status.error_code(), + status.error_message().c_str()); + } + + return cached_db_.FindFileContainingSymbol(symbol_name, output); +} + +bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( + const string& containing_type, int field_number, + google::protobuf::FileDescriptorProto* output) { + if (cached_db_.FindFileContainingExtension(containing_type, field_number, + output)) { + return true; + } + + if (missing_extensions_.find(containing_type) != missing_extensions_.end() && + missing_extensions_[containing_type].find(field_number) != + missing_extensions_[containing_type].end()) { + gpr_log(GPR_INFO, "nested map."); + return false; + } + + ClientContext ctx; + reflection::v1alpha::ExtensionRequest request; + request.set_containing_type(containing_type); + request.set_extension_number(field_number); + reflection::v1alpha::FileDescriptorProtoResponse response; + + Status status = stub_->GetFileContainingExtension(&ctx, request, &response); + if (status.ok()) { + const google::protobuf::FileDescriptorProto file_proto = + ParseFileDescriptorProtoResponse(&response); + if (known_files_.find(file_proto.name()) == known_files_.end()) { + known_files_.insert(file_proto.name()); + cached_db_.Add(file_proto); + } + } else if (status.error_code() == StatusCode::NOT_FOUND) { + if (missing_extensions_.find(containing_type) == + missing_extensions_.end()) { + missing_extensions_[containing_type] = {}; + } + missing_extensions_[containing_type].insert(field_number); + gpr_log(GPR_INFO, + "NOT_FOUND from server for FindFileContainingExtension(%s, %d)", + containing_type.c_str(), field_number); + } else { + gpr_log(GPR_INFO, + "Error on FindFileContainingExtension(%s, %d)\n" + "\tError code: %d\n\tError Message: %s", + containing_type.c_str(), field_number, status.error_code(), + status.error_message().c_str()); + } + + return cached_db_.FindFileContainingExtension(containing_type, field_number, + output); +} + +bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( + const string& extendee_type, std::vector* output) { + if (cached_extension_numbers_.find(extendee_type) != + cached_extension_numbers_.end()) { + *output = cached_extension_numbers_[extendee_type]; + return true; + } + + ClientContext ctx; + reflection::v1alpha::TypeRequest request; + request.set_type(extendee_type); + reflection::v1alpha::ExtensionNumberResponse response; + + Status status = stub_->GetAllExtensionNumbers(&ctx, request, &response); + if (status.ok()) { + auto number = response.extension_number(); + *output = std::vector(number.begin(), number.end()); + cached_extension_numbers_[extendee_type] = *output; + return true; + } else if (status.error_code() == StatusCode::NOT_FOUND) { + gpr_log(GPR_INFO, "NOT_FOUND from server for FindAllExtensionNumbers(%s)", + extendee_type.c_str()); + } else { + gpr_log(GPR_INFO, + "Error on FindAllExtensionNumbersExtension(%s)\n" + "\tError code: %d\n\tError Message: %s", + extendee_type.c_str(), status.error_code(), + status.error_message().c_str()); + } + return false; +} + +bool ProtoReflectionDescriptorDatabase::GetServices( + std::vector* output) { + ClientContext ctx; + reflection::v1alpha::EmptyRequest request; + reflection::v1alpha::ListServiceResponse response; + + Status status = stub_->ListService(&ctx, request, &response); + if (status.ok()) { + for (int i = 0; i < response.services_size(); ++i) { + (*output).push_back(response.services(i)); + } + return true; + } else { + gpr_log(GPR_INFO, + "Error on GetServices()\n\tError code: %d\n" + "\tError Message: %s", + status.error_code(), status.error_message().c_str()); + } + return false; +} + +const google::protobuf::FileDescriptorProto +ProtoReflectionDescriptorDatabase::ParseFileDescriptorProtoResponse( + reflection::v1alpha::FileDescriptorProtoResponse* response) { + google::protobuf::FileDescriptorProto file_desc_proto; + file_desc_proto.ParseFromString(response->file_descriptor_proto()); + return file_desc_proto; +} + +} // namespace grpc diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h new file mode 100644 index 00000000000..bf94654c3de --- /dev/null +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -0,0 +1,95 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// #include "reflection.grpc.pb.h" + +namespace grpc { + +class ProtoReflectionDescriptorDatabase + : public google::protobuf::DescriptorDatabase { + public: + explicit ProtoReflectionDescriptorDatabase( + std::unique_ptr stub); + + explicit ProtoReflectionDescriptorDatabase( + std::shared_ptr channel); + + virtual ~ProtoReflectionDescriptorDatabase(); + + // DescriptorDatabase methods + bool FindFileByName(const string& filename, + google::protobuf::FileDescriptorProto* output) + GRPC_OVERRIDE; + + bool FindFileContainingSymbol(const string& symbol_name, + google::protobuf::FileDescriptorProto* output) + GRPC_OVERRIDE; + + bool FindFileContainingExtension( + const string& containing_type, int field_number, + google::protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; + + bool FindAllExtensionNumbers(const string& extendee_type, + std::vector* output) GRPC_OVERRIDE; + + bool GetServices(std::vector* output); + + grpc::reflection::v1alpha::ServerReflection::Stub* stub() { + return stub_.get(); + } + + private: + const google::protobuf::FileDescriptorProto ParseFileDescriptorProtoResponse( + reflection::v1alpha::FileDescriptorProtoResponse* response); + + std::unique_ptr stub_; + std::unordered_set known_files_; + std::unordered_set missing_symbols_; + std::unordered_map> missing_extensions_; + std::unordered_map> cached_extension_numbers_; + + google::protobuf::SimpleDescriptorDatabase cached_db_; +}; + +} // namespace grpc diff --git a/test/cpp/util/reflection_debug/Makefile b/test/cpp/util/reflection_debug/Makefile new file mode 100644 index 00000000000..9eea5ae7347 --- /dev/null +++ b/test/cpp/util/reflection_debug/Makefile @@ -0,0 +1,50 @@ + +# Copyright 2015-2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +CXX = g++ +INCLUDES += -I. -I.. +CPPFLAGS += -I/usr/local/include -pthread +CXXFLAGS += -std=c++11 ${INCLUDES} +LDFLAGS += -L/usr/local/lib -lgrpc++_unsecure -lgrpc -lgrpc++_reflection -lprotobuf -lpthread -ldl +VPATH = .. + +# PROTOS_PATH = ../../../src/cpp/plugin/reflection + +vpath %.proto $(PROTOS_PATH) + +all: reflection_client + +reflection_client: proto_reflection_descriptor_database.o reflection_client.o + $(CXX) $(INCLUDES) $^ $(LDFLAGS) -o $@ + + +clean: + rm -f *.o reflection_client diff --git a/test/cpp/util/reflection_debug/reflection_client.cc b/test/cpp/util/reflection_debug/reflection_client.cc new file mode 100644 index 00000000000..fb406275148 --- /dev/null +++ b/test/cpp/util/reflection_debug/reflection_client.cc @@ -0,0 +1,216 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include "proto_reflection_descriptor_database.h" +// #include "reflection.grpc.pb.h" + +using grpc::Channel; +using grpc::ClientContext; +using grpc::Status; +using grpc::ProtoReflectionDescriptorDatabase; +using grpc::reflection::v1alpha::ServerReflection; +using grpc::reflection::v1alpha::EmptyRequest; +using grpc::reflection::v1alpha::ListServiceResponse; +using google::protobuf::FileDescriptorProto; +using google::protobuf::DescriptorPool; +using google::protobuf::ServiceDescriptor; +using google::protobuf::MethodDescriptor; +using google::protobuf::Descriptor; +using google::protobuf::FieldDescriptor; + +class ReflectionClient { + public: + ReflectionClient(std::shared_ptr channel) + : db_(new ProtoReflectionDescriptorDatabase( + ServerReflection::NewStub(channel))), + desc_pool_(new DescriptorPool(db_.get())) {} + + void PrintInfo() { + EmptyRequest request; + ListServiceResponse response; + ClientContext context; + Status status = db_->stub()->ListService(&context, request, &response); + if (status.ok()) { + std::string padding = ""; + std::cout << "Service amount:" << response.services_size() << std::endl; + for (int i = 0; i < response.services_size(); ++i) { + if (i != response.services_size() - 1) { + std::cout << padding << "│ " << std::endl; + std::cout << padding << "├─" << response.services(i) << std::endl; + PrintService(desc_pool_->FindServiceByName(response.services(i)), + padding + "│ "); + } else { + std::cout << padding << "│ " << std::endl; + std::cout << padding << "└─" << response.services(i) << std::endl; + PrintService(desc_pool_->FindServiceByName(response.services(i)), + padding + " "); + } + } + } else { + std::cout << status.error_message(); + } + } + + void PrintService(const ServiceDescriptor* service_desc, + const std::string padding) { + if (service_desc != nullptr) { + std::cout << padding << "│ Method amount:" << service_desc->method_count() + << std::endl; + for (int i = 0; i < service_desc->method_count(); ++i) { + if (i != service_desc->method_count() - 1) { + std::cout << padding << "├─" << service_desc->method(i)->name() + << std::endl; + PrintMethod(service_desc->method(i), padding + "│ "); + } else { + std::cout << padding << "└─" << service_desc->method(i)->name() + << std::endl; + PrintMethod(service_desc->method(i), padding + " "); + } + } + } + } + + void PrintMethod(const MethodDescriptor* method_desc, + const std::string padding) { + if (method_desc != nullptr) { + std::cout << padding + << "├─input type: " << method_desc->input_type()->name() + << std::endl; + PrintMessageType(method_desc->input_type(), padding + "│ "); + std::cout << padding + << "└─output type: " << method_desc->output_type()->name() + << std::endl; + PrintMessageType(method_desc->output_type(), padding + " "); + } + } + + void PrintMessageType(const Descriptor* type_desc, + const std::string padding) { + if (type_desc != nullptr) { + if (type_desc->field_count() > 0) { + std::cout << padding << "│ Field amount:" << type_desc->field_count() + << std::endl; + } + for (int i = 0; i < type_desc->field_count(); ++i) { + if (i != type_desc->field_count() - 1) { + const FieldDescriptor* field = type_desc->field(i); + std::cout << padding << "├─ " << std::left << std::setw(15) + << kLabelToName[field->label()] << std::setw(30) + << " name: " + field->name() << std::setw(50) + << " type: " + + (field->type() == FieldDescriptor::Type::TYPE_MESSAGE + ? field->message_type()->name() + : field->type_name()) + << std::endl; + } else { + const FieldDescriptor* field = type_desc->field(i); + std::cout << padding << "└─ " << std::left << std::setw(15) + << kLabelToName[field->label()] << std::setw(30) + << " name: " + field->name() << std::setw(50) + << " type: " + + (field->type() == FieldDescriptor::Type::TYPE_MESSAGE + ? field->message_type()->name() + : field->type_name()) + << std::endl; + } + } + } + } + + void Test() { + { + FileDescriptorProto output; + bool found = db_->FindFileByName("helloworld.proto", &output); + if (found) std::cout << output.name() << std::endl; + } + { + FileDescriptorProto output; + bool found = + db_->FindFileContainingSymbol("helloworld.Greeter.SayHello", &output); + if (found) std::cout << output.name() << std::endl; + } + { + FileDescriptorProto output; + bool found = db_->FindFileContainingExtension( + "helloworld.Greeter.HelloRequest", 1, &output); + found = db_->FindFileContainingExtension( + "helloworld.Greeter.HelloRequest", 1, &output); + if (found) std::cout << output.name() << std::endl; + } + DescriptorPool pool(db_.get()); + std::cout << pool.FindServiceByName("helloworld.Greeter")->name() + << std::endl; + } + + private: + const char* const kLabelToName[FieldDescriptor::Label::MAX_LABEL + 1] = { + "ERROR", // 0 is reserved for errors + + "optional", // LABEL_OPTIONAL + "required", // LABEL_REQUIRED + "repeated", // LABEL_REPEATED + }; + + std::unique_ptr db_; + std::unique_ptr desc_pool_; +}; + +int main(int argc, char** argv) { + int port = 50051; + if (argc == 2) { + try { + port = std::stoi(argv[1]); + if (port > 65535 || port < 1024) { + throw std::out_of_range("Port number out of range."); + } + } catch (std::invalid_argument&) { + } catch (std::out_of_range&) { + } + } + + ReflectionClient reflection_client(grpc::CreateChannel( + "localhost:" + std::to_string(port), grpc::InsecureChannelCredentials())); + + reflection_client.PrintInfo(); + + return 0; +} diff --git a/tools/codegen/extensions/gen_reflection_proto.sh b/tools/codegen/extensions/gen_reflection_proto.sh new file mode 100755 index 00000000000..f0bb6e5ccc6 --- /dev/null +++ b/tools/codegen/extensions/gen_reflection_proto.sh @@ -0,0 +1,33 @@ +#!/bin/bash +PROTO_DIR="src/proto/grpc/reflection/v1alpha" +PROTO_FILE="reflection" +HEADER_DIR="extensions/include/grpc++/impl" +SRC_DIR="extensions/reflection" +INCLUDE_DIR="grpc++/impl" +TMP_DIR="tmp" +GRPC_PLUGIN="bins/opt/grpc_cpp_plugin" +PROTOC=protoc + +set -e + +TMP_DIR=${TMP_DIR}_${PROTO_FILE} + +cd $(dirname $0)/../../.. + +[ ! -d $HEADER_DIR ] && mkdir -p $HEADER_DIR || : +[ ! -d $SRC_DIR ] && mkdir -p $SRC_DIR || : +[ ! -d $TMP_DIR ] && mkdir -p $TMP_DIR || : + +$PROTOC -I$PROTO_DIR --cpp_out=$TMP_DIR ${PROTO_DIR}/${PROTO_FILE}.proto +$PROTOC -I$PROTO_DIR --grpc_out=$TMP_DIR --plugin=protoc-gen-grpc=${GRPC_PLUGIN} ${PROTO_DIR}/${PROTO_FILE}.proto + +sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.pb.cc +sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc +sed -i "s/\"${PROTO_FILE}.grpc.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.grpc.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc +sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.h + +/bin/mv ${TMP_DIR}/${PROTO_FILE}.pb.h ${HEADER_DIR} +/bin/mv ${TMP_DIR}/${PROTO_FILE}.grpc.pb.h ${HEADER_DIR} +/bin/mv ${TMP_DIR}/${PROTO_FILE}.pb.cc ${SRC_DIR} +/bin/mv ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc ${SRC_DIR} +/bin/rm -r $TMP_DIR diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index f546f3b9950..e87f9099a59 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -2551,6 +2551,26 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "grpc", + "grpc++", + "grpc++_reflection" + ], + "headers": [ + "test/cpp/util/proto_reflection_descriptor_database.h" + ], + "language": "c++", + "name": "reflection_debug_test", + "src": [ + "test/cpp/util/proto_reflection_descriptor_database.cc", + "test/cpp/util/proto_reflection_descriptor_database.h", + "test/cpp/util/reflection_debug/reflection_client.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -4311,6 +4331,29 @@ "third_party": false, "type": "lib" }, + { + "deps": [], + "headers": [ + "extensions/include/grpc++/impl/proto_server_reflection_plugin.h", + "extensions/include/grpc++/impl/reflection.grpc.pb.h", + "extensions/include/grpc++/impl/reflection.pb.h", + "extensions/reflection/proto_server_reflection.h" + ], + "language": "c++", + "name": "grpc++_reflection", + "src": [ + "extensions/include/grpc++/impl/proto_server_reflection_plugin.h", + "extensions/include/grpc++/impl/reflection.grpc.pb.h", + "extensions/include/grpc++/impl/reflection.pb.h", + "extensions/reflection/proto_server_reflection.cc", + "extensions/reflection/proto_server_reflection.h", + "extensions/reflection/proto_server_reflection_plugin.cc", + "extensions/reflection/reflection.grpc.pb.cc", + "extensions/reflection/reflection.pb.cc" + ], + "third_party": false, + "type": "lib" + }, { "deps": [], "headers": [ diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index cf1154426f4..e24542d5fe7 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -2408,6 +2408,27 @@ "posix" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "gtest": false, + "language": "c++", + "name": "reflection_debug_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/grpc.sln b/vsprojects/grpc.sln index 029c9ed7c1d..dcb5e212fa0 100644 --- a/vsprojects/grpc.sln +++ b/vsprojects/grpc.sln @@ -93,6 +93,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++", "vcxproj\.\grpc++\ {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_reflection", "vcxproj\.\grpc++_reflection\grpc++_reflection.vcxproj", "{5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}" + ProjectSection(myProperties) = preProject + lib = "True" + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_unsecure", "vcxproj\.\grpc++_unsecure\grpc++_unsecure.vcxproj", "{6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}" ProjectSection(myProperties) = preProject lib = "True" @@ -343,6 +348,22 @@ Global {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|Win32.Build.0 = Release-DLL|Win32 {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|x64.ActiveCfg = Release-DLL|x64 {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|x64.Build.0 = Release-DLL|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug|Win32.ActiveCfg = Debug|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug|x64.ActiveCfg = Debug|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release|Win32.ActiveCfg = Release|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release|x64.ActiveCfg = Release|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug|Win32.Build.0 = Debug|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug|x64.Build.0 = Debug|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release|Win32.Build.0 = Release|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release|x64.Build.0 = Release|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Debug-DLL|x64.Build.0 = Debug|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release-DLL|Win32.Build.0 = Release|Win32 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release-DLL|x64.ActiveCfg = Release|x64 + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB}.Release-DLL|x64.Build.0 = Release|x64 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Debug|Win32.ActiveCfg = Debug|Win32 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Debug|x64.ActiveCfg = Debug|x64 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj new file mode 100644 index 00000000000..82b2b85f9eb --- /dev/null +++ b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + grpc++_reflection + + + grpc++_reflection + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Windows + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Windows + true + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + diff --git a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters new file mode 100644 index 00000000000..a5457bed008 --- /dev/null +++ b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters @@ -0,0 +1,52 @@ + + + + + extensions\reflection + + + extensions\reflection + + + extensions\reflection + + + extensions\reflection + + + + + extensions\include\grpc++\impl + + + extensions\include\grpc++\impl + + + extensions\include\grpc++\impl + + + + + extensions\reflection + + + + + + {8fd45ce8-8f02-367f-e3f7-4c0ae0e36566} + + + {1a18dfcc-bedf-226e-6929-377aba53249b} + + + {83bf0cce-01da-a93c-0ff3-a1abca63ec5f} + + + {d34e8821-f67b-a793-3419-e2781ab9b3ee} + + + {11feb184-a1d9-5485-26f0-538ddb50deff} + + + + diff --git a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj b/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj new file mode 100644 index 00000000000..757e1cd5358 --- /dev/null +++ b/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj @@ -0,0 +1,206 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {037B9EA1-03CC-6A3B-4E4B-DB17C3D59CF8} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + reflection_debug_test + static + Debug + static + Debug + + + reflection_debug_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + + + + + + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB} + + + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters b/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters new file mode 100644 index 00000000000..6258acedcc0 --- /dev/null +++ b/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters @@ -0,0 +1,32 @@ + + + + + test\cpp\util + + + test\cpp\util\reflection_debug + + + + + test\cpp\util + + + + + + {fdf7e642-420d-9e18-7a3c-19dca964f218} + + + {562b3927-e256-190d-ab72-6b4b04ffb8b2} + + + {8ed08be4-a27c-d51c-d587-a02cf3dc5abc} + + + {b84b1385-e0b2-239b-bac2-81a16bc90249} + + + + From 0333a49afa63e47eb66445243fe9d1e7d3fa68f4 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 4 May 2016 19:14:10 -0700 Subject: [PATCH 007/175] Use stream rpc to ensure all related requests go to a single server. --- .../include/grpc++/impl/reflection.grpc.pb.h | 579 +-- .../include/grpc++/impl/reflection.pb.h | 1834 ++++++--- .../reflection/proto_server_reflection.cc | 89 +- .../reflection/proto_server_reflection.h | 35 +- extensions/reflection/reflection.grpc.pb.cc | 256 +- extensions/reflection/reflection.pb.cc | 3535 +++++++++++------ .../grpc/reflection/v1alpha/reflection.proto | 141 +- .../proto_reflection_descriptor_database.cc | 250 +- .../proto_reflection_descriptor_database.h | 11 +- .../reflection_debug/reflection_client.cc | 45 +- .../extensions/gen_reflection_proto.sh | 42 +- 11 files changed, 4029 insertions(+), 2788 deletions(-) diff --git a/extensions/include/grpc++/impl/reflection.grpc.pb.h b/extensions/include/grpc++/impl/reflection.grpc.pb.h index f6009296366..7c6e7b2b78a 100644 --- a/extensions/include/grpc++/impl/reflection.grpc.pb.h +++ b/extensions/include/grpc++/impl/reflection.grpc.pb.h @@ -1,6 +1,72 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + // Generated by the gRPC protobuf plugin. // If you make any local change, they will be lost. // source: reflection.proto +// Original file comments: +// Copyright 2016, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Service exported by server reflection +// #ifndef GRPC_reflection_2eproto__INCLUDED #define GRPC_reflection_2eproto__INCLUDED @@ -32,516 +98,78 @@ class ServerReflection GRPC_FINAL { class StubInterface { public: virtual ~StubInterface() {} - virtual ::grpc::Status ListService( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::reflection::v1alpha::ListServiceResponse* response) = 0; - std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::ListServiceResponse>> - AsyncListService(::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::ListServiceResponse>>( - AsyncListServiceRaw(context, request, cq)); - } - virtual ::grpc::Status GetFileByName( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) = 0; - std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> - AsyncGetFileByName( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( - AsyncGetFileByNameRaw(context, request, cq)); - } - virtual ::grpc::Status GetFileContainingSymbol( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) = 0; - std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> - AsyncGetFileContainingSymbol( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( - AsyncGetFileContainingSymbolRaw(context, request, cq)); + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> DescriptorDatabaseInfo(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(DescriptorDatabaseInfoRaw(context)); } - virtual ::grpc::Status GetFileContainingExtension( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) = 0; - std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> - AsyncGetFileContainingExtension( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( - AsyncGetFileContainingExtensionRaw(context, request, cq)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> AsyncDescriptorDatabaseInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(AsyncDescriptorDatabaseInfoRaw(context, cq, tag)); } - virtual ::grpc::Status GetAllExtensionNumbers( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) = 0; - std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>> - AsyncGetAllExtensionNumbers( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>>( - AsyncGetAllExtensionNumbersRaw(context, request, cq)); - } - - private: - virtual ::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::ListServiceResponse>* - AsyncListServiceRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* - AsyncGetFileByNameRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* - AsyncGetFileContainingSymbolRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* - AsyncGetFileContainingExtensionRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::CompletionQueue* cq) = 0; - virtual ::grpc::ClientAsyncResponseReaderInterface< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>* - AsyncGetAllExtensionNumbersRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::CompletionQueue* cq) = 0; + private: + virtual ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* DescriptorDatabaseInfoRaw(::grpc::ClientContext* context) = 0; + virtual ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* AsyncDescriptorDatabaseInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0; }; class Stub GRPC_FINAL : public StubInterface { public: - Stub(const std::shared_ptr<::grpc::ChannelInterface>& channel); - ::grpc::Status ListService( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::reflection::v1alpha::ListServiceResponse* response) - GRPC_OVERRIDE; - std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ListServiceResponse>> - AsyncListService(::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ListServiceResponse>>( - AsyncListServiceRaw(context, request, cq)); + Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); + std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> DescriptorDatabaseInfo(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(DescriptorDatabaseInfoRaw(context)); } - ::grpc::Status GetFileByName( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_OVERRIDE; - std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> - AsyncGetFileByName( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( - AsyncGetFileByNameRaw(context, request, cq)); - } - ::grpc::Status GetFileContainingSymbol( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_OVERRIDE; - std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> - AsyncGetFileContainingSymbol( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( - AsyncGetFileContainingSymbolRaw(context, request, cq)); - } - ::grpc::Status GetFileContainingExtension( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_OVERRIDE; - std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>> - AsyncGetFileContainingExtension( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>>( - AsyncGetFileContainingExtensionRaw(context, request, cq)); - } - ::grpc::Status GetAllExtensionNumbers( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) - GRPC_OVERRIDE; - std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>> - AsyncGetAllExtensionNumbers( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::CompletionQueue* cq) { - return std::unique_ptr<::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>>( - AsyncGetAllExtensionNumbersRaw(context, request, cq)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> AsyncDescriptorDatabaseInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(AsyncDescriptorDatabaseInfoRaw(context, cq, tag)); } private: - std::shared_ptr<::grpc::ChannelInterface> channel_; - ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ListServiceResponse>* - AsyncListServiceRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; - ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* - AsyncGetFileByNameRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; - ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* - AsyncGetFileContainingSymbolRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; - ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* - AsyncGetFileContainingExtensionRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; - ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>* - AsyncGetAllExtensionNumbersRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; - const ::grpc::RpcMethod rpcmethod_ListService_; - const ::grpc::RpcMethod rpcmethod_GetFileByName_; - const ::grpc::RpcMethod rpcmethod_GetFileContainingSymbol_; - const ::grpc::RpcMethod rpcmethod_GetFileContainingExtension_; - const ::grpc::RpcMethod rpcmethod_GetAllExtensionNumbers_; + std::shared_ptr< ::grpc::ChannelInterface> channel_; + ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* DescriptorDatabaseInfoRaw(::grpc::ClientContext* context) GRPC_OVERRIDE; + ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* AsyncDescriptorDatabaseInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE; + const ::grpc::RpcMethod rpcmethod_DescriptorDatabaseInfo_; }; - static std::unique_ptr NewStub( - const std::shared_ptr<::grpc::ChannelInterface>& channel, - const ::grpc::StubOptions& options = ::grpc::StubOptions()); + static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); class Service : public ::grpc::Service { public: Service(); virtual ~Service(); - virtual ::grpc::Status ListService( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest* request, - ::grpc::reflection::v1alpha::ListServiceResponse* response); - virtual ::grpc::Status GetFileByName( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response); - virtual ::grpc::Status GetFileContainingSymbol( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response); - virtual ::grpc::Status GetFileContainingExtension( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response); - virtual ::grpc::Status GetAllExtensionNumbers( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::TypeRequest* request, - ::grpc::reflection::v1alpha::ExtensionNumberResponse* response); + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + virtual ::grpc::Status DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream); }; template - class WithAsyncMethod_ListService : public BaseClass { + class WithAsyncMethod_DescriptorDatabaseInfo : public BaseClass { private: - void BaseClassMustBeDerivedFromService(Service* service) {} - + void BaseClassMustBeDerivedFromService(const Service *service) {} public: - WithAsyncMethod_ListService() { ::grpc::Service::MarkMethodAsync(0); } - ~WithAsyncMethod_ListService() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status ListService( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest* request, - ::grpc::reflection::v1alpha::ListServiceResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); + WithAsyncMethod_DescriptorDatabaseInfo() { + ::grpc::Service::MarkMethodAsync(0); } - void RequestListService( - ::grpc::ServerContext* context, - ::grpc::reflection::v1alpha::EmptyRequest* request, - ::grpc::ServerAsyncResponseWriter< - ::grpc::reflection::v1alpha::ListServiceResponse>* response, - ::grpc::CompletionQueue* new_call_cq, - ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(0, context, request, response, - new_call_cq, notification_cq, tag); - } - }; - template - class WithAsyncMethod_GetFileByName : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithAsyncMethod_GetFileByName() { ::grpc::Service::MarkMethodAsync(1); } - ~WithAsyncMethod_GetFileByName() GRPC_OVERRIDE { + ~WithAsyncMethod_DescriptorDatabaseInfo() GRPC_OVERRIDE { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status GetFileByName( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestGetFileByName( - ::grpc::ServerContext* context, - ::grpc::reflection::v1alpha::FileNameRequest* request, - ::grpc::ServerAsyncResponseWriter< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* response, - ::grpc::CompletionQueue* new_call_cq, - ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(1, context, request, response, - new_call_cq, notification_cq, tag); + void RequestDescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + ::grpc::Service::RequestAsyncBidiStreaming(0, context, stream, new_call_cq, notification_cq, tag); } }; + typedef WithAsyncMethod_DescriptorDatabaseInfo AsyncService; template - class WithAsyncMethod_GetFileContainingSymbol : public BaseClass { + class WithGenericMethod_DescriptorDatabaseInfo : public BaseClass { private: - void BaseClassMustBeDerivedFromService(Service* service) {} - + void BaseClassMustBeDerivedFromService(const Service *service) {} public: - WithAsyncMethod_GetFileContainingSymbol() { - ::grpc::Service::MarkMethodAsync(2); + WithGenericMethod_DescriptorDatabaseInfo() { + ::grpc::Service::MarkMethodGeneric(0); } - ~WithAsyncMethod_GetFileContainingSymbol() GRPC_OVERRIDE { + ~WithGenericMethod_DescriptorDatabaseInfo() GRPC_OVERRIDE { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status GetFileContainingSymbol( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - void RequestGetFileContainingSymbol( - ::grpc::ServerContext* context, - ::grpc::reflection::v1alpha::SymbolRequest* request, - ::grpc::ServerAsyncResponseWriter< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* response, - ::grpc::CompletionQueue* new_call_cq, - ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(2, context, request, response, - new_call_cq, notification_cq, tag); - } - }; - template - class WithAsyncMethod_GetFileContainingExtension : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithAsyncMethod_GetFileContainingExtension() { - ::grpc::Service::MarkMethodAsync(3); - } - ~WithAsyncMethod_GetFileContainingExtension() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status GetFileContainingExtension( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - void RequestGetFileContainingExtension( - ::grpc::ServerContext* context, - ::grpc::reflection::v1alpha::ExtensionRequest* request, - ::grpc::ServerAsyncResponseWriter< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* response, - ::grpc::CompletionQueue* new_call_cq, - ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(3, context, request, response, - new_call_cq, notification_cq, tag); - } - }; - template - class WithAsyncMethod_GetAllExtensionNumbers : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithAsyncMethod_GetAllExtensionNumbers() { - ::grpc::Service::MarkMethodAsync(4); - } - ~WithAsyncMethod_GetAllExtensionNumbers() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status GetAllExtensionNumbers( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::TypeRequest* request, - ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - void RequestGetAllExtensionNumbers( - ::grpc::ServerContext* context, - ::grpc::reflection::v1alpha::TypeRequest* request, - ::grpc::ServerAsyncResponseWriter< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>* response, - ::grpc::CompletionQueue* new_call_cq, - ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - ::grpc::Service::RequestAsyncUnary(4, context, request, response, - new_call_cq, notification_cq, tag); - } - }; - typedef WithAsyncMethod_ListService< - WithAsyncMethod_GetFileByName>>>> - AsyncService; - template - class WithGenericMethod_ListService : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithGenericMethod_ListService() { ::grpc::Service::MarkMethodGeneric(0); } - ~WithGenericMethod_ListService() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status ListService( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest* request, - ::grpc::reflection::v1alpha::ListServiceResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - }; - template - class WithGenericMethod_GetFileByName : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithGenericMethod_GetFileByName() { ::grpc::Service::MarkMethodGeneric(1); } - ~WithGenericMethod_GetFileByName() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status GetFileByName( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - }; - template - class WithGenericMethod_GetFileContainingSymbol : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithGenericMethod_GetFileContainingSymbol() { - ::grpc::Service::MarkMethodGeneric(2); - } - ~WithGenericMethod_GetFileContainingSymbol() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status GetFileContainingSymbol( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - }; - template - class WithGenericMethod_GetFileContainingExtension : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithGenericMethod_GetFileContainingExtension() { - ::grpc::Service::MarkMethodGeneric(3); - } - ~WithGenericMethod_GetFileContainingExtension() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status GetFileContainingExtension( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) - GRPC_FINAL GRPC_OVERRIDE { - abort(); - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); - } - }; - template - class WithGenericMethod_GetAllExtensionNumbers : public BaseClass { - private: - void BaseClassMustBeDerivedFromService(Service* service) {} - - public: - WithGenericMethod_GetAllExtensionNumbers() { - ::grpc::Service::MarkMethodGeneric(4); - } - ~WithGenericMethod_GetAllExtensionNumbers() GRPC_OVERRIDE { - BaseClassMustBeDerivedFromService(this); - } - // disable synchronous version of this method - ::grpc::Status GetAllExtensionNumbers( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::TypeRequest* request, - ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) - GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } @@ -552,4 +180,5 @@ class ServerReflection GRPC_FINAL { } // namespace reflection } // namespace grpc + #endif // GRPC_reflection_2eproto__INCLUDED diff --git a/extensions/include/grpc++/impl/reflection.pb.h b/extensions/include/grpc++/impl/reflection.pb.h index b054e28de97..3b1f0a11a2c 100644 --- a/extensions/include/grpc++/impl/reflection.pb.h +++ b/extensions/include/grpc++/impl/reflection.pb.h @@ -1,3 +1,37 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + // Generated by the protocol buffer compiler. DO NOT EDIT! // source: reflection.proto @@ -21,11 +55,11 @@ #include #include -#include #include -#include #include +#include #include +#include #include // @@protoc_insertion_point(includes) @@ -38,116 +72,50 @@ void protobuf_AddDesc_reflection_2eproto(); void protobuf_AssignDesc_reflection_2eproto(); void protobuf_ShutdownFile_reflection_2eproto(); -class EmptyRequest; +class DescriptorDatabaseRequest; +class DescriptorDatabaseResponse; +class ErrorResponse; class ExtensionNumberResponse; class ExtensionRequest; -class FileDescriptorProtoResponse; -class FileNameRequest; class ListServiceResponse; -class SymbolRequest; -class TypeRequest; // =================================================================== -class EmptyRequest : public ::google::protobuf::Message { +class DescriptorDatabaseRequest : public ::google::protobuf::Message { public: - EmptyRequest(); - virtual ~EmptyRequest(); + DescriptorDatabaseRequest(); + virtual ~DescriptorDatabaseRequest(); - EmptyRequest(const EmptyRequest& from); + DescriptorDatabaseRequest(const DescriptorDatabaseRequest& from); - inline EmptyRequest& operator=(const EmptyRequest& from) { + inline DescriptorDatabaseRequest& operator=(const DescriptorDatabaseRequest& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); - static const EmptyRequest& default_instance(); - - void Swap(EmptyRequest* other); - - // implements Message ---------------------------------------------- - - inline EmptyRequest* New() const { return New(NULL); } - - EmptyRequest* New(::google::protobuf::Arena* arena) const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const EmptyRequest& from); - void MergeFrom(const EmptyRequest& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - - private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(EmptyRequest* other); - - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return _internal_metadata_.arena(); - } - inline void* MaybeArenaPtr() const { - return _internal_metadata_.raw_arena_ptr(); - } - - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.EmptyRequest) - private: - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; - mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); - friend void protobuf_AssignDesc_reflection_2eproto(); - friend void protobuf_ShutdownFile_reflection_2eproto(); - - void InitAsDefaultInstance(); - static EmptyRequest* default_instance_; -}; -// ------------------------------------------------------------------- - -class FileNameRequest : public ::google::protobuf::Message { - public: - FileNameRequest(); - virtual ~FileNameRequest(); - - FileNameRequest(const FileNameRequest& from); + static const DescriptorDatabaseRequest& default_instance(); - inline FileNameRequest& operator=(const FileNameRequest& from) { - CopyFrom(from); - return *this; - } + enum MessageRequestCase { + kFileByFilename = 3, + kFileContainingSymbol = 4, + kFileContainingExtension = 5, + kAllExtensionNumbersOfType = 6, + kListServices = 7, + MESSAGE_REQUEST_NOT_SET = 0, + }; - static const ::google::protobuf::Descriptor* descriptor(); - static const FileNameRequest& default_instance(); - - void Swap(FileNameRequest* other); + void Swap(DescriptorDatabaseRequest* other); // implements Message ---------------------------------------------- - inline FileNameRequest* New() const { return New(NULL); } + inline DescriptorDatabaseRequest* New() const { return New(NULL); } - FileNameRequest* New(::google::protobuf::Arena* arena) const; + DescriptorDatabaseRequest* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const FileNameRequest& from); - void MergeFrom(const FileNameRequest& from); + void CopyFrom(const DescriptorDatabaseRequest& from); + void MergeFrom(const DescriptorDatabaseRequest& from); void Clear(); bool IsInitialized() const; @@ -156,139 +124,137 @@ class FileNameRequest : public ::google::protobuf::Message { ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } - - private: + private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; - void InternalSwap(FileNameRequest* other); - - private: + void InternalSwap(DescriptorDatabaseRequest* other); + private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } + public: - public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- - // optional string filename = 1; - void clear_filename(); - static const int kFilenameFieldNumber = 1; - const ::std::string& filename() const; - void set_filename(const ::std::string& value); - void set_filename(const char* value); - void set_filename(const char* value, size_t size); - ::std::string* mutable_filename(); - ::std::string* release_filename(); - void set_allocated_filename(::std::string* filename); - - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.FileNameRequest) - private: - ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; - bool _is_default_instance_; - ::google::protobuf::internal::ArenaStringPtr filename_; - mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); - friend void protobuf_AssignDesc_reflection_2eproto(); - friend void protobuf_ShutdownFile_reflection_2eproto(); - - void InitAsDefaultInstance(); - static FileNameRequest* default_instance_; -}; -// ------------------------------------------------------------------- - -class SymbolRequest : public ::google::protobuf::Message { - public: - SymbolRequest(); - virtual ~SymbolRequest(); - - SymbolRequest(const SymbolRequest& from); - - inline SymbolRequest& operator=(const SymbolRequest& from) { - CopyFrom(from); - return *this; - } - - static const ::google::protobuf::Descriptor* descriptor(); - static const SymbolRequest& default_instance(); - - void Swap(SymbolRequest* other); - - // implements Message ---------------------------------------------- - - inline SymbolRequest* New() const { return New(NULL); } - - SymbolRequest* New(::google::protobuf::Arena* arena) const; - void CopyFrom(const ::google::protobuf::Message& from); - void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const SymbolRequest& from); - void MergeFrom(const SymbolRequest& from); - void Clear(); - bool IsInitialized() const; - - int ByteSize() const; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input); - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; - int GetCachedSize() const { return _cached_size_; } - + // optional string host = 1; + void clear_host(); + static const int kHostFieldNumber = 1; + const ::std::string& host() const; + void set_host(const ::std::string& value); + void set_host(const char* value); + void set_host(const char* value, size_t size); + ::std::string* mutable_host(); + ::std::string* release_host(); + void set_allocated_host(::std::string* host); + + // optional string file_by_filename = 3; + private: + bool has_file_by_filename() const; + public: + void clear_file_by_filename(); + static const int kFileByFilenameFieldNumber = 3; + const ::std::string& file_by_filename() const; + void set_file_by_filename(const ::std::string& value); + void set_file_by_filename(const char* value); + void set_file_by_filename(const char* value, size_t size); + ::std::string* mutable_file_by_filename(); + ::std::string* release_file_by_filename(); + void set_allocated_file_by_filename(::std::string* file_by_filename); + + // optional string file_containing_symbol = 4; + private: + bool has_file_containing_symbol() const; + public: + void clear_file_containing_symbol(); + static const int kFileContainingSymbolFieldNumber = 4; + const ::std::string& file_containing_symbol() const; + void set_file_containing_symbol(const ::std::string& value); + void set_file_containing_symbol(const char* value); + void set_file_containing_symbol(const char* value, size_t size); + ::std::string* mutable_file_containing_symbol(); + ::std::string* release_file_containing_symbol(); + void set_allocated_file_containing_symbol(::std::string* file_containing_symbol); + + // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; + bool has_file_containing_extension() const; + void clear_file_containing_extension(); + static const int kFileContainingExtensionFieldNumber = 5; + const ::grpc::reflection::v1alpha::ExtensionRequest& file_containing_extension() const; + ::grpc::reflection::v1alpha::ExtensionRequest* mutable_file_containing_extension(); + ::grpc::reflection::v1alpha::ExtensionRequest* release_file_containing_extension(); + void set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension); + + // optional string all_extension_numbers_of_type = 6; + private: + bool has_all_extension_numbers_of_type() const; + public: + void clear_all_extension_numbers_of_type(); + static const int kAllExtensionNumbersOfTypeFieldNumber = 6; + const ::std::string& all_extension_numbers_of_type() const; + void set_all_extension_numbers_of_type(const ::std::string& value); + void set_all_extension_numbers_of_type(const char* value); + void set_all_extension_numbers_of_type(const char* value, size_t size); + ::std::string* mutable_all_extension_numbers_of_type(); + ::std::string* release_all_extension_numbers_of_type(); + void set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type); + + // optional string list_services = 7; + private: + bool has_list_services() const; + public: + void clear_list_services(); + static const int kListServicesFieldNumber = 7; + const ::std::string& list_services() const; + void set_list_services(const ::std::string& value); + void set_list_services(const char* value); + void set_list_services(const char* value, size_t size); + ::std::string* mutable_list_services(); + ::std::string* release_list_services(); + void set_allocated_list_services(::std::string* list_services); + + MessageRequestCase message_request_case() const; + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.DescriptorDatabaseRequest) private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(SymbolRequest* other); + inline void set_has_file_by_filename(); + inline void set_has_file_containing_symbol(); + inline void set_has_file_containing_extension(); + inline void set_has_all_extension_numbers_of_type(); + inline void set_has_list_services(); - private: - inline ::google::protobuf::Arena* GetArenaNoVirtual() const { - return _internal_metadata_.arena(); - } - inline void* MaybeArenaPtr() const { - return _internal_metadata_.raw_arena_ptr(); - } + inline bool has_message_request() const; + void clear_message_request(); + inline void clear_has_message_request(); - public: - ::google::protobuf::Metadata GetMetadata() const; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // optional string symbol = 1; - void clear_symbol(); - static const int kSymbolFieldNumber = 1; - const ::std::string& symbol() const; - void set_symbol(const ::std::string& value); - void set_symbol(const char* value); - void set_symbol(const char* value, size_t size); - ::std::string* mutable_symbol(); - ::std::string* release_symbol(); - void set_allocated_symbol(::std::string* symbol); - - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.SymbolRequest) - private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; - ::google::protobuf::internal::ArenaStringPtr symbol_; + ::google::protobuf::internal::ArenaStringPtr host_; + union MessageRequestUnion { + MessageRequestUnion() {} + ::google::protobuf::internal::ArenaStringPtr file_by_filename_; + ::google::protobuf::internal::ArenaStringPtr file_containing_symbol_; + ::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension_; + ::google::protobuf::internal::ArenaStringPtr all_extension_numbers_of_type_; + ::google::protobuf::internal::ArenaStringPtr list_services_; + } message_request_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + ::google::protobuf::uint32 _oneof_case_[1]; + + friend void protobuf_AddDesc_reflection_2eproto(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static SymbolRequest* default_instance_; + static DescriptorDatabaseRequest* default_instance_; }; // ------------------------------------------------------------------- @@ -326,25 +292,22 @@ class ExtensionRequest : public ::google::protobuf::Message { ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } - - private: + private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; void InternalSwap(ExtensionRequest* other); - - private: + private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } + public: - public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- @@ -370,12 +333,13 @@ class ExtensionRequest : public ::google::protobuf::Message { // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ExtensionRequest) private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; ::google::protobuf::internal::ArenaStringPtr containing_type_; ::google::protobuf::int32 extension_number_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AddDesc_reflection_2eproto(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); @@ -384,32 +348,40 @@ class ExtensionRequest : public ::google::protobuf::Message { }; // ------------------------------------------------------------------- -class TypeRequest : public ::google::protobuf::Message { +class DescriptorDatabaseResponse : public ::google::protobuf::Message { public: - TypeRequest(); - virtual ~TypeRequest(); + DescriptorDatabaseResponse(); + virtual ~DescriptorDatabaseResponse(); - TypeRequest(const TypeRequest& from); + DescriptorDatabaseResponse(const DescriptorDatabaseResponse& from); - inline TypeRequest& operator=(const TypeRequest& from) { + inline DescriptorDatabaseResponse& operator=(const DescriptorDatabaseResponse& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); - static const TypeRequest& default_instance(); + static const DescriptorDatabaseResponse& default_instance(); + + enum MessageResponseCase { + kFileDescriptorProto = 4, + kAllExtensionNumbersResponse = 5, + kListServicesResponse = 6, + kErrorResponse = 7, + MESSAGE_RESPONSE_NOT_SET = 0, + }; - void Swap(TypeRequest* other); + void Swap(DescriptorDatabaseResponse* other); // implements Message ---------------------------------------------- - inline TypeRequest* New() const { return New(NULL); } + inline DescriptorDatabaseResponse* New() const { return New(NULL); } - TypeRequest* New(::google::protobuf::Arena* arena) const; + DescriptorDatabaseResponse* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const TypeRequest& from); - void MergeFrom(const TypeRequest& from); + void CopyFrom(const DescriptorDatabaseResponse& from); + void MergeFrom(const DescriptorDatabaseResponse& from); void Clear(); bool IsInitialized() const; @@ -418,83 +390,150 @@ class TypeRequest : public ::google::protobuf::Message { ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } - - private: + private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; - void InternalSwap(TypeRequest* other); - - private: + void InternalSwap(DescriptorDatabaseResponse* other); + private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } + public: - public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- - // optional string type = 1; - void clear_type(); - static const int kTypeFieldNumber = 1; - const ::std::string& type() const; - void set_type(const ::std::string& value); - void set_type(const char* value); - void set_type(const char* value, size_t size); - ::std::string* mutable_type(); - ::std::string* release_type(); - void set_allocated_type(::std::string* type); - - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.TypeRequest) + // optional string valid_host = 1; + void clear_valid_host(); + static const int kValidHostFieldNumber = 1; + const ::std::string& valid_host() const; + void set_valid_host(const ::std::string& value); + void set_valid_host(const char* value); + void set_valid_host(const char* value, size_t size); + ::std::string* mutable_valid_host(); + ::std::string* release_valid_host(); + void set_allocated_valid_host(::std::string* valid_host); + + // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + bool has_original_request() const; + void clear_original_request(); + static const int kOriginalRequestFieldNumber = 2; + const ::grpc::reflection::v1alpha::DescriptorDatabaseRequest& original_request() const; + ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* mutable_original_request(); + ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* release_original_request(); + void set_allocated_original_request(::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request); + + // optional bytes file_descriptor_proto = 4; + private: + bool has_file_descriptor_proto() const; + public: + void clear_file_descriptor_proto(); + static const int kFileDescriptorProtoFieldNumber = 4; + const ::std::string& file_descriptor_proto() const; + void set_file_descriptor_proto(const ::std::string& value); + void set_file_descriptor_proto(const char* value); + void set_file_descriptor_proto(const void* value, size_t size); + ::std::string* mutable_file_descriptor_proto(); + ::std::string* release_file_descriptor_proto(); + void set_allocated_file_descriptor_proto(::std::string* file_descriptor_proto); + + // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; + bool has_all_extension_numbers_response() const; + void clear_all_extension_numbers_response(); + static const int kAllExtensionNumbersResponseFieldNumber = 5; + const ::grpc::reflection::v1alpha::ExtensionNumberResponse& all_extension_numbers_response() const; + ::grpc::reflection::v1alpha::ExtensionNumberResponse* mutable_all_extension_numbers_response(); + ::grpc::reflection::v1alpha::ExtensionNumberResponse* release_all_extension_numbers_response(); + void set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response); + + // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; + bool has_list_services_response() const; + void clear_list_services_response(); + static const int kListServicesResponseFieldNumber = 6; + const ::grpc::reflection::v1alpha::ListServiceResponse& list_services_response() const; + ::grpc::reflection::v1alpha::ListServiceResponse* mutable_list_services_response(); + ::grpc::reflection::v1alpha::ListServiceResponse* release_list_services_response(); + void set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response); + + // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; + bool has_error_response() const; + void clear_error_response(); + static const int kErrorResponseFieldNumber = 7; + const ::grpc::reflection::v1alpha::ErrorResponse& error_response() const; + ::grpc::reflection::v1alpha::ErrorResponse* mutable_error_response(); + ::grpc::reflection::v1alpha::ErrorResponse* release_error_response(); + void set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response); + + MessageResponseCase message_response_case() const; + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.DescriptorDatabaseResponse) private: + inline void set_has_file_descriptor_proto(); + inline void set_has_all_extension_numbers_response(); + inline void set_has_list_services_response(); + inline void set_has_error_response(); + + inline bool has_message_response() const; + void clear_message_response(); + inline void clear_has_message_response(); + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; - ::google::protobuf::internal::ArenaStringPtr type_; + ::google::protobuf::internal::ArenaStringPtr valid_host_; + ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request_; + union MessageResponseUnion { + MessageResponseUnion() {} + ::google::protobuf::internal::ArenaStringPtr file_descriptor_proto_; + ::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response_; + ::grpc::reflection::v1alpha::ListServiceResponse* list_services_response_; + ::grpc::reflection::v1alpha::ErrorResponse* error_response_; + } message_response_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + ::google::protobuf::uint32 _oneof_case_[1]; + + friend void protobuf_AddDesc_reflection_2eproto(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static TypeRequest* default_instance_; + static DescriptorDatabaseResponse* default_instance_; }; // ------------------------------------------------------------------- -class ListServiceResponse : public ::google::protobuf::Message { +class ExtensionNumberResponse : public ::google::protobuf::Message { public: - ListServiceResponse(); - virtual ~ListServiceResponse(); + ExtensionNumberResponse(); + virtual ~ExtensionNumberResponse(); - ListServiceResponse(const ListServiceResponse& from); + ExtensionNumberResponse(const ExtensionNumberResponse& from); - inline ListServiceResponse& operator=(const ListServiceResponse& from) { + inline ExtensionNumberResponse& operator=(const ExtensionNumberResponse& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); - static const ListServiceResponse& default_instance(); + static const ExtensionNumberResponse& default_instance(); - void Swap(ListServiceResponse* other); + void Swap(ExtensionNumberResponse* other); // implements Message ---------------------------------------------- - inline ListServiceResponse* New() const { return New(NULL); } + inline ExtensionNumberResponse* New() const { return New(NULL); } - ListServiceResponse* New(::google::protobuf::Arena* arena) const; + ExtensionNumberResponse* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const ListServiceResponse& from); - void MergeFrom(const ListServiceResponse& from); + void CopyFrom(const ExtensionNumberResponse& from); + void MergeFrom(const ExtensionNumberResponse& from); void Clear(); bool IsInitialized() const; @@ -503,89 +542,95 @@ class ListServiceResponse : public ::google::protobuf::Message { ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } - - private: + private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; - void InternalSwap(ListServiceResponse* other); - - private: + void InternalSwap(ExtensionNumberResponse* other); + private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } + public: - public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- - // repeated string services = 1; - int services_size() const; - void clear_services(); - static const int kServicesFieldNumber = 1; - const ::std::string& services(int index) const; - ::std::string* mutable_services(int index); - void set_services(int index, const ::std::string& value); - void set_services(int index, const char* value); - void set_services(int index, const char* value, size_t size); - ::std::string* add_services(); - void add_services(const ::std::string& value); - void add_services(const char* value); - void add_services(const char* value, size_t size); - const ::google::protobuf::RepeatedPtrField< ::std::string>& services() const; - ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_services(); + // optional string base_type_name = 1; + void clear_base_type_name(); + static const int kBaseTypeNameFieldNumber = 1; + const ::std::string& base_type_name() const; + void set_base_type_name(const ::std::string& value); + void set_base_type_name(const char* value); + void set_base_type_name(const char* value, size_t size); + ::std::string* mutable_base_type_name(); + ::std::string* release_base_type_name(); + void set_allocated_base_type_name(::std::string* base_type_name); + + // repeated int32 extension_number = 2; + int extension_number_size() const; + void clear_extension_number(); + static const int kExtensionNumberFieldNumber = 2; + ::google::protobuf::int32 extension_number(int index) const; + void set_extension_number(int index, ::google::protobuf::int32 value); + void add_extension_number(::google::protobuf::int32 value); + const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + extension_number() const; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_extension_number(); - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ListServiceResponse) + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ExtensionNumberResponse) private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; - ::google::protobuf::RepeatedPtrField< ::std::string> services_; + ::google::protobuf::internal::ArenaStringPtr base_type_name_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > extension_number_; + mutable int _extension_number_cached_byte_size_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AddDesc_reflection_2eproto(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ListServiceResponse* default_instance_; + static ExtensionNumberResponse* default_instance_; }; // ------------------------------------------------------------------- -class FileDescriptorProtoResponse : public ::google::protobuf::Message { +class ListServiceResponse : public ::google::protobuf::Message { public: - FileDescriptorProtoResponse(); - virtual ~FileDescriptorProtoResponse(); + ListServiceResponse(); + virtual ~ListServiceResponse(); - FileDescriptorProtoResponse(const FileDescriptorProtoResponse& from); + ListServiceResponse(const ListServiceResponse& from); - inline FileDescriptorProtoResponse& operator=( - const FileDescriptorProtoResponse& from) { + inline ListServiceResponse& operator=(const ListServiceResponse& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); - static const FileDescriptorProtoResponse& default_instance(); + static const ListServiceResponse& default_instance(); - void Swap(FileDescriptorProtoResponse* other); + void Swap(ListServiceResponse* other); // implements Message ---------------------------------------------- - inline FileDescriptorProtoResponse* New() const { return New(NULL); } + inline ListServiceResponse* New() const { return New(NULL); } - FileDescriptorProtoResponse* New(::google::protobuf::Arena* arena) const; + ListServiceResponse* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const FileDescriptorProtoResponse& from); - void MergeFrom(const FileDescriptorProtoResponse& from); + void CopyFrom(const ListServiceResponse& from); + void MergeFrom(const ListServiceResponse& from); void Clear(); bool IsInitialized() const; @@ -594,85 +639,86 @@ class FileDescriptorProtoResponse : public ::google::protobuf::Message { ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } - - private: + private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; - void InternalSwap(FileDescriptorProtoResponse* other); - - private: + void InternalSwap(ListServiceResponse* other); + private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } + public: - public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- - // optional bytes file_descriptor_proto = 1; - void clear_file_descriptor_proto(); - static const int kFileDescriptorProtoFieldNumber = 1; - const ::std::string& file_descriptor_proto() const; - void set_file_descriptor_proto(const ::std::string& value); - void set_file_descriptor_proto(const char* value); - void set_file_descriptor_proto(const void* value, size_t size); - ::std::string* mutable_file_descriptor_proto(); - ::std::string* release_file_descriptor_proto(); - void set_allocated_file_descriptor_proto( - ::std::string* file_descriptor_proto); + // repeated string service = 1; + int service_size() const; + void clear_service(); + static const int kServiceFieldNumber = 1; + const ::std::string& service(int index) const; + ::std::string* mutable_service(int index); + void set_service(int index, const ::std::string& value); + void set_service(int index, const char* value); + void set_service(int index, const char* value, size_t size); + ::std::string* add_service(); + void add_service(const ::std::string& value); + void add_service(const char* value); + void add_service(const char* value, size_t size); + const ::google::protobuf::RepeatedPtrField< ::std::string>& service() const; + ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_service(); - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ListServiceResponse) private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; - ::google::protobuf::internal::ArenaStringPtr file_descriptor_proto_; + ::google::protobuf::RepeatedPtrField< ::std::string> service_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AddDesc_reflection_2eproto(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static FileDescriptorProtoResponse* default_instance_; + static ListServiceResponse* default_instance_; }; // ------------------------------------------------------------------- -class ExtensionNumberResponse : public ::google::protobuf::Message { +class ErrorResponse : public ::google::protobuf::Message { public: - ExtensionNumberResponse(); - virtual ~ExtensionNumberResponse(); + ErrorResponse(); + virtual ~ErrorResponse(); - ExtensionNumberResponse(const ExtensionNumberResponse& from); + ErrorResponse(const ErrorResponse& from); - inline ExtensionNumberResponse& operator=( - const ExtensionNumberResponse& from) { + inline ErrorResponse& operator=(const ErrorResponse& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); - static const ExtensionNumberResponse& default_instance(); + static const ErrorResponse& default_instance(); - void Swap(ExtensionNumberResponse* other); + void Swap(ErrorResponse* other); // implements Message ---------------------------------------------- - inline ExtensionNumberResponse* New() const { return New(NULL); } + inline ErrorResponse* New() const { return New(NULL); } - ExtensionNumberResponse* New(::google::protobuf::Arena* arena) const; + ErrorResponse* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const ExtensionNumberResponse& from); - void MergeFrom(const ExtensionNumberResponse& from); + void CopyFrom(const ErrorResponse& from); + void MergeFrom(const ErrorResponse& from); void Clear(); bool IsInitialized() const; @@ -681,212 +727,531 @@ class ExtensionNumberResponse : public ::google::protobuf::Message { ::google::protobuf::io::CodedInputStream* input); void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const; - ::google::protobuf::uint8* SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; int GetCachedSize() const { return _cached_size_; } - - private: + private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; - void InternalSwap(ExtensionNumberResponse* other); - - private: + void InternalSwap(ErrorResponse* other); + private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); } inline void* MaybeArenaPtr() const { return _internal_metadata_.raw_arena_ptr(); } + public: - public: ::google::protobuf::Metadata GetMetadata() const; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- - // repeated int32 extension_number = 1; - int extension_number_size() const; - void clear_extension_number(); - static const int kExtensionNumberFieldNumber = 1; - ::google::protobuf::int32 extension_number(int index) const; - void set_extension_number(int index, ::google::protobuf::int32 value); - void add_extension_number(::google::protobuf::int32 value); - const ::google::protobuf::RepeatedField< ::google::protobuf::int32>& - extension_number() const; - ::google::protobuf::RepeatedField< ::google::protobuf::int32>* - mutable_extension_number(); - - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ExtensionNumberResponse) + // optional int32 error_code = 1; + void clear_error_code(); + static const int kErrorCodeFieldNumber = 1; + ::google::protobuf::int32 error_code() const; + void set_error_code(::google::protobuf::int32 value); + + // optional string error_message = 2; + void clear_error_message(); + static const int kErrorMessageFieldNumber = 2; + const ::std::string& error_message() const; + void set_error_message(const ::std::string& value); + void set_error_message(const char* value); + void set_error_message(const char* value, size_t size); + ::std::string* mutable_error_message(); + ::std::string* release_error_message(); + void set_allocated_error_message(::std::string* error_message); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ErrorResponse) private: + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; - ::google::protobuf::RepeatedField< ::google::protobuf::int32> - extension_number_; - mutable int _extension_number_cached_byte_size_; + ::google::protobuf::internal::ArenaStringPtr error_message_; + ::google::protobuf::int32 error_code_; mutable int _cached_size_; - friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AddDesc_reflection_2eproto(); friend void protobuf_AssignDesc_reflection_2eproto(); friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static ExtensionNumberResponse* default_instance_; + static ErrorResponse* default_instance_; }; // =================================================================== + // =================================================================== #if !PROTOBUF_INLINE_NOT_IN_HEADERS -// EmptyRequest +// DescriptorDatabaseRequest -// ------------------------------------------------------------------- - -// FileNameRequest - -// optional string filename = 1; -inline void FileNameRequest::clear_filename() { - filename_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +// optional string host = 1; +inline void DescriptorDatabaseRequest::clear_host() { + host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline const ::std::string& FileNameRequest::filename() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileNameRequest.filename) - return filename_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline const ::std::string& DescriptorDatabaseRequest::host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + return host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void FileNameRequest::set_filename(const ::std::string& value) { - filename_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileNameRequest.filename) +inline void DescriptorDatabaseRequest::set_host(const ::std::string& value) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) } -inline void FileNameRequest::set_filename(const char* value) { - filename_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileNameRequest.filename) +inline void DescriptorDatabaseRequest::set_host(const char* value) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) } -inline void FileNameRequest::set_filename(const char* value, size_t size) { - filename_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), +inline void DescriptorDatabaseRequest::set_host(const char* value, size_t size) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileNameRequest.filename) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) } -inline ::std::string* FileNameRequest::mutable_filename() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileNameRequest.filename) - return filename_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline ::std::string* DescriptorDatabaseRequest::mutable_host() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* FileNameRequest::release_filename() { - return filename_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline ::std::string* DescriptorDatabaseRequest::release_host() { + + return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void FileNameRequest::set_allocated_filename(::std::string* filename) { - if (filename != NULL) { +inline void DescriptorDatabaseRequest::set_allocated_host(::std::string* host) { + if (host != NULL) { + } else { + } - filename_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), filename); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileNameRequest.filename) + host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), host); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) } -// ------------------------------------------------------------------- +// optional string file_by_filename = 3; +inline bool DescriptorDatabaseRequest::has_file_by_filename() const { + return message_request_case() == kFileByFilename; +} +inline void DescriptorDatabaseRequest::set_has_file_by_filename() { + _oneof_case_[0] = kFileByFilename; +} +inline void DescriptorDatabaseRequest::clear_file_by_filename() { + if (has_file_by_filename()) { + message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} +inline const ::std::string& DescriptorDatabaseRequest::file_by_filename() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + if (has_file_by_filename()) { + return message_request_.file_by_filename_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void DescriptorDatabaseRequest::set_file_by_filename(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +} +inline void DescriptorDatabaseRequest::set_file_by_filename(const char* value) { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +} +inline void DescriptorDatabaseRequest::set_file_by_filename(const char* value, size_t size) { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +} +inline ::std::string* DescriptorDatabaseRequest::mutable_file_by_filename() { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* DescriptorDatabaseRequest::release_file_by_filename() { + if (has_file_by_filename()) { + clear_has_message_request(); + return message_request_.file_by_filename_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void DescriptorDatabaseRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { + if (!has_file_by_filename()) { + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (file_by_filename != NULL) { + set_has_file_by_filename(); + message_request_.file_by_filename_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_by_filename); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +} + +// optional string file_containing_symbol = 4; +inline bool DescriptorDatabaseRequest::has_file_containing_symbol() const { + return message_request_case() == kFileContainingSymbol; +} +inline void DescriptorDatabaseRequest::set_has_file_containing_symbol() { + _oneof_case_[0] = kFileContainingSymbol; +} +inline void DescriptorDatabaseRequest::clear_file_containing_symbol() { + if (has_file_containing_symbol()) { + message_request_.file_containing_symbol_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} +inline const ::std::string& DescriptorDatabaseRequest::file_containing_symbol() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + if (has_file_containing_symbol()) { + return message_request_.file_containing_symbol_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void DescriptorDatabaseRequest::set_file_containing_symbol(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +} +inline void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value) { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +} +inline void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value, size_t size) { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +} +inline ::std::string* DescriptorDatabaseRequest::mutable_file_containing_symbol() { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* DescriptorDatabaseRequest::release_file_containing_symbol() { + if (has_file_containing_symbol()) { + clear_has_message_request(); + return message_request_.file_containing_symbol_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void DescriptorDatabaseRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { + if (!has_file_containing_symbol()) { + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (file_containing_symbol != NULL) { + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_containing_symbol); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +} -// SymbolRequest +// optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; +inline bool DescriptorDatabaseRequest::has_file_containing_extension() const { + return message_request_case() == kFileContainingExtension; +} +inline void DescriptorDatabaseRequest::set_has_file_containing_extension() { + _oneof_case_[0] = kFileContainingExtension; +} +inline void DescriptorDatabaseRequest::clear_file_containing_extension() { + if (has_file_containing_extension()) { + delete message_request_.file_containing_extension_; + clear_has_message_request(); + } +} +inline const ::grpc::reflection::v1alpha::ExtensionRequest& DescriptorDatabaseRequest::file_containing_extension() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + return has_file_containing_extension() + ? *message_request_.file_containing_extension_ + : ::grpc::reflection::v1alpha::ExtensionRequest::default_instance(); +} +inline ::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::mutable_file_containing_extension() { + if (!has_file_containing_extension()) { + clear_message_request(); + set_has_file_containing_extension(); + message_request_.file_containing_extension_ = new ::grpc::reflection::v1alpha::ExtensionRequest; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + return message_request_.file_containing_extension_; +} +inline ::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::release_file_containing_extension() { + if (has_file_containing_extension()) { + clear_has_message_request(); + ::grpc::reflection::v1alpha::ExtensionRequest* temp = message_request_.file_containing_extension_; + message_request_.file_containing_extension_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void DescriptorDatabaseRequest::set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension) { + clear_message_request(); + if (file_containing_extension) { + set_has_file_containing_extension(); + message_request_.file_containing_extension_ = file_containing_extension; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) +} -// optional string symbol = 1; -inline void SymbolRequest::clear_symbol() { - symbol_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +// optional string all_extension_numbers_of_type = 6; +inline bool DescriptorDatabaseRequest::has_all_extension_numbers_of_type() const { + return message_request_case() == kAllExtensionNumbersOfType; +} +inline void DescriptorDatabaseRequest::set_has_all_extension_numbers_of_type() { + _oneof_case_[0] = kAllExtensionNumbersOfType; +} +inline void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { + if (has_all_extension_numbers_of_type()) { + message_request_.all_extension_numbers_of_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } } -inline const ::std::string& SymbolRequest::symbol() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.SymbolRequest.symbol) - return symbol_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline const ::std::string& DescriptorDatabaseRequest::all_extension_numbers_of_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + if (has_all_extension_numbers_of_type()) { + return message_request_.all_extension_numbers_of_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } -inline void SymbolRequest::set_symbol(const ::std::string& value) { - symbol_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.SymbolRequest.symbol) +inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) } -inline void SymbolRequest::set_symbol(const char* value) { - symbol_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), +inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value) { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.SymbolRequest.symbol) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) } -inline void SymbolRequest::set_symbol(const char* value, size_t size) { - symbol_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.SymbolRequest.symbol) +inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) +} +inline ::std::string* DescriptorDatabaseRequest::mutable_all_extension_numbers_of_type() { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* SymbolRequest::mutable_symbol() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.SymbolRequest.symbol) - return symbol_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline ::std::string* DescriptorDatabaseRequest::release_all_extension_numbers_of_type() { + if (has_all_extension_numbers_of_type()) { + clear_has_message_request(); + return message_request_.all_extension_numbers_of_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void DescriptorDatabaseRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { + if (!has_all_extension_numbers_of_type()) { + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (all_extension_numbers_of_type != NULL) { + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + all_extension_numbers_of_type); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) +} + +// optional string list_services = 7; +inline bool DescriptorDatabaseRequest::has_list_services() const { + return message_request_case() == kListServices; +} +inline void DescriptorDatabaseRequest::set_has_list_services() { + _oneof_case_[0] = kListServices; +} +inline void DescriptorDatabaseRequest::clear_list_services() { + if (has_list_services()) { + message_request_.list_services_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} +inline const ::std::string& DescriptorDatabaseRequest::list_services() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + if (has_list_services()) { + return message_request_.list_services_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void DescriptorDatabaseRequest::set_list_services(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) } -inline ::std::string* SymbolRequest::release_symbol() { - return symbol_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline void DescriptorDatabaseRequest::set_list_services(const char* value) { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) +} +inline void DescriptorDatabaseRequest::set_list_services(const char* value, size_t size) { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) } -inline void SymbolRequest::set_allocated_symbol(::std::string* symbol) { - if (symbol != NULL) { +inline ::std::string* DescriptorDatabaseRequest::mutable_list_services() { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* DescriptorDatabaseRequest::release_list_services() { + if (has_list_services()) { + clear_has_message_request(); + return message_request_.list_services_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } else { + return NULL; + } +} +inline void DescriptorDatabaseRequest::set_allocated_list_services(::std::string* list_services) { + if (!has_list_services()) { + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (list_services != NULL) { + set_has_list_services(); + message_request_.list_services_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + list_services); } - symbol_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), symbol); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.SymbolRequest.symbol) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) } +inline bool DescriptorDatabaseRequest::has_message_request() const { + return message_request_case() != MESSAGE_REQUEST_NOT_SET; +} +inline void DescriptorDatabaseRequest::clear_has_message_request() { + _oneof_case_[0] = MESSAGE_REQUEST_NOT_SET; +} +inline DescriptorDatabaseRequest::MessageRequestCase DescriptorDatabaseRequest::message_request_case() const { + return DescriptorDatabaseRequest::MessageRequestCase(_oneof_case_[0]); +} // ------------------------------------------------------------------- // ExtensionRequest // optional string containing_type = 1; inline void ExtensionRequest::clear_containing_type() { - containing_type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + containing_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline const ::std::string& ExtensionRequest::containing_type() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.containing_type) - return containing_type_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return containing_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline void ExtensionRequest::set_containing_type(const ::std::string& value) { - containing_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } inline void ExtensionRequest::set_containing_type(const char* value) { - containing_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } -inline void ExtensionRequest::set_containing_type(const char* value, - size_t size) { - containing_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), +inline void ExtensionRequest::set_containing_type(const char* value, size_t size) { + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } inline ::std::string* ExtensionRequest::mutable_containing_type() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionRequest.containing_type) - return containing_type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return containing_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ExtensionRequest::release_containing_type() { - return containing_type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + + return containing_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void ExtensionRequest::set_allocated_containing_type( - ::std::string* containing_type) { +inline void ExtensionRequest::set_allocated_containing_type(::std::string* containing_type) { if (containing_type != NULL) { + } else { + } - containing_type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - containing_type); + containing_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), containing_type); // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } @@ -898,215 +1263,523 @@ inline ::google::protobuf::int32 ExtensionRequest::extension_number() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.extension_number) return extension_number_; } -inline void ExtensionRequest::set_extension_number( - ::google::protobuf::int32 value) { +inline void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { + extension_number_ = value; // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.extension_number) } // ------------------------------------------------------------------- -// TypeRequest +// DescriptorDatabaseResponse -// optional string type = 1; -inline void TypeRequest::clear_type() { - type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +// optional string valid_host = 1; +inline void DescriptorDatabaseResponse::clear_valid_host() { + valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline const ::std::string& TypeRequest::type() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.TypeRequest.type) - return type_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline const ::std::string& DescriptorDatabaseResponse::valid_host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + return valid_host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void TypeRequest::set_type(const ::std::string& value) { - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.TypeRequest.type) +inline void DescriptorDatabaseResponse::set_valid_host(const ::std::string& value) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) } -inline void TypeRequest::set_type(const char* value) { - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.TypeRequest.type) +inline void DescriptorDatabaseResponse::set_valid_host(const char* value) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) } -inline void TypeRequest::set_type(const char* value, size_t size) { - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.TypeRequest.type) +inline void DescriptorDatabaseResponse::set_valid_host(const char* value, size_t size) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) } -inline ::std::string* TypeRequest::mutable_type() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.TypeRequest.type) - return type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline ::std::string* DescriptorDatabaseResponse::mutable_valid_host() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* TypeRequest::release_type() { - return type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline ::std::string* DescriptorDatabaseResponse::release_valid_host() { + + return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void TypeRequest::set_allocated_type(::std::string* type) { - if (type != NULL) { +inline void DescriptorDatabaseResponse::set_allocated_valid_host(::std::string* valid_host) { + if (valid_host != NULL) { + } else { + } - type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.TypeRequest.type) + valid_host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), valid_host); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) } -// ------------------------------------------------------------------- - -// ListServiceResponse +// optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; +inline bool DescriptorDatabaseResponse::has_original_request() const { + return !_is_default_instance_ && original_request_ != NULL; +} +inline void DescriptorDatabaseResponse::clear_original_request() { + if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; + original_request_ = NULL; +} +inline const ::grpc::reflection::v1alpha::DescriptorDatabaseRequest& DescriptorDatabaseResponse::original_request() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + return original_request_ != NULL ? *original_request_ : *default_instance_->original_request_; +} +inline ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::mutable_original_request() { + + if (original_request_ == NULL) { + original_request_ = new ::grpc::reflection::v1alpha::DescriptorDatabaseRequest; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + return original_request_; +} +inline ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::release_original_request() { + + ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* temp = original_request_; + original_request_ = NULL; + return temp; +} +inline void DescriptorDatabaseResponse::set_allocated_original_request(::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request) { + delete original_request_; + original_request_ = original_request; + if (original_request) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) +} -// repeated string services = 1; -inline int ListServiceResponse::services_size() const { - return services_.size(); +// optional bytes file_descriptor_proto = 4; +inline bool DescriptorDatabaseResponse::has_file_descriptor_proto() const { + return message_response_case() == kFileDescriptorProto; +} +inline void DescriptorDatabaseResponse::set_has_file_descriptor_proto() { + _oneof_case_[0] = kFileDescriptorProto; } -inline void ListServiceResponse::clear_services() { services_.Clear(); } -inline const ::std::string& ListServiceResponse::services(int index) const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.services) - return services_.Get(index); +inline void DescriptorDatabaseResponse::clear_file_descriptor_proto() { + if (has_file_descriptor_proto()) { + message_response_.file_descriptor_proto_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_response(); + } } -inline ::std::string* ListServiceResponse::mutable_services(int index) { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.services) - return services_.Mutable(index); +inline const ::std::string& DescriptorDatabaseResponse::file_descriptor_proto() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + if (has_file_descriptor_proto()) { + return message_response_.file_descriptor_proto_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } -inline void ListServiceResponse::set_services(int index, - const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.services) - services_.Mutable(index)->assign(value); +inline void DescriptorDatabaseResponse::set_file_descriptor_proto(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) } -inline void ListServiceResponse::set_services(int index, const char* value) { - services_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.services) +inline void DescriptorDatabaseResponse::set_file_descriptor_proto(const char* value) { + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) } -inline void ListServiceResponse::set_services(int index, const char* value, - size_t size) { - services_.Mutable(index)->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) +inline void DescriptorDatabaseResponse::set_file_descriptor_proto(const void* value, size_t size) { + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) } -inline ::std::string* ListServiceResponse::add_services() { - return services_.Add(); +inline ::std::string* DescriptorDatabaseResponse::mutable_file_descriptor_proto() { + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + return message_response_.file_descriptor_proto_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void ListServiceResponse::add_services(const ::std::string& value) { - services_.Add()->assign(value); - // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.services) +inline ::std::string* DescriptorDatabaseResponse::release_file_descriptor_proto() { + if (has_file_descriptor_proto()) { + clear_has_message_response(); + return message_response_.file_descriptor_proto_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } } -inline void ListServiceResponse::add_services(const char* value) { - services_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.services) +inline void DescriptorDatabaseResponse::set_allocated_file_descriptor_proto(::std::string* file_descriptor_proto) { + if (!has_file_descriptor_proto()) { + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_response(); + if (file_descriptor_proto != NULL) { + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_descriptor_proto); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) } -inline void ListServiceResponse::add_services(const char* value, size_t size) { - services_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) + +// optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; +inline bool DescriptorDatabaseResponse::has_all_extension_numbers_response() const { + return message_response_case() == kAllExtensionNumbersResponse; } -inline const ::google::protobuf::RepeatedPtrField< ::std::string>& -ListServiceResponse::services() const { - // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.services) - return services_; +inline void DescriptorDatabaseResponse::set_has_all_extension_numbers_response() { + _oneof_case_[0] = kAllExtensionNumbersResponse; } -inline ::google::protobuf::RepeatedPtrField< ::std::string>* -ListServiceResponse::mutable_services() { - // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.services) - return &services_; +inline void DescriptorDatabaseResponse::clear_all_extension_numbers_response() { + if (has_all_extension_numbers_response()) { + delete message_response_.all_extension_numbers_response_; + clear_has_message_response(); + } +} +inline const ::grpc::reflection::v1alpha::ExtensionNumberResponse& DescriptorDatabaseResponse::all_extension_numbers_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + return has_all_extension_numbers_response() + ? *message_response_.all_extension_numbers_response_ + : ::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance(); +} +inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::mutable_all_extension_numbers_response() { + if (!has_all_extension_numbers_response()) { + clear_message_response(); + set_has_all_extension_numbers_response(); + message_response_.all_extension_numbers_response_ = new ::grpc::reflection::v1alpha::ExtensionNumberResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + return message_response_.all_extension_numbers_response_; +} +inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::release_all_extension_numbers_response() { + if (has_all_extension_numbers_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ExtensionNumberResponse* temp = message_response_.all_extension_numbers_response_; + message_response_.all_extension_numbers_response_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void DescriptorDatabaseResponse::set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response) { + clear_message_response(); + if (all_extension_numbers_response) { + set_has_all_extension_numbers_response(); + message_response_.all_extension_numbers_response_ = all_extension_numbers_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) } -// ------------------------------------------------------------------- +// optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; +inline bool DescriptorDatabaseResponse::has_list_services_response() const { + return message_response_case() == kListServicesResponse; +} +inline void DescriptorDatabaseResponse::set_has_list_services_response() { + _oneof_case_[0] = kListServicesResponse; +} +inline void DescriptorDatabaseResponse::clear_list_services_response() { + if (has_list_services_response()) { + delete message_response_.list_services_response_; + clear_has_message_response(); + } +} +inline const ::grpc::reflection::v1alpha::ListServiceResponse& DescriptorDatabaseResponse::list_services_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + return has_list_services_response() + ? *message_response_.list_services_response_ + : ::grpc::reflection::v1alpha::ListServiceResponse::default_instance(); +} +inline ::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::mutable_list_services_response() { + if (!has_list_services_response()) { + clear_message_response(); + set_has_list_services_response(); + message_response_.list_services_response_ = new ::grpc::reflection::v1alpha::ListServiceResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + return message_response_.list_services_response_; +} +inline ::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::release_list_services_response() { + if (has_list_services_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ListServiceResponse* temp = message_response_.list_services_response_; + message_response_.list_services_response_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void DescriptorDatabaseResponse::set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response) { + clear_message_response(); + if (list_services_response) { + set_has_list_services_response(); + message_response_.list_services_response_ = list_services_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) +} -// FileDescriptorProtoResponse - -// optional bytes file_descriptor_proto = 1; -inline void FileDescriptorProtoResponse::clear_file_descriptor_proto() { - file_descriptor_proto_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline const ::std::string& FileDescriptorProtoResponse::file_descriptor_proto() - const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) - return file_descriptor_proto_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void FileDescriptorProtoResponse::set_file_descriptor_proto( - const ::std::string& value) { - file_descriptor_proto_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) -} -inline void FileDescriptorProtoResponse::set_file_descriptor_proto( - const char* value) { - file_descriptor_proto_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +// optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; +inline bool DescriptorDatabaseResponse::has_error_response() const { + return message_response_case() == kErrorResponse; } -inline void FileDescriptorProtoResponse::set_file_descriptor_proto( - const void* value, size_t size) { - file_descriptor_proto_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +inline void DescriptorDatabaseResponse::set_has_error_response() { + _oneof_case_[0] = kErrorResponse; } -inline ::std::string* -FileDescriptorProtoResponse::mutable_file_descriptor_proto() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) - return file_descriptor_proto_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline void DescriptorDatabaseResponse::clear_error_response() { + if (has_error_response()) { + delete message_response_.error_response_; + clear_has_message_response(); + } } -inline ::std::string* -FileDescriptorProtoResponse::release_file_descriptor_proto() { - return file_descriptor_proto_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline const ::grpc::reflection::v1alpha::ErrorResponse& DescriptorDatabaseResponse::error_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + return has_error_response() + ? *message_response_.error_response_ + : ::grpc::reflection::v1alpha::ErrorResponse::default_instance(); } -inline void FileDescriptorProtoResponse::set_allocated_file_descriptor_proto( - ::std::string* file_descriptor_proto) { - if (file_descriptor_proto != NULL) { +inline ::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::mutable_error_response() { + if (!has_error_response()) { + clear_message_response(); + set_has_error_response(); + message_response_.error_response_ = new ::grpc::reflection::v1alpha::ErrorResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + return message_response_.error_response_; +} +inline ::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::release_error_response() { + if (has_error_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ErrorResponse* temp = message_response_.error_response_; + message_response_.error_response_ = NULL; + return temp; } else { + return NULL; } - file_descriptor_proto_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - file_descriptor_proto); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +} +inline void DescriptorDatabaseResponse::set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response) { + clear_message_response(); + if (error_response) { + set_has_error_response(); + message_response_.error_response_ = error_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) } +inline bool DescriptorDatabaseResponse::has_message_response() const { + return message_response_case() != MESSAGE_RESPONSE_NOT_SET; +} +inline void DescriptorDatabaseResponse::clear_has_message_response() { + _oneof_case_[0] = MESSAGE_RESPONSE_NOT_SET; +} +inline DescriptorDatabaseResponse::MessageResponseCase DescriptorDatabaseResponse::message_response_case() const { + return DescriptorDatabaseResponse::MessageResponseCase(_oneof_case_[0]); +} // ------------------------------------------------------------------- // ExtensionNumberResponse -// repeated int32 extension_number = 1; +// optional string base_type_name = 1; +inline void ExtensionNumberResponse::clear_base_type_name() { + base_type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ExtensionNumberResponse::base_type_name() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) + return base_type_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionNumberResponse::set_base_type_name(const ::std::string& value) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} +inline void ExtensionNumberResponse::set_base_type_name(const char* value) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} +inline void ExtensionNumberResponse::set_base_type_name(const char* value, size_t size) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} +inline ::std::string* ExtensionNumberResponse::mutable_base_type_name() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) + return base_type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ExtensionNumberResponse::release_base_type_name() { + + return base_type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ExtensionNumberResponse::set_allocated_base_type_name(::std::string* base_type_name) { + if (base_type_name != NULL) { + + } else { + + } + base_type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), base_type_name); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} + +// repeated int32 extension_number = 2; inline int ExtensionNumberResponse::extension_number_size() const { return extension_number_.size(); } inline void ExtensionNumberResponse::clear_extension_number() { extension_number_.Clear(); } -inline ::google::protobuf::int32 ExtensionNumberResponse::extension_number( - int index) const { +inline ::google::protobuf::int32 ExtensionNumberResponse::extension_number(int index) const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) return extension_number_.Get(index); } -inline void ExtensionNumberResponse::set_extension_number( - int index, ::google::protobuf::int32 value) { +inline void ExtensionNumberResponse::set_extension_number(int index, ::google::protobuf::int32 value) { extension_number_.Set(index, value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) } -inline void ExtensionNumberResponse::add_extension_number( - ::google::protobuf::int32 value) { +inline void ExtensionNumberResponse::add_extension_number(::google::protobuf::int32 value) { extension_number_.Add(value); // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) } -inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32>& +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& ExtensionNumberResponse::extension_number() const { // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) return extension_number_; } -inline ::google::protobuf::RepeatedField< ::google::protobuf::int32>* +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* ExtensionNumberResponse::mutable_extension_number() { // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) return &extension_number_; } -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- +// ListServiceResponse + +// repeated string service = 1; +inline int ListServiceResponse::service_size() const { + return service_.size(); +} +inline void ListServiceResponse::clear_service() { + service_.Clear(); +} +inline const ::std::string& ListServiceResponse::service(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Get(index); +} +inline ::std::string* ListServiceResponse::mutable_service(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Mutable(index); +} +inline void ListServiceResponse::set_service(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.service) + service_.Mutable(index)->assign(value); +} +inline void ListServiceResponse::set_service(int index, const char* value) { + service_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.service) +} +inline void ListServiceResponse::set_service(int index, const char* value, size_t size) { + service_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) +} +inline ::std::string* ListServiceResponse::add_service() { + return service_.Add(); +} +inline void ListServiceResponse::add_service(const ::std::string& value) { + service_.Add()->assign(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.service) +} +inline void ListServiceResponse::add_service(const char* value) { + service_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.service) +} +inline void ListServiceResponse::add_service(const char* value, size_t size) { + service_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +ListServiceResponse::service() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +ListServiceResponse::mutable_service() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return &service_; +} + // ------------------------------------------------------------------- +// ErrorResponse + +// optional int32 error_code = 1; +inline void ErrorResponse::clear_error_code() { + error_code_ = 0; +} +inline ::google::protobuf::int32 ErrorResponse::error_code() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_code) + return error_code_; +} +inline void ErrorResponse::set_error_code(::google::protobuf::int32 value) { + + error_code_ = value; + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_code) +} + +// optional string error_message = 2; +inline void ErrorResponse::clear_error_message() { + error_message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& ErrorResponse::error_message() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_message) + return error_message_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ErrorResponse::set_error_message(const ::std::string& value) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_message) +} +inline void ErrorResponse::set_error_message(const char* value) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ErrorResponse.error_message) +} +inline void ErrorResponse::set_error_message(const char* value, size_t size) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ErrorResponse.error_message) +} +inline ::std::string* ErrorResponse::mutable_error_message() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ErrorResponse.error_message) + return error_message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ErrorResponse::release_error_message() { + + return error_message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ErrorResponse::set_allocated_error_message(::std::string* error_message) { + if (error_message != NULL) { + + } else { + + } + error_message_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), error_message); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ErrorResponse.error_message) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // ------------------------------------------------------------------- @@ -1117,6 +1790,7 @@ ExtensionNumberResponse::mutable_extension_number() { // ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) } // namespace v1alpha diff --git a/extensions/reflection/proto_server_reflection.cc b/extensions/reflection/proto_server_reflection.cc index 0662bb595a1..1befb1d2f5b 100644 --- a/extensions/reflection/proto_server_reflection.cc +++ b/extensions/reflection/proto_server_reflection.cc @@ -51,14 +51,12 @@ using google::protobuf::FileDescriptor; using google::protobuf::FieldDescriptor; using google::protobuf::DescriptorPool; using google::protobuf::FileDescriptorProto; -using grpc::reflection::v1alpha::EmptyRequest; -using grpc::reflection::v1alpha::ListServiceResponse; -using grpc::reflection::v1alpha::FileNameRequest; -using grpc::reflection::v1alpha::SymbolRequest; +using grpc::reflection::v1alpha::DescriptorDatabaseRequest; using grpc::reflection::v1alpha::ExtensionRequest; -using grpc::reflection::v1alpha::TypeRequest; -using grpc::reflection::v1alpha::FileDescriptorProtoResponse; +using grpc::reflection::v1alpha::DescriptorDatabaseResponse; +using grpc::reflection::v1alpha::ListServiceResponse; using grpc::reflection::v1alpha::ExtensionNumberResponse; +using grpc::reflection::v1alpha::ErrorResponse; namespace grpc { @@ -70,55 +68,101 @@ void ProtoServerReflection::SetServiceList( services_ = services; } +Status ProtoServerReflection::DescriptorDatabaseInfo( + ServerContext* context, + ServerReaderWriter* + stream) { + DescriptorDatabaseRequest request; + DescriptorDatabaseResponse response; + Status status; + while (stream->Read(&request)) { + switch (request.message_request_case()) { + case DescriptorDatabaseRequest::MessageRequestCase::kFileByFilename: + status = GetFileByName(context, request.file_by_filename(), &response); + break; + case DescriptorDatabaseRequest::MessageRequestCase::kFileContainingSymbol: + status = GetFileContainingSymbol( + context, request.file_containing_symbol(), &response); + break; + case DescriptorDatabaseRequest::MessageRequestCase:: + kFileContainingExtension: + status = GetFileContainingExtension( + context, &request.file_containing_extension(), &response); + break; + case DescriptorDatabaseRequest::MessageRequestCase:: + kAllExtensionNumbersOfType: + status = GetAllExtensionNumbers( + context, request.all_extension_numbers_of_type(), + response.mutable_all_extension_numbers_response()); + break; + case DescriptorDatabaseRequest::MessageRequestCase::kListServices: + status = + ListService(context, response.mutable_list_services_response()); + break; + default: + status = Status(StatusCode::UNIMPLEMENTED, ""); + } + + response.set_valid_host(request.host()); + response.set_allocated_original_request( + new DescriptorDatabaseRequest(request)); + stream->Write(response); + } + + return Status::OK; +} + +void ProtoServerReflection::FillErrorResponse(Status* status, + ErrorResponse* error_response) { + error_response->set_error_code(status->error_code()); + error_response->set_error_message(status->error_message()); +} + Status ProtoServerReflection::ListService(ServerContext* context, - const EmptyRequest* request, ListServiceResponse* response) { if (services_ == nullptr) { return Status(StatusCode::NOT_FOUND, "Services not found."); } for (auto it = services_->begin(); it != services_->end(); ++it) { - response->add_services(*it); + response->add_service(*it); } return Status::OK; } Status ProtoServerReflection::GetFileByName( - ServerContext* context, const FileNameRequest* request, - FileDescriptorProtoResponse* response) { + ServerContext* context, const grpc::string& filename, + DescriptorDatabaseResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; } - const FileDescriptor* file_desc = - descriptor_pool_->FindFileByName(request->filename()); + const FileDescriptor* file_desc = descriptor_pool_->FindFileByName(filename); if (file_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "File not found."); } FillFileDescriptorProtoResponse(file_desc, response); - // file_desc->CopyTo(response->mutable_file_descriptor_proto()); return Status::OK; } Status ProtoServerReflection::GetFileContainingSymbol( - ServerContext* context, const SymbolRequest* request, - FileDescriptorProtoResponse* response) { + ServerContext* context, const grpc::string& symbol, + DescriptorDatabaseResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; } const FileDescriptor* file_desc = - descriptor_pool_->FindFileContainingSymbol(request->symbol()); + descriptor_pool_->FindFileContainingSymbol(symbol); if (file_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Symbol not found."); } FillFileDescriptorProtoResponse(file_desc, response); - // file_desc->CopyTo(response->mutable_file_descriptor_proto()); return Status::OK; } Status ProtoServerReflection::GetFileContainingExtension( ServerContext* context, const ExtensionRequest* request, - FileDescriptorProtoResponse* response) { + DescriptorDatabaseResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; } @@ -135,19 +179,17 @@ Status ProtoServerReflection::GetFileContainingExtension( return Status(StatusCode::NOT_FOUND, "Extension not found."); } FillFileDescriptorProtoResponse(field_desc->file(), response); - // field_desc->file()->CopyTo(response->mutable_file_descriptor_proto()); return Status::OK; } Status ProtoServerReflection::GetAllExtensionNumbers( - ServerContext* context, const TypeRequest* request, + ServerContext* context, const grpc::string& type, ExtensionNumberResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; } - const Descriptor* desc = - descriptor_pool_->FindMessageTypeByName(request->type()); + const Descriptor* desc = descriptor_pool_->FindMessageTypeByName(type); if (desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Type not found."); } @@ -157,11 +199,12 @@ Status ProtoServerReflection::GetAllExtensionNumbers( for (auto extension : extensions) { response->add_extension_number(extension->number()); } + response->set_base_type_name(type); return Status::OK; } void ProtoServerReflection::FillFileDescriptorProtoResponse( - const FileDescriptor* file_desc, FileDescriptorProtoResponse* response) { + const FileDescriptor* file_desc, DescriptorDatabaseResponse* response) { FileDescriptorProto file_desc_proto; grpc::string data; file_desc->CopyTo(&file_desc_proto); diff --git a/extensions/reflection/proto_server_reflection.h b/extensions/reflection/proto_server_reflection.h index 5fe23191ff8..c32ee9ff54b 100644 --- a/extensions/reflection/proto_server_reflection.h +++ b/extensions/reflection/proto_server_reflection.h @@ -52,36 +52,41 @@ class ProtoServerReflection GRPC_FINAL public: ProtoServerReflection(); - ProtoServerReflection(const Server* server); - void SetServiceList(const std::vector* services); - Status ListService( - ServerContext* context, const reflection::v1alpha::EmptyRequest* request, - reflection::v1alpha::ListServiceResponse* response) GRPC_OVERRIDE; + Status DescriptorDatabaseInfo( + ServerContext* context, + ServerReaderWriter* + stream) GRPC_OVERRIDE; + + private: + Status ListService(ServerContext* context, + reflection::v1alpha::ListServiceResponse* response); Status GetFileByName( - ServerContext* context, - const reflection::v1alpha::FileNameRequest* request, - reflection::v1alpha::FileDescriptorProtoResponse* response) GRPC_OVERRIDE; + ServerContext* context, const grpc::string& file_name, + reflection::v1alpha::DescriptorDatabaseResponse* response); Status GetFileContainingSymbol( - ServerContext* context, const reflection::v1alpha::SymbolRequest* request, - reflection::v1alpha::FileDescriptorProtoResponse* response) GRPC_OVERRIDE; + ServerContext* context, const grpc::string& symbol, + reflection::v1alpha::DescriptorDatabaseResponse* response); Status GetFileContainingExtension( ServerContext* context, const reflection::v1alpha::ExtensionRequest* request, - reflection::v1alpha::FileDescriptorProtoResponse* response) GRPC_OVERRIDE; + reflection::v1alpha::DescriptorDatabaseResponse* response); Status GetAllExtensionNumbers( - ServerContext* context, const reflection::v1alpha::TypeRequest* request, - reflection::v1alpha::ExtensionNumberResponse* response) GRPC_OVERRIDE; + ServerContext* context, const grpc::string& type, + reflection::v1alpha::ExtensionNumberResponse* response); - private: void FillFileDescriptorProtoResponse( const google::protobuf::FileDescriptor* file_desc, - reflection::v1alpha::FileDescriptorProtoResponse* response); + reflection::v1alpha::DescriptorDatabaseResponse* response); + + void FillErrorResponse(Status* status, + reflection::v1alpha::ErrorResponse* error_response); const google::protobuf::DescriptorPool* descriptor_pool_; const std::vector* services_; diff --git a/extensions/reflection/reflection.grpc.pb.cc b/extensions/reflection/reflection.grpc.pb.cc index c098e52752f..83a63529fcb 100644 --- a/extensions/reflection/reflection.grpc.pb.cc +++ b/extensions/reflection/reflection.grpc.pb.cc @@ -1,9 +1,43 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + // Generated by the gRPC protobuf plugin. // If you make any local change, they will be lost. // source: reflection.proto -#include #include +#include #include #include @@ -18,228 +52,46 @@ namespace reflection { namespace v1alpha { static const char* ServerReflection_method_names[] = { - "/grpc.reflection.v1alpha.ServerReflection/ListService", - "/grpc.reflection.v1alpha.ServerReflection/GetFileByName", - "/grpc.reflection.v1alpha.ServerReflection/GetFileContainingSymbol", - "/grpc.reflection.v1alpha.ServerReflection/GetFileContainingExtension", - "/grpc.reflection.v1alpha.ServerReflection/GetAllExtensionNumbers", + "/grpc.reflection.v1alpha.ServerReflection/DescriptorDatabaseInfo", }; -std::unique_ptr ServerReflection::NewStub( - const std::shared_ptr< ::grpc::ChannelInterface>& channel, - const ::grpc::StubOptions& options) { - std::unique_ptr stub( - new ServerReflection::Stub(channel)); +std::unique_ptr< ServerReflection::Stub> ServerReflection::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { + std::unique_ptr< ServerReflection::Stub> stub(new ServerReflection::Stub(channel)); return stub; } -ServerReflection::Stub::Stub( - const std::shared_ptr< ::grpc::ChannelInterface>& channel) - : channel_(channel), - rpcmethod_ListService_(ServerReflection_method_names[0], - ::grpc::RpcMethod::NORMAL_RPC, channel), - rpcmethod_GetFileByName_(ServerReflection_method_names[1], - ::grpc::RpcMethod::NORMAL_RPC, channel), - rpcmethod_GetFileContainingSymbol_(ServerReflection_method_names[2], - ::grpc::RpcMethod::NORMAL_RPC, - channel), - rpcmethod_GetFileContainingExtension_(ServerReflection_method_names[3], - ::grpc::RpcMethod::NORMAL_RPC, - channel), - rpcmethod_GetAllExtensionNumbers_(ServerReflection_method_names[4], - ::grpc::RpcMethod::NORMAL_RPC, - channel) {} - -::grpc::Status ServerReflection::Stub::ListService( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::reflection::v1alpha::ListServiceResponse* response) { - return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_ListService_, - context, request, response); -} - -::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ListServiceResponse>* -ServerReflection::Stub::AsyncListServiceRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest& request, - ::grpc::CompletionQueue* cq) { - return new ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ListServiceResponse>( - channel_.get(), cq, rpcmethod_ListService_, context, request); -} - -::grpc::Status ServerReflection::Stub::GetFileByName( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { - return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_GetFileByName_, - context, request, response); -} - -::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* -ServerReflection::Stub::AsyncGetFileByNameRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest& request, - ::grpc::CompletionQueue* cq) { - return new ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( - channel_.get(), cq, rpcmethod_GetFileByName_, context, request); -} - -::grpc::Status ServerReflection::Stub::GetFileContainingSymbol( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { - return ::grpc::BlockingUnaryCall(channel_.get(), - rpcmethod_GetFileContainingSymbol_, context, - request, response); -} - -::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* -ServerReflection::Stub::AsyncGetFileContainingSymbolRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest& request, - ::grpc::CompletionQueue* cq) { - return new ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( - channel_.get(), cq, rpcmethod_GetFileContainingSymbol_, context, request); -} - -::grpc::Status ServerReflection::Stub::GetFileContainingExtension( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { - return ::grpc::BlockingUnaryCall(channel_.get(), - rpcmethod_GetFileContainingExtension_, - context, request, response); -} +ServerReflection::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) + : channel_(channel), rpcmethod_DescriptorDatabaseInfo_(ServerReflection_method_names[0], ::grpc::RpcMethod::BIDI_STREAMING, channel) + {} -::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>* -ServerReflection::Stub::AsyncGetFileContainingExtensionRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest& request, - ::grpc::CompletionQueue* cq) { - return new ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( - channel_.get(), cq, rpcmethod_GetFileContainingExtension_, context, - request); +::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* ServerReflection::Stub::DescriptorDatabaseInfoRaw(::grpc::ClientContext* context) { + return new ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>(channel_.get(), rpcmethod_DescriptorDatabaseInfo_, context); } -::grpc::Status ServerReflection::Stub::GetAllExtensionNumbers( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) { - return ::grpc::BlockingUnaryCall(channel_.get(), - rpcmethod_GetAllExtensionNumbers_, context, - request, response); -} - -::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>* -ServerReflection::Stub::AsyncGetAllExtensionNumbersRaw( - ::grpc::ClientContext* context, - const ::grpc::reflection::v1alpha::TypeRequest& request, - ::grpc::CompletionQueue* cq) { - return new ::grpc::ClientAsyncResponseReader< - ::grpc::reflection::v1alpha::ExtensionNumberResponse>( - channel_.get(), cq, rpcmethod_GetAllExtensionNumbers_, context, request); +::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* ServerReflection::Stub::AsyncDescriptorDatabaseInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return new ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>(channel_.get(), cq, rpcmethod_DescriptorDatabaseInfo_, context, tag); } ServerReflection::Service::Service() { (void)ServerReflection_method_names; AddMethod(new ::grpc::RpcServiceMethod( - ServerReflection_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, - new ::grpc::RpcMethodHandler< - ServerReflection::Service, ::grpc::reflection::v1alpha::EmptyRequest, - ::grpc::reflection::v1alpha::ListServiceResponse>( - std::mem_fn(&ServerReflection::Service::ListService), this))); - AddMethod(new ::grpc::RpcServiceMethod( - ServerReflection_method_names[1], ::grpc::RpcMethod::NORMAL_RPC, - new ::grpc::RpcMethodHandler< - ServerReflection::Service, - ::grpc::reflection::v1alpha::FileNameRequest, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( - std::mem_fn(&ServerReflection::Service::GetFileByName), this))); - AddMethod(new ::grpc::RpcServiceMethod( - ServerReflection_method_names[2], ::grpc::RpcMethod::NORMAL_RPC, - new ::grpc::RpcMethodHandler< - ServerReflection::Service, ::grpc::reflection::v1alpha::SymbolRequest, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( - std::mem_fn(&ServerReflection::Service::GetFileContainingSymbol), - this))); - AddMethod(new ::grpc::RpcServiceMethod( - ServerReflection_method_names[3], ::grpc::RpcMethod::NORMAL_RPC, - new ::grpc::RpcMethodHandler< - ServerReflection::Service, - ::grpc::reflection::v1alpha::ExtensionRequest, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse>( - std::mem_fn(&ServerReflection::Service::GetFileContainingExtension), - this))); - AddMethod(new ::grpc::RpcServiceMethod( - ServerReflection_method_names[4], ::grpc::RpcMethod::NORMAL_RPC, - new ::grpc::RpcMethodHandler< - ServerReflection::Service, ::grpc::reflection::v1alpha::TypeRequest, - ::grpc::reflection::v1alpha::ExtensionNumberResponse>( - std::mem_fn(&ServerReflection::Service::GetAllExtensionNumbers), - this))); + ServerReflection_method_names[0], + ::grpc::RpcMethod::BIDI_STREAMING, + new ::grpc::BidiStreamingHandler< ServerReflection::Service, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>( + std::mem_fn(&ServerReflection::Service::DescriptorDatabaseInfo), this))); } -ServerReflection::Service::~Service() {} - -::grpc::Status ServerReflection::Service::ListService( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::EmptyRequest* request, - ::grpc::reflection::v1alpha::ListServiceResponse* response) { - (void)context; - (void)request; - (void)response; - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); +ServerReflection::Service::~Service() { } -::grpc::Status ServerReflection::Service::GetFileByName( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::FileNameRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { - (void)context; - (void)request; - (void)response; +::grpc::Status ServerReflection::Service::DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream) { + (void) context; + (void) stream; return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } -::grpc::Status ServerReflection::Service::GetFileContainingSymbol( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::SymbolRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { - (void)context; - (void)request; - (void)response; - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); -} - -::grpc::Status ServerReflection::Service::GetFileContainingExtension( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::ExtensionRequest* request, - ::grpc::reflection::v1alpha::FileDescriptorProtoResponse* response) { - (void)context; - (void)request; - (void)response; - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); -} - -::grpc::Status ServerReflection::Service::GetAllExtensionNumbers( - ::grpc::ServerContext* context, - const ::grpc::reflection::v1alpha::TypeRequest* request, - ::grpc::reflection::v1alpha::ExtensionNumberResponse* response) { - (void)context; - (void)request; - (void)response; - return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); -} } // namespace grpc } // namespace reflection } // namespace v1alpha + diff --git a/extensions/reflection/reflection.pb.cc b/extensions/reflection/reflection.pb.cc index 97b3cb87916..0c9bfe79a4c 100644 --- a/extensions/reflection/reflection.pb.cc +++ b/extensions/reflection/reflection.pb.cc @@ -1,3 +1,37 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + // Generated by the protocol buffer compiler. DO NOT EDIT! // source: reflection.proto @@ -6,15 +40,15 @@ #include +#include +#include +#include +#include +#include #include #include -#include #include -#include -#include -#include #include -#include // @@protoc_insertion_point(includes) namespace grpc { @@ -23,147 +57,156 @@ namespace v1alpha { namespace { -const ::google::protobuf::Descriptor* EmptyRequest_descriptor_ = NULL; +const ::google::protobuf::Descriptor* DescriptorDatabaseRequest_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - EmptyRequest_reflection_ = NULL; -const ::google::protobuf::Descriptor* FileNameRequest_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - FileNameRequest_reflection_ = NULL; -const ::google::protobuf::Descriptor* SymbolRequest_descriptor_ = NULL; -const ::google::protobuf::internal::GeneratedMessageReflection* - SymbolRequest_reflection_ = NULL; + DescriptorDatabaseRequest_reflection_ = NULL; +struct DescriptorDatabaseRequestOneofInstance { + ::google::protobuf::internal::ArenaStringPtr file_by_filename_; + ::google::protobuf::internal::ArenaStringPtr file_containing_symbol_; + const ::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension_; + ::google::protobuf::internal::ArenaStringPtr all_extension_numbers_of_type_; + ::google::protobuf::internal::ArenaStringPtr list_services_; +}* DescriptorDatabaseRequest_default_oneof_instance_ = NULL; const ::google::protobuf::Descriptor* ExtensionRequest_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - ExtensionRequest_reflection_ = NULL; -const ::google::protobuf::Descriptor* TypeRequest_descriptor_ = NULL; + ExtensionRequest_reflection_ = NULL; +const ::google::protobuf::Descriptor* DescriptorDatabaseResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - TypeRequest_reflection_ = NULL; -const ::google::protobuf::Descriptor* ListServiceResponse_descriptor_ = NULL; + DescriptorDatabaseResponse_reflection_ = NULL; +struct DescriptorDatabaseResponseOneofInstance { + ::google::protobuf::internal::ArenaStringPtr file_descriptor_proto_; + const ::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response_; + const ::grpc::reflection::v1alpha::ListServiceResponse* list_services_response_; + const ::grpc::reflection::v1alpha::ErrorResponse* error_response_; +}* DescriptorDatabaseResponse_default_oneof_instance_ = NULL; +const ::google::protobuf::Descriptor* ExtensionNumberResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - ListServiceResponse_reflection_ = NULL; -const ::google::protobuf::Descriptor* FileDescriptorProtoResponse_descriptor_ = - NULL; + ExtensionNumberResponse_reflection_ = NULL; +const ::google::protobuf::Descriptor* ListServiceResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - FileDescriptorProtoResponse_reflection_ = NULL; -const ::google::protobuf::Descriptor* ExtensionNumberResponse_descriptor_ = - NULL; + ListServiceResponse_reflection_ = NULL; +const ::google::protobuf::Descriptor* ErrorResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - ExtensionNumberResponse_reflection_ = NULL; + ErrorResponse_reflection_ = NULL; } // namespace + void protobuf_AssignDesc_reflection_2eproto() { protobuf_AddDesc_reflection_2eproto(); const ::google::protobuf::FileDescriptor* file = - ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( - "reflection.proto"); + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "reflection.proto"); GOOGLE_CHECK(file != NULL); - EmptyRequest_descriptor_ = file->message_type(0); - static const int EmptyRequest_offsets_[1] = {}; - EmptyRequest_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - EmptyRequest_descriptor_, EmptyRequest::default_instance_, - EmptyRequest_offsets_, -1, -1, -1, sizeof(EmptyRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmptyRequest, - _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - EmptyRequest, _is_default_instance_)); - FileNameRequest_descriptor_ = file->message_type(1); - static const int FileNameRequest_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileNameRequest, - filename_), - }; - FileNameRequest_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - FileNameRequest_descriptor_, FileNameRequest::default_instance_, - FileNameRequest_offsets_, -1, -1, -1, sizeof(FileNameRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileNameRequest, - _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - FileNameRequest, _is_default_instance_)); - SymbolRequest_descriptor_ = file->message_type(2); - static const int SymbolRequest_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SymbolRequest, symbol_), + DescriptorDatabaseRequest_descriptor_ = file->message_type(0); + static const int DescriptorDatabaseRequest_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, host_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, file_by_filename_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, file_containing_symbol_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, file_containing_extension_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, all_extension_numbers_of_type_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, list_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, message_request_), }; - SymbolRequest_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - SymbolRequest_descriptor_, SymbolRequest::default_instance_, - SymbolRequest_offsets_, -1, -1, -1, sizeof(SymbolRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SymbolRequest, - _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - SymbolRequest, _is_default_instance_)); - ExtensionRequest_descriptor_ = file->message_type(3); + DescriptorDatabaseRequest_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + DescriptorDatabaseRequest_descriptor_, + DescriptorDatabaseRequest::default_instance_, + DescriptorDatabaseRequest_offsets_, + -1, + -1, + -1, + DescriptorDatabaseRequest_default_oneof_instance_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, _oneof_case_[0]), + sizeof(DescriptorDatabaseRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, _is_default_instance_)); + ExtensionRequest_descriptor_ = file->message_type(1); static const int ExtensionRequest_offsets_[2] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, - containing_type_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, - extension_number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, containing_type_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, extension_number_), }; - ExtensionRequest_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - ExtensionRequest_descriptor_, ExtensionRequest::default_instance_, - ExtensionRequest_offsets_, -1, -1, -1, sizeof(ExtensionRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, - _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - ExtensionRequest, _is_default_instance_)); - TypeRequest_descriptor_ = file->message_type(4); - static const int TypeRequest_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TypeRequest, type_), + ExtensionRequest_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + ExtensionRequest_descriptor_, + ExtensionRequest::default_instance_, + ExtensionRequest_offsets_, + -1, + -1, + -1, + sizeof(ExtensionRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, _is_default_instance_)); + DescriptorDatabaseResponse_descriptor_ = file->message_type(2); + static const int DescriptorDatabaseResponse_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, valid_host_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, original_request_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, file_descriptor_proto_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, all_extension_numbers_response_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, list_services_response_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, error_response_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, message_response_), }; - TypeRequest_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - TypeRequest_descriptor_, TypeRequest::default_instance_, - TypeRequest_offsets_, -1, -1, -1, sizeof(TypeRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TypeRequest, - _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - TypeRequest, _is_default_instance_)); - ListServiceResponse_descriptor_ = file->message_type(5); - static const int ListServiceResponse_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, - services_), + DescriptorDatabaseResponse_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + DescriptorDatabaseResponse_descriptor_, + DescriptorDatabaseResponse::default_instance_, + DescriptorDatabaseResponse_offsets_, + -1, + -1, + -1, + DescriptorDatabaseResponse_default_oneof_instance_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, _oneof_case_[0]), + sizeof(DescriptorDatabaseResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, _is_default_instance_)); + ExtensionNumberResponse_descriptor_ = file->message_type(3); + static const int ExtensionNumberResponse_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, base_type_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, extension_number_), }; - ListServiceResponse_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - ListServiceResponse_descriptor_, - ListServiceResponse::default_instance_, ListServiceResponse_offsets_, - -1, -1, -1, sizeof(ListServiceResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, - _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - ListServiceResponse, _is_default_instance_)); - FileDescriptorProtoResponse_descriptor_ = file->message_type(6); - static const int FileDescriptorProtoResponse_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - FileDescriptorProtoResponse, file_descriptor_proto_), + ExtensionNumberResponse_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + ExtensionNumberResponse_descriptor_, + ExtensionNumberResponse::default_instance_, + ExtensionNumberResponse_offsets_, + -1, + -1, + -1, + sizeof(ExtensionNumberResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, _is_default_instance_)); + ListServiceResponse_descriptor_ = file->message_type(4); + static const int ListServiceResponse_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, service_), }; - FileDescriptorProtoResponse_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - FileDescriptorProtoResponse_descriptor_, - FileDescriptorProtoResponse::default_instance_, - FileDescriptorProtoResponse_offsets_, -1, -1, -1, - sizeof(FileDescriptorProtoResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - FileDescriptorProtoResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - FileDescriptorProtoResponse, _is_default_instance_)); - ExtensionNumberResponse_descriptor_ = file->message_type(7); - static const int ExtensionNumberResponse_offsets_[1] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, - extension_number_), + ListServiceResponse_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + ListServiceResponse_descriptor_, + ListServiceResponse::default_instance_, + ListServiceResponse_offsets_, + -1, + -1, + -1, + sizeof(ListServiceResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, _is_default_instance_)); + ErrorResponse_descriptor_ = file->message_type(5); + static const int ErrorResponse_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, error_code_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, error_message_), }; - ExtensionNumberResponse_reflection_ = ::google::protobuf::internal:: - GeneratedMessageReflection::NewGeneratedMessageReflection( - ExtensionNumberResponse_descriptor_, - ExtensionNumberResponse::default_instance_, - ExtensionNumberResponse_offsets_, -1, -1, -1, - sizeof(ExtensionNumberResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - ExtensionNumberResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET( - ExtensionNumberResponse, _is_default_instance_)); + ErrorResponse_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + ErrorResponse_descriptor_, + ErrorResponse::default_instance_, + ErrorResponse_offsets_, + -1, + -1, + -1, + sizeof(ErrorResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, _is_default_instance_)); } namespace { @@ -171,51 +214,42 @@ namespace { GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); inline void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, - &protobuf_AssignDesc_reflection_2eproto); + &protobuf_AssignDesc_reflection_2eproto); } void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - EmptyRequest_descriptor_, &EmptyRequest::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - FileNameRequest_descriptor_, &FileNameRequest::default_instance()); - ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - SymbolRequest_descriptor_, &SymbolRequest::default_instance()); + DescriptorDatabaseRequest_descriptor_, &DescriptorDatabaseRequest::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( ExtensionRequest_descriptor_, &ExtensionRequest::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - TypeRequest_descriptor_, &TypeRequest::default_instance()); + DescriptorDatabaseResponse_descriptor_, &DescriptorDatabaseResponse::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ListServiceResponse_descriptor_, - &ListServiceResponse::default_instance()); + ExtensionNumberResponse_descriptor_, &ExtensionNumberResponse::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - FileDescriptorProtoResponse_descriptor_, - &FileDescriptorProtoResponse::default_instance()); + ListServiceResponse_descriptor_, &ListServiceResponse::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - ExtensionNumberResponse_descriptor_, - &ExtensionNumberResponse::default_instance()); + ErrorResponse_descriptor_, &ErrorResponse::default_instance()); } } // namespace void protobuf_ShutdownFile_reflection_2eproto() { - delete EmptyRequest::default_instance_; - delete EmptyRequest_reflection_; - delete FileNameRequest::default_instance_; - delete FileNameRequest_reflection_; - delete SymbolRequest::default_instance_; - delete SymbolRequest_reflection_; + delete DescriptorDatabaseRequest::default_instance_; + delete DescriptorDatabaseRequest_default_oneof_instance_; + delete DescriptorDatabaseRequest_reflection_; delete ExtensionRequest::default_instance_; delete ExtensionRequest_reflection_; - delete TypeRequest::default_instance_; - delete TypeRequest_reflection_; - delete ListServiceResponse::default_instance_; - delete ListServiceResponse_reflection_; - delete FileDescriptorProtoResponse::default_instance_; - delete FileDescriptorProtoResponse_reflection_; + delete DescriptorDatabaseResponse::default_instance_; + delete DescriptorDatabaseResponse_default_oneof_instance_; + delete DescriptorDatabaseResponse_reflection_; delete ExtensionNumberResponse::default_instance_; delete ExtensionNumberResponse_reflection_; + delete ListServiceResponse::default_instance_; + delete ListServiceResponse_reflection_; + delete ErrorResponse::default_instance_; + delete ErrorResponse_reflection_; } void protobuf_AddDesc_reflection_2eproto() { @@ -225,54 +259,52 @@ void protobuf_AddDesc_reflection_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\020reflection.proto\022\027grpc.reflection.v1al" - "pha\"\016\n\014EmptyRequest\"#\n\017FileNameRequest\022\020" - "\n\010filename\030\001 \001(\t\"\037\n\rSymbolRequest\022\016\n\006sym" - "bol\030\001 \001(\t\"E\n\020ExtensionRequest\022\027\n\017contain" - "ing_type\030\001 \001(\t\022\030\n\020extension_number\030\002 \001(\005" - "\"\033\n\013TypeRequest\022\014\n\004type\030\001 " - "\001(\t\"\'\n\023ListSer" - "viceResponse\022\020\n\010services\030\001 \003(\t\"<\n\033FileDe" - "scriptorProtoResponse\022\035\n\025file_descriptor" - "_proto\030\001 \001(\014\"3\n\027ExtensionNumberResponse\022" - "\030\n\020extension_number\030\001 \003(\0052\333\004\n\020ServerRefl" - "ection\022d\n\013ListService\022%.grpc.reflection." - "v1alpha.EmptyRequest\032,.grpc.reflection.v" - "1alpha.ListServiceResponse\"\000\022q\n\rGetFileB" - "yName\022(.grpc.reflection.v1alpha.FileName" - "Request\0324.grpc.reflection.v1alpha.FileDe" - "scriptorProtoResponse\"\000\022y\n\027GetFileContai" - "ningSymbol\022&.grpc.reflection.v1alpha.Sym" - "bolRequest\0324.grpc.reflection.v1alpha.Fil" - "eDescriptorProtoResponse\"\000\022\177\n\032GetFileCon" - "tainingExtension\022).grpc.reflection.v1alp" - "ha.ExtensionRequest\0324.grpc.reflection.v1" - "alpha.FileDescriptorProtoResponse\"\000\022r\n\026G" - "etAllExtensionNumbers\022$.grpc.reflection." - "v1alpha.TypeRequest\0320.grpc.reflection.v1" - "alpha.ExtensionNumberResponse\"\000b\006proto3", - 999); + "\n\020reflection.proto\022\027grpc.reflection.v1al" + "pha\"\214\002\n\031DescriptorDatabaseRequest\022\014\n\004hos" + "t\030\001 \001(\t\022\032\n\020file_by_filename\030\003 \001(\tH\000\022 \n\026f" + "ile_containing_symbol\030\004 \001(\tH\000\022N\n\031file_co" + "ntaining_extension\030\005 \001(\0132).grpc.reflecti" + "on.v1alpha.ExtensionRequestH\000\022\'\n\035all_ext" + "ension_numbers_of_type\030\006 \001(\tH\000\022\027\n\rlist_s" + "ervices\030\007 \001(\tH\000B\021\n\017message_request\"E\n\020Ex" + "tensionRequest\022\027\n\017containing_type\030\001 \001(\t\022" + "\030\n\020extension_number\030\002 \001(\005\"\241\003\n\032Descriptor" + "DatabaseResponse\022\022\n\nvalid_host\030\001 \001(\t\022L\n\020" + "original_request\030\002 \001(\01322.grpc.reflection" + ".v1alpha.DescriptorDatabaseRequest\022\037\n\025fi" + "le_descriptor_proto\030\004 \001(\014H\000\022Z\n\036all_exten" + "sion_numbers_response\030\005 \001(\01320.grpc.refle" + "ction.v1alpha.ExtensionNumberResponseH\000\022" + "N\n\026list_services_response\030\006 \001(\0132,.grpc.r" + "eflection.v1alpha.ListServiceResponseH\000\022" + "@\n\016error_response\030\007 \001(\0132&.grpc.reflectio" + "n.v1alpha.ErrorResponseH\000B\022\n\020message_res" + "ponse\"K\n\027ExtensionNumberResponse\022\026\n\016base" + "_type_name\030\001 \001(\t\022\030\n\020extension_number\030\002 \003" + "(\005\"&\n\023ListServiceResponse\022\017\n\007service\030\001 \003" + "(\t\":\n\rErrorResponse\022\022\n\nerror_code\030\001 \001(\005\022" + "\025\n\rerror_message\030\002 \001(\t2\232\001\n\020ServerReflect" + "ion\022\205\001\n\026DescriptorDatabaseInfo\0222.grpc.re" + "flection.v1alpha.DescriptorDatabaseReque" + "st\0323.grpc.reflection.v1alpha.DescriptorD" + "atabaseResponse(\0010\001b\006proto3", 1147); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( - "reflection.proto", &protobuf_RegisterTypes); - EmptyRequest::default_instance_ = new EmptyRequest(); - FileNameRequest::default_instance_ = new FileNameRequest(); - SymbolRequest::default_instance_ = new SymbolRequest(); + "reflection.proto", &protobuf_RegisterTypes); + DescriptorDatabaseRequest::default_instance_ = new DescriptorDatabaseRequest(); + DescriptorDatabaseRequest_default_oneof_instance_ = new DescriptorDatabaseRequestOneofInstance(); ExtensionRequest::default_instance_ = new ExtensionRequest(); - TypeRequest::default_instance_ = new TypeRequest(); - ListServiceResponse::default_instance_ = new ListServiceResponse(); - FileDescriptorProtoResponse::default_instance_ = - new FileDescriptorProtoResponse(); + DescriptorDatabaseResponse::default_instance_ = new DescriptorDatabaseResponse(); + DescriptorDatabaseResponse_default_oneof_instance_ = new DescriptorDatabaseResponseOneofInstance(); ExtensionNumberResponse::default_instance_ = new ExtensionNumberResponse(); - EmptyRequest::default_instance_->InitAsDefaultInstance(); - FileNameRequest::default_instance_->InitAsDefaultInstance(); - SymbolRequest::default_instance_->InitAsDefaultInstance(); + ListServiceResponse::default_instance_ = new ListServiceResponse(); + ErrorResponse::default_instance_ = new ErrorResponse(); + DescriptorDatabaseRequest::default_instance_->InitAsDefaultInstance(); ExtensionRequest::default_instance_->InitAsDefaultInstance(); - TypeRequest::default_instance_->InitAsDefaultInstance(); - ListServiceResponse::default_instance_->InitAsDefaultInstance(); - FileDescriptorProtoResponse::default_instance_->InitAsDefaultInstance(); + DescriptorDatabaseResponse::default_instance_->InitAsDefaultInstance(); ExtensionNumberResponse::default_instance_->InitAsDefaultInstance(); - ::google::protobuf::internal::OnShutdown( - &protobuf_ShutdownFile_reflection_2eproto); + ListServiceResponse::default_instance_->InitAsDefaultInstance(); + ErrorResponse::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_reflection_2eproto); } // Force AddDescriptors() to be called at static initialization time. @@ -291,263 +323,223 @@ static void MergeFromFail(int line) { } // namespace + // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int DescriptorDatabaseRequest::kHostFieldNumber; +const int DescriptorDatabaseRequest::kFileByFilenameFieldNumber; +const int DescriptorDatabaseRequest::kFileContainingSymbolFieldNumber; +const int DescriptorDatabaseRequest::kFileContainingExtensionFieldNumber; +const int DescriptorDatabaseRequest::kAllExtensionNumbersOfTypeFieldNumber; +const int DescriptorDatabaseRequest::kListServicesFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -EmptyRequest::EmptyRequest() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +DescriptorDatabaseRequest::DescriptorDatabaseRequest() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.EmptyRequest) + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.DescriptorDatabaseRequest) } -void EmptyRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } +void DescriptorDatabaseRequest::InitAsDefaultInstance() { + _is_default_instance_ = true; + DescriptorDatabaseRequest_default_oneof_instance_->file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + DescriptorDatabaseRequest_default_oneof_instance_->file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + DescriptorDatabaseRequest_default_oneof_instance_->file_containing_extension_ = const_cast< ::grpc::reflection::v1alpha::ExtensionRequest*>(&::grpc::reflection::v1alpha::ExtensionRequest::default_instance()); + DescriptorDatabaseRequest_default_oneof_instance_->all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + DescriptorDatabaseRequest_default_oneof_instance_->list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} -EmptyRequest::EmptyRequest(const EmptyRequest& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +DescriptorDatabaseRequest::DescriptorDatabaseRequest(const DescriptorDatabaseRequest& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.EmptyRequest) + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.DescriptorDatabaseRequest) } -void EmptyRequest::SharedCtor() { - _is_default_instance_ = false; +void DescriptorDatabaseRequest::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; + host_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); } -EmptyRequest::~EmptyRequest() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.EmptyRequest) +DescriptorDatabaseRequest::~DescriptorDatabaseRequest() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.DescriptorDatabaseRequest) SharedDtor(); } -void EmptyRequest::SharedDtor() { +void DescriptorDatabaseRequest::SharedDtor() { + host_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (has_message_request()) { + clear_message_request(); + } if (this != default_instance_) { } } -void EmptyRequest::SetCachedSize(int size) const { +void DescriptorDatabaseRequest::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } -const ::google::protobuf::Descriptor* EmptyRequest::descriptor() { +const ::google::protobuf::Descriptor* DescriptorDatabaseRequest::descriptor() { protobuf_AssignDescriptorsOnce(); - return EmptyRequest_descriptor_; + return DescriptorDatabaseRequest_descriptor_; } -const EmptyRequest& EmptyRequest::default_instance() { +const DescriptorDatabaseRequest& DescriptorDatabaseRequest::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); return *default_instance_; } -EmptyRequest* EmptyRequest::default_instance_ = NULL; +DescriptorDatabaseRequest* DescriptorDatabaseRequest::default_instance_ = NULL; -EmptyRequest* EmptyRequest::New(::google::protobuf::Arena* arena) const { - EmptyRequest* n = new EmptyRequest; +DescriptorDatabaseRequest* DescriptorDatabaseRequest::New(::google::protobuf::Arena* arena) const { + DescriptorDatabaseRequest* n = new DescriptorDatabaseRequest; if (arena != NULL) { arena->Own(n); } return n; } -void EmptyRequest::Clear() {} - -bool EmptyRequest::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.EmptyRequest) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { - goto success; +void DescriptorDatabaseRequest::clear_message_request() { + switch(message_request_case()) { + case kFileByFilename: { + message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + break; + } + case kFileContainingSymbol: { + message_request_.file_containing_symbol_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + break; + } + case kFileContainingExtension: { + delete message_request_.file_containing_extension_; + break; + } + case kAllExtensionNumbersOfType: { + message_request_.all_extension_numbers_of_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + break; + } + case kListServices: { + message_request_.list_services_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + break; + } + case MESSAGE_REQUEST_NOT_SET: { + break; } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); - } -success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.EmptyRequest) - return true; -failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.EmptyRequest) - return false; -#undef DO_ -} - -void EmptyRequest::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.EmptyRequest) - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.EmptyRequest) -} - -::google::protobuf::uint8* EmptyRequest::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.EmptyRequest) - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.EmptyRequest) - return target; -} - -int EmptyRequest::ByteSize() const { - int total_size = 0; - - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void EmptyRequest::MergeFrom(const ::google::protobuf::Message& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const EmptyRequest* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); - } else { - MergeFrom(*source); - } -} - -void EmptyRequest::MergeFrom(const EmptyRequest& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); -} - -void EmptyRequest::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -void EmptyRequest::CopyFrom(const EmptyRequest& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); -} - -bool EmptyRequest::IsInitialized() const { return true; } - -void EmptyRequest::Swap(EmptyRequest* other) { - if (other == this) return; - InternalSwap(other); -} -void EmptyRequest::InternalSwap(EmptyRequest* other) { - _internal_metadata_.Swap(&other->_internal_metadata_); - std::swap(_cached_size_, other->_cached_size_); -} - -::google::protobuf::Metadata EmptyRequest::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = EmptyRequest_descriptor_; - metadata.reflection = EmptyRequest_reflection_; - return metadata; -} - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// EmptyRequest - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int FileNameRequest::kFilenameFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -FileNameRequest::FileNameRequest() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.FileNameRequest) -} - -void FileNameRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } - -FileNameRequest::FileNameRequest(const FileNameRequest& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.FileNameRequest) -} - -void FileNameRequest::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - filename_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -FileNameRequest::~FileNameRequest() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.FileNameRequest) - SharedDtor(); -} - -void FileNameRequest::SharedDtor() { - filename_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != default_instance_) { } + _oneof_case_[0] = MESSAGE_REQUEST_NOT_SET; } -void FileNameRequest::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ::google::protobuf::Descriptor* FileNameRequest::descriptor() { - protobuf_AssignDescriptorsOnce(); - return FileNameRequest_descriptor_; -} -const FileNameRequest& FileNameRequest::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; +void DescriptorDatabaseRequest::Clear() { + host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_message_request(); } -FileNameRequest* FileNameRequest::default_instance_ = NULL; - -FileNameRequest* FileNameRequest::New(::google::protobuf::Arena* arena) const { - FileNameRequest* n = new FileNameRequest; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void FileNameRequest::Clear() { - filename_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -bool FileNameRequest::MergePartialFromCodedStream( +bool DescriptorDatabaseRequest::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.FileNameRequest) + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.DescriptorDatabaseRequest) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; if (!p.second) goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string filename = 1; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string host = 1; case 1: { if (tag == 10) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_filename())); + input, this->mutable_host())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->host().data(), this->host().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.host")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(26)) goto parse_file_by_filename; + break; + } + + // optional string file_by_filename = 3; + case 3: { + if (tag == 26) { + parse_file_by_filename: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_file_by_filename())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->file_by_filename().data(), this->file_by_filename().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(34)) goto parse_file_containing_symbol; + break; + } + + // optional string file_containing_symbol = 4; + case 4: { + if (tag == 34) { + parse_file_containing_symbol: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_file_containing_symbol())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->filename().data(), this->filename().length(), - ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.FileNameRequest.filename")); + this->file_containing_symbol().data(), this->file_containing_symbol().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(42)) goto parse_file_containing_extension; + break; + } + + // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; + case 5: { + if (tag == 42) { + parse_file_containing_extension: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_file_containing_extension())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(50)) goto parse_all_extension_numbers_of_type; + break; + } + + // optional string all_extension_numbers_of_type = 6; + case 6: { + if (tag == 50) { + parse_all_extension_numbers_of_type: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_all_extension_numbers_of_type())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->all_extension_numbers_of_type().data(), this->all_extension_numbers_of_type().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(58)) goto parse_list_services; + break; + } + + // optional string list_services = 7; + case 7: { + if (tag == 58) { + parse_list_services: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_list_services())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->list_services().data(), this->list_services().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services")); } else { goto handle_unusual; } @@ -559,78 +551,215 @@ bool FileNameRequest::MergePartialFromCodedStream( handle_unusual: if (tag == 0 || ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite:: - WIRETYPE_END_GROUP) { + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { goto success; } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, - tag)); + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); break; } } } success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.FileNameRequest) + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.DescriptorDatabaseRequest) return true; failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.FileNameRequest) + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.DescriptorDatabaseRequest) return false; #undef DO_ } -void FileNameRequest::SerializeWithCachedSizes( +void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.FileNameRequest) - // optional string filename = 1; - if (this->filename().size() > 0) { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // optional string host = 1; + if (this->host().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->filename().data(), this->filename().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.FileNameRequest.filename"); + this->host().data(), this->host().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.host"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->filename(), output); + 1, this->host(), output); } - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.FileNameRequest) + // optional string file_by_filename = 3; + if (has_file_by_filename()) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->file_by_filename().data(), this->file_by_filename().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 3, this->file_by_filename(), output); + } + + // optional string file_containing_symbol = 4; + if (has_file_containing_symbol()) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->file_containing_symbol().data(), this->file_containing_symbol().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 4, this->file_containing_symbol(), output); + } + + // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; + if (has_file_containing_extension()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, *message_request_.file_containing_extension_, output); + } + + // optional string all_extension_numbers_of_type = 6; + if (has_all_extension_numbers_of_type()) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->all_extension_numbers_of_type().data(), this->all_extension_numbers_of_type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 6, this->all_extension_numbers_of_type(), output); + } + + // optional string list_services = 7; + if (has_list_services()) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->list_services().data(), this->list_services().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 7, this->list_services(), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.DescriptorDatabaseRequest) } -::google::protobuf::uint8* FileNameRequest::SerializeWithCachedSizesToArray( +::google::protobuf::uint8* DescriptorDatabaseRequest::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.FileNameRequest) - // optional string filename = 1; - if (this->filename().size() > 0) { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // optional string host = 1; + if (this->host().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->host().data(), this->host().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.host"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->host(), target); + } + + // optional string file_by_filename = 3; + if (has_file_by_filename()) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->file_by_filename().data(), this->file_by_filename().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 3, this->file_by_filename(), target); + } + + // optional string file_containing_symbol = 4; + if (has_file_containing_symbol()) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->file_containing_symbol().data(), this->file_containing_symbol().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 4, this->file_containing_symbol(), target); + } + + // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; + if (has_file_containing_extension()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, *message_request_.file_containing_extension_, target); + } + + // optional string all_extension_numbers_of_type = 6; + if (has_all_extension_numbers_of_type()) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->all_extension_numbers_of_type().data(), this->all_extension_numbers_of_type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 6, this->all_extension_numbers_of_type(), target); + } + + // optional string list_services = 7; + if (has_list_services()) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->filename().data(), this->filename().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.FileNameRequest.filename"); - target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->filename(), target); + this->list_services().data(), this->list_services().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 7, this->list_services(), target); } - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.FileNameRequest) + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.DescriptorDatabaseRequest) return target; } -int FileNameRequest::ByteSize() const { +int DescriptorDatabaseRequest::ByteSize() const { int total_size = 0; - // optional string filename = 1; - if (this->filename().size() > 0) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->filename()); + // optional string host = 1; + if (this->host().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->host()); } + switch (message_request_case()) { + // optional string file_by_filename = 3; + case kFileByFilename: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->file_by_filename()); + break; + } + // optional string file_containing_symbol = 4; + case kFileContainingSymbol: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->file_containing_symbol()); + break; + } + // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; + case kFileContainingExtension: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *message_request_.file_containing_extension_); + break; + } + // optional string all_extension_numbers_of_type = 6; + case kAllExtensionNumbersOfType: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->all_extension_numbers_of_type()); + break; + } + // optional string list_services = 7; + case kListServices: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->list_services()); + break; + } + case MESSAGE_REQUEST_NOT_SET: { + break; + } + } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } -void FileNameRequest::MergeFrom(const ::google::protobuf::Message& from) { +void DescriptorDatabaseRequest::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const FileNameRequest* source = - ::google::protobuf::internal::DynamicCastToGenerated< - const FileNameRequest>(&from); + const DescriptorDatabaseRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -638,369 +767,498 @@ void FileNameRequest::MergeFrom(const ::google::protobuf::Message& from) { } } -void FileNameRequest::MergeFrom(const FileNameRequest& from) { +void DescriptorDatabaseRequest::MergeFrom(const DescriptorDatabaseRequest& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - if (from.filename().size() > 0) { - filename_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.filename_); + switch (from.message_request_case()) { + case kFileByFilename: { + set_file_by_filename(from.file_by_filename()); + break; + } + case kFileContainingSymbol: { + set_file_containing_symbol(from.file_containing_symbol()); + break; + } + case kFileContainingExtension: { + mutable_file_containing_extension()->::grpc::reflection::v1alpha::ExtensionRequest::MergeFrom(from.file_containing_extension()); + break; + } + case kAllExtensionNumbersOfType: { + set_all_extension_numbers_of_type(from.all_extension_numbers_of_type()); + break; + } + case kListServices: { + set_list_services(from.list_services()); + break; + } + case MESSAGE_REQUEST_NOT_SET: { + break; + } + } + if (from.host().size() > 0) { + + host_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.host_); } } -void FileNameRequest::CopyFrom(const ::google::protobuf::Message& from) { +void DescriptorDatabaseRequest::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } -void FileNameRequest::CopyFrom(const FileNameRequest& from) { +void DescriptorDatabaseRequest::CopyFrom(const DescriptorDatabaseRequest& from) { if (&from == this) return; Clear(); MergeFrom(from); } -bool FileNameRequest::IsInitialized() const { return true; } +bool DescriptorDatabaseRequest::IsInitialized() const { + + return true; +} -void FileNameRequest::Swap(FileNameRequest* other) { +void DescriptorDatabaseRequest::Swap(DescriptorDatabaseRequest* other) { if (other == this) return; InternalSwap(other); } -void FileNameRequest::InternalSwap(FileNameRequest* other) { - filename_.Swap(&other->filename_); +void DescriptorDatabaseRequest::InternalSwap(DescriptorDatabaseRequest* other) { + host_.Swap(&other->host_); + std::swap(message_request_, other->message_request_); + std::swap(_oneof_case_[0], other->_oneof_case_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } -::google::protobuf::Metadata FileNameRequest::GetMetadata() const { +::google::protobuf::Metadata DescriptorDatabaseRequest::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; - metadata.descriptor = FileNameRequest_descriptor_; - metadata.reflection = FileNameRequest_reflection_; + metadata.descriptor = DescriptorDatabaseRequest_descriptor_; + metadata.reflection = DescriptorDatabaseRequest_reflection_; return metadata; } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// FileNameRequest - -// optional string filename = 1; -void FileNameRequest::clear_filename() { - filename_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& FileNameRequest::filename() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileNameRequest.filename) - return filename_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileNameRequest::set_filename(const ::std::string& value) { - filename_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileNameRequest.filename) -} -void FileNameRequest::set_filename(const char* value) { - filename_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileNameRequest.filename) +// DescriptorDatabaseRequest + +// optional string host = 1; +void DescriptorDatabaseRequest::clear_host() { + host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& DescriptorDatabaseRequest::host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + return host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void DescriptorDatabaseRequest::set_host(const ::std::string& value) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) } -void FileNameRequest::set_filename(const char* value, size_t size) { - filename_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + void DescriptorDatabaseRequest::set_host(const char* value) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) +} + void DescriptorDatabaseRequest::set_host(const char* value, size_t size) { + + host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileNameRequest.filename) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) } -::std::string* FileNameRequest::mutable_filename() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileNameRequest.filename) - return filename_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::std::string* DescriptorDatabaseRequest::mutable_host() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -::std::string* FileNameRequest::release_filename() { - return filename_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::std::string* DescriptorDatabaseRequest::release_host() { + + return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -void FileNameRequest::set_allocated_filename(::std::string* filename) { - if (filename != NULL) { + void DescriptorDatabaseRequest::set_allocated_host(::std::string* host) { + if (host != NULL) { + } else { + } - filename_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), filename); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileNameRequest.filename) + host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), host); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) } -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int SymbolRequest::kSymbolFieldNumber; -#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 - -SymbolRequest::SymbolRequest() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.SymbolRequest) +// optional string file_by_filename = 3; +bool DescriptorDatabaseRequest::has_file_by_filename() const { + return message_request_case() == kFileByFilename; } - -void SymbolRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } - -SymbolRequest::SymbolRequest(const SymbolRequest& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { - SharedCtor(); - MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.SymbolRequest) +void DescriptorDatabaseRequest::set_has_file_by_filename() { + _oneof_case_[0] = kFileByFilename; } - -void SymbolRequest::SharedCtor() { - _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); - _cached_size_ = 0; - symbol_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +void DescriptorDatabaseRequest::clear_file_by_filename() { + if (has_file_by_filename()) { + message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } } - -SymbolRequest::~SymbolRequest() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.SymbolRequest) - SharedDtor(); + const ::std::string& DescriptorDatabaseRequest::file_by_filename() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + if (has_file_by_filename()) { + return message_request_.file_by_filename_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - -void SymbolRequest::SharedDtor() { - symbol_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != default_instance_) { + void DescriptorDatabaseRequest::set_file_by_filename(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) } - -void SymbolRequest::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); + void DescriptorDatabaseRequest::set_file_by_filename(const char* value) { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +} + void DescriptorDatabaseRequest::set_file_by_filename(const char* value, size_t size) { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +} + ::std::string* DescriptorDatabaseRequest::mutable_file_by_filename() { + if (!has_file_by_filename()) { + clear_message_request(); + set_has_file_by_filename(); + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* DescriptorDatabaseRequest::release_file_by_filename() { + if (has_file_by_filename()) { + clear_has_message_request(); + return message_request_.file_by_filename_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } } -const ::google::protobuf::Descriptor* SymbolRequest::descriptor() { - protobuf_AssignDescriptorsOnce(); - return SymbolRequest_descriptor_; + void DescriptorDatabaseRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { + if (!has_file_by_filename()) { + message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (file_by_filename != NULL) { + set_has_file_by_filename(); + message_request_.file_by_filename_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_by_filename); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) } -const SymbolRequest& SymbolRequest::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); - return *default_instance_; +// optional string file_containing_symbol = 4; +bool DescriptorDatabaseRequest::has_file_containing_symbol() const { + return message_request_case() == kFileContainingSymbol; } - -SymbolRequest* SymbolRequest::default_instance_ = NULL; - -SymbolRequest* SymbolRequest::New(::google::protobuf::Arena* arena) const { - SymbolRequest* n = new SymbolRequest; - if (arena != NULL) { - arena->Own(n); +void DescriptorDatabaseRequest::set_has_file_containing_symbol() { + _oneof_case_[0] = kFileContainingSymbol; +} +void DescriptorDatabaseRequest::clear_file_containing_symbol() { + if (has_file_containing_symbol()) { + message_request_.file_containing_symbol_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); } - return n; } - -void SymbolRequest::Clear() { - symbol_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + const ::std::string& DescriptorDatabaseRequest::file_containing_symbol() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + if (has_file_containing_symbol()) { + return message_request_.file_containing_symbol_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - -bool SymbolRequest::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure - ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.SymbolRequest) - for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); - tag = p.first; - if (!p.second) goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string symbol = 1; - case 1: { - if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_symbol())); - DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->symbol().data(), this->symbol().length(), - ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.SymbolRequest.symbol")); - } else { - goto handle_unusual; - } - if (input->ExpectAtEnd()) goto success; - break; - } - - default: { - handle_unusual: - if (tag == 0 || - ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite:: - WIRETYPE_END_GROUP) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, - tag)); - break; - } - } + void DescriptorDatabaseRequest::set_file_containing_symbol(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.SymbolRequest) - return true; -failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.SymbolRequest) - return false; -#undef DO_ + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) } - -void SymbolRequest::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.SymbolRequest) - // optional string symbol = 1; - if (this->symbol().size() > 0) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->symbol().data(), this->symbol().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.SymbolRequest.symbol"); - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->symbol(), output); + void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value) { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +} + void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value, size_t size) { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +} + ::std::string* DescriptorDatabaseRequest::mutable_file_containing_symbol() { + if (!has_file_containing_symbol()) { + clear_message_request(); + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* DescriptorDatabaseRequest::release_file_containing_symbol() { + if (has_file_containing_symbol()) { + clear_has_message_request(); + return message_request_.file_containing_symbol_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; } - - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.SymbolRequest) } - -::google::protobuf::uint8* SymbolRequest::SerializeWithCachedSizesToArray( - ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.SymbolRequest) - // optional string symbol = 1; - if (this->symbol().size() > 0) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->symbol().data(), this->symbol().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.SymbolRequest.symbol"); - target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->symbol(), target); + void DescriptorDatabaseRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { + if (!has_file_containing_symbol()) { + message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.SymbolRequest) - return target; + clear_message_request(); + if (file_containing_symbol != NULL) { + set_has_file_containing_symbol(); + message_request_.file_containing_symbol_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_containing_symbol); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) } -int SymbolRequest::ByteSize() const { - int total_size = 0; - - // optional string symbol = 1; - if (this->symbol().size() > 0) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->symbol()); +// optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; +bool DescriptorDatabaseRequest::has_file_containing_extension() const { + return message_request_case() == kFileContainingExtension; +} +void DescriptorDatabaseRequest::set_has_file_containing_extension() { + _oneof_case_[0] = kFileContainingExtension; +} +void DescriptorDatabaseRequest::clear_file_containing_extension() { + if (has_file_containing_extension()) { + delete message_request_.file_containing_extension_; + clear_has_message_request(); } - - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = total_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; } - -void SymbolRequest::MergeFrom(const ::google::protobuf::Message& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const SymbolRequest* source = - ::google::protobuf::internal::DynamicCastToGenerated( - &from); - if (source == NULL) { - ::google::protobuf::internal::ReflectionOps::Merge(from, this); + const ::grpc::reflection::v1alpha::ExtensionRequest& DescriptorDatabaseRequest::file_containing_extension() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + return has_file_containing_extension() + ? *message_request_.file_containing_extension_ + : ::grpc::reflection::v1alpha::ExtensionRequest::default_instance(); +} +::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::mutable_file_containing_extension() { + if (!has_file_containing_extension()) { + clear_message_request(); + set_has_file_containing_extension(); + message_request_.file_containing_extension_ = new ::grpc::reflection::v1alpha::ExtensionRequest; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + return message_request_.file_containing_extension_; +} +::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::release_file_containing_extension() { + if (has_file_containing_extension()) { + clear_has_message_request(); + ::grpc::reflection::v1alpha::ExtensionRequest* temp = message_request_.file_containing_extension_; + message_request_.file_containing_extension_ = NULL; + return temp; } else { - MergeFrom(*source); + return NULL; } } - -void SymbolRequest::MergeFrom(const SymbolRequest& from) { - if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - if (from.symbol().size() > 0) { - symbol_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.symbol_); +void DescriptorDatabaseRequest::set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension) { + clear_message_request(); + if (file_containing_extension) { + set_has_file_containing_extension(); + message_request_.file_containing_extension_ = file_containing_extension; } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) } -void SymbolRequest::CopyFrom(const ::google::protobuf::Message& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); +// optional string all_extension_numbers_of_type = 6; +bool DescriptorDatabaseRequest::has_all_extension_numbers_of_type() const { + return message_request_case() == kAllExtensionNumbersOfType; } - -void SymbolRequest::CopyFrom(const SymbolRequest& from) { - if (&from == this) return; - Clear(); - MergeFrom(from); +void DescriptorDatabaseRequest::set_has_all_extension_numbers_of_type() { + _oneof_case_[0] = kAllExtensionNumbersOfType; } - -bool SymbolRequest::IsInitialized() const { return true; } - -void SymbolRequest::Swap(SymbolRequest* other) { - if (other == this) return; - InternalSwap(other); +void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { + if (has_all_extension_numbers_of_type()) { + message_request_.all_extension_numbers_of_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } +} + const ::std::string& DescriptorDatabaseRequest::all_extension_numbers_of_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + if (has_all_extension_numbers_of_type()) { + return message_request_.all_extension_numbers_of_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} + void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) +} + void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value) { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) +} + void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) +} + ::std::string* DescriptorDatabaseRequest::mutable_all_extension_numbers_of_type() { + if (!has_all_extension_numbers_of_type()) { + clear_message_request(); + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* DescriptorDatabaseRequest::release_all_extension_numbers_of_type() { + if (has_all_extension_numbers_of_type()) { + clear_has_message_request(); + return message_request_.all_extension_numbers_of_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } } -void SymbolRequest::InternalSwap(SymbolRequest* other) { - symbol_.Swap(&other->symbol_); - _internal_metadata_.Swap(&other->_internal_metadata_); - std::swap(_cached_size_, other->_cached_size_); + void DescriptorDatabaseRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { + if (!has_all_extension_numbers_of_type()) { + message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (all_extension_numbers_of_type != NULL) { + set_has_all_extension_numbers_of_type(); + message_request_.all_extension_numbers_of_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + all_extension_numbers_of_type); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) } -::google::protobuf::Metadata SymbolRequest::GetMetadata() const { - protobuf_AssignDescriptorsOnce(); - ::google::protobuf::Metadata metadata; - metadata.descriptor = SymbolRequest_descriptor_; - metadata.reflection = SymbolRequest_reflection_; - return metadata; +// optional string list_services = 7; +bool DescriptorDatabaseRequest::has_list_services() const { + return message_request_case() == kListServices; } - -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// SymbolRequest - -// optional string symbol = 1; -void SymbolRequest::clear_symbol() { - symbol_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& SymbolRequest::symbol() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.SymbolRequest.symbol) - return symbol_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void SymbolRequest::set_symbol(const ::std::string& value) { - symbol_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.SymbolRequest.symbol) -} -void SymbolRequest::set_symbol(const char* value) { - symbol_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.SymbolRequest.symbol) +void DescriptorDatabaseRequest::set_has_list_services() { + _oneof_case_[0] = kListServices; } -void SymbolRequest::set_symbol(const char* value, size_t size) { - symbol_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.SymbolRequest.symbol) +void DescriptorDatabaseRequest::clear_list_services() { + if (has_list_services()) { + message_request_.list_services_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_request(); + } } -::std::string* SymbolRequest::mutable_symbol() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.SymbolRequest.symbol) - return symbol_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + const ::std::string& DescriptorDatabaseRequest::list_services() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + if (has_list_services()) { + return message_request_.list_services_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } -::std::string* SymbolRequest::release_symbol() { - return symbol_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + void DescriptorDatabaseRequest::set_list_services(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) } -void SymbolRequest::set_allocated_symbol(::std::string* symbol) { - if (symbol != NULL) { + void DescriptorDatabaseRequest::set_list_services(const char* value) { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) +} + void DescriptorDatabaseRequest::set_list_services(const char* value, size_t size) { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) +} + ::std::string* DescriptorDatabaseRequest::mutable_list_services() { + if (!has_list_services()) { + clear_message_request(); + set_has_list_services(); + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* DescriptorDatabaseRequest::release_list_services() { + if (has_list_services()) { + clear_has_message_request(); + return message_request_.list_services_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } else { + return NULL; } - symbol_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), symbol); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.SymbolRequest.symbol) +} + void DescriptorDatabaseRequest::set_allocated_list_services(::std::string* list_services) { + if (!has_list_services()) { + message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_request(); + if (list_services != NULL) { + set_has_list_services(); + message_request_.list_services_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + list_services); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) } +bool DescriptorDatabaseRequest::has_message_request() const { + return message_request_case() != MESSAGE_REQUEST_NOT_SET; +} +void DescriptorDatabaseRequest::clear_has_message_request() { + _oneof_case_[0] = MESSAGE_REQUEST_NOT_SET; +} +DescriptorDatabaseRequest::MessageRequestCase DescriptorDatabaseRequest::message_request_case() const { + return DescriptorDatabaseRequest::MessageRequestCase(_oneof_case_[0]); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== @@ -1011,26 +1269,28 @@ const int ExtensionRequest::kExtensionNumberFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 ExtensionRequest::ExtensionRequest() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { + : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ExtensionRequest) } -void ExtensionRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } +void ExtensionRequest::InitAsDefaultInstance() { + _is_default_instance_ = true; +} ExtensionRequest::ExtensionRequest(const ExtensionRequest& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ExtensionRequest) } void ExtensionRequest::SharedCtor() { - _is_default_instance_ = false; + _is_default_instance_ = false; ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; - containing_type_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + containing_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); extension_number_ = 0; } @@ -1040,8 +1300,7 @@ ExtensionRequest::~ExtensionRequest() { } void ExtensionRequest::SharedDtor() { - containing_type_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + containing_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != default_instance_) { } } @@ -1063,8 +1322,7 @@ const ExtensionRequest& ExtensionRequest::default_instance() { ExtensionRequest* ExtensionRequest::default_instance_ = NULL; -ExtensionRequest* ExtensionRequest::New( - ::google::protobuf::Arena* arena) const { +ExtensionRequest* ExtensionRequest::New(::google::protobuf::Arena* arena) const { ExtensionRequest* n = new ExtensionRequest; if (arena != NULL) { arena->Own(n); @@ -1073,33 +1331,29 @@ ExtensionRequest* ExtensionRequest::New( } void ExtensionRequest::Clear() { - containing_type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + containing_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); extension_number_ = 0; } bool ExtensionRequest::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ExtensionRequest) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; if (!p.second) goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional string containing_type = 1; case 1: { if (tag == 10) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_containing_type())); + input, this->mutable_containing_type())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->containing_type().data(), this->containing_type().length(), - ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.ExtensionRequest.containing_type")); + this->containing_type().data(), this->containing_type().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.ExtensionRequest.containing_type")); } else { goto handle_unusual; } @@ -1110,11 +1364,10 @@ bool ExtensionRequest::MergePartialFromCodedStream( // optional int32 extension_number = 2; case 2: { if (tag == 16) { - parse_extension_number: + parse_extension_number: DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &extension_number_))); + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &extension_number_))); } else { goto handle_unusual; @@ -1127,12 +1380,10 @@ bool ExtensionRequest::MergePartialFromCodedStream( handle_unusual: if (tag == 0 || ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite:: - WIRETYPE_END_GROUP) { + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { goto success; } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, - tag)); + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); break; } } @@ -1152,17 +1403,16 @@ void ExtensionRequest::SerializeWithCachedSizes( // optional string containing_type = 1; if (this->containing_type().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->containing_type().data(), this->containing_type().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.ExtensionRequest.containing_type"); + this->containing_type().data(), this->containing_type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ExtensionRequest.containing_type"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->containing_type(), output); + 1, this->containing_type(), output); } // optional int32 extension_number = 2; if (this->extension_number() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt32( - 2, this->extension_number(), output); + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->extension_number(), output); } // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ExtensionRequest) @@ -1174,17 +1424,17 @@ void ExtensionRequest::SerializeWithCachedSizes( // optional string containing_type = 1; if (this->containing_type().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->containing_type().data(), this->containing_type().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.ExtensionRequest.containing_type"); - target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + this->containing_type().data(), this->containing_type().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ExtensionRequest.containing_type"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->containing_type(), target); } // optional int32 extension_number = 2; if (this->extension_number() != 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray( - 2, this->extension_number(), target); + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->extension_number(), target); } // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ExtensionRequest) @@ -1196,14 +1446,16 @@ int ExtensionRequest::ByteSize() const { // optional string containing_type = 1; if (this->containing_type().size() > 0) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->containing_type()); + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->containing_type()); } // optional int32 extension_number = 2; if (this->extension_number() != 0) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->extension_number()); + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->extension_number()); } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -1214,9 +1466,9 @@ int ExtensionRequest::ByteSize() const { void ExtensionRequest::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const ExtensionRequest* source = - ::google::protobuf::internal::DynamicCastToGenerated< - const ExtensionRequest>(&from); + const ExtensionRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -1227,9 +1479,8 @@ void ExtensionRequest::MergeFrom(const ::google::protobuf::Message& from) { void ExtensionRequest::MergeFrom(const ExtensionRequest& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); if (from.containing_type().size() > 0) { - containing_type_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.containing_type_); + + containing_type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.containing_type_); } if (from.extension_number() != 0) { set_extension_number(from.extension_number()); @@ -1248,7 +1499,10 @@ void ExtensionRequest::CopyFrom(const ExtensionRequest& from) { MergeFrom(from); } -bool ExtensionRequest::IsInitialized() const { return true; } +bool ExtensionRequest::IsInitialized() const { + + return true; +} void ExtensionRequest::Swap(ExtensionRequest* other) { if (other == this) return; @@ -1274,58 +1528,57 @@ void ExtensionRequest::InternalSwap(ExtensionRequest* other) { // optional string containing_type = 1; void ExtensionRequest::clear_containing_type() { - containing_type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + containing_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -const ::std::string& ExtensionRequest::containing_type() const { + const ::std::string& ExtensionRequest::containing_type() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.containing_type) - return containing_type_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return containing_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -void ExtensionRequest::set_containing_type(const ::std::string& value) { - containing_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + void ExtensionRequest::set_containing_type(const ::std::string& value) { + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } -void ExtensionRequest::set_containing_type(const char* value) { - containing_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); + void ExtensionRequest::set_containing_type(const char* value) { + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } -void ExtensionRequest::set_containing_type(const char* value, size_t size) { - containing_type_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), + void ExtensionRequest::set_containing_type(const char* value, size_t size) { + + containing_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } -::std::string* ExtensionRequest::mutable_containing_type() { + ::std::string* ExtensionRequest::mutable_containing_type() { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionRequest.containing_type) - return containing_type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return containing_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -::std::string* ExtensionRequest::release_containing_type() { - return containing_type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::std::string* ExtensionRequest::release_containing_type() { + + return containing_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -void ExtensionRequest::set_allocated_containing_type( - ::std::string* containing_type) { + void ExtensionRequest::set_allocated_containing_type(::std::string* containing_type) { if (containing_type != NULL) { + } else { + } - containing_type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - containing_type); + containing_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), containing_type); // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionRequest.containing_type) } // optional int32 extension_number = 2; -void ExtensionRequest::clear_extension_number() { extension_number_ = 0; } -::google::protobuf::int32 ExtensionRequest::extension_number() const { +void ExtensionRequest::clear_extension_number() { + extension_number_ = 0; +} + ::google::protobuf::int32 ExtensionRequest::extension_number() const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionRequest.extension_number) return extension_number_; } -void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { + void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { + extension_number_ = value; // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionRequest.extension_number) } @@ -1335,96 +1588,203 @@ void ExtensionRequest::set_extension_number(::google::protobuf::int32 value) { // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int TypeRequest::kTypeFieldNumber; +const int DescriptorDatabaseResponse::kValidHostFieldNumber; +const int DescriptorDatabaseResponse::kOriginalRequestFieldNumber; +const int DescriptorDatabaseResponse::kFileDescriptorProtoFieldNumber; +const int DescriptorDatabaseResponse::kAllExtensionNumbersResponseFieldNumber; +const int DescriptorDatabaseResponse::kListServicesResponseFieldNumber; +const int DescriptorDatabaseResponse::kErrorResponseFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -TypeRequest::TypeRequest() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +DescriptorDatabaseResponse::DescriptorDatabaseResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.TypeRequest) + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.DescriptorDatabaseResponse) } -void TypeRequest::InitAsDefaultInstance() { _is_default_instance_ = true; } +void DescriptorDatabaseResponse::InitAsDefaultInstance() { + _is_default_instance_ = true; + original_request_ = const_cast< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest*>(&::grpc::reflection::v1alpha::DescriptorDatabaseRequest::default_instance()); + DescriptorDatabaseResponse_default_oneof_instance_->file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + DescriptorDatabaseResponse_default_oneof_instance_->all_extension_numbers_response_ = const_cast< ::grpc::reflection::v1alpha::ExtensionNumberResponse*>(&::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance()); + DescriptorDatabaseResponse_default_oneof_instance_->list_services_response_ = const_cast< ::grpc::reflection::v1alpha::ListServiceResponse*>(&::grpc::reflection::v1alpha::ListServiceResponse::default_instance()); + DescriptorDatabaseResponse_default_oneof_instance_->error_response_ = const_cast< ::grpc::reflection::v1alpha::ErrorResponse*>(&::grpc::reflection::v1alpha::ErrorResponse::default_instance()); +} -TypeRequest::TypeRequest(const TypeRequest& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +DescriptorDatabaseResponse::DescriptorDatabaseResponse(const DescriptorDatabaseResponse& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.TypeRequest) + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.DescriptorDatabaseResponse) } -void TypeRequest::SharedCtor() { - _is_default_instance_ = false; +void DescriptorDatabaseResponse::SharedCtor() { + _is_default_instance_ = false; ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; - type_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + valid_host_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + original_request_ = NULL; + clear_has_message_response(); } -TypeRequest::~TypeRequest() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.TypeRequest) +DescriptorDatabaseResponse::~DescriptorDatabaseResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.DescriptorDatabaseResponse) SharedDtor(); } -void TypeRequest::SharedDtor() { - type_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +void DescriptorDatabaseResponse::SharedDtor() { + valid_host_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (has_message_response()) { + clear_message_response(); + } if (this != default_instance_) { + delete original_request_; } } -void TypeRequest::SetCachedSize(int size) const { +void DescriptorDatabaseResponse::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } -const ::google::protobuf::Descriptor* TypeRequest::descriptor() { +const ::google::protobuf::Descriptor* DescriptorDatabaseResponse::descriptor() { protobuf_AssignDescriptorsOnce(); - return TypeRequest_descriptor_; + return DescriptorDatabaseResponse_descriptor_; } -const TypeRequest& TypeRequest::default_instance() { +const DescriptorDatabaseResponse& DescriptorDatabaseResponse::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); return *default_instance_; } -TypeRequest* TypeRequest::default_instance_ = NULL; +DescriptorDatabaseResponse* DescriptorDatabaseResponse::default_instance_ = NULL; -TypeRequest* TypeRequest::New(::google::protobuf::Arena* arena) const { - TypeRequest* n = new TypeRequest; +DescriptorDatabaseResponse* DescriptorDatabaseResponse::New(::google::protobuf::Arena* arena) const { + DescriptorDatabaseResponse* n = new DescriptorDatabaseResponse; if (arena != NULL) { arena->Own(n); } return n; } -void TypeRequest::Clear() { - type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +void DescriptorDatabaseResponse::clear_message_response() { + switch(message_response_case()) { + case kFileDescriptorProto: { + message_response_.file_descriptor_proto_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + break; + } + case kAllExtensionNumbersResponse: { + delete message_response_.all_extension_numbers_response_; + break; + } + case kListServicesResponse: { + delete message_response_.list_services_response_; + break; + } + case kErrorResponse: { + delete message_response_.error_response_; + break; + } + case MESSAGE_RESPONSE_NOT_SET: { + break; + } + } + _oneof_case_[0] = MESSAGE_RESPONSE_NOT_SET; +} + + +void DescriptorDatabaseResponse::Clear() { + valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; + original_request_ = NULL; + clear_message_response(); } -bool TypeRequest::MergePartialFromCodedStream( +bool DescriptorDatabaseResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.TypeRequest) + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.DescriptorDatabaseResponse) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; if (!p.second) goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional string type = 1; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string valid_host = 1; case 1: { if (tag == 10) { DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_type())); + input, this->mutable_valid_host())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type().data(), this->type().length(), - ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.TypeRequest.type")); + this->valid_host().data(), this->valid_host().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_original_request; + break; + } + + // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + case 2: { + if (tag == 18) { + parse_original_request: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_original_request())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(34)) goto parse_file_descriptor_proto; + break; + } + + // optional bytes file_descriptor_proto = 4; + case 4: { + if (tag == 34) { + parse_file_descriptor_proto: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_file_descriptor_proto())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(42)) goto parse_all_extension_numbers_response; + break; + } + + // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; + case 5: { + if (tag == 42) { + parse_all_extension_numbers_response: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_all_extension_numbers_response())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(50)) goto parse_list_services_response; + break; + } + + // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; + case 6: { + if (tag == 50) { + parse_list_services_response: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_list_services_response())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(58)) goto parse_error_response; + break; + } + + // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; + case 7: { + if (tag == 58) { + parse_error_response: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_error_response())); } else { goto handle_unusual; } @@ -1436,77 +1796,182 @@ bool TypeRequest::MergePartialFromCodedStream( handle_unusual: if (tag == 0 || ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite:: - WIRETYPE_END_GROUP) { + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { goto success; } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, - tag)); + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); break; } } } success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.TypeRequest) + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.DescriptorDatabaseResponse) return true; failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.TypeRequest) + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.DescriptorDatabaseResponse) return false; #undef DO_ } -void TypeRequest::SerializeWithCachedSizes( +void DescriptorDatabaseResponse::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.TypeRequest) - // optional string type = 1; - if (this->type().size() > 0) { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // optional string valid_host = 1; + if (this->valid_host().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type().data(), this->type().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.TypeRequest.type"); + this->valid_host().data(), this->valid_host().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->type(), output); + 1, this->valid_host(), output); + } + + // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + if (this->has_original_request()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, *this->original_request_, output); + } + + // optional bytes file_descriptor_proto = 4; + if (has_file_descriptor_proto()) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 4, this->file_descriptor_proto(), output); + } + + // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; + if (has_all_extension_numbers_response()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, *message_response_.all_extension_numbers_response_, output); + } + + // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; + if (has_list_services_response()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 6, *message_response_.list_services_response_, output); } - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.TypeRequest) + // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; + if (has_error_response()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 7, *message_response_.error_response_, output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.DescriptorDatabaseResponse) } -::google::protobuf::uint8* TypeRequest::SerializeWithCachedSizesToArray( +::google::protobuf::uint8* DescriptorDatabaseResponse::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.TypeRequest) - // optional string type = 1; - if (this->type().size() > 0) { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // optional string valid_host = 1; + if (this->valid_host().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->type().data(), this->type().length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.TypeRequest.type"); - target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->type(), target); + this->valid_host().data(), this->valid_host().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->valid_host(), target); + } + + // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + if (this->has_original_request()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, *this->original_request_, target); + } + + // optional bytes file_descriptor_proto = 4; + if (has_file_descriptor_proto()) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 4, this->file_descriptor_proto(), target); } - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.TypeRequest) + // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; + if (has_all_extension_numbers_response()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, *message_response_.all_extension_numbers_response_, target); + } + + // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; + if (has_list_services_response()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 6, *message_response_.list_services_response_, target); + } + + // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; + if (has_error_response()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 7, *message_response_.error_response_, target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.DescriptorDatabaseResponse) return target; } -int TypeRequest::ByteSize() const { +int DescriptorDatabaseResponse::ByteSize() const { int total_size = 0; - // optional string type = 1; - if (this->type().size() > 0) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->type()); + // optional string valid_host = 1; + if (this->valid_host().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->valid_host()); + } + + // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + if (this->has_original_request()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->original_request_); } + switch (message_response_case()) { + // optional bytes file_descriptor_proto = 4; + case kFileDescriptorProto: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->file_descriptor_proto()); + break; + } + // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; + case kAllExtensionNumbersResponse: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *message_response_.all_extension_numbers_response_); + break; + } + // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; + case kListServicesResponse: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *message_response_.list_services_response_); + break; + } + // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; + case kErrorResponse: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *message_response_.error_response_); + break; + } + case MESSAGE_RESPONSE_NOT_SET: { + break; + } + } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; } -void TypeRequest::MergeFrom(const ::google::protobuf::Message& from) { +void DescriptorDatabaseResponse::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const TypeRequest* source = - ::google::protobuf::internal::DynamicCastToGenerated( + const DescriptorDatabaseResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); @@ -1515,190 +1980,504 @@ void TypeRequest::MergeFrom(const ::google::protobuf::Message& from) { } } -void TypeRequest::MergeFrom(const TypeRequest& from) { +void DescriptorDatabaseResponse::MergeFrom(const DescriptorDatabaseResponse& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - if (from.type().size() > 0) { - type_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.type_); + switch (from.message_response_case()) { + case kFileDescriptorProto: { + set_file_descriptor_proto(from.file_descriptor_proto()); + break; + } + case kAllExtensionNumbersResponse: { + mutable_all_extension_numbers_response()->::grpc::reflection::v1alpha::ExtensionNumberResponse::MergeFrom(from.all_extension_numbers_response()); + break; + } + case kListServicesResponse: { + mutable_list_services_response()->::grpc::reflection::v1alpha::ListServiceResponse::MergeFrom(from.list_services_response()); + break; + } + case kErrorResponse: { + mutable_error_response()->::grpc::reflection::v1alpha::ErrorResponse::MergeFrom(from.error_response()); + break; + } + case MESSAGE_RESPONSE_NOT_SET: { + break; + } + } + if (from.valid_host().size() > 0) { + + valid_host_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.valid_host_); + } + if (from.has_original_request()) { + mutable_original_request()->::grpc::reflection::v1alpha::DescriptorDatabaseRequest::MergeFrom(from.original_request()); } } -void TypeRequest::CopyFrom(const ::google::protobuf::Message& from) { +void DescriptorDatabaseResponse::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } -void TypeRequest::CopyFrom(const TypeRequest& from) { +void DescriptorDatabaseResponse::CopyFrom(const DescriptorDatabaseResponse& from) { if (&from == this) return; Clear(); MergeFrom(from); } -bool TypeRequest::IsInitialized() const { return true; } +bool DescriptorDatabaseResponse::IsInitialized() const { + + return true; +} -void TypeRequest::Swap(TypeRequest* other) { +void DescriptorDatabaseResponse::Swap(DescriptorDatabaseResponse* other) { if (other == this) return; InternalSwap(other); } -void TypeRequest::InternalSwap(TypeRequest* other) { - type_.Swap(&other->type_); +void DescriptorDatabaseResponse::InternalSwap(DescriptorDatabaseResponse* other) { + valid_host_.Swap(&other->valid_host_); + std::swap(original_request_, other->original_request_); + std::swap(message_response_, other->message_response_); + std::swap(_oneof_case_[0], other->_oneof_case_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } -::google::protobuf::Metadata TypeRequest::GetMetadata() const { +::google::protobuf::Metadata DescriptorDatabaseResponse::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; - metadata.descriptor = TypeRequest_descriptor_; - metadata.reflection = TypeRequest_reflection_; + metadata.descriptor = DescriptorDatabaseResponse_descriptor_; + metadata.reflection = DescriptorDatabaseResponse_reflection_; return metadata; } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// TypeRequest - -// optional string type = 1; -void TypeRequest::clear_type() { - type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& TypeRequest::type() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.TypeRequest.type) - return type_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void TypeRequest::set_type(const ::std::string& value) { - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.TypeRequest.type) -} -void TypeRequest::set_type(const char* value) { - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.TypeRequest.type) -} -void TypeRequest::set_type(const char* value, size_t size) { - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.TypeRequest.type) -} -::std::string* TypeRequest::mutable_type() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.TypeRequest.type) - return type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* TypeRequest::release_type() { - return type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void TypeRequest::set_allocated_type(::std::string* type) { - if (type != NULL) { +// DescriptorDatabaseResponse + +// optional string valid_host = 1; +void DescriptorDatabaseResponse::clear_valid_host() { + valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& DescriptorDatabaseResponse::valid_host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + return valid_host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void DescriptorDatabaseResponse::set_valid_host(const ::std::string& value) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) +} + void DescriptorDatabaseResponse::set_valid_host(const char* value) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) +} + void DescriptorDatabaseResponse::set_valid_host(const char* value, size_t size) { + + valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) +} + ::std::string* DescriptorDatabaseResponse::mutable_valid_host() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* DescriptorDatabaseResponse::release_valid_host() { + + return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void DescriptorDatabaseResponse::set_allocated_valid_host(::std::string* valid_host) { + if (valid_host != NULL) { + + } else { + + } + valid_host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), valid_host); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) +} + +// optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; +bool DescriptorDatabaseResponse::has_original_request() const { + return !_is_default_instance_ && original_request_ != NULL; +} +void DescriptorDatabaseResponse::clear_original_request() { + if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; + original_request_ = NULL; +} +const ::grpc::reflection::v1alpha::DescriptorDatabaseRequest& DescriptorDatabaseResponse::original_request() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + return original_request_ != NULL ? *original_request_ : *default_instance_->original_request_; +} +::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::mutable_original_request() { + + if (original_request_ == NULL) { + original_request_ = new ::grpc::reflection::v1alpha::DescriptorDatabaseRequest; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + return original_request_; +} +::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::release_original_request() { + + ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* temp = original_request_; + original_request_ = NULL; + return temp; +} +void DescriptorDatabaseResponse::set_allocated_original_request(::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request) { + delete original_request_; + original_request_ = original_request; + if (original_request) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) +} + +// optional bytes file_descriptor_proto = 4; +bool DescriptorDatabaseResponse::has_file_descriptor_proto() const { + return message_response_case() == kFileDescriptorProto; +} +void DescriptorDatabaseResponse::set_has_file_descriptor_proto() { + _oneof_case_[0] = kFileDescriptorProto; +} +void DescriptorDatabaseResponse::clear_file_descriptor_proto() { + if (has_file_descriptor_proto()) { + message_response_.file_descriptor_proto_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_message_response(); + } +} + const ::std::string& DescriptorDatabaseResponse::file_descriptor_proto() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + if (has_file_descriptor_proto()) { + return message_response_.file_descriptor_proto_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} + void DescriptorDatabaseResponse::set_file_descriptor_proto(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) +} + void DescriptorDatabaseResponse::set_file_descriptor_proto(const char* value) { + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) +} + void DescriptorDatabaseResponse::set_file_descriptor_proto(const void* value, size_t size) { + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) +} + ::std::string* DescriptorDatabaseResponse::mutable_file_descriptor_proto() { + if (!has_file_descriptor_proto()) { + clear_message_response(); + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + return message_response_.file_descriptor_proto_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* DescriptorDatabaseResponse::release_file_descriptor_proto() { + if (has_file_descriptor_proto()) { + clear_has_message_response(); + return message_response_.file_descriptor_proto_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} + void DescriptorDatabaseResponse::set_allocated_file_descriptor_proto(::std::string* file_descriptor_proto) { + if (!has_file_descriptor_proto()) { + message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_message_response(); + if (file_descriptor_proto != NULL) { + set_has_file_descriptor_proto(); + message_response_.file_descriptor_proto_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + file_descriptor_proto); + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) +} + +// optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; +bool DescriptorDatabaseResponse::has_all_extension_numbers_response() const { + return message_response_case() == kAllExtensionNumbersResponse; +} +void DescriptorDatabaseResponse::set_has_all_extension_numbers_response() { + _oneof_case_[0] = kAllExtensionNumbersResponse; +} +void DescriptorDatabaseResponse::clear_all_extension_numbers_response() { + if (has_all_extension_numbers_response()) { + delete message_response_.all_extension_numbers_response_; + clear_has_message_response(); + } +} + const ::grpc::reflection::v1alpha::ExtensionNumberResponse& DescriptorDatabaseResponse::all_extension_numbers_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + return has_all_extension_numbers_response() + ? *message_response_.all_extension_numbers_response_ + : ::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance(); +} +::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::mutable_all_extension_numbers_response() { + if (!has_all_extension_numbers_response()) { + clear_message_response(); + set_has_all_extension_numbers_response(); + message_response_.all_extension_numbers_response_ = new ::grpc::reflection::v1alpha::ExtensionNumberResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + return message_response_.all_extension_numbers_response_; +} +::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::release_all_extension_numbers_response() { + if (has_all_extension_numbers_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ExtensionNumberResponse* temp = message_response_.all_extension_numbers_response_; + message_response_.all_extension_numbers_response_ = NULL; + return temp; + } else { + return NULL; + } +} +void DescriptorDatabaseResponse::set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response) { + clear_message_response(); + if (all_extension_numbers_response) { + set_has_all_extension_numbers_response(); + message_response_.all_extension_numbers_response_ = all_extension_numbers_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) +} + +// optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; +bool DescriptorDatabaseResponse::has_list_services_response() const { + return message_response_case() == kListServicesResponse; +} +void DescriptorDatabaseResponse::set_has_list_services_response() { + _oneof_case_[0] = kListServicesResponse; +} +void DescriptorDatabaseResponse::clear_list_services_response() { + if (has_list_services_response()) { + delete message_response_.list_services_response_; + clear_has_message_response(); + } +} + const ::grpc::reflection::v1alpha::ListServiceResponse& DescriptorDatabaseResponse::list_services_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + return has_list_services_response() + ? *message_response_.list_services_response_ + : ::grpc::reflection::v1alpha::ListServiceResponse::default_instance(); +} +::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::mutable_list_services_response() { + if (!has_list_services_response()) { + clear_message_response(); + set_has_list_services_response(); + message_response_.list_services_response_ = new ::grpc::reflection::v1alpha::ListServiceResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + return message_response_.list_services_response_; +} +::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::release_list_services_response() { + if (has_list_services_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ListServiceResponse* temp = message_response_.list_services_response_; + message_response_.list_services_response_ = NULL; + return temp; + } else { + return NULL; + } +} +void DescriptorDatabaseResponse::set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response) { + clear_message_response(); + if (list_services_response) { + set_has_list_services_response(); + message_response_.list_services_response_ = list_services_response; + } + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) +} + +// optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; +bool DescriptorDatabaseResponse::has_error_response() const { + return message_response_case() == kErrorResponse; +} +void DescriptorDatabaseResponse::set_has_error_response() { + _oneof_case_[0] = kErrorResponse; +} +void DescriptorDatabaseResponse::clear_error_response() { + if (has_error_response()) { + delete message_response_.error_response_; + clear_has_message_response(); + } +} + const ::grpc::reflection::v1alpha::ErrorResponse& DescriptorDatabaseResponse::error_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + return has_error_response() + ? *message_response_.error_response_ + : ::grpc::reflection::v1alpha::ErrorResponse::default_instance(); +} +::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::mutable_error_response() { + if (!has_error_response()) { + clear_message_response(); + set_has_error_response(); + message_response_.error_response_ = new ::grpc::reflection::v1alpha::ErrorResponse; + } + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + return message_response_.error_response_; +} +::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::release_error_response() { + if (has_error_response()) { + clear_has_message_response(); + ::grpc::reflection::v1alpha::ErrorResponse* temp = message_response_.error_response_; + message_response_.error_response_ = NULL; + return temp; } else { + return NULL; + } +} +void DescriptorDatabaseResponse::set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response) { + clear_message_response(); + if (error_response) { + set_has_error_response(); + message_response_.error_response_ = error_response; } - type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.TypeRequest.type) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) } +bool DescriptorDatabaseResponse::has_message_response() const { + return message_response_case() != MESSAGE_RESPONSE_NOT_SET; +} +void DescriptorDatabaseResponse::clear_has_message_response() { + _oneof_case_[0] = MESSAGE_RESPONSE_NOT_SET; +} +DescriptorDatabaseResponse::MessageResponseCase DescriptorDatabaseResponse::message_response_case() const { + return DescriptorDatabaseResponse::MessageResponseCase(_oneof_case_[0]); +} #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int ListServiceResponse::kServicesFieldNumber; +const int ExtensionNumberResponse::kBaseTypeNameFieldNumber; +const int ExtensionNumberResponse::kExtensionNumberFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -ListServiceResponse::ListServiceResponse() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +ExtensionNumberResponse::ExtensionNumberResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ListServiceResponse) + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) } -void ListServiceResponse::InitAsDefaultInstance() { +void ExtensionNumberResponse::InitAsDefaultInstance() { _is_default_instance_ = true; } -ListServiceResponse::ListServiceResponse(const ListServiceResponse& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +ExtensionNumberResponse::ExtensionNumberResponse(const ExtensionNumberResponse& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ListServiceResponse) + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) } -void ListServiceResponse::SharedCtor() { - _is_default_instance_ = false; +void ExtensionNumberResponse::SharedCtor() { + _is_default_instance_ = false; ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; + base_type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -ListServiceResponse::~ListServiceResponse() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ListServiceResponse) +ExtensionNumberResponse::~ExtensionNumberResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ExtensionNumberResponse) SharedDtor(); } -void ListServiceResponse::SharedDtor() { +void ExtensionNumberResponse::SharedDtor() { + base_type_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != default_instance_) { } } -void ListServiceResponse::SetCachedSize(int size) const { +void ExtensionNumberResponse::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } -const ::google::protobuf::Descriptor* ListServiceResponse::descriptor() { +const ::google::protobuf::Descriptor* ExtensionNumberResponse::descriptor() { protobuf_AssignDescriptorsOnce(); - return ListServiceResponse_descriptor_; + return ExtensionNumberResponse_descriptor_; } -const ListServiceResponse& ListServiceResponse::default_instance() { +const ExtensionNumberResponse& ExtensionNumberResponse::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); return *default_instance_; } -ListServiceResponse* ListServiceResponse::default_instance_ = NULL; +ExtensionNumberResponse* ExtensionNumberResponse::default_instance_ = NULL; -ListServiceResponse* ListServiceResponse::New( - ::google::protobuf::Arena* arena) const { - ListServiceResponse* n = new ListServiceResponse; +ExtensionNumberResponse* ExtensionNumberResponse::New(::google::protobuf::Arena* arena) const { + ExtensionNumberResponse* n = new ExtensionNumberResponse; if (arena != NULL) { arena->Own(n); } return n; } -void ListServiceResponse::Clear() { services_.Clear(); } +void ExtensionNumberResponse::Clear() { + base_type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + extension_number_.Clear(); +} -bool ListServiceResponse::MergePartialFromCodedStream( +bool ExtensionNumberResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ListServiceResponse) + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ExtensionNumberResponse) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; if (!p.second) goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated string services = 1; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string base_type_name = 1; case 1: { if (tag == 10) { - parse_services: DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_services())); + input, this->mutable_base_type_name())); DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->services(this->services_size() - 1).data(), - this->services(this->services_size() - 1).length(), - ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.ListServiceResponse.services")); + this->base_type_name().data(), this->base_type_name().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name")); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_extension_number; + break; + } + + // repeated int32 extension_number = 2; + case 2: { + if (tag == 18) { + parse_extension_number: + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_extension_number()))); + } else if (tag == 16) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 18, input, this->mutable_extension_number()))); } else { goto handle_unusual; } - if (input->ExpectTag(10)) goto parse_services; if (input->ExpectAtEnd()) goto success; break; } @@ -1707,66 +2486,106 @@ bool ListServiceResponse::MergePartialFromCodedStream( handle_unusual: if (tag == 0 || ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite:: - WIRETYPE_END_GROUP) { + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { goto success; } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, - tag)); + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); break; } } } success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ListServiceResponse) + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ExtensionNumberResponse) return true; failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ListServiceResponse) + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ExtensionNumberResponse) return false; #undef DO_ } -void ListServiceResponse::SerializeWithCachedSizes( +void ExtensionNumberResponse::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ListServiceResponse) - // repeated string services = 1; - for (int i = 0; i < this->services_size(); i++) { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ExtensionNumberResponse) + // optional string base_type_name = 1; + if (this->base_type_name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->services(i).data(), this->services(i).length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.ListServiceResponse.services"); - ::google::protobuf::internal::WireFormatLite::WriteString( - 1, this->services(i), output); + this->base_type_name().data(), this->base_type_name().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->base_type_name(), output); + } + + // repeated int32 extension_number = 2; + if (this->extension_number_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(_extension_number_cached_byte_size_); + } + for (int i = 0; i < this->extension_number_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( + this->extension_number(i), output); } - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ListServiceResponse) + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ExtensionNumberResponse) } -::google::protobuf::uint8* ListServiceResponse::SerializeWithCachedSizesToArray( +::google::protobuf::uint8* ExtensionNumberResponse::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ListServiceResponse) - // repeated string services = 1; - for (int i = 0; i < this->services_size(); i++) { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ExtensionNumberResponse) + // optional string base_type_name = 1; + if (this->base_type_name().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->services(i).data(), this->services(i).length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.ListServiceResponse.services"); - target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 1, this->services(i), target); + this->base_type_name().data(), this->base_type_name().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->base_type_name(), target); } - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ListServiceResponse) + // repeated int32 extension_number = 2; + if (this->extension_number_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 2, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + _extension_number_cached_byte_size_, target); + } + for (int i = 0; i < this->extension_number_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32NoTagToArray(this->extension_number(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ExtensionNumberResponse) return target; } -int ListServiceResponse::ByteSize() const { +int ExtensionNumberResponse::ByteSize() const { int total_size = 0; - // repeated string services = 1; - total_size += 1 * this->services_size(); - for (int i = 0; i < this->services_size(); i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->services(i)); + // optional string base_type_name = 1; + if (this->base_type_name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->base_type_name()); + } + + // repeated int32 extension_number = 2; + { + int data_size = 0; + for (int i = 0; i < this->extension_number_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->extension_number(i)); + } + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _extension_number_cached_byte_size_ = data_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -1775,11 +2594,11 @@ int ListServiceResponse::ByteSize() const { return total_size; } -void ListServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { +void ExtensionNumberResponse::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const ListServiceResponse* source = - ::google::protobuf::internal::DynamicCastToGenerated< - const ListServiceResponse>(&from); + const ExtensionNumberResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -1787,92 +2606,125 @@ void ListServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { } } -void ListServiceResponse::MergeFrom(const ListServiceResponse& from) { +void ExtensionNumberResponse::MergeFrom(const ExtensionNumberResponse& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - services_.MergeFrom(from.services_); + extension_number_.MergeFrom(from.extension_number_); + if (from.base_type_name().size() > 0) { + + base_type_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.base_type_name_); + } } -void ListServiceResponse::CopyFrom(const ::google::protobuf::Message& from) { +void ExtensionNumberResponse::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } -void ListServiceResponse::CopyFrom(const ListServiceResponse& from) { +void ExtensionNumberResponse::CopyFrom(const ExtensionNumberResponse& from) { if (&from == this) return; Clear(); MergeFrom(from); } -bool ListServiceResponse::IsInitialized() const { return true; } +bool ExtensionNumberResponse::IsInitialized() const { -void ListServiceResponse::Swap(ListServiceResponse* other) { + return true; +} + +void ExtensionNumberResponse::Swap(ExtensionNumberResponse* other) { if (other == this) return; InternalSwap(other); } -void ListServiceResponse::InternalSwap(ListServiceResponse* other) { - services_.UnsafeArenaSwap(&other->services_); +void ExtensionNumberResponse::InternalSwap(ExtensionNumberResponse* other) { + base_type_name_.Swap(&other->base_type_name_); + extension_number_.UnsafeArenaSwap(&other->extension_number_); _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } -::google::protobuf::Metadata ListServiceResponse::GetMetadata() const { +::google::protobuf::Metadata ExtensionNumberResponse::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; - metadata.descriptor = ListServiceResponse_descriptor_; - metadata.reflection = ListServiceResponse_reflection_; + metadata.descriptor = ExtensionNumberResponse_descriptor_; + metadata.reflection = ExtensionNumberResponse_reflection_; return metadata; } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// ListServiceResponse +// ExtensionNumberResponse -// repeated string services = 1; -int ListServiceResponse::services_size() const { return services_.size(); } -void ListServiceResponse::clear_services() { services_.Clear(); } -const ::std::string& ListServiceResponse::services(int index) const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.services) - return services_.Get(index); +// optional string base_type_name = 1; +void ExtensionNumberResponse::clear_base_type_name() { + base_type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& ExtensionNumberResponse::base_type_name() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) + return base_type_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void ExtensionNumberResponse::set_base_type_name(const ::std::string& value) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} + void ExtensionNumberResponse::set_base_type_name(const char* value) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) } -::std::string* ListServiceResponse::mutable_services(int index) { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.services) - return services_.Mutable(index); + void ExtensionNumberResponse::set_base_type_name(const char* value, size_t size) { + + base_type_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) +} + ::std::string* ExtensionNumberResponse::mutable_base_type_name() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) + return base_type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -void ListServiceResponse::set_services(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.services) - services_.Mutable(index)->assign(value); + ::std::string* ExtensionNumberResponse::release_base_type_name() { + + return base_type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void ExtensionNumberResponse::set_allocated_base_type_name(::std::string* base_type_name) { + if (base_type_name != NULL) { + + } else { + + } + base_type_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), base_type_name); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) } -void ListServiceResponse::set_services(int index, const char* value) { - services_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.services) + +// repeated int32 extension_number = 2; +int ExtensionNumberResponse::extension_number_size() const { + return extension_number_.size(); } -void ListServiceResponse::set_services(int index, const char* value, - size_t size) { - services_.Mutable(index)->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) +void ExtensionNumberResponse::clear_extension_number() { + extension_number_.Clear(); } -::std::string* ListServiceResponse::add_services() { return services_.Add(); } -void ListServiceResponse::add_services(const ::std::string& value) { - services_.Add()->assign(value); - // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.services) + ::google::protobuf::int32 ExtensionNumberResponse::extension_number(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_.Get(index); } -void ListServiceResponse::add_services(const char* value) { - services_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.services) + void ExtensionNumberResponse::set_extension_number(int index, ::google::protobuf::int32 value) { + extension_number_.Set(index, value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) } -void ListServiceResponse::add_services(const char* value, size_t size) { - services_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.services) + void ExtensionNumberResponse::add_extension_number(::google::protobuf::int32 value) { + extension_number_.Add(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) } -const ::google::protobuf::RepeatedPtrField< ::std::string>& -ListServiceResponse::services() const { - // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.services) - return services_; + const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +ExtensionNumberResponse::extension_number() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return extension_number_; } -::google::protobuf::RepeatedPtrField< ::std::string>* -ListServiceResponse::mutable_services() { - // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.services) - return &services_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +ExtensionNumberResponse::mutable_extension_number() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + return &extension_number_; } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS @@ -1880,102 +2732,97 @@ ListServiceResponse::mutable_services() { // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int FileDescriptorProtoResponse::kFileDescriptorProtoFieldNumber; +const int ListServiceResponse::kServiceFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -FileDescriptorProtoResponse::FileDescriptorProtoResponse() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +ListServiceResponse::ListServiceResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ListServiceResponse) } -void FileDescriptorProtoResponse::InitAsDefaultInstance() { +void ListServiceResponse::InitAsDefaultInstance() { _is_default_instance_ = true; } -FileDescriptorProtoResponse::FileDescriptorProtoResponse( - const FileDescriptorProtoResponse& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +ListServiceResponse::ListServiceResponse(const ListServiceResponse& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ListServiceResponse) } -void FileDescriptorProtoResponse::SharedCtor() { - _is_default_instance_ = false; +void ListServiceResponse::SharedCtor() { + _is_default_instance_ = false; ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; - file_descriptor_proto_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -FileDescriptorProtoResponse::~FileDescriptorProtoResponse() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.FileDescriptorProtoResponse) +ListServiceResponse::~ListServiceResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ListServiceResponse) SharedDtor(); } -void FileDescriptorProtoResponse::SharedDtor() { - file_descriptor_proto_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +void ListServiceResponse::SharedDtor() { if (this != default_instance_) { } } -void FileDescriptorProtoResponse::SetCachedSize(int size) const { +void ListServiceResponse::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } -const ::google::protobuf::Descriptor* -FileDescriptorProtoResponse::descriptor() { +const ::google::protobuf::Descriptor* ListServiceResponse::descriptor() { protobuf_AssignDescriptorsOnce(); - return FileDescriptorProtoResponse_descriptor_; + return ListServiceResponse_descriptor_; } -const FileDescriptorProtoResponse& -FileDescriptorProtoResponse::default_instance() { +const ListServiceResponse& ListServiceResponse::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); return *default_instance_; } -FileDescriptorProtoResponse* FileDescriptorProtoResponse::default_instance_ = - NULL; +ListServiceResponse* ListServiceResponse::default_instance_ = NULL; -FileDescriptorProtoResponse* FileDescriptorProtoResponse::New( - ::google::protobuf::Arena* arena) const { - FileDescriptorProtoResponse* n = new FileDescriptorProtoResponse; +ListServiceResponse* ListServiceResponse::New(::google::protobuf::Arena* arena) const { + ListServiceResponse* n = new ListServiceResponse; if (arena != NULL) { arena->Own(n); } return n; } -void FileDescriptorProtoResponse::Clear() { - file_descriptor_proto_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); +void ListServiceResponse::Clear() { + service_.Clear(); } -bool FileDescriptorProtoResponse::MergePartialFromCodedStream( +bool ListServiceResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ListServiceResponse) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; if (!p.second) goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // optional bytes file_descriptor_proto = 1; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated string service = 1; case 1: { if (tag == 10) { - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_file_descriptor_proto())); + parse_service: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_service())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->service(this->service_size() - 1).data(), + this->service(this->service_size() - 1).length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.ListServiceResponse.service")); } else { goto handle_unusual; } + if (input->ExpectTag(10)) goto parse_service; if (input->ExpectAtEnd()) goto success; break; } @@ -1984,58 +2831,64 @@ bool FileDescriptorProtoResponse::MergePartialFromCodedStream( handle_unusual: if (tag == 0 || ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite:: - WIRETYPE_END_GROUP) { + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { goto success; } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, - tag)); + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); break; } } } success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ListServiceResponse) return true; failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ListServiceResponse) return false; #undef DO_ } -void FileDescriptorProtoResponse::SerializeWithCachedSizes( +void ListServiceResponse::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.FileDescriptorProtoResponse) - // optional bytes file_descriptor_proto = 1; - if (this->file_descriptor_proto().size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( - 1, this->file_descriptor_proto(), output); + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ListServiceResponse) + // repeated string service = 1; + for (int i = 0; i < this->service_size(); i++) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->service(i).data(), this->service(i).length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ListServiceResponse.service"); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->service(i), output); } - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ListServiceResponse) } -::google::protobuf::uint8* -FileDescriptorProtoResponse::SerializeWithCachedSizesToArray( +::google::protobuf::uint8* ListServiceResponse::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.FileDescriptorProtoResponse) - // optional bytes file_descriptor_proto = 1; - if (this->file_descriptor_proto().size() > 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( - 1, this->file_descriptor_proto(), target); + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ListServiceResponse) + // repeated string service = 1; + for (int i = 0; i < this->service_size(); i++) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->service(i).data(), this->service(i).length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ListServiceResponse.service"); + target = ::google::protobuf::internal::WireFormatLite:: + WriteStringToArray(1, this->service(i), target); } - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.FileDescriptorProtoResponse) + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ListServiceResponse) return target; } -int FileDescriptorProtoResponse::ByteSize() const { +int ListServiceResponse::ByteSize() const { int total_size = 0; - // optional bytes file_descriptor_proto = 1; - if (this->file_descriptor_proto().size() > 0) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( - this->file_descriptor_proto()); + // repeated string service = 1; + total_size += 1 * this->service_size(); + for (int i = 0; i < this->service_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->service(i)); } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -2044,12 +2897,11 @@ int FileDescriptorProtoResponse::ByteSize() const { return total_size; } -void FileDescriptorProtoResponse::MergeFrom( - const ::google::protobuf::Message& from) { +void ListServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const FileDescriptorProtoResponse* source = - ::google::protobuf::internal::DynamicCastToGenerated< - const FileDescriptorProtoResponse>(&from); + const ListServiceResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -2057,102 +2909,101 @@ void FileDescriptorProtoResponse::MergeFrom( } } -void FileDescriptorProtoResponse::MergeFrom( - const FileDescriptorProtoResponse& from) { +void ListServiceResponse::MergeFrom(const ListServiceResponse& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - if (from.file_descriptor_proto().size() > 0) { - file_descriptor_proto_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.file_descriptor_proto_); - } + service_.MergeFrom(from.service_); } -void FileDescriptorProtoResponse::CopyFrom( - const ::google::protobuf::Message& from) { +void ListServiceResponse::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } -void FileDescriptorProtoResponse::CopyFrom( - const FileDescriptorProtoResponse& from) { +void ListServiceResponse::CopyFrom(const ListServiceResponse& from) { if (&from == this) return; Clear(); MergeFrom(from); } -bool FileDescriptorProtoResponse::IsInitialized() const { return true; } +bool ListServiceResponse::IsInitialized() const { + + return true; +} -void FileDescriptorProtoResponse::Swap(FileDescriptorProtoResponse* other) { +void ListServiceResponse::Swap(ListServiceResponse* other) { if (other == this) return; InternalSwap(other); } -void FileDescriptorProtoResponse::InternalSwap( - FileDescriptorProtoResponse* other) { - file_descriptor_proto_.Swap(&other->file_descriptor_proto_); +void ListServiceResponse::InternalSwap(ListServiceResponse* other) { + service_.UnsafeArenaSwap(&other->service_); _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } -::google::protobuf::Metadata FileDescriptorProtoResponse::GetMetadata() const { +::google::protobuf::Metadata ListServiceResponse::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; - metadata.descriptor = FileDescriptorProtoResponse_descriptor_; - metadata.reflection = FileDescriptorProtoResponse_reflection_; + metadata.descriptor = ListServiceResponse_descriptor_; + metadata.reflection = ListServiceResponse_reflection_; return metadata; } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// FileDescriptorProtoResponse - -// optional bytes file_descriptor_proto = 1; -void FileDescriptorProtoResponse::clear_file_descriptor_proto() { - file_descriptor_proto_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -const ::std::string& FileDescriptorProtoResponse::file_descriptor_proto() - const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) - return file_descriptor_proto_.GetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void FileDescriptorProtoResponse::set_file_descriptor_proto( - const ::std::string& value) { - file_descriptor_proto_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) -} -void FileDescriptorProtoResponse::set_file_descriptor_proto(const char* value) { - file_descriptor_proto_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +// ListServiceResponse + +// repeated string service = 1; +int ListServiceResponse::service_size() const { + return service_.size(); } -void FileDescriptorProtoResponse::set_file_descriptor_proto(const void* value, - size_t size) { - file_descriptor_proto_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) +void ListServiceResponse::clear_service() { + service_.Clear(); } -::std::string* FileDescriptorProtoResponse::mutable_file_descriptor_proto() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) - return file_descriptor_proto_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + const ::std::string& ListServiceResponse::service(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Get(index); } -::std::string* FileDescriptorProtoResponse::release_file_descriptor_proto() { - return file_descriptor_proto_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::std::string* ListServiceResponse::mutable_service(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Mutable(index); } -void FileDescriptorProtoResponse::set_allocated_file_descriptor_proto( - ::std::string* file_descriptor_proto) { - if (file_descriptor_proto != NULL) { - } else { - } - file_descriptor_proto_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - file_descriptor_proto); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.FileDescriptorProtoResponse.file_descriptor_proto) + void ListServiceResponse::set_service(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.service) + service_.Mutable(index)->assign(value); +} + void ListServiceResponse::set_service(int index, const char* value) { + service_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.service) +} + void ListServiceResponse::set_service(int index, const char* value, size_t size) { + service_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) +} + ::std::string* ListServiceResponse::add_service() { + return service_.Add(); +} + void ListServiceResponse::add_service(const ::std::string& value) { + service_.Add()->assign(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.service) +} + void ListServiceResponse::add_service(const char* value) { + service_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.service) +} + void ListServiceResponse::add_service(const char* value, size_t size) { + service_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) +} + const ::google::protobuf::RepeatedPtrField< ::std::string>& +ListServiceResponse::service() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_; +} + ::google::protobuf::RepeatedPtrField< ::std::string>* +ListServiceResponse::mutable_service() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return &service_; } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS @@ -2160,98 +3011,111 @@ void FileDescriptorProtoResponse::set_allocated_file_descriptor_proto( // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int ExtensionNumberResponse::kExtensionNumberFieldNumber; +const int ErrorResponse::kErrorCodeFieldNumber; +const int ErrorResponse::kErrorMessageFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -ExtensionNumberResponse::ExtensionNumberResponse() - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +ErrorResponse::ErrorResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ErrorResponse) } -void ExtensionNumberResponse::InitAsDefaultInstance() { +void ErrorResponse::InitAsDefaultInstance() { _is_default_instance_ = true; } -ExtensionNumberResponse::ExtensionNumberResponse( - const ExtensionNumberResponse& from) - : ::google::protobuf::Message(), _internal_metadata_(NULL) { +ErrorResponse::ErrorResponse(const ErrorResponse& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ExtensionNumberResponse) + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ErrorResponse) } -void ExtensionNumberResponse::SharedCtor() { - _is_default_instance_ = false; +void ErrorResponse::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; + error_code_ = 0; + error_message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -ExtensionNumberResponse::~ExtensionNumberResponse() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ExtensionNumberResponse) +ErrorResponse::~ErrorResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ErrorResponse) SharedDtor(); } -void ExtensionNumberResponse::SharedDtor() { +void ErrorResponse::SharedDtor() { + error_message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != default_instance_) { } } -void ExtensionNumberResponse::SetCachedSize(int size) const { +void ErrorResponse::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } -const ::google::protobuf::Descriptor* ExtensionNumberResponse::descriptor() { +const ::google::protobuf::Descriptor* ErrorResponse::descriptor() { protobuf_AssignDescriptorsOnce(); - return ExtensionNumberResponse_descriptor_; + return ErrorResponse_descriptor_; } -const ExtensionNumberResponse& ExtensionNumberResponse::default_instance() { +const ErrorResponse& ErrorResponse::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); return *default_instance_; } -ExtensionNumberResponse* ExtensionNumberResponse::default_instance_ = NULL; +ErrorResponse* ErrorResponse::default_instance_ = NULL; -ExtensionNumberResponse* ExtensionNumberResponse::New( - ::google::protobuf::Arena* arena) const { - ExtensionNumberResponse* n = new ExtensionNumberResponse; +ErrorResponse* ErrorResponse::New(::google::protobuf::Arena* arena) const { + ErrorResponse* n = new ErrorResponse; if (arena != NULL) { arena->Own(n); } return n; } -void ExtensionNumberResponse::Clear() { extension_number_.Clear(); } +void ErrorResponse::Clear() { + error_code_ = 0; + error_message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} -bool ExtensionNumberResponse::MergePartialFromCodedStream( +bool ErrorResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) \ - if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ExtensionNumberResponse) + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ErrorResponse) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoff(127); + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; if (!p.second) goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated int32 extension_number = 1; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int32 error_code = 1; case 1: { - if (tag == 10) { - DO_(( - ::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_extension_number()))); - } else if (tag == 8) { - DO_(( - ::google::protobuf::internal::WireFormatLite:: - ReadRepeatedPrimitiveNoInline< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - 1, 10, input, this->mutable_extension_number()))); + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &error_code_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_error_message; + break; + } + + // optional string error_message = 2; + case 2: { + if (tag == 18) { + parse_error_message: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_error_message())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->error_message().data(), this->error_message().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.ErrorResponse.error_message")); } else { goto handle_unusual; } @@ -2263,85 +3127,82 @@ bool ExtensionNumberResponse::MergePartialFromCodedStream( handle_unusual: if (tag == 0 || ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == - ::google::protobuf::internal::WireFormatLite:: - WIRETYPE_END_GROUP) { + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { goto success; } - DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, - tag)); + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); break; } } } success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ExtensionNumberResponse) + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ErrorResponse) return true; failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ExtensionNumberResponse) + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ErrorResponse) return false; #undef DO_ } -void ExtensionNumberResponse::SerializeWithCachedSizes( +void ErrorResponse::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ExtensionNumberResponse) - // repeated int32 extension_number = 1; - if (this->extension_number_size() > 0) { - ::google::protobuf::internal::WireFormatLite::WriteTag( - 1, - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, - output); - output->WriteVarint32(_extension_number_cached_byte_size_); + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ErrorResponse) + // optional int32 error_code = 1; + if (this->error_code() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->error_code(), output); } - for (int i = 0; i < this->extension_number_size(); i++) { - ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( - this->extension_number(i), output); + + // optional string error_message = 2; + if (this->error_message().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->error_message().data(), this->error_message().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ErrorResponse.error_message"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 2, this->error_message(), output); } - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ExtensionNumberResponse) + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ErrorResponse) } -::google::protobuf::uint8* -ExtensionNumberResponse::SerializeWithCachedSizesToArray( +::google::protobuf::uint8* ErrorResponse::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ExtensionNumberResponse) - // repeated int32 extension_number = 1; - if (this->extension_number_size() > 0) { - target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( - 1, - ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, - target); - target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( - _extension_number_cached_byte_size_, target); + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ErrorResponse) + // optional int32 error_code = 1; + if (this->error_code() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->error_code(), target); } - for (int i = 0; i < this->extension_number_size(); i++) { + + // optional string error_message = 2; + if (this->error_message().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->error_message().data(), this->error_message().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ErrorResponse.error_message"); target = - ::google::protobuf::internal::WireFormatLite::WriteInt32NoTagToArray( - this->extension_number(i), target); + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->error_message(), target); } - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ExtensionNumberResponse) + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ErrorResponse) return target; } -int ExtensionNumberResponse::ByteSize() const { +int ErrorResponse::ByteSize() const { int total_size = 0; - // repeated int32 extension_number = 1; - { - int data_size = 0; - for (int i = 0; i < this->extension_number_size(); i++) { - data_size += ::google::protobuf::internal::WireFormatLite::Int32Size( - this->extension_number(i)); - } - if (data_size > 0) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - data_size); - } - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _extension_number_cached_byte_size_ = data_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - total_size += data_size; + // optional int32 error_code = 1; + if (this->error_code() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->error_code()); + } + + // optional string error_message = 2; + if (this->error_message().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->error_message()); } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -2350,12 +3211,11 @@ int ExtensionNumberResponse::ByteSize() const { return total_size; } -void ExtensionNumberResponse::MergeFrom( - const ::google::protobuf::Message& from) { +void ErrorResponse::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const ExtensionNumberResponse* source = - ::google::protobuf::internal::DynamicCastToGenerated< - const ExtensionNumberResponse>(&from); + const ErrorResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { @@ -2363,78 +3223,111 @@ void ExtensionNumberResponse::MergeFrom( } } -void ExtensionNumberResponse::MergeFrom(const ExtensionNumberResponse& from) { +void ErrorResponse::MergeFrom(const ErrorResponse& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - extension_number_.MergeFrom(from.extension_number_); + if (from.error_code() != 0) { + set_error_code(from.error_code()); + } + if (from.error_message().size() > 0) { + + error_message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.error_message_); + } } -void ExtensionNumberResponse::CopyFrom( - const ::google::protobuf::Message& from) { +void ErrorResponse::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } -void ExtensionNumberResponse::CopyFrom(const ExtensionNumberResponse& from) { +void ErrorResponse::CopyFrom(const ErrorResponse& from) { if (&from == this) return; Clear(); MergeFrom(from); } -bool ExtensionNumberResponse::IsInitialized() const { return true; } +bool ErrorResponse::IsInitialized() const { -void ExtensionNumberResponse::Swap(ExtensionNumberResponse* other) { + return true; +} + +void ErrorResponse::Swap(ErrorResponse* other) { if (other == this) return; InternalSwap(other); } -void ExtensionNumberResponse::InternalSwap(ExtensionNumberResponse* other) { - extension_number_.UnsafeArenaSwap(&other->extension_number_); +void ErrorResponse::InternalSwap(ErrorResponse* other) { + std::swap(error_code_, other->error_code_); + error_message_.Swap(&other->error_message_); _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); } -::google::protobuf::Metadata ExtensionNumberResponse::GetMetadata() const { +::google::protobuf::Metadata ErrorResponse::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; - metadata.descriptor = ExtensionNumberResponse_descriptor_; - metadata.reflection = ExtensionNumberResponse_reflection_; + metadata.descriptor = ErrorResponse_descriptor_; + metadata.reflection = ErrorResponse_reflection_; return metadata; } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// ExtensionNumberResponse +// ErrorResponse -// repeated int32 extension_number = 1; -int ExtensionNumberResponse::extension_number_size() const { - return extension_number_.size(); +// optional int32 error_code = 1; +void ErrorResponse::clear_error_code() { + error_code_ = 0; } -void ExtensionNumberResponse::clear_extension_number() { - extension_number_.Clear(); + ::google::protobuf::int32 ErrorResponse::error_code() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_code) + return error_code_; } -::google::protobuf::int32 ExtensionNumberResponse::extension_number( - int index) const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) - return extension_number_.Get(index); + void ErrorResponse::set_error_code(::google::protobuf::int32 value) { + + error_code_ = value; + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_code) } -void ExtensionNumberResponse::set_extension_number( - int index, ::google::protobuf::int32 value) { - extension_number_.Set(index, value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + +// optional string error_message = 2; +void ErrorResponse::clear_error_message() { + error_message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -void ExtensionNumberResponse::add_extension_number( - ::google::protobuf::int32 value) { - extension_number_.Add(value); - // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) + const ::std::string& ErrorResponse::error_message() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ErrorResponse.error_message) + return error_message_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -const ::google::protobuf::RepeatedField< ::google::protobuf::int32>& -ExtensionNumberResponse::extension_number() const { - // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) - return extension_number_; + void ErrorResponse::set_error_message(const ::std::string& value) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ErrorResponse.error_message) } -::google::protobuf::RepeatedField< ::google::protobuf::int32>* -ExtensionNumberResponse::mutable_extension_number() { - // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ExtensionNumberResponse.extension_number) - return &extension_number_; + void ErrorResponse::set_error_message(const char* value) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ErrorResponse.error_message) +} + void ErrorResponse::set_error_message(const char* value, size_t size) { + + error_message_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ErrorResponse.error_message) +} + ::std::string* ErrorResponse::mutable_error_message() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ErrorResponse.error_message) + return error_message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* ErrorResponse::release_error_message() { + + return error_message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void ErrorResponse::set_allocated_error_message(::std::string* error_message) { + if (error_message != NULL) { + + } else { + + } + error_message_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), error_message); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ErrorResponse.error_message) } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS diff --git a/src/proto/grpc/reflection/v1alpha/reflection.proto b/src/proto/grpc/reflection/v1alpha/reflection.proto index 4b13bd1e51c..6e6a0b08644 100644 --- a/src/proto/grpc/reflection/v1alpha/reflection.proto +++ b/src/proto/grpc/reflection/v1alpha/reflection.proto @@ -34,85 +34,98 @@ syntax = "proto3"; package grpc.reflection.v1alpha; service ServerReflection { - // List the full names of registered services. - rpc ListService(EmptyRequest) returns (ListServiceResponse) { - } - - // Find a proto file by file name. - rpc GetFileByName(FileNameRequest) returns (FileDescriptorProtoResponse) { - } - - // Find the proto file that declares the given fully-qualified symbol name. - rpc GetFileContainingSymbol(SymbolRequest) - returns (FileDescriptorProtoResponse) { - } - - // Find the proto file which defines an extension extending the given message - // type with the given field number. - rpc GetFileContainingExtension(ExtensionRequest) - returns (FileDescriptorProtoResponse) { - } - - // Finds the tag numbers used by all known extensions of extendee_type, and - // appends them to ExtensionNumberResponse in an undefined order. - // This method is best-effort: it's not guaranteed that the reflection service - // will implement this method, and it's not guaranteed that this method will - // provide all extensions. Returns StatusCode::UNIMPLEMENTED if it's not - // implemented. - rpc GetAllExtensionNumbers(TypeRequest) returns (ExtensionNumberResponse) { - } -} - -// An empty message sent by the client when calling ListService method. -message EmptyRequest { -} - -// The filename sent by the client when calling GetFileByName method. -message FileNameRequest { - // Name of the proto file. - string filename = 1; + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + rpc DescriptorDatabaseInfo(stream DescriptorDatabaseRequest) + returns (stream DescriptorDatabaseResponse); } -// The symbol name sent by the client when calling GetFileContainingSymbol -// method. -message SymbolRequest { - // Fully-qualified symbol name (e.g. .[.] or - // .). - string symbol = 1; +// The message sent by the client when calling DescriptorDatabaseInfo method. +message DescriptorDatabaseRequest { + string host = 1; + // To use reflection service, the client should set one of the following + // fields in message_request. The server distinguishes requests by their + // defined field and then handles them using corresponding methods. + oneof message_request { + // Find a proto file by the file name. + string file_by_filename = 3; + + // Find the proto file that declares the given fully-qualified symbol name. + // This field should be a fully-qualified symbol name + // (e.g. .[.] or .). + string file_containing_symbol = 4; + + // Find the proto file which defines an extension extending the given + // message type with the given field number. + ExtensionRequest file_containing_extension = 5; + + // Finds the tag numbers used by all known extensions of extendee_type, and + // appends them to ExtensionNumberResponse in an undefined order. + // Its corresponding method is best-effort: it's not guaranteed that the + // reflection service will implement this method, and it's not guaranteed + // that this method will provide all extensions. Returns + // StatusCode::UNIMPLEMENTED if it's not implemented. + // This field should be a fully-qualified type name. The format is + // . + string all_extension_numbers_of_type = 6; + + // List the full names of registered services. The content will not be + // checked. + string list_services = 7; + } } -// The type name and extension number sent by the client when calling -// GetFileContainingExtension method. +// The type name and extension number sent by the client when requesting +// file_containing_extension. message ExtensionRequest { // Fully-qualified type name. The format should be . string containing_type = 1; int32 extension_number = 2; } -// The type name sent by the client when calling GetAllExtensionNumbers method. -message TypeRequest { - // Fully-qualified type name. The format should be . - string type = 1; +// The message sent by the server to answer DescriptorDatabaseInfo method. +message DescriptorDatabaseResponse { + string valid_host = 1; + DescriptorDatabaseRequest original_request = 2; + // The server set one of the following fields accroding to the message_request + // in the request. + oneof message_response { + // A serialized FileDescriptorProto message. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. This message is used to answer file_by_filename, + // file_containing_symbol, file_containing_extension requests. + bytes file_descriptor_proto = 4; + + // This message is used to answer all_extension_numbers_of_type requst. + ExtensionNumberResponse all_extension_numbers_response = 5; + + // This message is used to answer list_services request. + ListServiceResponse list_services_response = 6; + + // This message is used when an error occurs. + ErrorResponse error_response = 7; + } +} + +// A list of extension numbers sent by the server answering +// all_extension_numbers_of_type request. +message ExtensionNumberResponse { + // Full name of the base type, including the package name. The format + // is . + string base_type_name = 1; + repeated int32 extension_number = 2; } -// A list of service names sent by the server answering ListService method. +// A list of service names sent by the server answering list_services request. message ListServiceResponse { // Full names of registered services, including package names. The format // is . - repeated string services = 1; -} - -// A serialized FileDescriptorProto sent by the server answering -// GetFileByName, GetFileContainingSymbol, GetFileContainingExtension methods. -message FileDescriptorProtoResponse { - // Serialized FileDescriptorProto message. Some languages have limited support - // for working with descriptors. The can only obtain an opaque binary blob - // that contains serialized FileDescriptorProto message. - bytes file_descriptor_proto = 1; + repeated string service = 1; } -// A list of extension numbers sent by the server answering -// GetAllExtensionNumbers method. -message ExtensionNumberResponse { - repeated int32 extension_number = 1; +// The error code and error message sent by the server when an error occurs. +message ErrorResponse { + // This field uses the error codes defined in grpc::StatusCode. + int32 error_code = 1; + string error_message = 2; } diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc index c2ed93c12b6..4ed069ffc26 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -37,15 +37,21 @@ #include +using grpc::reflection::v1alpha::ServerReflection; +using grpc::reflection::v1alpha::DescriptorDatabaseRequest; +using grpc::reflection::v1alpha::DescriptorDatabaseResponse; +using grpc::reflection::v1alpha::ListServiceResponse; +using grpc::reflection::v1alpha::ErrorResponse; + namespace grpc { ProtoReflectionDescriptorDatabase::ProtoReflectionDescriptorDatabase( - std::unique_ptr stub) + std::unique_ptr stub) : stub_(std::move(stub)) {} ProtoReflectionDescriptorDatabase::ProtoReflectionDescriptorDatabase( std::shared_ptr channel) - : stub_(reflection::v1alpha::ServerReflection::NewStub(channel)) {} + : stub_(ServerReflection::NewStub(channel)) {} ProtoReflectionDescriptorDatabase::~ProtoReflectionDescriptorDatabase() {} @@ -59,28 +65,40 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName( return false; } - ClientContext ctx; - reflection::v1alpha::FileNameRequest request; - request.set_filename(filename); - reflection::v1alpha::FileDescriptorProtoResponse response; + DescriptorDatabaseRequest request; + request.set_file_by_filename(filename); + DescriptorDatabaseResponse response; + + GetStream()->Write(request); + GetStream()->Read(&response); - Status status = stub_->GetFileByName(&ctx, request, &response); - if (status.ok()) { - // const google::protobuf::FileDescriptorProto* file_proto = - // response.mutable_file_descriptor_proto(); + if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto) { const google::protobuf::FileDescriptorProto file_proto = - ParseFileDescriptorProtoResponse(&response); + ParseFileDescriptorProtoResponse(response.file_descriptor_proto()); known_files_.insert(file_proto.name()); cached_db_.Add(file_proto); - } else if (status.error_code() == StatusCode::NOT_FOUND) { - gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileByName(%s)", - filename.c_str()); + } else if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + const ErrorResponse error = response.error_response(); + if (error.error_code() == StatusCode::NOT_FOUND) { + gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileByName(%s)", + filename.c_str()); + } else { + gpr_log(GPR_INFO, + "Error on FindFileByName(%s)\n\tError code: %d\n" + "\tError Message: %s", + filename.c_str(), error.error_code(), + error.error_message().c_str()); + } } else { - gpr_log(GPR_INFO, - "Error on FindFileByName(%s)\n\tError code: %d\n" - "\tError Message: %s", - filename.c_str(), status.error_code(), - status.error_message().c_str()); + gpr_log( + GPR_INFO, + "Error on FindFileByName(%s) response type\n" + "\tExpecting: %d\n\tReceived: %d", + filename.c_str(), + DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto, + response.message_response_case()); } return cached_db_.FindFileByName(filename, output); @@ -96,31 +114,46 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( return false; } - ClientContext ctx; - reflection::v1alpha::SymbolRequest request; - request.set_symbol(symbol_name); - reflection::v1alpha::FileDescriptorProtoResponse response; + DescriptorDatabaseRequest request; + request.set_file_containing_symbol(symbol_name); + DescriptorDatabaseResponse response; + + GetStream()->Write(request); + GetStream()->Read(&response); - Status status = stub_->GetFileContainingSymbol(&ctx, request, &response); - if (status.ok()) { + // Status status = stub_->GetFileContainingSymbol(&ctx, request, &response); + if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto) { const google::protobuf::FileDescriptorProto file_proto = - ParseFileDescriptorProtoResponse(&response); + ParseFileDescriptorProtoResponse(response.file_descriptor_proto()); if (known_files_.find(file_proto.name()) == known_files_.end()) { known_files_.insert(file_proto.name()); cached_db_.Add(file_proto); } - } else if (status.error_code() == StatusCode::NOT_FOUND) { - missing_symbols_.insert(symbol_name); - gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileContainingSymbol(%s)", - symbol_name.c_str()); + } else if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + const ErrorResponse error = response.error_response(); + if (error.error_code() == StatusCode::NOT_FOUND) { + missing_symbols_.insert(symbol_name); + gpr_log(GPR_INFO, + "NOT_FOUND from server for FindFileContainingSymbol(%s)", + symbol_name.c_str()); + } else { + gpr_log(GPR_INFO, + "Error on FindFileContainingSymbol(%s)\n" + "\tError code: %d\n\tError Message: %s", + symbol_name.c_str(), error.error_code(), + error.error_message().c_str()); + } } else { - gpr_log(GPR_INFO, - "Error on FindFileContainingSymbol(%s)\n" - "\tError code: %d\n\tError Message: %s", - symbol_name.c_str(), status.error_code(), - status.error_message().c_str()); + gpr_log( + GPR_INFO, + "Error on FindFileContainingSymbol(%s) response type\n" + "\tExpecting: %d\n\tReceived: %d", + symbol_name.c_str(), + DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto, + response.message_response_case()); } - return cached_db_.FindFileContainingSymbol(symbol_name, output); } @@ -139,35 +172,53 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( return false; } - ClientContext ctx; - reflection::v1alpha::ExtensionRequest request; - request.set_containing_type(containing_type); - request.set_extension_number(field_number); - reflection::v1alpha::FileDescriptorProtoResponse response; + DescriptorDatabaseRequest request; + request.mutable_file_containing_extension()->set_containing_type( + containing_type); + request.mutable_file_containing_extension()->set_extension_number( + field_number); + DescriptorDatabaseResponse response; - Status status = stub_->GetFileContainingExtension(&ctx, request, &response); - if (status.ok()) { + GetStream()->Write(request); + GetStream()->Read(&response); + + // Status status = stub_->GetFileContainingExtension(&ctx, request, + // &response); + if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto) { const google::protobuf::FileDescriptorProto file_proto = - ParseFileDescriptorProtoResponse(&response); + ParseFileDescriptorProtoResponse(response.file_descriptor_proto()); if (known_files_.find(file_proto.name()) == known_files_.end()) { known_files_.insert(file_proto.name()); cached_db_.Add(file_proto); } - } else if (status.error_code() == StatusCode::NOT_FOUND) { - if (missing_extensions_.find(containing_type) == - missing_extensions_.end()) { - missing_extensions_[containing_type] = {}; + } else if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + const ErrorResponse error = response.error_response(); + if (error.error_code() == StatusCode::NOT_FOUND) { + if (missing_extensions_.find(containing_type) == + missing_extensions_.end()) { + missing_extensions_[containing_type] = {}; + } + missing_extensions_[containing_type].insert(field_number); + gpr_log(GPR_INFO, + "NOT_FOUND from server for FindFileContainingExtension(%s, %d)", + containing_type.c_str(), field_number); + } else { + gpr_log(GPR_INFO, + "Error on FindFileContainingExtension(%s, %d)\n" + "\tError code: %d\n\tError Message: %s", + containing_type.c_str(), field_number, error.error_code(), + error.error_message().c_str()); } - missing_extensions_[containing_type].insert(field_number); - gpr_log(GPR_INFO, - "NOT_FOUND from server for FindFileContainingExtension(%s, %d)", - containing_type.c_str(), field_number); } else { - gpr_log(GPR_INFO, - "Error on FindFileContainingExtension(%s, %d)\n" - "\tError code: %d\n\tError Message: %s", - containing_type.c_str(), field_number, status.error_code(), - status.error_message().c_str()); + gpr_log( + GPR_INFO, + "Error on FindFileContainingExtension(%s, %d) response type\n" + "\tExpecting: %d\n\tReceived: %d", + containing_type.c_str(), field_number, + DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto, + response.message_response_case()); } return cached_db_.FindFileContainingExtension(containing_type, field_number, @@ -182,57 +233,86 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( return true; } - ClientContext ctx; - reflection::v1alpha::TypeRequest request; - request.set_type(extendee_type); - reflection::v1alpha::ExtensionNumberResponse response; + DescriptorDatabaseRequest request; + request.set_all_extension_numbers_of_type(extendee_type); + DescriptorDatabaseResponse response; + + GetStream()->Write(request); + GetStream()->Read(&response); - Status status = stub_->GetAllExtensionNumbers(&ctx, request, &response); - if (status.ok()) { - auto number = response.extension_number(); + // Status status = stub_->GetAllExtensionNumbers(&ctx, request, &response); + if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase:: + kAllExtensionNumbersResponse) { + auto number = response.all_extension_numbers_response().extension_number(); *output = std::vector(number.begin(), number.end()); cached_extension_numbers_[extendee_type] = *output; return true; - } else if (status.error_code() == StatusCode::NOT_FOUND) { - gpr_log(GPR_INFO, "NOT_FOUND from server for FindAllExtensionNumbers(%s)", - extendee_type.c_str()); - } else { - gpr_log(GPR_INFO, - "Error on FindAllExtensionNumbersExtension(%s)\n" - "\tError code: %d\n\tError Message: %s", - extendee_type.c_str(), status.error_code(), - status.error_message().c_str()); + } else if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + const ErrorResponse error = response.error_response(); + if (error.error_code() == StatusCode::NOT_FOUND) { + gpr_log(GPR_INFO, "NOT_FOUND from server for FindAllExtensionNumbers(%s)", + extendee_type.c_str()); + } else { + gpr_log(GPR_INFO, + "Error on FindAllExtensionNumbersExtension(%s)\n" + "\tError code: %d\n\tError Message: %s", + extendee_type.c_str(), error.error_code(), + error.error_message().c_str()); + } } return false; } bool ProtoReflectionDescriptorDatabase::GetServices( std::vector* output) { - ClientContext ctx; - reflection::v1alpha::EmptyRequest request; - reflection::v1alpha::ListServiceResponse response; - - Status status = stub_->ListService(&ctx, request, &response); - if (status.ok()) { - for (int i = 0; i < response.services_size(); ++i) { - (*output).push_back(response.services(i)); + DescriptorDatabaseRequest request; + request.set_list_services(""); + DescriptorDatabaseResponse response; + GetStream()->Write(request); + GetStream()->Read(&response); + + // Status status = stub_->ListService(&ctx, request, &response); + if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kListServicesResponse) { + const ListServiceResponse ls_response = response.list_services_response(); + for (int i = 0; i < ls_response.service_size(); ++i) { + (*output).push_back(ls_response.service(i)); } return true; - } else { + } else if (response.message_response_case() == + DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + const ErrorResponse error = response.error_response(); gpr_log(GPR_INFO, "Error on GetServices()\n\tError code: %d\n" "\tError Message: %s", - status.error_code(), status.error_message().c_str()); + error.error_code(), error.error_message().c_str()); + } else { + gpr_log( + GPR_INFO, + "Error on GetServices() response type\n\tExpecting: %d\n\tReceived: %d", + DescriptorDatabaseResponse::MessageResponseCase::kListServicesResponse, + response.message_response_case()); } return false; } const google::protobuf::FileDescriptorProto ProtoReflectionDescriptorDatabase::ParseFileDescriptorProtoResponse( - reflection::v1alpha::FileDescriptorProtoResponse* response) { + const std::string& byte_fd_proto) { google::protobuf::FileDescriptorProto file_desc_proto; - file_desc_proto.ParseFromString(response->file_descriptor_proto()); + file_desc_proto.ParseFromString(byte_fd_proto); return file_desc_proto; } +const std::shared_ptr +ProtoReflectionDescriptorDatabase::GetStream() { + if (stream_ == nullptr) { + stream_ = stub_->DescriptorDatabaseInfo(&ctx_); + // stream_.reset(std::move(stub_->DescriptorDatabaseInfo(&ctx_))); + } + return stream_; +} + } // namespace grpc diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index bf94654c3de..f37135e681f 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -80,9 +80,18 @@ class ProtoReflectionDescriptorDatabase } private: + typedef ClientReaderWriter< + grpc::reflection::v1alpha::DescriptorDatabaseRequest, + grpc::reflection::v1alpha::DescriptorDatabaseResponse> + ClientStream; + const google::protobuf::FileDescriptorProto ParseFileDescriptorProtoResponse( - reflection::v1alpha::FileDescriptorProtoResponse* response); + const std::string& byte_fd_proto); + + const std::shared_ptr GetStream(); + std::shared_ptr stream_; + grpc::ClientContext ctx_; std::unique_ptr stub_; std::unordered_set known_files_; std::unordered_set missing_symbols_; diff --git a/test/cpp/util/reflection_debug/reflection_client.cc b/test/cpp/util/reflection_debug/reflection_client.cc index fb406275148..a1e97f7edec 100644 --- a/test/cpp/util/reflection_debug/reflection_client.cc +++ b/test/cpp/util/reflection_debug/reflection_client.cc @@ -48,8 +48,8 @@ using grpc::ClientContext; using grpc::Status; using grpc::ProtoReflectionDescriptorDatabase; using grpc::reflection::v1alpha::ServerReflection; -using grpc::reflection::v1alpha::EmptyRequest; -using grpc::reflection::v1alpha::ListServiceResponse; +// using grpc::reflection::v1alpha::EmptyRequest; +// using grpc::reflection::v1alpha::ListServiceResponse; using google::protobuf::FileDescriptorProto; using google::protobuf::DescriptorPool; using google::protobuf::ServiceDescriptor; @@ -65,28 +65,22 @@ class ReflectionClient { desc_pool_(new DescriptorPool(db_.get())) {} void PrintInfo() { - EmptyRequest request; - ListServiceResponse response; - ClientContext context; - Status status = db_->stub()->ListService(&context, request, &response); - if (status.ok()) { + std::vector services; + bool found_services = db_->GetServices(&services); + if (found_services) { std::string padding = ""; - std::cout << "Service amount:" << response.services_size() << std::endl; - for (int i = 0; i < response.services_size(); ++i) { - if (i != response.services_size() - 1) { + std::cout << "Service amount:" << services.size() << std::endl; + for (auto it = services.begin(); it != services.end(); ++it) { + if (it != services.end() - 1) { std::cout << padding << "│ " << std::endl; - std::cout << padding << "├─" << response.services(i) << std::endl; - PrintService(desc_pool_->FindServiceByName(response.services(i)), - padding + "│ "); + std::cout << padding << "├─" << *it << std::endl; + PrintService(desc_pool_->FindServiceByName(*it), padding + "│ "); } else { std::cout << padding << "│ " << std::endl; - std::cout << padding << "└─" << response.services(i) << std::endl; - PrintService(desc_pool_->FindServiceByName(response.services(i)), - padding + " "); + std::cout << padding << "└─" << *it << std::endl; + PrintService(desc_pool_->FindServiceByName(*it), padding + " "); } } - } else { - std::cout << status.error_message(); } } @@ -157,6 +151,15 @@ class ReflectionClient { } void Test() { + { + std::vector services; + bool found = db_->GetServices(&services); + if (found) { + for (auto it : services) { + std::cout << it << std::endl; + } + } + } { FileDescriptorProto output; bool found = db_->FindFileByName("helloworld.proto", &output); @@ -176,9 +179,9 @@ class ReflectionClient { "helloworld.Greeter.HelloRequest", 1, &output); if (found) std::cout << output.name() << std::endl; } - DescriptorPool pool(db_.get()); - std::cout << pool.FindServiceByName("helloworld.Greeter")->name() - << std::endl; + // DescriptorPool pool(db_.get()); + // std::cout << pool.FindServiceByName("helloworld.Greeter")->name() + // << std::endl; } private: diff --git a/tools/codegen/extensions/gen_reflection_proto.sh b/tools/codegen/extensions/gen_reflection_proto.sh index f0bb6e5ccc6..26f9e4711ae 100755 --- a/tools/codegen/extensions/gen_reflection_proto.sh +++ b/tools/codegen/extensions/gen_reflection_proto.sh @@ -1,4 +1,34 @@ #!/bin/bash + +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + PROTO_DIR="src/proto/grpc/reflection/v1alpha" PROTO_FILE="reflection" HEADER_DIR="extensions/include/grpc++/impl" @@ -22,9 +52,19 @@ $PROTOC -I$PROTO_DIR --cpp_out=$TMP_DIR ${PROTO_DIR}/${PROTO_FILE}.proto $PROTOC -I$PROTO_DIR --grpc_out=$TMP_DIR --plugin=protoc-gen-grpc=${GRPC_PLUGIN} ${PROTO_DIR}/${PROTO_FILE}.proto sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.pb.cc +sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.h sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc sed -i "s/\"${PROTO_FILE}.grpc.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.grpc.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc -sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.h + +/bin/cp LICENSE ${TMP_DIR}/TMP_LICENSE +sed -i -e "s/./ &/" -e "s/.*/ \*&/" ${TMP_DIR}/TMP_LICENSE +sed -i -r "\$a\ *\n *\/\n\n" ${TMP_DIR}/TMP_LICENSE + +sed -i -e "1s/^/ *\n/" -e "1s/^/\/*\n/" ${TMP_DIR}/*.pb.h +sed -i -e "1s/^/ *\n/" -e "1s/^/\/*\n/" ${TMP_DIR}/*.pb.cc + +sed -i "2r ${TMP_DIR}/TMP_LICENSE" ${TMP_DIR}/*.pb.h +sed -i "2r ${TMP_DIR}/TMP_LICENSE" ${TMP_DIR}/*.pb.cc /bin/mv ${TMP_DIR}/${PROTO_FILE}.pb.h ${HEADER_DIR} /bin/mv ${TMP_DIR}/${PROTO_FILE}.grpc.pb.h ${HEADER_DIR} From 2eedca72d53e9987da3a3a29961736312baf8b6f Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 5 May 2016 18:20:09 -0700 Subject: [PATCH 008/175] Check the value of Next() in async examples --- examples/cpp/helloworld/greeter_async_client.cc | 4 +++- examples/cpp/helloworld/greeter_async_server.cc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/cpp/helloworld/greeter_async_client.cc b/examples/cpp/helloworld/greeter_async_client.cc index c1f5eb55f05..33de59fb957 100644 --- a/examples/cpp/helloworld/greeter_async_client.cc +++ b/examples/cpp/helloworld/greeter_async_client.cc @@ -87,7 +87,9 @@ class GreeterClient { void* got_tag; bool ok = false; // Block until the next result is available in the completion queue "cq". - cq.Next(&got_tag, &ok); + // The return value of Next should always be checked. This return value + // tells us whether there is any kind of event or the cq_ is shutting down. + GPR_ASSERT(cq.Next(&got_tag, &ok)); // Verify that the result from "cq" corresponds, by its tag, our previous // request. diff --git a/examples/cpp/helloworld/greeter_async_server.cc b/examples/cpp/helloworld/greeter_async_server.cc index 64e065b1e40..ead44182e57 100644 --- a/examples/cpp/helloworld/greeter_async_server.cc +++ b/examples/cpp/helloworld/greeter_async_server.cc @@ -160,7 +160,9 @@ class ServerImpl final { // Block waiting to read the next event from the completion queue. The // event is uniquely identified by its tag, which in this case is the // memory address of a CallData instance. - cq_->Next(&tag, &ok); + // The return value of Next should always be checked. This return value + // tells us whether there is any kind of event or cq_ is shutting down. + GPR_ASSERT(cq_->Next(&tag, &ok)); GPR_ASSERT(ok); static_cast(tag)->Proceed(); } From a301eaade83854cf172d39899232835f21e57690 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 6 May 2016 16:59:03 -0700 Subject: [PATCH 009/175] Allow servers to select compression level via initial MD. Setting the newly added compression_level field of grpc_op::send_initial_metadata by a server now has the effect of applying that compression level for the subsequent call messages leaving the server. The ultimate meaning of the level depends on the client's supported compression algorithms. --- grpc.def | 1 - include/grpc++/impl/codegen/call.h | 6 + include/grpc/compression.h | 7 - include/grpc/impl/codegen/grpc_types.h | 1 + .../lib/compression/compression_algorithm.c | 56 ----- src/core/lib/surface/call.c | 159 ++++++++++++-- src/csharp/ext/grpc_csharp_ext.c | 11 +- .../GRPCClient/private/GRPCWrappedCall.m | 1 + src/php/ext/grpc/call.c | 1 + .../grpcio/grpc/_cython/imports.generated.c | 2 - .../grpcio/grpc/_cython/imports.generated.h | 3 - src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 - src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 - test/core/bad_ssl/bad_ssl_test.c | 1 + test/core/client_config/lb_policies_test.c | 3 + .../set_initial_connect_string_test.c | 1 + test/core/compression/compression_test.c | 97 --------- test/core/end2end/dualstack_socket_test.c | 2 + test/core/end2end/fixtures/h2_ssl_cert.c | 1 + test/core/end2end/fixtures/proxy.c | 2 + test/core/end2end/fuzzers/client_fuzzer.c | 3 + test/core/end2end/goaway_server_test.c | 6 + .../core/end2end/invalid_call_argument_test.c | 7 +- test/core/end2end/no_server_test.c | 4 + test/core/end2end/tests/bad_hostname.c | 1 + test/core/end2end/tests/binary_metadata.c | 3 + test/core/end2end/tests/call_creds.c | 4 + test/core/end2end/tests/cancel_after_accept.c | 2 + .../end2end/tests/cancel_after_client_done.c | 2 + test/core/end2end/tests/cancel_after_invoke.c | 1 + .../core/end2end/tests/cancel_before_invoke.c | 1 + test/core/end2end/tests/cancel_with_status.c | 1 + test/core/end2end/tests/compressed_payload.c | 199 +++++++++++++----- test/core/end2end/tests/default_host.c | 2 + test/core/end2end/tests/disappearing_server.c | 2 + test/core/end2end/tests/filter_causes_close.c | 1 + .../end2end/tests/graceful_server_shutdown.c | 2 + test/core/end2end/tests/high_initial_seqno.c | 2 + test/core/end2end/tests/hpack_size.c | 2 + test/core/end2end/tests/idempotent_request.c | 2 + .../core/end2end/tests/invoke_large_request.c | 3 + test/core/end2end/tests/large_metadata.c | 3 + .../end2end/tests/max_concurrent_streams.c | 8 + test/core/end2end/tests/max_message_length.c | 2 + test/core/end2end/tests/negative_deadline.c | 1 + test/core/end2end/tests/payload.c | 3 + test/core/end2end/tests/ping_pong_streaming.c | 7 + test/core/end2end/tests/registered_call.c | 2 + test/core/end2end/tests/request_with_flags.c | 1 + .../core/end2end/tests/request_with_payload.c | 3 + .../end2end/tests/server_finishes_request.c | 2 + .../end2end/tests/shutdown_finishes_calls.c | 2 + .../end2end/tests/simple_delayed_request.c | 2 + test/core/end2end/tests/simple_metadata.c | 3 + test/core/end2end/tests/simple_request.c | 2 + test/core/end2end/tests/trailing_metadata.c | 3 + test/core/fling/client.c | 1 + test/core/surface/lame_client_test.c | 2 + 58 files changed, 403 insertions(+), 254 deletions(-) diff --git a/grpc.def b/grpc.def index 09a94a6cd0c..e807b8cf8ff 100644 --- a/grpc.def +++ b/grpc.def @@ -34,7 +34,6 @@ EXPORTS census_view_reset grpc_compression_algorithm_parse grpc_compression_algorithm_name - grpc_compression_algorithm_for_level grpc_compression_options_init grpc_compression_options_enable_algorithm grpc_compression_options_disable_algorithm diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index d081b7d9c59..2acdf475f2b 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -47,7 +47,9 @@ #include #include #include + #include +#include #include struct grpc_byte_buffer; @@ -187,6 +189,8 @@ class CallOpSendInitialMetadata { flags_ = flags; initial_metadata_count_ = metadata.size(); initial_metadata_ = FillMetadataArray(metadata); + // TODO(dgq): expose compression level in API so it can be properly set. + compression_level_ = GRPC_COMPRESS_LEVEL_NONE; } protected: @@ -198,6 +202,7 @@ class CallOpSendInitialMetadata { op->reserved = NULL; op->data.send_initial_metadata.count = initial_metadata_count_; op->data.send_initial_metadata.metadata = initial_metadata_; + op->data.send_initial_metadata.compression_level = compression_level_; } void FinishOp(bool* status, int max_message_size) { if (!send_) return; @@ -209,6 +214,7 @@ class CallOpSendInitialMetadata { uint32_t flags_; size_t initial_metadata_count_; grpc_metadata* initial_metadata_; + grpc_compression_level compression_level_; }; class CallOpSendMessage { diff --git a/include/grpc/compression.h b/include/grpc/compression.h index 8de4b133d4c..04816b9f3a9 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -55,13 +55,6 @@ GRPCAPI int grpc_compression_algorithm_parse( GRPCAPI int grpc_compression_algorithm_name( grpc_compression_algorithm algorithm, char **name); -/** Returns the compression algorithm corresponding to \a level for the - * compression algorithms encoded in the \a accepted_encodings bitset. - * - * It abort()s for unknown levels . */ -GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level( - grpc_compression_level level, uint32_t accepted_encodings); - GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts); /** Mark \a algorithm as enabled in \a opts. */ diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 7b20cc14d43..29af70522c9 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -330,6 +330,7 @@ typedef struct grpc_op { struct { size_t count; grpc_metadata *metadata; + grpc_compression_level compression_level; } send_initial_metadata; grpc_byte_buffer *send_message; struct { diff --git a/src/core/lib/compression/compression_algorithm.c b/src/core/lib/compression/compression_algorithm.c index 7039364b7bc..142f3fffa5d 100644 --- a/src/core/lib/compression/compression_algorithm.c +++ b/src/core/lib/compression/compression_algorithm.c @@ -125,62 +125,6 @@ grpc_mdelem *grpc_compression_encoding_mdelem( return NULL; } -/* TODO(dgq): Add the ability to specify parameters to the individual - * compression algorithms */ -grpc_compression_algorithm grpc_compression_algorithm_for_level( - grpc_compression_level level, uint32_t accepted_encodings) { - GRPC_API_TRACE("grpc_compression_algorithm_for_level(level=%d)", 1, - ((int)level)); - if (level > GRPC_COMPRESS_LEVEL_HIGH) { - gpr_log(GPR_ERROR, "Unknown compression level %d.", (int)level); - abort(); - } - - const size_t num_supported = - GPR_BITCOUNT(accepted_encodings) - 1; /* discard NONE */ - if (level == GRPC_COMPRESS_LEVEL_NONE || num_supported == 0) { - return GRPC_COMPRESS_NONE; - } - - GPR_ASSERT(level > 0); - - /* Establish a "ranking" or compression algorithms in increasing order of - * compression. - * This is simplistic and we will probably want to introduce other dimensions - * in the future (cpu/memory cost, etc). */ - const grpc_compression_algorithm algos_ranking[] = {GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_DEFLATE}; - - /* intersect algos_ranking with the supported ones keeping the ranked order */ - grpc_compression_algorithm - sorted_supported_algos[GRPC_COMPRESS_ALGORITHMS_COUNT]; - size_t algos_supported_idx = 0; - for (size_t i = 0; i < GPR_ARRAY_SIZE(algos_ranking); i++) { - const grpc_compression_algorithm alg = algos_ranking[i]; - for (size_t j = 0; j < num_supported; j++) { - if (GPR_BITGET(accepted_encodings, alg) == 1) { - /* if \a alg in supported */ - sorted_supported_algos[algos_supported_idx++] = alg; - break; - } - } - if (algos_supported_idx == num_supported) break; - } - - switch (level) { - case GRPC_COMPRESS_LEVEL_NONE: - abort(); /* should have been handled already */ - case GRPC_COMPRESS_LEVEL_LOW: - return sorted_supported_algos[0]; - case GRPC_COMPRESS_LEVEL_MED: - return sorted_supported_algos[num_supported / 2]; - case GRPC_COMPRESS_LEVEL_HIGH: - return sorted_supported_algos[num_supported - 1]; - default: - abort(); - }; -} - void grpc_compression_options_init(grpc_compression_options *opts) { opts->enabled_algorithms_bitset = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; opts->default_compression_algorithm = GRPC_COMPRESS_NONE; diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 9b2b94eedf5..911b5b80bb9 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -420,6 +420,65 @@ grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm( return algorithm; } +static grpc_compression_algorithm compression_algorithm_for_level_locked( + grpc_call *call, grpc_compression_level level) { + /* Establish a "ranking" or compression algorithms in increasing order of + * compression. + * This is simplistic and we will probably want to introduce other + * dimensions + * in the future (cpu/memory cost, etc). */ + const grpc_compression_algorithm algos_ranking[] = {GRPC_COMPRESS_GZIP, + GRPC_COMPRESS_DEFLATE}; + const uint32_t accepted_encodings = call->encodings_accepted_by_peer; + if (level > GRPC_COMPRESS_LEVEL_HIGH) { + extern int grpc_compress_filter_trace; + if (grpc_compress_filter_trace) { + gpr_log(GPR_ERROR, + "Unknown compression level %d. Compression will be disabled.", + (int)level); + } + return GRPC_COMPRESS_NONE; + } + + const size_t num_supported = + GPR_BITCOUNT(accepted_encodings) - 1; /* discard NONE */ + if (level == GRPC_COMPRESS_LEVEL_NONE || num_supported == 0) { + return GRPC_COMPRESS_NONE; + } + + GPR_ASSERT(level > 0); + + /* intersect algos_ranking with the supported ones keeping the ranked order + */ + grpc_compression_algorithm + sorted_supported_algos[GRPC_COMPRESS_ALGORITHMS_COUNT]; + size_t algos_supported_idx = 0; + for (size_t i = 0; i < GPR_ARRAY_SIZE(algos_ranking); i++) { + const grpc_compression_algorithm alg = algos_ranking[i]; + for (size_t j = 0; j < num_supported; j++) { + if (GPR_BITGET(accepted_encodings, alg) == 1) { + /* if \a alg in supported */ + sorted_supported_algos[algos_supported_idx++] = alg; + break; + } + } + if (algos_supported_idx == num_supported) break; + } + + switch (level) { + case GRPC_COMPRESS_LEVEL_NONE: + abort(); /* should have been handled already */ + case GRPC_COMPRESS_LEVEL_LOW: + return sorted_supported_algos[0]; + case GRPC_COMPRESS_LEVEL_MED: + return sorted_supported_algos[num_supported / 2]; + case GRPC_COMPRESS_LEVEL_HIGH: + return sorted_supported_algos[num_supported - 1]; + default: + abort(); + }; +} + uint32_t grpc_call_test_only_get_message_flags(grpc_call *call) { uint32_t flags; gpr_mu_lock(&call->mu); @@ -545,15 +604,28 @@ static grpc_linked_mdelem *linked_from_md(grpc_metadata *md) { return (grpc_linked_mdelem *)&md->internal_data; } +static grpc_metadata *get_md_elem(grpc_metadata *metadata, + grpc_metadata *additional_metadata, int i, + int count) { + grpc_metadata *res = + i < count ? &metadata[i] : &additional_metadata[i - count]; + GPR_ASSERT(res); + return res; +} + static int prepare_application_metadata(grpc_call *call, int count, grpc_metadata *metadata, int is_trailing, - int prepend_extra_metadata) { + int prepend_extra_metadata, + grpc_metadata *additional_metadata, + int additional_metadata_count) { + int total_count = count + additional_metadata_count; int i; grpc_metadata_batch *batch = &call->metadata_batch[0 /* is_receiving */][is_trailing]; - for (i = 0; i < count; i++) { - grpc_metadata *md = &metadata[i]; + for (i = 0; i < total_count; i++) { + const grpc_metadata *md = + get_md_elem(metadata, additional_metadata, i, count); grpc_linked_mdelem *l = (grpc_linked_mdelem *)&md->internal_data; GPR_ASSERT(sizeof(grpc_linked_mdelem) == sizeof(md->internal_data)); l->md = grpc_mdelem_from_string_and_buffer( @@ -572,9 +644,10 @@ static int prepare_application_metadata(grpc_call *call, int count, break; } } - if (i != count) { + if (i != total_count) { for (int j = 0; j <= i; j++) { - grpc_metadata *md = &metadata[j]; + const grpc_metadata *md = + get_md_elem(metadata, additional_metadata, j, count); grpc_linked_mdelem *l = (grpc_linked_mdelem *)&md->internal_data; GRPC_MDELEM_UNREF(l->md); } @@ -595,24 +668,36 @@ static int prepare_application_metadata(grpc_call *call, int count, } } } - for (i = 1; i < count; i++) { - linked_from_md(&metadata[i])->prev = linked_from_md(&metadata[i - 1]); + for (i = 1; i < total_count; i++) { + grpc_metadata *md = get_md_elem(metadata, additional_metadata, i, count); + grpc_metadata *prev_md = + get_md_elem(metadata, additional_metadata, i - 1, count); + linked_from_md(md)->prev = linked_from_md(prev_md); } - for (i = 0; i < count - 1; i++) { - linked_from_md(&metadata[i])->next = linked_from_md(&metadata[i + 1]); + for (i = 0; i < total_count - 1; i++) { + grpc_metadata *md = get_md_elem(metadata, additional_metadata, i, count); + grpc_metadata *next_md = + get_md_elem(metadata, additional_metadata, i + 1, count); + linked_from_md(md)->next = linked_from_md(next_md); } - switch (prepend_extra_metadata * 2 + (count != 0)) { + + switch (prepend_extra_metadata * 2 + (total_count != 0)) { case 0: /* no prepend, no metadata => nothing to do */ batch->list.head = batch->list.tail = NULL; break; - case 1: + case 1: { /* metadata, but no prepend */ - batch->list.head = linked_from_md(&metadata[0]); - batch->list.tail = linked_from_md(&metadata[count - 1]); + grpc_metadata *first_md = + get_md_elem(metadata, additional_metadata, 0, count); + grpc_metadata *last_md = + get_md_elem(metadata, additional_metadata, total_count - 1, count); + batch->list.head = linked_from_md(first_md); + batch->list.tail = linked_from_md(last_md); batch->list.head->prev = NULL; batch->list.tail->next = NULL; break; + } case 2: /* prepend, but no md */ batch->list.head = &call->send_extra_metadata[0]; @@ -621,17 +706,22 @@ static int prepare_application_metadata(grpc_call *call, int count, batch->list.head->prev = NULL; batch->list.tail->next = NULL; break; - case 3: + case 3: { /* prepend AND md */ + grpc_metadata *first_md = + get_md_elem(metadata, additional_metadata, 0, count); + grpc_metadata *last_md = + get_md_elem(metadata, additional_metadata, total_count - 1, count); batch->list.head = &call->send_extra_metadata[0]; call->send_extra_metadata[call->send_extra_metadata_count - 1].next = - linked_from_md(&metadata[0]); - linked_from_md(&metadata[0])->prev = + linked_from_md(first_md); + linked_from_md(first_md)->prev = &call->send_extra_metadata[call->send_extra_metadata_count - 1]; - batch->list.tail = linked_from_md(&metadata[count - 1]); + batch->list.tail = linked_from_md(last_md); batch->list.head->prev = NULL; batch->list.tail->next = NULL; break; + } default: GPR_UNREACHABLE_CODE(return 0); } @@ -1229,7 +1319,29 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, error = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS; goto done_with_error; } - if (op->data.send_initial_metadata.count > INT_MAX) { + /* process compression level */ + grpc_metadata compression_md; + memset(&compression_md, 0, sizeof(grpc_metadata)); + size_t additional_metadata_count = 0; + if (op->data.send_initial_metadata.compression_level > + GRPC_COMPRESS_LEVEL_NONE) { + if (call->is_client) { + error = GRPC_CALL_ERROR_NOT_ON_CLIENT; + goto done_with_error; + } + const grpc_compression_algorithm calgo = + compression_algorithm_for_level_locked( + call, op->data.send_initial_metadata.compression_level); + char *calgo_name; + grpc_compression_algorithm_name(calgo, &calgo_name); + compression_md.key = "grpc-internal-encoding-request"; + compression_md.value = calgo_name; + compression_md.value_length = strlen(calgo_name); + additional_metadata_count++; + } + + if (op->data.send_initial_metadata.count + additional_metadata_count > + INT_MAX) { error = GRPC_CALL_ERROR_INVALID_METADATA; goto done_with_error; } @@ -1237,7 +1349,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, call->sent_initial_metadata = 1; if (!prepare_application_metadata( call, (int)op->data.send_initial_metadata.count, - op->data.send_initial_metadata.metadata, 0, call->is_client)) { + op->data.send_initial_metadata.metadata, 0, call->is_client, + &compression_md, (int)additional_metadata_count)) { error = GRPC_CALL_ERROR_INVALID_METADATA; goto done_with_error; } @@ -1325,7 +1438,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, if (!prepare_application_metadata( call, (int)op->data.send_status_from_server.trailing_metadata_count, - op->data.send_status_from_server.trailing_metadata, 1, 1)) { + op->data.send_status_from_server.trailing_metadata, 1, 1, NULL, + 0)) { error = GRPC_CALL_ERROR_INVALID_METADATA; goto done_with_error; } @@ -1513,9 +1627,10 @@ uint8_t grpc_call_is_client(grpc_call *call) { return call->is_client; } grpc_compression_algorithm grpc_call_compression_for_level( grpc_call *call, grpc_compression_level level) { gpr_mu_lock(&call->mu); - const uint32_t accepted_encodings = call->encodings_accepted_by_peer; + grpc_compression_algorithm algo = + compression_algorithm_for_level_locked(call, level); gpr_mu_unlock(&call->mu); - return grpc_compression_algorithm_for_level(level, accepted_encodings); + return algo; } const char *grpc_call_error_to_string(grpc_call_error error) { diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 5b8ff9b819b..49198cb7085 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -503,6 +503,7 @@ grpcsharp_call_start_unary(grpc_call *call, grpcsharp_batch_context *ctx, grpc_metadata_array *initial_metadata, uint32_t write_flags) { /* TODO: don't use magic number */ grpc_op ops[6]; + memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; grpcsharp_metadata_array_move(&(ctx->send_initial_metadata), initial_metadata); @@ -555,6 +556,7 @@ grpcsharp_call_start_client_streaming(grpc_call *call, grpc_metadata_array *initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[4]; + memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; grpcsharp_metadata_array_move(&(ctx->send_initial_metadata), initial_metadata); @@ -596,6 +598,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming( size_t send_buffer_len, grpc_metadata_array *initial_metadata, uint32_t write_flags) { /* TODO: don't use magic number */ grpc_op ops[4]; + memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; grpcsharp_metadata_array_move(&(ctx->send_initial_metadata), initial_metadata); @@ -638,6 +641,7 @@ grpcsharp_call_start_duplex_streaming(grpc_call *call, grpc_metadata_array *initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[2]; + memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; grpcsharp_metadata_array_move(&(ctx->send_initial_metadata), initial_metadata); @@ -684,6 +688,7 @@ grpcsharp_call_send_message(grpc_call *call, grpcsharp_batch_context *ctx, int32_t send_empty_initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[2]; + memset(ops, 0, sizeof(ops)); size_t nops = send_empty_initial_metadata ? 2 : 1; ops[0].op = GRPC_OP_SEND_MESSAGE; ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); @@ -691,8 +696,6 @@ grpcsharp_call_send_message(grpc_call *call, grpcsharp_batch_context *ctx, ops[0].flags = write_flags; ops[0].reserved = NULL; ops[1].op = GRPC_OP_SEND_INITIAL_METADATA; - ops[1].data.send_initial_metadata.count = 0; - ops[1].data.send_initial_metadata.metadata = NULL; ops[1].flags = 0; ops[1].reserved = NULL; @@ -719,6 +722,7 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( size_t optional_send_buffer_len, uint32_t write_flags) { /* TODO: don't use magic number */ grpc_op ops[3]; + memset(ops, 0, sizeof(ops)); size_t nops = 1; ops[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; ops[0].data.send_status_from_server.status = status_code; @@ -743,8 +747,6 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( } if (send_empty_initial_metadata) { ops[nops].op = GRPC_OP_SEND_INITIAL_METADATA; - ops[nops].data.send_initial_metadata.count = 0; - ops[nops].data.send_initial_metadata.metadata = NULL; ops[nops].flags = 0; ops[nops].reserved = NULL; nops++; @@ -784,6 +786,7 @@ grpcsharp_call_send_initial_metadata(grpc_call *call, grpc_metadata_array *initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[1]; + memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; grpcsharp_metadata_array_move(&(ctx->send_initial_metadata), initial_metadata); diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 16e5bff7ff7..f72ec9068e7 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -72,6 +72,7 @@ _op.op = GRPC_OP_SEND_INITIAL_METADATA; _op.data.send_initial_metadata.count = metadata.count; _op.data.send_initial_metadata.metadata = metadata.grpc_metadataArray; + _op.data.send_initial_metadata.compression_level = 0; _handler = handler; } return self; diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index a0f3d160c64..227d61877ba 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -291,6 +291,7 @@ PHP_METHOD(Call, startBatch) { grpc_metadata_array_init(&recv_trailing_metadata); MAKE_STD_ZVAL(result); object_init(result); + memset(ops, 0, sizeof(ops)); /* "a" == 1 array */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) { diff --git a/src/python/grpcio/grpc/_cython/imports.generated.c b/src/python/grpcio/grpc/_cython/imports.generated.c index 09551472b5f..3daa6d6affc 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.c +++ b/src/python/grpcio/grpc/_cython/imports.generated.c @@ -72,7 +72,6 @@ census_view_get_data_type census_view_get_data_import; census_view_reset_type census_view_reset_import; grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import; grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; -grpc_compression_algorithm_for_level_type grpc_compression_algorithm_for_level_import; grpc_compression_options_init_type grpc_compression_options_init_import; grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import; grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import; @@ -343,7 +342,6 @@ void pygrpc_load_imports(HMODULE library) { census_view_reset_import = (census_view_reset_type) GetProcAddress(library, "census_view_reset"); grpc_compression_algorithm_parse_import = (grpc_compression_algorithm_parse_type) GetProcAddress(library, "grpc_compression_algorithm_parse"); grpc_compression_algorithm_name_import = (grpc_compression_algorithm_name_type) GetProcAddress(library, "grpc_compression_algorithm_name"); - grpc_compression_algorithm_for_level_import = (grpc_compression_algorithm_for_level_type) GetProcAddress(library, "grpc_compression_algorithm_for_level"); grpc_compression_options_init_import = (grpc_compression_options_init_type) GetProcAddress(library, "grpc_compression_options_init"); grpc_compression_options_enable_algorithm_import = (grpc_compression_options_enable_algorithm_type) GetProcAddress(library, "grpc_compression_options_enable_algorithm"); grpc_compression_options_disable_algorithm_import = (grpc_compression_options_disable_algorithm_type) GetProcAddress(library, "grpc_compression_options_disable_algorithm"); diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index 54c8aaad13e..2a81352f0b5 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -167,9 +167,6 @@ extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_im typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, char **name); extern grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; #define grpc_compression_algorithm_name grpc_compression_algorithm_name_import -typedef grpc_compression_algorithm(*grpc_compression_algorithm_for_level_type)(grpc_compression_level level, uint32_t accepted_encodings); -extern grpc_compression_algorithm_for_level_type grpc_compression_algorithm_for_level_import; -#define grpc_compression_algorithm_for_level grpc_compression_algorithm_for_level_import typedef void(*grpc_compression_options_init_type)(grpc_compression_options *opts); extern grpc_compression_options_init_type grpc_compression_options_init_import; #define grpc_compression_options_init grpc_compression_options_init_import diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index cebbe8c40fe..07d52d83daa 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -72,7 +72,6 @@ census_view_get_data_type census_view_get_data_import; census_view_reset_type census_view_reset_import; grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import; grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; -grpc_compression_algorithm_for_level_type grpc_compression_algorithm_for_level_import; grpc_compression_options_init_type grpc_compression_options_init_import; grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import; grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import; @@ -339,7 +338,6 @@ void grpc_rb_load_imports(HMODULE library) { census_view_reset_import = (census_view_reset_type) GetProcAddress(library, "census_view_reset"); grpc_compression_algorithm_parse_import = (grpc_compression_algorithm_parse_type) GetProcAddress(library, "grpc_compression_algorithm_parse"); grpc_compression_algorithm_name_import = (grpc_compression_algorithm_name_type) GetProcAddress(library, "grpc_compression_algorithm_name"); - grpc_compression_algorithm_for_level_import = (grpc_compression_algorithm_for_level_type) GetProcAddress(library, "grpc_compression_algorithm_for_level"); grpc_compression_options_init_import = (grpc_compression_options_init_type) GetProcAddress(library, "grpc_compression_options_init"); grpc_compression_options_enable_algorithm_import = (grpc_compression_options_enable_algorithm_type) GetProcAddress(library, "grpc_compression_options_enable_algorithm"); grpc_compression_options_disable_algorithm_import = (grpc_compression_options_disable_algorithm_type) GetProcAddress(library, "grpc_compression_options_disable_algorithm"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index d7ea6c574c8..6885e3926aa 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -167,9 +167,6 @@ extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_im typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, char **name); extern grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; #define grpc_compression_algorithm_name grpc_compression_algorithm_name_import -typedef grpc_compression_algorithm(*grpc_compression_algorithm_for_level_type)(grpc_compression_level level, uint32_t accepted_encodings); -extern grpc_compression_algorithm_for_level_type grpc_compression_algorithm_for_level_import; -#define grpc_compression_algorithm_for_level grpc_compression_algorithm_for_level_import typedef void(*grpc_compression_options_init_type)(grpc_compression_options *opts); extern grpc_compression_options_init_type grpc_compression_options_init_import; #define grpc_compression_options_init grpc_compression_options_init_import diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c index c4ae212ec29..bb06ab0bb96 100644 --- a/test/core/bad_ssl/bad_ssl_test.c +++ b/test/core/bad_ssl/bad_ssl_test.c @@ -84,6 +84,7 @@ static void run_test(const char *target, size_t nops) { "/foo", "foo.test.google.fr:1234", deadline, NULL); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index e766672cf5d..be79c3c049e 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -275,6 +275,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client, GPR_ASSERT(c); completed_client = 0; + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -327,6 +328,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client, } if (s_idx >= 0) { + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -415,6 +417,7 @@ static grpc_call **perform_multirequest(servers_fixture *f, kill_server(f, i); } + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c index 83058d9b2c3..2555eb393f0 100644 --- a/test/core/client_config/set_initial_connect_string_test.c +++ b/test/core/client_config/set_initial_connect_string_test.c @@ -133,6 +133,7 @@ static void start_rpc(int use_creds, int target_port) { state.call = grpc_channel_create_call( state.channel, NULL, GRPC_PROPAGATE_DEFAULTS, state.cq, "/Service/Method", "localhost", gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + memset(&state.op, 0, sizeof(state.op)); state.op.op = GRPC_OP_SEND_INITIAL_METADATA; state.op.data.send_initial_metadata.count = 0; state.op.flags = 0; diff --git a/test/core/compression/compression_test.c b/test/core/compression/compression_test.c index 4c43746e335..ed6f9e72142 100644 --- a/test/core/compression/compression_test.c +++ b/test/core/compression/compression_test.c @@ -92,102 +92,6 @@ static void test_compression_algorithm_name(void) { /* the value of "name" is undefined upon failure */ } -static void test_compression_algorithm_for_level(void) { - gpr_log(GPR_DEBUG, "test_compression_algorithm_for_level"); - - { - /* accept only identity (aka none) */ - uint32_t accepted_encodings = 0; - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */ - - GPR_ASSERT(GRPC_COMPRESS_NONE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_NONE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_NONE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_NONE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH, - accepted_encodings)); - } - - { - /* accept only gzip */ - uint32_t accepted_encodings = 0; - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */ - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_GZIP); - - GPR_ASSERT(GRPC_COMPRESS_NONE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_GZIP == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_GZIP == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_GZIP == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH, - accepted_encodings)); - } - - { - /* accept only deflate */ - uint32_t accepted_encodings = 0; - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */ - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_DEFLATE); - - GPR_ASSERT(GRPC_COMPRESS_NONE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_DEFLATE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_DEFLATE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_DEFLATE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH, - accepted_encodings)); - } - - { - /* accept gzip and deflate */ - uint32_t accepted_encodings = 0; - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_NONE); /* always */ - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_GZIP); - GPR_BITSET(&accepted_encodings, GRPC_COMPRESS_DEFLATE); - - GPR_ASSERT(GRPC_COMPRESS_NONE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_GZIP == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_LOW, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_DEFLATE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_MED, - accepted_encodings)); - - GPR_ASSERT(GRPC_COMPRESS_DEFLATE == - grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH, - accepted_encodings)); - } -} - static void test_compression_enable_disable_algorithm(void) { grpc_compression_options options; grpc_compression_algorithm algorithm; @@ -221,7 +125,6 @@ int main(int argc, char **argv) { grpc_init(); test_compression_algorithm_parse(); test_compression_algorithm_name(); - test_compression_algorithm_for_level(); test_compression_enable_disable_algorithm(); grpc_shutdown(); diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 81f76ea79c2..d556f29bafb 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -165,6 +165,7 @@ void test_connect(const char *server_host, const char *client_host, int port, "/foo", "foo.test.google.fr", deadline, NULL); GPR_ASSERT(c); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -199,6 +200,7 @@ void test_connect(const char *server_host, const char *client_host, int port, cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index cd031ca4826..7b56e1f50e3 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -321,6 +321,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, NULL); GPR_ASSERT(c); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index a6487a17ac2..2fcd14696c3 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -169,6 +169,7 @@ static void on_p2s_recv_initial_metadata(void *arg, int success) { grpc_op op; grpc_call_error err; + memset(&op, 0, sizeof(op)); if (!pc->proxy->shutdown) { op.op = GRPC_OP_SEND_INITIAL_METADATA; op.flags = 0; @@ -326,6 +327,7 @@ static void on_new_call(void *arg, int success) { if (success) { grpc_op op; + memset(&op, 0, sizeof(op)); proxy_call *pc = gpr_malloc(sizeof(*pc)); memset(pc, 0, sizeof(*pc)); pc->proxy = proxy; diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c index afcf7638f72..5612b6621a5 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.c @@ -31,6 +31,8 @@ * */ +#include + #include #include @@ -78,6 +80,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { size_t details_capacity = 0; grpc_op ops[6]; + memset(ops, 0, sizeof(ops)); grpc_op *op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index 5f8c2641e76..3266793137c 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -132,6 +132,7 @@ int main(int argc, char **argv) { chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/foo", "127.0.0.1", GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20), NULL); /* send initial metadata to probe connectivity */ + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -142,6 +143,7 @@ int main(int argc, char **argv) { (size_t)(op - ops), tag(0x101), NULL)); /* and receive status to probe termination */ + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv1; @@ -183,6 +185,7 @@ int main(int argc, char **argv) { tag(0x9999)); /* listen for close on the server call to probe for finishing */ + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled1; @@ -205,6 +208,7 @@ int main(int argc, char **argv) { chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/foo", "127.0.0.1", GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20), NULL); /* send initial metadata to probe connectivity */ + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -215,6 +219,7 @@ int main(int argc, char **argv) { (size_t)(op - ops), tag(0x201), NULL)); /* and receive status to probe termination */ + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv2; @@ -249,6 +254,7 @@ int main(int argc, char **argv) { cq_verify(cqv); /* listen for close on the server call to probe for finishing */ + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled2; diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index cf42e92a1a3..35456607012 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -30,11 +30,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + +#include +#include + #include #include #include #include -#include + #include "test/core/end2end/cq_verifier.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -74,6 +78,7 @@ static void prepare_test(int is_client) { g_state.cqv = cq_verifier_create(g_state.cq); g_state.details = NULL; g_state.details_capacity = 0; + memset(g_state.ops, 0, sizeof(g_state.ops)); if (is_client) { /* create a call, channel to a non existant server */ diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index 7a5cd2335f1..08af3821971 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -31,9 +31,12 @@ * */ +#include + #include #include #include + #include "test/core/end2end/cq_verifier.h" #include "test/core/util/test_config.h" @@ -65,6 +68,7 @@ int main(int argc, char **argv) { call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, "/Foo", "nonexistant", deadline, NULL); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index 3cb9b3d4b12..c9663c2155e 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -123,6 +123,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 994c3bf1dd2..3dd26120777 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -157,6 +157,7 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 2; @@ -201,6 +202,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 2; @@ -219,6 +221,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index b555bea740b..eee0cb8dedb 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -193,6 +193,7 @@ static void request_response_with_payload_and_call_creds( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -248,6 +249,7 @@ static void request_response_with_payload_and_call_creds( /* Cannot set creds on the server call object. */ GPR_ASSERT(grpc_call_set_credentials(s, NULL) != GRPC_CALL_OK); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -265,6 +267,7 @@ static void request_response_with_payload_and_call_creds( cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; @@ -410,6 +413,7 @@ static void test_request_with_server_rejecting_client_creds( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index fc2a64a6c18..51c13da3b1e 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -136,6 +136,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -174,6 +175,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, cq_expect_completion(cqv, tag(2), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 3bafa8c85fd..2b5a409deef 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -136,6 +136,7 @@ static void test_cancel_after_accept_and_writes_closed( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; @@ -178,6 +179,7 @@ static void test_cancel_after_accept_and_writes_closed( cq_expect_completion(cqv, tag(2), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index fc2751af8e1..85fbe9de7bb 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -131,6 +131,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 33005db9e45..d99062c6082 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -131,6 +131,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index c3ee4a6a0ee..83629a9a028 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -122,6 +122,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 589bc314f8e..13eb0e8b3d6 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -45,6 +45,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/compress_filter.h" +#include "src/core/lib/surface/call.h" #include "src/core/lib/surface/call_test_only.h" #include "test/core/end2end/cq_verifier.h" @@ -104,10 +105,13 @@ static void end_test(grpc_end2end_test_fixture *f) { static void request_with_payload_template( grpc_end2end_test_config config, const char *test_name, - uint32_t send_flags_bitmask, - grpc_compression_algorithm requested_compression_algorithm, - grpc_compression_algorithm expected_compression_algorithm, - grpc_metadata *client_metadata) { + uint32_t client_send_flags_bitmask, + grpc_compression_algorithm default_client_channel_compression_algorithm, + grpc_compression_algorithm default_server_channel_compression_algorithm, + grpc_compression_algorithm expected_algorithm_from_client, + grpc_compression_algorithm expected_algorithm_from_server, + grpc_metadata *client_init_metadata, + grpc_compression_level server_compression_level) { grpc_call *c; grpc_call *s; gpr_slice request_payload_slice; @@ -122,6 +126,8 @@ static void request_with_payload_template( grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; grpc_byte_buffer *request_payload_recv = NULL; + grpc_byte_buffer *response_payload; + grpc_byte_buffer *response_payload_recv; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -129,17 +135,22 @@ static void request_with_payload_template( size_t details_capacity = 0; int was_cancelled = 2; cq_verifier *cqv; - char str[1024]; + char request_str[1024]; + char response_str[1024]; - memset(str, 'x', 1023); - str[1023] = '\0'; - request_payload_slice = gpr_slice_from_copied_string(str); - request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + memset(request_str, 'x', 1023); + request_str[1023] = '\0'; + + memset(response_str, 'y', 1023); + response_str[1023] = '\0'; + + request_payload_slice = gpr_slice_from_copied_string(request_str); + gpr_slice response_payload_slice = gpr_slice_from_copied_string(response_str); client_args = grpc_channel_args_set_compression_algorithm( - NULL, requested_compression_algorithm); + NULL, default_client_channel_compression_algorithm); server_args = grpc_channel_args_set_compression_algorithm( - NULL, requested_compression_algorithm); + NULL, default_server_channel_compression_algorithm); f = begin_test(config, test_name, client_args, server_args); cqv = cq_verifier_create(f.cq); @@ -153,26 +164,18 @@ static void request_with_payload_template( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; - if (client_metadata != NULL) { + if (client_init_metadata != NULL) { op->data.send_initial_metadata.count = 1; - op->data.send_initial_metadata.metadata = client_metadata; + op->data.send_initial_metadata.metadata = client_init_metadata; } else { op->data.send_initial_metadata.count = 0; } op->flags = 0; op->reserved = NULL; op++; - op->op = GRPC_OP_SEND_MESSAGE; - op->data.send_message = request_payload; - op->flags = send_flags_bitmask; - op->reserved = NULL; - op++; - op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; - op->flags = 0; - op->reserved = NULL; - op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; @@ -191,9 +194,9 @@ static void request_with_payload_template( error = grpc_server_request_call(f.server, &s, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101)); + &request_metadata_recv, f.cq, f.cq, tag(100)); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(101), 1); + cq_expect_completion(cqv, tag(100), 1); cq_verify(cqv); GPR_ASSERT( @@ -205,29 +208,103 @@ static void request_with_payload_template( GPR_ASSERT(GPR_BITGET(grpc_call_test_only_get_encodings_accepted_by_peer(s), GRPC_COMPRESS_GZIP) != 0); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; + op->data.send_initial_metadata.compression_level = server_compression_level; op->flags = 0; op->reserved = NULL; op++; - op->op = GRPC_OP_RECV_MESSAGE; - op->data.recv_message = &request_payload_recv; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(102), 1); - cq_verify(cqv); + for (int i = 0; i < 2; i++) { + request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); + response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message = request_payload; + op->flags = client_send_flags_bitmask; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message = &response_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message = &request_payload_recv; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + cq_expect_completion(cqv, tag(102), 1); + cq_verify(cqv); + + GPR_ASSERT(request_payload_recv->type == GRPC_BB_RAW); + GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, request_str)); + GPR_ASSERT(request_payload_recv->data.raw.compression == + expected_algorithm_from_client); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message = response_payload; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + cq_expect_completion(cqv, tag(103), 1); + cq_expect_completion(cqv, tag(2), 1); + cq_verify(cqv); + + GPR_ASSERT(response_payload_recv->type == GRPC_BB_RAW); + GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, response_str)); + if (server_compression_level > GRPC_COMPRESS_LEVEL_NONE) { + const grpc_compression_algorithm algo_for_server_level = + grpc_call_compression_for_level(s, server_compression_level); + GPR_ASSERT(response_payload_recv->data.raw.compression == + algo_for_server_level); + } else { + GPR_ASSERT(response_payload_recv->data.raw.compression == + expected_algorithm_from_server); + } + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(response_payload); + grpc_byte_buffer_destroy(request_payload_recv); + grpc_byte_buffer_destroy(response_payload_recv); + } + + gpr_slice_unref(request_payload_slice); + gpr_slice_unref(response_payload_slice); + memset(ops, 0, sizeof(ops)); op = ops; - op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = &was_cancelled; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; op->reserved = NULL; op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + memset(ops, 0, sizeof(ops)); + op = ops; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_OK; @@ -235,11 +312,13 @@ static void request_with_payload_template( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(1), 1); + cq_expect_completion(cqv, tag(3), 1); + cq_expect_completion(cqv, tag(101), 1); + cq_expect_completion(cqv, tag(104), 1); cq_verify(cqv); GPR_ASSERT(status == GRPC_STATUS_OK); @@ -248,12 +327,6 @@ static void request_with_payload_template( GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(was_cancelled == 0); - GPR_ASSERT(request_payload_recv->type == GRPC_BB_RAW); - GPR_ASSERT(request_payload_recv->data.raw.compression == - expected_compression_algorithm); - - GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, str)); - gpr_free(details); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); @@ -265,10 +338,6 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); - gpr_slice_unref(request_payload_slice); - grpc_byte_buffer_destroy(request_payload); - grpc_byte_buffer_destroy(request_payload_recv); - grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); @@ -280,60 +349,78 @@ static void test_invoke_request_with_exceptionally_uncompressed_payload( grpc_end2end_test_config config) { request_with_payload_template( config, "test_invoke_request_with_exceptionally_uncompressed_payload", - GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_NONE, NULL); + GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, + GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, NULL, GRPC_COMPRESS_LEVEL_NONE); } static void test_invoke_request_with_uncompressed_payload( grpc_end2end_test_config config) { request_with_payload_template( config, "test_invoke_request_with_uncompressed_payload", 0, - GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, NULL); + GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, + GRPC_COMPRESS_NONE, NULL, GRPC_COMPRESS_LEVEL_NONE); } static void test_invoke_request_with_compressed_payload( grpc_end2end_test_config config) { request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, - GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, NULL); + GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, + GRPC_COMPRESS_GZIP, NULL, GRPC_COMPRESS_LEVEL_NONE); +} + +static void test_invoke_request_with_server_level( + grpc_end2end_test_config config) { + request_with_payload_template( + config, "test_invoke_request_with_server_level", 0, GRPC_COMPRESS_NONE, + GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE /* ignored */, + NULL, GRPC_COMPRESS_LEVEL_HIGH); } static void test_invoke_request_with_compressed_payload_md_override( grpc_end2end_test_config config) { grpc_metadata gzip_compression_override; - grpc_metadata none_compression_override; + grpc_metadata identity_compression_override; gzip_compression_override.key = GRPC_COMPRESS_REQUEST_ALGORITHM_KEY; gzip_compression_override.value = "gzip"; - gzip_compression_override.value_length = 4; + gzip_compression_override.value_length = + strlen(gzip_compression_override.value); memset(&gzip_compression_override.internal_data, 0, sizeof(gzip_compression_override.internal_data)); - none_compression_override.key = GRPC_COMPRESS_REQUEST_ALGORITHM_KEY; - none_compression_override.value = "identity"; - none_compression_override.value_length = 4; - memset(&none_compression_override.internal_data, 0, - sizeof(none_compression_override.internal_data)); + identity_compression_override.key = GRPC_COMPRESS_REQUEST_ALGORITHM_KEY; + identity_compression_override.value = "identity"; + identity_compression_override.value_length = + strlen(identity_compression_override.value); + memset(&identity_compression_override.internal_data, 0, + sizeof(identity_compression_override.internal_data)); /* Channel default NONE (aka IDENTITY), call override to GZIP */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_1", 0, - GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, &gzip_compression_override); + GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, + GRPC_COMPRESS_NONE, &gzip_compression_override, GRPC_COMPRESS_LEVEL_NONE); /* Channel default DEFLATE, call override to GZIP */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_2", 0, - GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_GZIP, &gzip_compression_override); + GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, + GRPC_COMPRESS_NONE, &gzip_compression_override, GRPC_COMPRESS_LEVEL_NONE); /* Channel default DEFLATE, call override to NONE (aka IDENTITY) */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_3", 0, - GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, &none_compression_override); + GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, + GRPC_COMPRESS_NONE, &identity_compression_override, + GRPC_COMPRESS_LEVEL_NONE); } void compressed_payload(grpc_end2end_test_config config) { test_invoke_request_with_exceptionally_uncompressed_payload(config); test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); + test_invoke_request_with_server_level(config); test_invoke_request_with_compressed_payload_md_override(config); } diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c index 44384a783ec..728ee597b50 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.c @@ -131,6 +131,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -173,6 +174,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 03d1ded04cf..536fbd0d8a8 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -108,6 +108,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -145,6 +146,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, - and still complete the request */ grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index 99049aa6bd5..dae98233e02 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -134,6 +134,7 @@ static void test_request(grpc_end2end_test_config config) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 26198f3bdfc..f527b8617d9 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -122,6 +122,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -160,6 +161,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_server_shutdown_and_notify(f.server, f.cq, tag(0xdead)); cq_verify_empty(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index 374606dcb73..50e3c9cb898 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -128,6 +128,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -161,6 +162,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index 07d5d387b4c..ee889b77a1c 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -323,6 +323,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = GPR_ARRAY_SIZE(extra_metadata); @@ -357,6 +358,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index e53f3b2aaa8..dfedcfebee8 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -132,6 +132,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -174,6 +175,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 6410305451a..9c9ca951293 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -138,6 +138,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -181,6 +182,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -198,6 +200,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index 0e5d6b4fe01..6631d207d26 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -138,6 +138,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 1; @@ -177,6 +178,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -194,6 +196,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 1bb53073cb0..41de74ff874 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -124,6 +124,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -157,6 +158,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -270,6 +272,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { f.server, &s1, &call_details, &request_metadata_recv, f.cq, f.cq, tag(101))); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -283,6 +286,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv1; @@ -300,6 +304,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -313,6 +318,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv2; @@ -354,6 +360,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { } GPR_ASSERT(live_call == 300 || live_call == 400); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -388,6 +395,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(201), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index b5dbc1382a8..6d957ef55d2 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -140,6 +140,7 @@ static void test_max_message_length(grpc_end2end_test_config config) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -178,6 +179,7 @@ static void test_max_message_length(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index 03e57a90f6f..fd56c8b4ff1 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -122,6 +122,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index bdfb1354068..443d85eecc4 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -131,6 +131,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -174,6 +175,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -191,6 +193,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 15e1c6e338a..1d2f7943c1d 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -135,6 +135,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -164,6 +165,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, cq_expect_completion(cqv, tag(100), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -182,6 +184,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = request_payload; @@ -196,6 +199,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &request_payload_recv; @@ -207,6 +211,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message = response_payload; @@ -228,6 +233,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_slice_unref(request_payload_slice); gpr_slice_unref(response_payload_slice); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; @@ -236,6 +242,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); GPR_ASSERT(GRPC_CALL_OK == error); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 3c4edbae7dc..ece6250ea13 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -125,6 +125,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -158,6 +159,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 779895b9701..68545284dbe 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -131,6 +131,7 @@ static void test_invoke_request_with_flags( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 77064040909..d94267e09cf 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -130,6 +130,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -167,6 +168,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -184,6 +186,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index a4f5319e5b4..a723c6fd2ca 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -126,6 +126,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -155,6 +156,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index 80287cd507a..abb6b26a875 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -115,6 +115,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -149,6 +150,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 400b3a00274..e1fcc035bbd 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -117,6 +117,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -152,6 +153,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index 707b3c9512c..c9b1a03da52 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -141,6 +141,7 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 2; @@ -185,6 +186,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 2; @@ -203,6 +205,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 42108425e6f..a8014e6894c 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -132,6 +132,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -174,6 +175,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index 4dd8c12cba9..41e0f009113 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -144,6 +144,7 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata_array_init(&request_metadata_recv); grpc_call_details_init(&call_details); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 2; @@ -188,6 +189,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_completion(cqv, tag(101), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 2; @@ -206,6 +208,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 81562277ec0..123f2b5bbed 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -65,6 +65,7 @@ static void init_ping_pong_request(void) { grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 12fa9de6cf3..285d8ea24dc 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -115,6 +115,7 @@ int main(int argc, char **argv) { GPR_ASSERT(call); cqv = cq_verifier_create(cq); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; @@ -133,6 +134,7 @@ int main(int argc, char **argv) { cq_expect_completion(cqv, tag(1), 0); cq_verify(cqv); + memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; From 5ff7b71a257e264b2ee986e60a086f282b6670bc Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 12 May 2016 18:08:26 -0700 Subject: [PATCH 010/175] memset for api fuzzer --- test/core/end2end/fuzzers/api_fuzzer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index b133a948ee0..6d07350e56b 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -697,6 +697,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { break; } grpc_op *ops = gpr_malloc(sizeof(grpc_op) * num_ops); + memset(ops, 0, sizeof(grpc_op) * num_ops); bool ok = true; size_t i; grpc_op *op; From 118dc63dbbe3dd8412cbd483369fc927b2b464e5 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 12 May 2016 18:25:13 -0700 Subject: [PATCH 011/175] made send_initial_md compression level a "maybe" --- include/grpc/impl/codegen/grpc_types.h | 8 +++++++- src/core/lib/surface/call.c | 8 +++++--- test/core/end2end/tests/compressed_payload.c | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 607a38216ba..234e5a0161e 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -37,6 +37,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -332,7 +333,12 @@ typedef struct grpc_op { struct { size_t count; grpc_metadata *metadata; - grpc_compression_level compression_level; + /** If \a is_set, \a compression_level will be used for the call. + * Otherwise, \a compression_level won't be considered */ + struct { + bool is_set; + grpc_compression_level compression_level; + } maybe_compression_level; } send_initial_metadata; grpc_byte_buffer *send_message; struct { diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 911b5b80bb9..7ca9406171a 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1323,15 +1323,17 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, grpc_metadata compression_md; memset(&compression_md, 0, sizeof(grpc_metadata)); size_t additional_metadata_count = 0; - if (op->data.send_initial_metadata.compression_level > - GRPC_COMPRESS_LEVEL_NONE) { + if (op->data.send_initial_metadata.maybe_compression_level.is_set && + op->data.send_initial_metadata.maybe_compression_level + .compression_level > GRPC_COMPRESS_LEVEL_NONE) { if (call->is_client) { error = GRPC_CALL_ERROR_NOT_ON_CLIENT; goto done_with_error; } const grpc_compression_algorithm calgo = compression_algorithm_for_level_locked( - call, op->data.send_initial_metadata.compression_level); + call, op->data.send_initial_metadata.maybe_compression_level + .compression_level); char *calgo_name; grpc_compression_algorithm_name(calgo, &calgo_name); compression_md.key = "grpc-internal-encoding-request"; diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 13eb0e8b3d6..7739335620d 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -212,7 +212,9 @@ static void request_with_payload_template( op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.compression_level = server_compression_level; + op->data.send_initial_metadata.maybe_compression_level.is_set = true; + op->data.send_initial_metadata.maybe_compression_level.compression_level = + server_compression_level; op->flags = 0; op->reserved = NULL; op++; From d982bba41d8676f33431d540d8a4b0c15e426f1c Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 12 May 2016 18:53:52 -0700 Subject: [PATCH 012/175] Add base64 decoder --- BUILD | 6 + Makefile | 38 ++++ binding.gyp | 1 + build.yaml | 10 + config.m4 | 1 + gRPC.podspec | 3 + grpc.gemspec | 2 + package.xml | 2 + .../transport/chttp2/transport/bin_decoder.c | 115 +++++++++++ .../transport/chttp2/transport/bin_decoder.h | 48 +++++ src/python/grpcio/grpc_core_dependencies.py | 1 + test/core/transport/chttp2/bin_decoder_test.c | 120 +++++++++++ tools/doxygen/Doxyfile.core.internal | 2 + tools/run_tests/sources_and_headers.json | 17 ++ tools/run_tests/tests.json | 21 ++ vsprojects/buildtests_c.sln | 25 +++ vsprojects/vcxproj/grpc/grpc.vcxproj | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 6 + .../grpc_unsecure/grpc_unsecure.vcxproj | 3 + .../grpc_unsecure.vcxproj.filters | 6 + .../bin_decoder_test/bin_decoder_test.vcxproj | 193 ++++++++++++++++++ .../bin_decoder_test.vcxproj.filters | 24 +++ 22 files changed, 647 insertions(+) create mode 100644 src/core/ext/transport/chttp2/transport/bin_decoder.c create mode 100644 src/core/ext/transport/chttp2/transport/bin_decoder.h create mode 100644 test/core/transport/chttp2/bin_decoder_test.c create mode 100644 vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj create mode 100644 vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj.filters diff --git a/BUILD b/BUILD index 1ca357896a7..42214c5e65c 100644 --- a/BUILD +++ b/BUILD @@ -234,6 +234,7 @@ cc_library( "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/transport.h", "src/core/lib/transport/transport_impl.h", + "src/core/ext/transport/chttp2/transport/bin_decoder.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", "src/core/ext/transport/chttp2/transport/frame.h", @@ -376,6 +377,7 @@ cc_library( "src/core/lib/transport/transport.c", "src/core/lib/transport/transport_op_string.c", "src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c", + "src/core/ext/transport/chttp2/transport/bin_decoder.c", "src/core/ext/transport/chttp2/transport/bin_encoder.c", "src/core/ext/transport/chttp2/transport/chttp2_plugin.c", "src/core/ext/transport/chttp2/transport/chttp2_transport.c", @@ -580,6 +582,7 @@ cc_library( "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/transport.h", "src/core/lib/transport/transport_impl.h", + "src/core/ext/transport/chttp2/transport/bin_decoder.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", "src/core/ext/transport/chttp2/transport/frame.h", @@ -709,6 +712,7 @@ cc_library( "src/core/lib/transport/transport.c", "src/core/lib/transport/transport_op_string.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", + "src/core/ext/transport/chttp2/transport/bin_decoder.c", "src/core/ext/transport/chttp2/transport/bin_encoder.c", "src/core/ext/transport/chttp2/transport/chttp2_plugin.c", "src/core/ext/transport/chttp2/transport/chttp2_transport.c", @@ -1401,6 +1405,7 @@ objc_library( "src/core/lib/transport/transport.c", "src/core/lib/transport/transport_op_string.c", "src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c", + "src/core/ext/transport/chttp2/transport/bin_decoder.c", "src/core/ext/transport/chttp2/transport/bin_encoder.c", "src/core/ext/transport/chttp2/transport/chttp2_plugin.c", "src/core/ext/transport/chttp2/transport/chttp2_transport.c", @@ -1584,6 +1589,7 @@ objc_library( "src/core/lib/transport/static_metadata.h", "src/core/lib/transport/transport.h", "src/core/lib/transport/transport_impl.h", + "src/core/ext/transport/chttp2/transport/bin_decoder.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", "src/core/ext/transport/chttp2/transport/frame.h", diff --git a/Makefile b/Makefile index f0a0ebd3eb6..ce243fc1868 100644 --- a/Makefile +++ b/Makefile @@ -889,6 +889,7 @@ algorithm_test: $(BINDIR)/$(CONFIG)/algorithm_test alloc_test: $(BINDIR)/$(CONFIG)/alloc_test alpn_test: $(BINDIR)/$(CONFIG)/alpn_test api_fuzzer: $(BINDIR)/$(CONFIG)/api_fuzzer +bin_decoder_test: $(BINDIR)/$(CONFIG)/bin_decoder_test bin_encoder_test: $(BINDIR)/$(CONFIG)/bin_encoder_test census_context_test: $(BINDIR)/$(CONFIG)/census_context_test channel_create_test: $(BINDIR)/$(CONFIG)/channel_create_test @@ -1227,6 +1228,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/algorithm_test \ $(BINDIR)/$(CONFIG)/alloc_test \ $(BINDIR)/$(CONFIG)/alpn_test \ + $(BINDIR)/$(CONFIG)/bin_decoder_test \ $(BINDIR)/$(CONFIG)/bin_encoder_test \ $(BINDIR)/$(CONFIG)/census_context_test \ $(BINDIR)/$(CONFIG)/channel_create_test \ @@ -1483,6 +1485,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/alloc_test || ( echo test alloc_test failed ; exit 1 ) $(E) "[RUN] Testing alpn_test" $(Q) $(BINDIR)/$(CONFIG)/alpn_test || ( echo test alpn_test failed ; exit 1 ) + $(E) "[RUN] Testing bin_decoder_test" + $(Q) $(BINDIR)/$(CONFIG)/bin_decoder_test || ( echo test bin_decoder_test failed ; exit 1 ) $(E) "[RUN] Testing bin_encoder_test" $(Q) $(BINDIR)/$(CONFIG)/bin_encoder_test || ( echo test bin_encoder_test failed ; exit 1 ) $(E) "[RUN] Testing census_context_test" @@ -2575,6 +2579,7 @@ LIBGRPC_SRC = \ src/core/lib/transport/transport.c \ src/core/lib/transport/transport_op_string.c \ src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c \ + src/core/ext/transport/chttp2/transport/bin_decoder.c \ src/core/ext/transport/chttp2/transport/bin_encoder.c \ src/core/ext/transport/chttp2/transport/chttp2_plugin.c \ src/core/ext/transport/chttp2/transport/chttp2_transport.c \ @@ -2917,6 +2922,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/transport/transport.c \ src/core/lib/transport/transport_op_string.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ + src/core/ext/transport/chttp2/transport/bin_decoder.c \ src/core/ext/transport/chttp2/transport/bin_encoder.c \ src/core/ext/transport/chttp2/transport/chttp2_plugin.c \ src/core/ext/transport/chttp2/transport/chttp2_transport.c \ @@ -6137,6 +6143,38 @@ endif endif +BIN_DECODER_TEST_SRC = \ + test/core/transport/chttp2/bin_decoder_test.c \ + +BIN_DECODER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(BIN_DECODER_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/bin_decoder_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/bin_decoder_test: $(BIN_DECODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(BIN_DECODER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/bin_decoder_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/transport/chttp2/bin_decoder_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a + +deps_bin_decoder_test: $(BIN_DECODER_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(BIN_DECODER_TEST_OBJS:.o=.dep) +endif +endif + + BIN_ENCODER_TEST_SRC = \ test/core/transport/chttp2/bin_encoder_test.c \ diff --git a/binding.gyp b/binding.gyp index 8bc2aee3d1a..df497ec265f 100644 --- a/binding.gyp +++ b/binding.gyp @@ -646,6 +646,7 @@ 'src/core/lib/transport/transport.c', 'src/core/lib/transport/transport_op_string.c', 'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c', + 'src/core/ext/transport/chttp2/transport/bin_decoder.c', 'src/core/ext/transport/chttp2/transport/bin_encoder.c', 'src/core/ext/transport/chttp2/transport/chttp2_plugin.c', 'src/core/ext/transport/chttp2/transport/chttp2_transport.c', diff --git a/build.yaml b/build.yaml index 187eb9ca8c6..5ba8405a6a6 100644 --- a/build.yaml +++ b/build.yaml @@ -466,6 +466,7 @@ filegroups: - gpr_test_util - name: grpc_transport_chttp2 headers: + - src/core/ext/transport/chttp2/transport/bin_decoder.h - src/core/ext/transport/chttp2/transport/bin_encoder.h - src/core/ext/transport/chttp2/transport/chttp2_transport.h - src/core/ext/transport/chttp2/transport/frame.h @@ -487,6 +488,7 @@ filegroups: - src/core/ext/transport/chttp2/transport/timeout_encoding.h - src/core/ext/transport/chttp2/transport/varint.h src: + - src/core/ext/transport/chttp2/transport/bin_decoder.c - src/core/ext/transport/chttp2/transport/bin_encoder.c - src/core/ext/transport/chttp2/transport/chttp2_plugin.c - src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1140,6 +1142,14 @@ targets: - test/core/end2end/fuzzers/api_fuzzer_corpus dict: test/core/end2end/fuzzers/api_fuzzer.dictionary maxlen: 2048 +- name: bin_decoder_test + build: test + language: c + src: + - test/core/transport/chttp2/bin_decoder_test.c + deps: + - grpc_test_util + - grpc - name: bin_encoder_test build: test language: c diff --git a/config.m4 b/config.m4 index c8d2aae106c..2bdcd0e4999 100644 --- a/config.m4 +++ b/config.m4 @@ -165,6 +165,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/transport/transport.c \ src/core/lib/transport/transport_op_string.c \ src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c \ + src/core/ext/transport/chttp2/transport/bin_decoder.c \ src/core/ext/transport/chttp2/transport/bin_encoder.c \ src/core/ext/transport/chttp2/transport/chttp2_plugin.c \ src/core/ext/transport/chttp2/transport/chttp2_transport.c \ diff --git a/gRPC.podspec b/gRPC.podspec index 393733209de..a3a97a10b87 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -237,6 +237,7 @@ Pod::Spec.new do |s| 'src/core/lib/transport/static_metadata.h', 'src/core/lib/transport/transport.h', 'src/core/lib/transport/transport_impl.h', + 'src/core/ext/transport/chttp2/transport/bin_decoder.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', 'src/core/ext/transport/chttp2/transport/frame.h', @@ -412,6 +413,7 @@ Pod::Spec.new do |s| 'src/core/lib/transport/transport.c', 'src/core/lib/transport/transport_op_string.c', 'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c', + 'src/core/ext/transport/chttp2/transport/bin_decoder.c', 'src/core/ext/transport/chttp2/transport/bin_encoder.c', 'src/core/ext/transport/chttp2/transport/chttp2_plugin.c', 'src/core/ext/transport/chttp2/transport/chttp2_transport.c', @@ -580,6 +582,7 @@ Pod::Spec.new do |s| 'src/core/lib/transport/static_metadata.h', 'src/core/lib/transport/transport.h', 'src/core/lib/transport/transport_impl.h', + 'src/core/ext/transport/chttp2/transport/bin_decoder.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', 'src/core/ext/transport/chttp2/transport/frame.h', diff --git a/grpc.gemspec b/grpc.gemspec index 240ea1ca1ff..4a698f94b57 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -245,6 +245,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/transport/static_metadata.h ) s.files += %w( src/core/lib/transport/transport.h ) s.files += %w( src/core/lib/transport/transport_impl.h ) + s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h ) s.files += %w( src/core/ext/transport/chttp2/transport/frame.h ) @@ -391,6 +392,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/transport/transport.c ) s.files += %w( src/core/lib/transport/transport_op_string.c ) s.files += %w( src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c ) + s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.c ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.c ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_plugin.c ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.c ) diff --git a/package.xml b/package.xml index 4c159e6024c..d6a4f2edbbd 100644 --- a/package.xml +++ b/package.xml @@ -252,6 +252,7 @@ + @@ -398,6 +399,7 @@ + diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c new file mode 100644 index 00000000000..fe6c84bfb8f --- /dev/null +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -0,0 +1,115 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/ext/transport/chttp2/transport/bin_decoder.h" +#include +#include + +static uint8_t decode_table[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, + 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0}; + +static const uint8_t tail_xtra[4] = {0, 0, 1, 2}; + +gpr_slice grpc_chttp2_base64_decode(gpr_slice input) { + size_t input_length = GPR_SLICE_LENGTH(input); + GPR_ASSERT(input_length % 4 == 0); + size_t output_length = input_length / 4 * 3; + + if (input_length > 0) { + uint8_t *input_end = GPR_SLICE_END_PTR(input); + if (*(--input_end) == '=') { + output_length--; + if (*(--input_end) == '=') { + output_length--; + } + } + } + + gpr_log(GPR_ERROR, "input_length: %d, output_length: %d\n", input_length, + output_length); + + return grpc_chttp2_base64_decode_with_length(input, output_length); +} + +gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input, + size_t output_length) { + size_t input_length = GPR_SLICE_LENGTH(input); + // The length of a base64 string cannot be 4 * n + 1 + GPR_ASSERT(input_length % 4 != 1); + GPR_ASSERT(output_length <= + input_length / 4 * 3 + tail_xtra[input_length % 4]); + size_t output_triplets = output_length / 3; + size_t tail_case = output_length % 3; + gpr_slice output = gpr_slice_malloc(output_length); + uint8_t *in = GPR_SLICE_START_PTR(input); + uint8_t *out = GPR_SLICE_START_PTR(output); + size_t i; + + for (i = 0; i < output_triplets; i++) { + out[0] = (uint8_t)((decode_table[in[0]] << 2) | (decode_table[in[1]] >> 4)); + out[1] = (uint8_t)((decode_table[in[1]] << 4) | (decode_table[in[2]] >> 2)); + out[2] = (uint8_t)((decode_table[in[2]] << 6) | decode_table[in[3]]); + out += 3; + in += 4; + } + + if (tail_case > 0) { + switch (tail_case) { + case 2: + out[1] = + (uint8_t)((decode_table[in[1]] << 4) | (decode_table[in[2]] >> 2)); + case 1: + out[0] = + (uint8_t)((decode_table[in[0]] << 2) | (decode_table[in[1]] >> 4)); + } + out += tail_case; + in += tail_case + 1; + } + + GPR_ASSERT(out == GPR_SLICE_END_PTR(output)); + GPR_ASSERT(in <= GPR_SLICE_END_PTR(input)); + return output; +} diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h new file mode 100644 index 00000000000..5516f86d53b --- /dev/null +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h @@ -0,0 +1,48 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H +#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H + +#include + +/* base64 decode a slice with pad chars. Returns a new slice, does not take + ownership of the input */ +gpr_slice grpc_chttp2_base64_decode(gpr_slice input); + +/* base64 decode a slice without pad chars, data length is needed. Returns a new + slice, does not take ownership of the input */ +gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input, + size_t output_length); + +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 4b98dc1a133..f6508a3c739 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -159,6 +159,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/transport/transport.c', 'src/core/lib/transport/transport_op_string.c', 'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c', + 'src/core/ext/transport/chttp2/transport/bin_decoder.c', 'src/core/ext/transport/chttp2/transport/bin_encoder.c', 'src/core/ext/transport/chttp2/transport/chttp2_plugin.c', 'src/core/ext/transport/chttp2/transport/chttp2_transport.c', diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.c new file mode 100644 index 00000000000..980da02dc35 --- /dev/null +++ b/test/core/transport/chttp2/bin_decoder_test.c @@ -0,0 +1,120 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/ext/transport/chttp2/transport/bin_decoder.h" + +#include + +#include +#include +#include +#include "src/core/ext/transport/chttp2/transport/bin_encoder.h" +#include "src/core/lib/support/string.h" + +static int all_ok = 1; + +static void expect_slice_eq(gpr_slice expected, gpr_slice slice, char *debug, + int line) { + if (0 != gpr_slice_cmp(slice, expected)) { + char *hs = gpr_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + char *he = gpr_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); + gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs, + he); + gpr_free(hs); + gpr_free(he); + all_ok = 0; + } + gpr_slice_unref(expected); + gpr_slice_unref(slice); +} + +static gpr_slice base64_encode(const char *s) { + gpr_slice ss = gpr_slice_from_copied_string(s); + gpr_slice out = grpc_chttp2_base64_encode(ss); + gpr_slice_unref(ss); + return out; +} + +static gpr_slice base64_decode(const char *s) { + gpr_slice ss = gpr_slice_from_copied_string(s); + gpr_slice out = grpc_chttp2_base64_decode(ss); + gpr_slice_unref(ss); + return out; +} + +#define EXPECT_SLICE_EQ(expected, slice) \ + expect_slice_eq( \ + gpr_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \ + #slice, __LINE__); + +#define ENCODE_AND_DECODE(s) \ + EXPECT_SLICE_EQ( \ + s, grpc_chttp2_base64_decode_with_length(base64_encode(s), strlen(s))); + +int main(int argc, char **argv) { + /* + * ENCODE_AND_DECODE tests grpc_chttp2_base64_decode_with_length(), which + * takes encoded base64 strings without pad chars, but output length is + * required + */ + /* Base64 test vectors from RFC 4648 */ + ENCODE_AND_DECODE(""); + ENCODE_AND_DECODE("f"); + ENCODE_AND_DECODE("foo"); + ENCODE_AND_DECODE("fo"); + ENCODE_AND_DECODE("foob"); + ENCODE_AND_DECODE("fooba"); + ENCODE_AND_DECODE("foobar"); + + ENCODE_AND_DECODE("\xc0\xc1\xc2\xc3\xc4\xc5"); + + /* Base64 test vectors from RFC 4648, with pad chars */ + /* BASE64("") = "" */ + EXPECT_SLICE_EQ("", base64_decode("")); + /* BASE64("f") = "Zg==" */ + EXPECT_SLICE_EQ("f", base64_decode("Zg==")); + /* BASE64("fo") = "Zm8=" */ + EXPECT_SLICE_EQ("fo", base64_decode("Zm8=")); + /* BASE64("foo") = "Zm9v" */ + EXPECT_SLICE_EQ("foo", base64_decode("Zm9v")); + /* BASE64("foob") = "Zm9vYg==" */ + EXPECT_SLICE_EQ("foob", base64_decode("Zm9vYg==")); + /* BASE64("fooba") = "Zm9vYmE=" */ + EXPECT_SLICE_EQ("fooba", base64_decode("Zm9vYmE=")); + /* BASE64("foobar") = "Zm9vYmFy" */ + EXPECT_SLICE_EQ("foobar", base64_decode("Zm9vYmFy")); + + EXPECT_SLICE_EQ("\xc0\xc1\xc2\xc3\xc4\xc5", base64_decode("wMHCw8TF")); + + return all_ok ? 0 : 1; +} diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 7e0d5ebd37f..670afe1261c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -862,6 +862,7 @@ src/core/lib/transport/metadata_batch.h \ src/core/lib/transport/static_metadata.h \ src/core/lib/transport/transport.h \ src/core/lib/transport/transport_impl.h \ +src/core/ext/transport/chttp2/transport/bin_decoder.h \ src/core/ext/transport/chttp2/transport/bin_encoder.h \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ src/core/ext/transport/chttp2/transport/frame.h \ @@ -1008,6 +1009,7 @@ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/transport.c \ src/core/lib/transport/transport_op_string.c \ src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c \ +src/core/ext/transport/chttp2/transport/bin_decoder.c \ src/core/ext/transport/chttp2/transport/bin_encoder.c \ src/core/ext/transport/chttp2/transport/chttp2_plugin.c \ src/core/ext/transport/chttp2/transport/chttp2_transport.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index b36f0a8ca8e..da54d55b93d 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -79,6 +79,20 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "grpc", + "grpc_test_util" + ], + "headers": [], + "language": "c", + "name": "bin_decoder_test", + "src": [ + "test/core/transport/chttp2/bin_decoder_test.c" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "grpc", @@ -6150,6 +6164,7 @@ "grpc_transport_chttp2_alpn" ], "headers": [ + "src/core/ext/transport/chttp2/transport/bin_decoder.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", "src/core/ext/transport/chttp2/transport/frame.h", @@ -6174,6 +6189,8 @@ "language": "c", "name": "grpc_transport_chttp2", "src": [ + "src/core/ext/transport/chttp2/transport/bin_decoder.c", + "src/core/ext/transport/chttp2/transport/bin_decoder.h", "src/core/ext/transport/chttp2/transport/bin_encoder.c", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_plugin.c", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 581b8fd0e71..604296a89ad 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -85,6 +85,27 @@ "windows" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "gtest": false, + "language": "c", + "name": "bin_decoder_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index be8b5d40ace..931ceef9985 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -160,6 +160,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alpn_test", "vcxproj\test\a {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bin_decoder_test", "vcxproj\test\bin_decoder_test\bin_decoder_test.vcxproj", "{6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bin_encoder_test", "vcxproj\test\bin_encoder_test\bin_encoder_test.vcxproj", "{D5C70922-D68E-0E9D-9988-995E0F9A79AE}" ProjectSection(myProperties) = preProject lib = "False" @@ -1675,6 +1684,22 @@ Global {5BAAE7EA-A972-DD80-F190-29B9E3110BB3}.Release-DLL|Win32.Build.0 = Release|Win32 {5BAAE7EA-A972-DD80-F190-29B9E3110BB3}.Release-DLL|x64.ActiveCfg = Release|x64 {5BAAE7EA-A972-DD80-F190-29B9E3110BB3}.Release-DLL|x64.Build.0 = Release|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug|Win32.ActiveCfg = Debug|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug|x64.ActiveCfg = Debug|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release|Win32.ActiveCfg = Release|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release|x64.ActiveCfg = Release|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug|Win32.Build.0 = Debug|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug|x64.Build.0 = Debug|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release|Win32.Build.0 = Release|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release|x64.Build.0 = Release|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Debug-DLL|x64.Build.0 = Debug|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release-DLL|Win32.Build.0 = Release|Win32 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release-DLL|x64.ActiveCfg = Release|x64 + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B}.Release-DLL|x64.Build.0 = Release|x64 {D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Debug|Win32.ActiveCfg = Debug|Win32 {D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Debug|x64.ActiveCfg = Debug|x64 {D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 6a2843e37c9..0791e2a5f33 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -371,6 +371,7 @@ + @@ -602,6 +603,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 7d53be719cf..a727dc31d1c 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -250,6 +250,9 @@ src\core\ext\transport\chttp2\server\secure + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport @@ -806,6 +809,9 @@ src\core\lib\transport + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index fbf26a29f33..0c183c1a6b4 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -360,6 +360,7 @@ + @@ -579,6 +580,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 2500d5c106a..7ce44451386 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -253,6 +253,9 @@ src\core\ext\transport\chttp2\server\insecure + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport @@ -740,6 +743,9 @@ src\core\lib\transport + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport diff --git a/vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj b/vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj new file mode 100644 index 00000000000..b0c878f5dd9 --- /dev/null +++ b/vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj @@ -0,0 +1,193 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {6BFAC6BA-3B9D-E8F5-BE35-91E8EFB9E25B} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + bin_decoder_test + static + Debug + static + Debug + + + bin_decoder_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj.filters b/vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj.filters new file mode 100644 index 00000000000..f6044656fac --- /dev/null +++ b/vsprojects/vcxproj/test/bin_decoder_test/bin_decoder_test.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + test\core\transport\chttp2 + + + + + + {6865d212-f7ee-5eb1-aa2e-c8ce3dd9f834} + + + {79be26a4-2e58-2868-d847-e692e13ed37a} + + + {2b861a75-ca04-d422-f519-5b6d3c81e6e4} + + + {9725ed79-ddf1-6ffe-21e1-14fef9d481a6} + + + + From d6fb831ce52d1e26a7d92397222cff75ec85674b Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 13 May 2016 11:06:05 -0700 Subject: [PATCH 013/175] Updated codegen/call.h --- include/grpc++/impl/codegen/call.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 2acdf475f2b..c3cbe68acb3 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -202,7 +202,9 @@ class CallOpSendInitialMetadata { op->reserved = NULL; op->data.send_initial_metadata.count = initial_metadata_count_; op->data.send_initial_metadata.metadata = initial_metadata_; - op->data.send_initial_metadata.compression_level = compression_level_; + op->data.send_initial_metadata.maybe_compression_level.is_set = true; + op->data.send_initial_metadata.maybe_compression_level.compression_level = + compression_level_; } void FinishOp(bool* status, int max_message_size) { if (!send_) return; From 13878f494ba7e21a56af562a795559b040dc8855 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 13 May 2016 12:21:01 -0700 Subject: [PATCH 014/175] Added missing memset to grpc_op in test --- test/core/bad_client/tests/large_metadata.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.c index 1a8d2a29870..303de32dcd5 100644 --- a/test/core/bad_client/tests/large_metadata.c +++ b/test/core/bad_client/tests/large_metadata.c @@ -423,6 +423,7 @@ static void server_verifier_sends_too_much_metadata(grpc_server *server, meta.value_length = metadata_value_size; grpc_op op; + memset(&op, 0, sizeof(op)); op.op = GRPC_OP_SEND_INITIAL_METADATA; op.data.send_initial_metadata.count = 1; op.data.send_initial_metadata.metadata = &meta; From 3370b8bbcde704d6f7072c69dbe1acdce9f8c88b Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 13 May 2016 12:27:06 -0700 Subject: [PATCH 015/175] Bring the 80s back. --- include/grpc/impl/codegen/grpc_types.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 234e5a0161e..b4ccafd1ab6 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -37,7 +37,6 @@ #include #include -#include #include #ifdef __cplusplus @@ -336,7 +335,7 @@ typedef struct grpc_op { /** If \a is_set, \a compression_level will be used for the call. * Otherwise, \a compression_level won't be considered */ struct { - bool is_set; + uint8_t is_set; grpc_compression_level compression_level; } maybe_compression_level; } send_initial_metadata; From 5833c706dbff35a55465db4405cf0ac035c63abe Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 13 May 2016 17:23:07 -0700 Subject: [PATCH 016/175] Add incremental decoding and input validation --- .../transport/chttp2/transport/bin_decoder.c | 208 ++++++++++++++---- .../transport/chttp2/transport/bin_decoder.h | 22 +- test/core/transport/chttp2/bin_decoder_test.c | 36 ++- 3 files changed, 212 insertions(+), 54 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c index fe6c84bfb8f..640c29f63d2 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.c +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -32,31 +32,130 @@ */ #include "src/core/ext/transport/chttp2/transport/bin_decoder.h" +#include #include #include +#include "src/core/lib/support/string.h" static uint8_t decode_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, - 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0}; + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 62, 0x40, 0x40, 0x40, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40}; static const uint8_t tail_xtra[4] = {0, 0, 1, 2}; +static inline bool input_is_valid(uint8_t *input_ptr, size_t length) { + size_t i; + + for (i = 0; i < length; ++i) { + if ((decode_table[input_ptr[i]] & 0xC0) != 0) { + gpr_log(GPR_ERROR, + "Base64 decoding failed, invalid charactor '%c' in base64 " + "input.\n", + (char)(*input_ptr)); + return false; + } + } + return true; +} + +#define COMPOSE_OUTPUT_BYTE_0(input_ptr) \ + (uint8_t)((decode_table[input_ptr[0]] << 2) | \ + (decode_table[input_ptr[1]] >> 4)) + +#define COMPOSE_OUTPUT_BYTE_1(input_ptr) \ + (uint8_t)((decode_table[ctx->input_cur[1]] << 4) | \ + (decode_table[ctx->input_cur[2]] >> 2)) + +#define COMPOSE_OUTPUT_BYTE_2(input_ptr) \ + (uint8_t)((decode_table[ctx->input_cur[2]] << 6) | \ + decode_table[ctx->input_cur[3]]) + +bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx) { + size_t input_tail; + + if (ctx->input_cur > ctx->input_end || ctx->output_cur > ctx->output_end) { + return false; + } + + while (ctx->input_end >= ctx->input_cur + 4 && + ctx->output_end >= ctx->output_cur + 3) { + if (!input_is_valid(ctx->input_cur, 4)) return false; + ctx->output_cur[0] = COMPOSE_OUTPUT_BYTE_0(ctx->input_cur); + ctx->output_cur[1] = COMPOSE_OUTPUT_BYTE_1(ctx->input_cur); + ctx->output_cur[2] = COMPOSE_OUTPUT_BYTE_2(ctx->input_cur); + ctx->output_cur += 3; + ctx->input_cur += 4; + } + + input_tail = (size_t)(ctx->input_end - ctx->input_cur); + if (input_tail == 4) { + // Process the input data with pad chars + if (ctx->input_cur[3] == '=') { + if (ctx->input_cur[2] == '=' && ctx->output_end >= ctx->output_cur + 1) { + if (!input_is_valid(ctx->input_cur, 2)) return false; + *(ctx->output_cur++) = COMPOSE_OUTPUT_BYTE_0(ctx->input_cur); + ctx->input_cur += 4; + } else if (ctx->output_end >= ctx->output_cur + 2) { + if (!input_is_valid(ctx->input_cur, 3)) return false; + *(ctx->output_cur++) = COMPOSE_OUTPUT_BYTE_0(ctx->input_cur); + *(ctx->output_cur++) = COMPOSE_OUTPUT_BYTE_1(ctx->input_cur); + ; + ctx->input_cur += 4; + } + } + + } else if (ctx->contains_tail && input_tail > 1) { + // Process the input data without pad chars, but constains_tail is set + if (ctx->output_end >= ctx->output_cur + tail_xtra[input_tail]) { + if (!input_is_valid(ctx->input_cur, input_tail)) return false; + switch (input_tail) { + case 3: + ctx->output_cur[1] = COMPOSE_OUTPUT_BYTE_1(ctx->input_cur); + case 2: + ctx->output_cur[0] = COMPOSE_OUTPUT_BYTE_0(ctx->input_cur); + } + ctx->output_cur += tail_xtra[input_tail]; + ctx->input_cur += input_tail; + } + } + + return true; +} + gpr_slice grpc_chttp2_base64_decode(gpr_slice input) { size_t input_length = GPR_SLICE_LENGTH(input); - GPR_ASSERT(input_length % 4 == 0); size_t output_length = input_length / 4 * 3; + struct grpc_base64_decode_context ctx; + gpr_slice output; + + if (input_length % 4 != 0) { + gpr_log(GPR_ERROR, + "Base64 decoding failed, input of " + "grpc_chttp2_base64_decode has a length of %zu, which is not a " + "multiple of 4.\n", + input_length); + return gpr_empty_slice(); + } if (input_length > 0) { uint8_t *input_end = GPR_SLICE_END_PTR(input); @@ -67,49 +166,66 @@ gpr_slice grpc_chttp2_base64_decode(gpr_slice input) { } } } + output = gpr_slice_malloc(output_length); - gpr_log(GPR_ERROR, "input_length: %d, output_length: %d\n", input_length, - output_length); + ctx.input_cur = GPR_SLICE_START_PTR(input); + ctx.input_end = GPR_SLICE_END_PTR(input); + ctx.output_cur = GPR_SLICE_START_PTR(output); + ctx.output_end = GPR_SLICE_END_PTR(output); + ctx.contains_tail = false; - return grpc_chttp2_base64_decode_with_length(input, output_length); + if (!grpc_base64_decode_partial(&ctx)) { + char *s = gpr_dump_slice(input, GPR_DUMP_ASCII); + gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s); + gpr_free(s); + gpr_slice_unref(output); + return gpr_empty_slice(); + } + GPR_ASSERT(ctx.output_cur == GPR_SLICE_END_PTR(output)); + GPR_ASSERT(ctx.input_cur == GPR_SLICE_END_PTR(input)); + return output; } gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input, size_t output_length) { size_t input_length = GPR_SLICE_LENGTH(input); - // The length of a base64 string cannot be 4 * n + 1 - GPR_ASSERT(input_length % 4 != 1); - GPR_ASSERT(output_length <= - input_length / 4 * 3 + tail_xtra[input_length % 4]); - size_t output_triplets = output_length / 3; - size_t tail_case = output_length % 3; gpr_slice output = gpr_slice_malloc(output_length); - uint8_t *in = GPR_SLICE_START_PTR(input); - uint8_t *out = GPR_SLICE_START_PTR(output); - size_t i; + struct grpc_base64_decode_context ctx; - for (i = 0; i < output_triplets; i++) { - out[0] = (uint8_t)((decode_table[in[0]] << 2) | (decode_table[in[1]] >> 4)); - out[1] = (uint8_t)((decode_table[in[1]] << 4) | (decode_table[in[2]] >> 2)); - out[2] = (uint8_t)((decode_table[in[2]] << 6) | decode_table[in[3]]); - out += 3; - in += 4; + // The length of a base64 string cannot be 4 * n + 1 + if (input_length % 4 == 1) { + gpr_log(GPR_ERROR, + "Base64 decoding failed, input of " + "grpc_chttp2_base64_decode_with_length has a length of %zu, which " + "has a tail of 1 byte.\n", + input_length); + gpr_slice_unref(output); + return gpr_empty_slice(); } - if (tail_case > 0) { - switch (tail_case) { - case 2: - out[1] = - (uint8_t)((decode_table[in[1]] << 4) | (decode_table[in[2]] >> 2)); - case 1: - out[0] = - (uint8_t)((decode_table[in[0]] << 2) | (decode_table[in[1]] >> 4)); - } - out += tail_case; - in += tail_case + 1; + if (output_length > input_length / 4 * 3 + tail_xtra[input_length % 4]) { + gpr_log(GPR_ERROR, + "Base64 decoding failed, output_length %zu is longer " + "than the max possible output length %zu./\n", + output_length, input_length / 4 * 3 + tail_xtra[input_length % 4]); + gpr_slice_unref(output); + return gpr_empty_slice(); } - GPR_ASSERT(out == GPR_SLICE_END_PTR(output)); - GPR_ASSERT(in <= GPR_SLICE_END_PTR(input)); + ctx.input_cur = GPR_SLICE_START_PTR(input); + ctx.input_end = GPR_SLICE_END_PTR(input); + ctx.output_cur = GPR_SLICE_START_PTR(output); + ctx.output_end = GPR_SLICE_END_PTR(output); + ctx.contains_tail = true; + + if (!grpc_base64_decode_partial(&ctx)) { + char *s = gpr_dump_slice(input, GPR_DUMP_ASCII); + gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s); + gpr_free(s); + gpr_slice_unref(output); + return gpr_empty_slice(); + } + GPR_ASSERT(ctx.output_cur == GPR_SLICE_END_PTR(output)); + GPR_ASSERT(ctx.input_cur <= GPR_SLICE_END_PTR(input)); return output; } diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h index 5516f86d53b..b9d40c9b74b 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.h +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h @@ -35,13 +35,31 @@ #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H #include +#include + +struct grpc_base64_decode_context { + /* input/output: */ + uint8_t *input_cur; + uint8_t *input_end; + uint8_t *output_cur; + uint8_t *output_end; + /* Indicate if the decoder should handle the tail of input data*/ + bool contains_tail; +}; + +/* base64 decode a grpc_base64_decode_context util either input_end is reached + or output_end is reached. When input_end is reached, (input_end - input_cur) + is less than 4. When output_end is reached, (output_end - output_cur) is less + than 3. Returns false if decoding is failed. */ +bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx); /* base64 decode a slice with pad chars. Returns a new slice, does not take - ownership of the input */ + ownership of the input. Returns an empty slice if decoding is failed. */ gpr_slice grpc_chttp2_base64_decode(gpr_slice input); /* base64 decode a slice without pad chars, data length is needed. Returns a new - slice, does not take ownership of the input */ + slice, does not take ownership of the input. Returns an empty slice if + decoding is failed. */ gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input, size_t output_length); diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.c index 980da02dc35..c4e6cd332f0 100644 --- a/test/core/transport/chttp2/bin_decoder_test.c +++ b/test/core/transport/chttp2/bin_decoder_test.c @@ -37,7 +37,6 @@ #include #include -#include #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/lib/support/string.h" @@ -72,6 +71,14 @@ static gpr_slice base64_decode(const char *s) { return out; } +static gpr_slice base64_decode_with_length(const char *s, + size_t output_length) { + gpr_slice ss = gpr_slice_from_copied_string(s); + gpr_slice out = grpc_chttp2_base64_decode_with_length(ss, output_length); + gpr_slice_unref(ss); + return out; +} + #define EXPECT_SLICE_EQ(expected, slice) \ expect_slice_eq( \ gpr_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \ @@ -82,11 +89,9 @@ static gpr_slice base64_decode(const char *s) { s, grpc_chttp2_base64_decode_with_length(base64_encode(s), strlen(s))); int main(int argc, char **argv) { - /* - * ENCODE_AND_DECODE tests grpc_chttp2_base64_decode_with_length(), which - * takes encoded base64 strings without pad chars, but output length is - * required - */ + /* ENCODE_AND_DECODE tests grpc_chttp2_base64_decode_with_length(), which + takes encoded base64 strings without pad chars, but output length is + required. */ /* Base64 test vectors from RFC 4648 */ ENCODE_AND_DECODE(""); ENCODE_AND_DECODE("f"); @@ -116,5 +121,24 @@ int main(int argc, char **argv) { EXPECT_SLICE_EQ("\xc0\xc1\xc2\xc3\xc4\xc5", base64_decode("wMHCw8TF")); + // Test illegal input length in grpc_chttp2_base64_decode + EXPECT_SLICE_EQ("", base64_decode("a")); + EXPECT_SLICE_EQ("", base64_decode("ab")); + EXPECT_SLICE_EQ("", base64_decode("abc")); + + // Test illegal charactors in grpc_chttp2_base64_decode + EXPECT_SLICE_EQ("", base64_decode("Zm:v")); + EXPECT_SLICE_EQ("", base64_decode("Zm=v")); + + // Test output_length longer than max possible output length in + // grpc_chttp2_base64_decode_with_length + EXPECT_SLICE_EQ("", base64_decode_with_length("Zg", 2)); + EXPECT_SLICE_EQ("", base64_decode_with_length("Zm8", 3)); + EXPECT_SLICE_EQ("", base64_decode_with_length("Zm9v", 4)); + + // Test illegal charactors in grpc_chttp2_base64_decode_with_length + EXPECT_SLICE_EQ("", base64_decode_with_length("Zm:v", 3)); + EXPECT_SLICE_EQ("", base64_decode_with_length("Zm=v", 3)); + return all_ok ? 0 : 1; } From 3812c7df8c24772a69a676a63ee4b13f06c9df64 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 13 May 2016 17:31:43 -0700 Subject: [PATCH 017/175] Remove unnecessary headers, fix typos. --- src/core/ext/transport/chttp2/transport/bin_decoder.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c index 640c29f63d2..1caf88e0665 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.c +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -34,7 +34,6 @@ #include "src/core/ext/transport/chttp2/transport/bin_decoder.h" #include #include -#include #include "src/core/lib/support/string.h" static uint8_t decode_table[] = { @@ -206,7 +205,7 @@ gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input, if (output_length > input_length / 4 * 3 + tail_xtra[input_length % 4]) { gpr_log(GPR_ERROR, "Base64 decoding failed, output_length %zu is longer " - "than the max possible output length %zu./\n", + "than the max possible output length %zu.\n", output_length, input_length / 4 * 3 + tail_xtra[input_length % 4]); gpr_slice_unref(output); return gpr_empty_slice(); From 1a612aa2df70ed139eccc1a2f29c21f6ea79fbfe Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 13 May 2016 17:53:03 -0700 Subject: [PATCH 018/175] Use __inline instead of inline --- src/core/ext/transport/chttp2/transport/bin_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c index 1caf88e0665..d2ebfe4829c 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.c +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -62,7 +62,7 @@ static uint8_t decode_table[] = { static const uint8_t tail_xtra[4] = {0, 0, 1, 2}; -static inline bool input_is_valid(uint8_t *input_ptr, size_t length) { +static __inline bool input_is_valid(uint8_t *input_ptr, size_t length) { size_t i; for (i = 0; i < length; ++i) { From 9e9f7b62c706245cd74de1a7f01c03ba0bd96b0b Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 16 May 2016 19:12:12 -0700 Subject: [PATCH 019/175] Refactorings and renamings related to compression. Also added levels to the channel args options. --- include/grpc/impl/codegen/compression_types.h | 27 +++++++++++++---- src/core/lib/channel/channel_args.c | 4 +-- src/core/lib/channel/channel_args.h | 2 +- src/core/lib/channel/compress_filter.c | 29 +++++++------------ src/core/lib/channel/compress_filter.h | 6 ++-- .../lib/compression/compression_algorithm.c | 3 +- src/cpp/client/client_context.cc | 9 +++--- src/cpp/server/server_builder.cc | 7 +++++ src/cpp/server/server_context.cc | 6 ++-- test/core/end2end/tests/compressed_payload.c | 6 ++-- 10 files changed, 58 insertions(+), 41 deletions(-) diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h index 8d2ec3b9d71..7cf68bfaf89 100644 --- a/include/grpc/impl/codegen/compression_types.h +++ b/include/grpc/impl/codegen/compression_types.h @@ -35,11 +35,17 @@ #define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H #include +#include #ifdef __cplusplus extern "C" { #endif +/** To be used as initial metadata key for the request of a concrete compression + * algorithm */ +#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \ + "grpc-internal-encoding-request" + /** To be used in channel arguments */ #define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \ "grpc.default_compression_algorithm" @@ -74,15 +80,24 @@ typedef struct grpc_compression_options { */ uint32_t enabled_algorithms_bitset; - /** The default channel compression algorithm. It'll be used in the absence of + /** The default channel compression level. It'll be used in the absence of * call specific settings. This option corresponds to the channel argument key - * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM */ - grpc_compression_algorithm default_compression_algorithm; + * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present, takes + * precedence over \a default_algorithm. + * TODO(dgq): currently only available for server channels. */ + struct { + bool is_set; + grpc_compression_algorithm level; + } default_level; - /** The default channel compression level. It'll be used in the absence of + /** The default channel compression algorithm. It'll be used in the absence of * call specific settings. This option corresponds to the channel argument key - * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL */ - grpc_compression_algorithm default_compression_level; + * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */ + struct { + bool is_set; + grpc_compression_algorithm algorithm; + } default_algorithm; + } grpc_compression_options; #ifdef __cplusplus diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 893cf0700e5..920b632abfe 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -238,11 +238,11 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( return result; } -int grpc_channel_args_compression_algorithm_get_states( +uint32_t grpc_channel_args_compression_algorithm_get_states( const grpc_channel_args *a) { int *states_arg; if (find_compression_algorithm_states_bitset(a, &states_arg)) { - return *states_arg; + return (uint32_t)*states_arg; } else { return (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; /* All algs. enabled */ } diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 23c7b7b897b..653d04f4279 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -81,7 +81,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( * * The i-th bit of the returned bitset corresponds to the i-th entry in the * grpc_compression_algorithm enum. */ -int grpc_channel_args_compression_algorithm_get_states( +uint32_t grpc_channel_args_compression_algorithm_get_states( const grpc_channel_args *a); int grpc_channel_args_compare(const grpc_channel_args *a, diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index 5510c79b183..02991b9c797 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -73,8 +73,8 @@ typedef struct call_data { typedef struct channel_data { /** The default, channel-level, compression algorithm */ grpc_compression_algorithm default_compression_algorithm; - /** Compression options for the channel */ - grpc_compression_options compression_options; + /** Bitset of enabled algorithms */ + uint32_t enabled_algorithms_bitset; /** Supported compression algorithms */ uint32_t supported_compression_algorithms; } channel_data; @@ -96,9 +96,8 @@ static grpc_mdelem *compression_md_filter(void *user_data, grpc_mdelem *md) { md_c_str); calld->compression_algorithm = GRPC_COMPRESS_NONE; } - if (grpc_compression_options_is_algorithm_enabled( - &channeld->compression_options, calld->compression_algorithm) == - 0) { + if (!GPR_BITGET(channeld->enabled_algorithms_bitset, + calld->compression_algorithm)) { gpr_log(GPR_ERROR, "Invalid compression algorithm: '%s' (previously disabled). " "Ignoring.", @@ -280,32 +279,26 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_channel_element_args *args) { channel_data *channeld = elem->channel_data; - grpc_compression_algorithm algo_idx; - grpc_compression_options_init(&channeld->compression_options); - channeld->compression_options.enabled_algorithms_bitset = - (uint32_t)grpc_channel_args_compression_algorithm_get_states( - args->channel_args); + channeld->enabled_algorithms_bitset = + grpc_channel_args_compression_algorithm_get_states(args->channel_args); channeld->default_compression_algorithm = grpc_channel_args_get_compression_algorithm(args->channel_args); /* Make sure the default isn't disabled. */ - if (!grpc_compression_options_is_algorithm_enabled( - &channeld->compression_options, - channeld->default_compression_algorithm)) { + if (!GPR_BITGET(channeld->enabled_algorithms_bitset, + channeld->default_compression_algorithm)) { gpr_log(GPR_DEBUG, "compression algorithm %d not enabled: switching to none", channeld->default_compression_algorithm); channeld->default_compression_algorithm = GRPC_COMPRESS_NONE; } - channeld->compression_options.default_compression_algorithm = - channeld->default_compression_algorithm; channeld->supported_compression_algorithms = 0; - for (algo_idx = 0; algo_idx < GRPC_COMPRESS_ALGORITHMS_COUNT; ++algo_idx) { + for (grpc_compression_algorithm algo_idx = 0; + algo_idx < GRPC_COMPRESS_ALGORITHMS_COUNT; ++algo_idx) { /* skip disabled algorithms */ - if (grpc_compression_options_is_algorithm_enabled( - &channeld->compression_options, algo_idx) == 0) { + if (!GPR_BITGET(channeld->enabled_algorithms_bitset, algo_idx)) { continue; } channeld->supported_compression_algorithms |= 1u << algo_idx; diff --git a/src/core/lib/channel/compress_filter.h b/src/core/lib/channel/compress_filter.h index cf5879d82ef..059bd8e8198 100644 --- a/src/core/lib/channel/compress_filter.h +++ b/src/core/lib/channel/compress_filter.h @@ -34,9 +34,9 @@ #ifndef GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H #define GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H -#include "src/core/lib/channel/channel_stack.h" +#include -#define GRPC_COMPRESS_REQUEST_ALGORITHM_KEY "grpc-internal-encoding-request" +#include "src/core/lib/channel/channel_stack.h" extern int grpc_compress_filter_trace; @@ -48,7 +48,7 @@ extern int grpc_compress_filter_trace; * - Channel configuration, as established at channel creation time. * - The metadata accompanying the outgoing data to be compressed. This is * taken as a request only. We may choose not to honor it. The metadata key - * is given by \a GRPC_COMPRESS_REQUEST_ALGORITHM_KEY. + * is given by \a GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY. * * Compression can be disabled for concrete messages (for instance in order to * prevent CRIME/BEAST type attacks) by having the GRPC_WRITE_NO_COMPRESS set in diff --git a/src/core/lib/compression/compression_algorithm.c b/src/core/lib/compression/compression_algorithm.c index 7039364b7bc..6d47bbd38d7 100644 --- a/src/core/lib/compression/compression_algorithm.c +++ b/src/core/lib/compression/compression_algorithm.c @@ -183,7 +183,8 @@ grpc_compression_algorithm grpc_compression_algorithm_for_level( void grpc_compression_options_init(grpc_compression_options *opts) { opts->enabled_algorithms_bitset = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; - opts->default_compression_algorithm = GRPC_COMPRESS_NONE; + opts->default_level.is_set = false; + opts->default_algorithm.is_set = false; } void grpc_compression_options_enable_algorithm( diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 32c7794ade7..d3e5ce0c4a6 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -33,15 +33,14 @@ #include -#include -#include -#include #include #include #include #include -#include "src/core/lib/channel/compress_filter.h" +#include +#include +#include namespace grpc { @@ -112,7 +111,7 @@ void ClientContext::set_compression_algorithm( abort(); } GPR_ASSERT(algorithm_name != nullptr); - AddMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name); + AddMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name); } void ClientContext::TryCancel() { diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 61f0f6ae2ac..e6050c3b522 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -125,6 +125,13 @@ std::unique_ptr ServerBuilder::BuildAndStart() { } args.SetInt(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, compression_options_.enabled_algorithms_bitset); + if (compression_options_.default_level.is_set) { + args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL, + compression_options_.default_level.level); + } else if (compression_options_.default_algorithm.is_set) { + args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, + compression_options_.default_algorithm.algorithm); + } std::unique_ptr server( new Server(thread_pool.release(), true, max_message_size_, &args)); ServerInitializer* initializer = server->initializer(); diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 204fef1b09e..43117fd1e95 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -42,7 +42,6 @@ #include #include -#include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/surface/call.h" namespace grpc { @@ -196,6 +195,9 @@ bool ServerContext::IsCancelled() const { } void ServerContext::set_compression_level(grpc_compression_level level) { + // TODO(dgq): get rid of grpc_call_compression_for_level and propagate the + // compression level by adding a new argument to + // CallOpSendInitialMetadata::SendInitialMetadata. const grpc_compression_algorithm algorithm_for_level = grpc_call_compression_for_level(call_, level); set_compression_algorithm(algorithm_for_level); @@ -210,7 +212,7 @@ void ServerContext::set_compression_algorithm( abort(); } GPR_ASSERT(algorithm_name != NULL); - AddInitialMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name); + AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name); } grpc::string ServerContext::peer() const { diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 589bc314f8e..4165f357891 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -38,13 +38,13 @@ #include #include +#include #include #include #include #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/surface/call_test_only.h" #include "test/core/end2end/cq_verifier.h" @@ -302,13 +302,13 @@ static void test_invoke_request_with_compressed_payload_md_override( grpc_metadata gzip_compression_override; grpc_metadata none_compression_override; - gzip_compression_override.key = GRPC_COMPRESS_REQUEST_ALGORITHM_KEY; + gzip_compression_override.key = GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY; gzip_compression_override.value = "gzip"; gzip_compression_override.value_length = 4; memset(&gzip_compression_override.internal_data, 0, sizeof(gzip_compression_override.internal_data)); - none_compression_override.key = GRPC_COMPRESS_REQUEST_ALGORITHM_KEY; + none_compression_override.key = GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY; none_compression_override.value = "identity"; none_compression_override.value_length = 4; memset(&none_compression_override.internal_data, 0, From 9ce6a1c72a3eea22de79e38530f9a730d9db62e8 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 17 May 2016 09:14:21 -0700 Subject: [PATCH 020/175] Fix typos --- src/core/ext/transport/chttp2/transport/bin_decoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c index d2ebfe4829c..ec252e29b18 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.c +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -68,7 +68,7 @@ static __inline bool input_is_valid(uint8_t *input_ptr, size_t length) { for (i = 0; i < length; ++i) { if ((decode_table[input_ptr[i]] & 0xC0) != 0) { gpr_log(GPR_ERROR, - "Base64 decoding failed, invalid charactor '%c' in base64 " + "Base64 decoding failed, invalid character '%c' in base64 " "input.\n", (char)(*input_ptr)); return false; @@ -96,6 +96,7 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx) { return false; } + // Process a block of 4 input characters and 3 output bytes while (ctx->input_end >= ctx->input_cur + 4 && ctx->output_end >= ctx->output_cur + 3) { if (!input_is_valid(ctx->input_cur, 4)) return false; @@ -106,6 +107,7 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx) { ctx->input_cur += 4; } + // Process the tail of input data input_tail = (size_t)(ctx->input_end - ctx->input_cur); if (input_tail == 4) { // Process the input data with pad chars From af1c7e4f06b3b490fef6dd75669c92cc71acb8c7 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 11:38:45 -0700 Subject: [PATCH 021/175] INTERNAL -> UNIMPLEMENTED for disabled algorithms --- src/core/lib/surface/call.c | 2 +- test/core/end2end/tests/compressed_payload.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 2462adc26a0..f1767cb05cf 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -434,7 +434,7 @@ static void set_compression_algorithm(grpc_call *call, gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.", algo_name); gpr_log(GPR_ERROR, error_msg); - close_with_status(&exec_ctx, call, GRPC_STATUS_INTERNAL, error_msg); + close_with_status(&exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg); } else { call->compression_algorithm = algo; } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index b713d399c0c..1c58d4d0b1c 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -496,11 +496,11 @@ static void test_invoke_request_with_compressed_payload_md_override( GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, &none_compression_override); } -static void test_invoke_request_with_invalid_algorithm( +static void test_invoke_request_with_disabled_algorithm( grpc_end2end_test_config config) { request_for_disabled_algorithm( - config, "test_invoke_request_with_invalid_algorithm", 0, - GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_STATUS_INTERNAL, NULL); + config, "test_invoke_request_with_disabled_algorithm", 0, + GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_STATUS_UNIMPLEMENTED, NULL); } void compressed_payload(grpc_end2end_test_config config) { @@ -508,7 +508,7 @@ void compressed_payload(grpc_end2end_test_config config) { test_invoke_request_with_uncompressed_payload(config); test_invoke_request_with_compressed_payload(config); test_invoke_request_with_compressed_payload_md_override(config); - test_invoke_request_with_invalid_algorithm(config); + test_invoke_request_with_disabled_algorithm(config); } void compressed_payload_pre_init(void) {} From fa2cc03e236554261a7dda3c076a56515bf3b0df Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 13:47:40 -0700 Subject: [PATCH 022/175] Tiny int -> bool change for cq verifier --- test/core/end2end/cq_verifier.c | 2 +- test/core/end2end/cq_verifier.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 77afe588d79..8e9fa70b0ec 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -284,6 +284,6 @@ static expectation *add(cq_verifier *v, grpc_completion_type type, void *tag) { return e; } -void cq_expect_completion(cq_verifier *v, void *tag, int success) { +void cq_expect_completion(cq_verifier *v, void *tag, bool success) { add(v, GRPC_OP_COMPLETE, tag)->success = success; } diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h index b3e07c45a58..8c9a85c2187 100644 --- a/test/core/end2end/cq_verifier.h +++ b/test/core/end2end/cq_verifier.h @@ -34,6 +34,8 @@ #ifndef GRPC_TEST_CORE_END2END_CQ_VERIFIER_H #define GRPC_TEST_CORE_END2END_CQ_VERIFIER_H +#include + #include #include "test/core/util/test_config.h" @@ -57,7 +59,7 @@ void cq_verify_empty(cq_verifier *v); Any functions taking ... expect a NULL terminated list of key/value pairs (each pair using two parameter slots) of metadata that MUST be present in the event. */ -void cq_expect_completion(cq_verifier *v, void *tag, int success); +void cq_expect_completion(cq_verifier *v, void *tag, bool success); int byte_buffer_eq_string(grpc_byte_buffer *byte_buffer, const char *string); int contains_metadata(grpc_metadata_array *array, const char *key, From f15d700e5ea33b5c0ef2efdb191a4d9e322d3d71 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 13:48:41 -0700 Subject: [PATCH 023/175] Moved down verification upon cancellation --- test/core/end2end/tests/compressed_payload.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 1c58d4d0b1c..a0fb8c042af 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -197,7 +197,7 @@ static void request_for_disabled_algorithm( grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq, tag(101)); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(101), 1); + cq_expect_completion(cqv, tag(101), true); cq_verify(cqv); op = ops; @@ -214,8 +214,7 @@ static void request_for_disabled_algorithm( error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(102), 0); - cq_verify(cqv); + cq_expect_completion(cqv, tag(102), false); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; @@ -226,8 +225,8 @@ static void request_for_disabled_algorithm( error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(103), 1); - cq_expect_completion(cqv, tag(1), 1); + cq_expect_completion(cqv, tag(103), true); + cq_expect_completion(cqv, tag(1), true); cq_verify(cqv); /* call was cancelled (closed) ... */ @@ -359,7 +358,7 @@ static void request_with_payload_template( grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, f.cq, f.cq, tag(101)); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(101), 1); + cq_expect_completion(cqv, tag(101), true); cq_verify(cqv); GPR_ASSERT(GPR_BITCOUNT(grpc_call_test_only_get_encodings_accepted_by_peer( @@ -385,7 +384,7 @@ static void request_with_payload_template( error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(102), 1); + cq_expect_completion(cqv, tag(102), true); cq_verify(cqv); op = ops; @@ -404,8 +403,8 @@ static void request_with_payload_template( error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(103), 1); - cq_expect_completion(cqv, tag(1), 1); + cq_expect_completion(cqv, tag(103), true); + cq_expect_completion(cqv, tag(1), true); cq_verify(cqv); GPR_ASSERT(status == GRPC_STATUS_OK); From acf94785b7e44200d680831dac392b1e7a3a0c21 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 11 May 2016 17:16:39 -0700 Subject: [PATCH 024/175] Update reflection API --- .../include/grpc++/impl/reflection.grpc.pb.h | 48 +- .../include/grpc++/impl/reflection.pb.h | 852 +++++---- .../reflection/proto_server_reflection.cc | 39 +- .../reflection/proto_server_reflection.h | 14 +- extensions/reflection/reflection.grpc.pb.cc | 18 +- extensions/reflection/reflection.pb.cc | 1560 +++++++++++------ .../grpc/reflection/v1alpha/reflection.proto | 50 +- 7 files changed, 1671 insertions(+), 910 deletions(-) diff --git a/extensions/include/grpc++/impl/reflection.grpc.pb.h b/extensions/include/grpc++/impl/reflection.grpc.pb.h index 7c6e7b2b78a..e49a1b3f509 100644 --- a/extensions/include/grpc++/impl/reflection.grpc.pb.h +++ b/extensions/include/grpc++/impl/reflection.grpc.pb.h @@ -100,31 +100,31 @@ class ServerReflection GRPC_FINAL { virtual ~StubInterface() {} // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> DescriptorDatabaseInfo(::grpc::ClientContext* context) { - return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(DescriptorDatabaseInfoRaw(context)); + std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> ServerReflectionInfo(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(ServerReflectionInfoRaw(context)); } - std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> AsyncDescriptorDatabaseInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(AsyncDescriptorDatabaseInfoRaw(context, cq, tag)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> AsyncServerReflectionInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(AsyncServerReflectionInfoRaw(context, cq, tag)); } private: - virtual ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* DescriptorDatabaseInfoRaw(::grpc::ClientContext* context) = 0; - virtual ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* AsyncDescriptorDatabaseInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0; + virtual ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflectionInfoRaw(::grpc::ClientContext* context) = 0; + virtual ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0; }; class Stub GRPC_FINAL : public StubInterface { public: Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); - std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> DescriptorDatabaseInfo(::grpc::ClientContext* context) { - return std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(DescriptorDatabaseInfoRaw(context)); + std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> ServerReflectionInfo(::grpc::ClientContext* context) { + return std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(ServerReflectionInfoRaw(context)); } - std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>> AsyncDescriptorDatabaseInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { - return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>>(AsyncDescriptorDatabaseInfoRaw(context, cq, tag)); + std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> AsyncServerReflectionInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(AsyncServerReflectionInfoRaw(context, cq, tag)); } private: std::shared_ptr< ::grpc::ChannelInterface> channel_; - ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* DescriptorDatabaseInfoRaw(::grpc::ClientContext* context) GRPC_OVERRIDE; - ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* AsyncDescriptorDatabaseInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE; - const ::grpc::RpcMethod rpcmethod_DescriptorDatabaseInfo_; + ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflectionInfoRaw(::grpc::ClientContext* context) GRPC_OVERRIDE; + ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE; + const ::grpc::RpcMethod rpcmethod_ServerReflectionInfo_; }; static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); @@ -134,42 +134,42 @@ class ServerReflection GRPC_FINAL { virtual ~Service(); // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - virtual ::grpc::Status DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream); + virtual ::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream); }; template - class WithAsyncMethod_DescriptorDatabaseInfo : public BaseClass { + class WithAsyncMethod_ServerReflectionInfo : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service *service) {} public: - WithAsyncMethod_DescriptorDatabaseInfo() { + WithAsyncMethod_ServerReflectionInfo() { ::grpc::Service::MarkMethodAsync(0); } - ~WithAsyncMethod_DescriptorDatabaseInfo() GRPC_OVERRIDE { + ~WithAsyncMethod_ServerReflectionInfo() GRPC_OVERRIDE { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } - void RequestDescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { + void RequestServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { ::grpc::Service::RequestAsyncBidiStreaming(0, context, stream, new_call_cq, notification_cq, tag); } }; - typedef WithAsyncMethod_DescriptorDatabaseInfo AsyncService; + typedef WithAsyncMethod_ServerReflectionInfo AsyncService; template - class WithGenericMethod_DescriptorDatabaseInfo : public BaseClass { + class WithGenericMethod_ServerReflectionInfo : public BaseClass { private: void BaseClassMustBeDerivedFromService(const Service *service) {} public: - WithGenericMethod_DescriptorDatabaseInfo() { + WithGenericMethod_ServerReflectionInfo() { ::grpc::Service::MarkMethodGeneric(0); } - ~WithGenericMethod_DescriptorDatabaseInfo() GRPC_OVERRIDE { + ~WithGenericMethod_ServerReflectionInfo() GRPC_OVERRIDE { BaseClassMustBeDerivedFromService(this); } // disable synchronous version of this method - ::grpc::Status DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { + ::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) GRPC_FINAL GRPC_OVERRIDE { abort(); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); } diff --git a/extensions/include/grpc++/impl/reflection.pb.h b/extensions/include/grpc++/impl/reflection.pb.h index 3b1f0a11a2c..2a807c1335a 100644 --- a/extensions/include/grpc++/impl/reflection.pb.h +++ b/extensions/include/grpc++/impl/reflection.pb.h @@ -72,29 +72,31 @@ void protobuf_AddDesc_reflection_2eproto(); void protobuf_AssignDesc_reflection_2eproto(); void protobuf_ShutdownFile_reflection_2eproto(); -class DescriptorDatabaseRequest; -class DescriptorDatabaseResponse; class ErrorResponse; class ExtensionNumberResponse; class ExtensionRequest; +class FileDescriptorResponse; class ListServiceResponse; +class ServerReflectionRequest; +class ServerReflectionResponse; +class ServiceResponse; // =================================================================== -class DescriptorDatabaseRequest : public ::google::protobuf::Message { +class ServerReflectionRequest : public ::google::protobuf::Message { public: - DescriptorDatabaseRequest(); - virtual ~DescriptorDatabaseRequest(); + ServerReflectionRequest(); + virtual ~ServerReflectionRequest(); - DescriptorDatabaseRequest(const DescriptorDatabaseRequest& from); + ServerReflectionRequest(const ServerReflectionRequest& from); - inline DescriptorDatabaseRequest& operator=(const DescriptorDatabaseRequest& from) { + inline ServerReflectionRequest& operator=(const ServerReflectionRequest& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); - static const DescriptorDatabaseRequest& default_instance(); + static const ServerReflectionRequest& default_instance(); enum MessageRequestCase { kFileByFilename = 3, @@ -105,17 +107,17 @@ class DescriptorDatabaseRequest : public ::google::protobuf::Message { MESSAGE_REQUEST_NOT_SET = 0, }; - void Swap(DescriptorDatabaseRequest* other); + void Swap(ServerReflectionRequest* other); // implements Message ---------------------------------------------- - inline DescriptorDatabaseRequest* New() const { return New(NULL); } + inline ServerReflectionRequest* New() const { return New(NULL); } - DescriptorDatabaseRequest* New(::google::protobuf::Arena* arena) const; + ServerReflectionRequest* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const DescriptorDatabaseRequest& from); - void MergeFrom(const DescriptorDatabaseRequest& from); + void CopyFrom(const ServerReflectionRequest& from); + void MergeFrom(const ServerReflectionRequest& from); void Clear(); bool IsInitialized() const; @@ -130,7 +132,7 @@ class DescriptorDatabaseRequest : public ::google::protobuf::Message { void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; - void InternalSwap(DescriptorDatabaseRequest* other); + void InternalSwap(ServerReflectionRequest* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -223,7 +225,7 @@ class DescriptorDatabaseRequest : public ::google::protobuf::Message { void set_allocated_list_services(::std::string* list_services); MessageRequestCase message_request_case() const; - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ServerReflectionRequest) private: inline void set_has_file_by_filename(); inline void set_has_file_containing_symbol(); @@ -254,7 +256,7 @@ class DescriptorDatabaseRequest : public ::google::protobuf::Message { friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static DescriptorDatabaseRequest* default_instance_; + static ServerReflectionRequest* default_instance_; }; // ------------------------------------------------------------------- @@ -348,40 +350,40 @@ class ExtensionRequest : public ::google::protobuf::Message { }; // ------------------------------------------------------------------- -class DescriptorDatabaseResponse : public ::google::protobuf::Message { +class ServerReflectionResponse : public ::google::protobuf::Message { public: - DescriptorDatabaseResponse(); - virtual ~DescriptorDatabaseResponse(); + ServerReflectionResponse(); + virtual ~ServerReflectionResponse(); - DescriptorDatabaseResponse(const DescriptorDatabaseResponse& from); + ServerReflectionResponse(const ServerReflectionResponse& from); - inline DescriptorDatabaseResponse& operator=(const DescriptorDatabaseResponse& from) { + inline ServerReflectionResponse& operator=(const ServerReflectionResponse& from) { CopyFrom(from); return *this; } static const ::google::protobuf::Descriptor* descriptor(); - static const DescriptorDatabaseResponse& default_instance(); + static const ServerReflectionResponse& default_instance(); enum MessageResponseCase { - kFileDescriptorProto = 4, + kFileDescriptorResponse = 4, kAllExtensionNumbersResponse = 5, kListServicesResponse = 6, kErrorResponse = 7, MESSAGE_RESPONSE_NOT_SET = 0, }; - void Swap(DescriptorDatabaseResponse* other); + void Swap(ServerReflectionResponse* other); // implements Message ---------------------------------------------- - inline DescriptorDatabaseResponse* New() const { return New(NULL); } + inline ServerReflectionResponse* New() const { return New(NULL); } - DescriptorDatabaseResponse* New(::google::protobuf::Arena* arena) const; + ServerReflectionResponse* New(::google::protobuf::Arena* arena) const; void CopyFrom(const ::google::protobuf::Message& from); void MergeFrom(const ::google::protobuf::Message& from); - void CopyFrom(const DescriptorDatabaseResponse& from); - void MergeFrom(const DescriptorDatabaseResponse& from); + void CopyFrom(const ServerReflectionResponse& from); + void MergeFrom(const ServerReflectionResponse& from); void Clear(); bool IsInitialized() const; @@ -396,7 +398,7 @@ class DescriptorDatabaseResponse : public ::google::protobuf::Message { void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const; - void InternalSwap(DescriptorDatabaseResponse* other); + void InternalSwap(ServerReflectionResponse* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return _internal_metadata_.arena(); @@ -423,28 +425,23 @@ class DescriptorDatabaseResponse : public ::google::protobuf::Message { ::std::string* release_valid_host(); void set_allocated_valid_host(::std::string* valid_host); - // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; bool has_original_request() const; void clear_original_request(); static const int kOriginalRequestFieldNumber = 2; - const ::grpc::reflection::v1alpha::DescriptorDatabaseRequest& original_request() const; - ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* mutable_original_request(); - ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* release_original_request(); - void set_allocated_original_request(::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request); - - // optional bytes file_descriptor_proto = 4; - private: - bool has_file_descriptor_proto() const; - public: - void clear_file_descriptor_proto(); - static const int kFileDescriptorProtoFieldNumber = 4; - const ::std::string& file_descriptor_proto() const; - void set_file_descriptor_proto(const ::std::string& value); - void set_file_descriptor_proto(const char* value); - void set_file_descriptor_proto(const void* value, size_t size); - ::std::string* mutable_file_descriptor_proto(); - ::std::string* release_file_descriptor_proto(); - void set_allocated_file_descriptor_proto(::std::string* file_descriptor_proto); + const ::grpc::reflection::v1alpha::ServerReflectionRequest& original_request() const; + ::grpc::reflection::v1alpha::ServerReflectionRequest* mutable_original_request(); + ::grpc::reflection::v1alpha::ServerReflectionRequest* release_original_request(); + void set_allocated_original_request(::grpc::reflection::v1alpha::ServerReflectionRequest* original_request); + + // optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; + bool has_file_descriptor_response() const; + void clear_file_descriptor_response(); + static const int kFileDescriptorResponseFieldNumber = 4; + const ::grpc::reflection::v1alpha::FileDescriptorResponse& file_descriptor_response() const; + ::grpc::reflection::v1alpha::FileDescriptorResponse* mutable_file_descriptor_response(); + ::grpc::reflection::v1alpha::FileDescriptorResponse* release_file_descriptor_response(); + void set_allocated_file_descriptor_response(::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response); // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; bool has_all_extension_numbers_response() const; @@ -474,9 +471,9 @@ class DescriptorDatabaseResponse : public ::google::protobuf::Message { void set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response); MessageResponseCase message_response_case() const; - // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ServerReflectionResponse) private: - inline void set_has_file_descriptor_proto(); + inline void set_has_file_descriptor_response(); inline void set_has_all_extension_numbers_response(); inline void set_has_list_services_response(); inline void set_has_error_response(); @@ -488,10 +485,10 @@ class DescriptorDatabaseResponse : public ::google::protobuf::Message { ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; ::google::protobuf::internal::ArenaStringPtr valid_host_; - ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request_; + ::grpc::reflection::v1alpha::ServerReflectionRequest* original_request_; union MessageResponseUnion { MessageResponseUnion() {} - ::google::protobuf::internal::ArenaStringPtr file_descriptor_proto_; + ::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response_; ::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response_; ::grpc::reflection::v1alpha::ListServiceResponse* list_services_response_; ::grpc::reflection::v1alpha::ErrorResponse* error_response_; @@ -504,7 +501,95 @@ class DescriptorDatabaseResponse : public ::google::protobuf::Message { friend void protobuf_ShutdownFile_reflection_2eproto(); void InitAsDefaultInstance(); - static DescriptorDatabaseResponse* default_instance_; + static ServerReflectionResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class FileDescriptorResponse : public ::google::protobuf::Message { + public: + FileDescriptorResponse(); + virtual ~FileDescriptorResponse(); + + FileDescriptorResponse(const FileDescriptorResponse& from); + + inline FileDescriptorResponse& operator=(const FileDescriptorResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FileDescriptorResponse& default_instance(); + + void Swap(FileDescriptorResponse* other); + + // implements Message ---------------------------------------------- + + inline FileDescriptorResponse* New() const { return New(NULL); } + + FileDescriptorResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FileDescriptorResponse& from); + void MergeFrom(const FileDescriptorResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FileDescriptorResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated bytes file_descriptor_proto = 1; + int file_descriptor_proto_size() const; + void clear_file_descriptor_proto(); + static const int kFileDescriptorProtoFieldNumber = 1; + const ::std::string& file_descriptor_proto(int index) const; + ::std::string* mutable_file_descriptor_proto(int index); + void set_file_descriptor_proto(int index, const ::std::string& value); + void set_file_descriptor_proto(int index, const char* value); + void set_file_descriptor_proto(int index, const void* value, size_t size); + ::std::string* add_file_descriptor_proto(); + void add_file_descriptor_proto(const ::std::string& value); + void add_file_descriptor_proto(const char* value); + void add_file_descriptor_proto(const void* value, size_t size); + const ::google::protobuf::RepeatedPtrField< ::std::string>& file_descriptor_proto() const; + ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_file_descriptor_proto(); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.FileDescriptorResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::RepeatedPtrField< ::std::string> file_descriptor_proto_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static FileDescriptorResponse* default_instance_; }; // ------------------------------------------------------------------- @@ -661,28 +746,24 @@ class ListServiceResponse : public ::google::protobuf::Message { // accessors ------------------------------------------------------- - // repeated string service = 1; + // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; int service_size() const; void clear_service(); static const int kServiceFieldNumber = 1; - const ::std::string& service(int index) const; - ::std::string* mutable_service(int index); - void set_service(int index, const ::std::string& value); - void set_service(int index, const char* value); - void set_service(int index, const char* value, size_t size); - ::std::string* add_service(); - void add_service(const ::std::string& value); - void add_service(const char* value); - void add_service(const char* value, size_t size); - const ::google::protobuf::RepeatedPtrField< ::std::string>& service() const; - ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_service(); + const ::grpc::reflection::v1alpha::ServiceResponse& service(int index) const; + ::grpc::reflection::v1alpha::ServiceResponse* mutable_service(int index); + ::grpc::reflection::v1alpha::ServiceResponse* add_service(); + ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >* + mutable_service(); + const ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >& + service() const; // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ListServiceResponse) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; bool _is_default_instance_; - ::google::protobuf::RepeatedPtrField< ::std::string> service_; + ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse > service_; mutable int _cached_size_; friend void protobuf_AddDesc_reflection_2eproto(); friend void protobuf_AssignDesc_reflection_2eproto(); @@ -693,6 +774,89 @@ class ListServiceResponse : public ::google::protobuf::Message { }; // ------------------------------------------------------------------- +class ServiceResponse : public ::google::protobuf::Message { + public: + ServiceResponse(); + virtual ~ServiceResponse(); + + ServiceResponse(const ServiceResponse& from); + + inline ServiceResponse& operator=(const ServiceResponse& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ServiceResponse& default_instance(); + + void Swap(ServiceResponse* other); + + // implements Message ---------------------------------------------- + + inline ServiceResponse* New() const { return New(NULL); } + + ServiceResponse* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ServiceResponse& from); + void MergeFrom(const ServiceResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ServiceResponse* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // @@protoc_insertion_point(class_scope:grpc.reflection.v1alpha.ServiceResponse) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + mutable int _cached_size_; + friend void protobuf_AddDesc_reflection_2eproto(); + friend void protobuf_AssignDesc_reflection_2eproto(); + friend void protobuf_ShutdownFile_reflection_2eproto(); + + void InitAsDefaultInstance(); + static ServiceResponse* default_instance_; +}; +// ------------------------------------------------------------------- + class ErrorResponse : public ::google::protobuf::Message { public: ErrorResponse(); @@ -787,82 +951,82 @@ class ErrorResponse : public ::google::protobuf::Message { // =================================================================== #if !PROTOBUF_INLINE_NOT_IN_HEADERS -// DescriptorDatabaseRequest +// ServerReflectionRequest // optional string host = 1; -inline void DescriptorDatabaseRequest::clear_host() { +inline void ServerReflectionRequest::clear_host() { host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline const ::std::string& DescriptorDatabaseRequest::host() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) +inline const ::std::string& ServerReflectionRequest::host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void DescriptorDatabaseRequest::set_host(const ::std::string& value) { +inline void ServerReflectionRequest::set_host(const ::std::string& value) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.host) } -inline void DescriptorDatabaseRequest::set_host(const char* value) { +inline void ServerReflectionRequest::set_host(const char* value) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.host) } -inline void DescriptorDatabaseRequest::set_host(const char* value, size_t size) { +inline void ServerReflectionRequest::set_host(const char* value, size_t size) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.host) } -inline ::std::string* DescriptorDatabaseRequest::mutable_host() { +inline ::std::string* ServerReflectionRequest::mutable_host() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* DescriptorDatabaseRequest::release_host() { +inline ::std::string* ServerReflectionRequest::release_host() { return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void DescriptorDatabaseRequest::set_allocated_host(::std::string* host) { +inline void ServerReflectionRequest::set_allocated_host(::std::string* host) { if (host != NULL) { } else { } host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), host); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.host) } // optional string file_by_filename = 3; -inline bool DescriptorDatabaseRequest::has_file_by_filename() const { +inline bool ServerReflectionRequest::has_file_by_filename() const { return message_request_case() == kFileByFilename; } -inline void DescriptorDatabaseRequest::set_has_file_by_filename() { +inline void ServerReflectionRequest::set_has_file_by_filename() { _oneof_case_[0] = kFileByFilename; } -inline void DescriptorDatabaseRequest::clear_file_by_filename() { +inline void ServerReflectionRequest::clear_file_by_filename() { if (has_file_by_filename()) { message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } -inline const ::std::string& DescriptorDatabaseRequest::file_by_filename() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +inline const ::std::string& ServerReflectionRequest::file_by_filename() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (has_file_by_filename()) { return message_request_.file_by_filename_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } -inline void DescriptorDatabaseRequest::set_file_by_filename(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) +inline void ServerReflectionRequest::set_file_by_filename(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } -inline void DescriptorDatabaseRequest::set_file_by_filename(const char* value) { +inline void ServerReflectionRequest::set_file_by_filename(const char* value) { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); @@ -870,9 +1034,9 @@ inline void DescriptorDatabaseRequest::set_file_by_filename(const char* value) { } message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } -inline void DescriptorDatabaseRequest::set_file_by_filename(const char* value, size_t size) { +inline void ServerReflectionRequest::set_file_by_filename(const char* value, size_t size) { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); @@ -880,18 +1044,18 @@ inline void DescriptorDatabaseRequest::set_file_by_filename(const char* value, s } message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } -inline ::std::string* DescriptorDatabaseRequest::mutable_file_by_filename() { +inline ::std::string* ServerReflectionRequest::mutable_file_by_filename() { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* DescriptorDatabaseRequest::release_file_by_filename() { +inline ::std::string* ServerReflectionRequest::release_file_by_filename() { if (has_file_by_filename()) { clear_has_message_request(); return message_request_.file_by_filename_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -899,7 +1063,7 @@ inline ::std::string* DescriptorDatabaseRequest::release_file_by_filename() { return NULL; } } -inline void DescriptorDatabaseRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { +inline void ServerReflectionRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { if (!has_file_by_filename()) { message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -909,40 +1073,40 @@ inline void DescriptorDatabaseRequest::set_allocated_file_by_filename(::std::str message_request_.file_by_filename_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_by_filename); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } // optional string file_containing_symbol = 4; -inline bool DescriptorDatabaseRequest::has_file_containing_symbol() const { +inline bool ServerReflectionRequest::has_file_containing_symbol() const { return message_request_case() == kFileContainingSymbol; } -inline void DescriptorDatabaseRequest::set_has_file_containing_symbol() { +inline void ServerReflectionRequest::set_has_file_containing_symbol() { _oneof_case_[0] = kFileContainingSymbol; } -inline void DescriptorDatabaseRequest::clear_file_containing_symbol() { +inline void ServerReflectionRequest::clear_file_containing_symbol() { if (has_file_containing_symbol()) { message_request_.file_containing_symbol_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } -inline const ::std::string& DescriptorDatabaseRequest::file_containing_symbol() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +inline const ::std::string& ServerReflectionRequest::file_containing_symbol() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (has_file_containing_symbol()) { return message_request_.file_containing_symbol_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } -inline void DescriptorDatabaseRequest::set_file_containing_symbol(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) +inline void ServerReflectionRequest::set_file_containing_symbol(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } -inline void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value) { +inline void ServerReflectionRequest::set_file_containing_symbol(const char* value) { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); @@ -950,9 +1114,9 @@ inline void DescriptorDatabaseRequest::set_file_containing_symbol(const char* va } message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } -inline void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value, size_t size) { +inline void ServerReflectionRequest::set_file_containing_symbol(const char* value, size_t size) { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); @@ -960,18 +1124,18 @@ inline void DescriptorDatabaseRequest::set_file_containing_symbol(const char* va } message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } -inline ::std::string* DescriptorDatabaseRequest::mutable_file_containing_symbol() { +inline ::std::string* ServerReflectionRequest::mutable_file_containing_symbol() { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* DescriptorDatabaseRequest::release_file_containing_symbol() { +inline ::std::string* ServerReflectionRequest::release_file_containing_symbol() { if (has_file_containing_symbol()) { clear_has_message_request(); return message_request_.file_containing_symbol_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -979,7 +1143,7 @@ inline ::std::string* DescriptorDatabaseRequest::release_file_containing_symbol( return NULL; } } -inline void DescriptorDatabaseRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { +inline void ServerReflectionRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { if (!has_file_containing_symbol()) { message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -989,38 +1153,38 @@ inline void DescriptorDatabaseRequest::set_allocated_file_containing_symbol(::st message_request_.file_containing_symbol_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_containing_symbol); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; -inline bool DescriptorDatabaseRequest::has_file_containing_extension() const { +inline bool ServerReflectionRequest::has_file_containing_extension() const { return message_request_case() == kFileContainingExtension; } -inline void DescriptorDatabaseRequest::set_has_file_containing_extension() { +inline void ServerReflectionRequest::set_has_file_containing_extension() { _oneof_case_[0] = kFileContainingExtension; } -inline void DescriptorDatabaseRequest::clear_file_containing_extension() { +inline void ServerReflectionRequest::clear_file_containing_extension() { if (has_file_containing_extension()) { delete message_request_.file_containing_extension_; clear_has_message_request(); } } -inline const ::grpc::reflection::v1alpha::ExtensionRequest& DescriptorDatabaseRequest::file_containing_extension() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) +inline const ::grpc::reflection::v1alpha::ExtensionRequest& ServerReflectionRequest::file_containing_extension() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) return has_file_containing_extension() ? *message_request_.file_containing_extension_ : ::grpc::reflection::v1alpha::ExtensionRequest::default_instance(); } -inline ::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::mutable_file_containing_extension() { +inline ::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::mutable_file_containing_extension() { if (!has_file_containing_extension()) { clear_message_request(); set_has_file_containing_extension(); message_request_.file_containing_extension_ = new ::grpc::reflection::v1alpha::ExtensionRequest; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) return message_request_.file_containing_extension_; } -inline ::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::release_file_containing_extension() { +inline ::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::release_file_containing_extension() { if (has_file_containing_extension()) { clear_has_message_request(); ::grpc::reflection::v1alpha::ExtensionRequest* temp = message_request_.file_containing_extension_; @@ -1030,46 +1194,46 @@ inline ::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest: return NULL; } } -inline void DescriptorDatabaseRequest::set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension) { +inline void ServerReflectionRequest::set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension) { clear_message_request(); if (file_containing_extension) { set_has_file_containing_extension(); message_request_.file_containing_extension_ = file_containing_extension; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) } // optional string all_extension_numbers_of_type = 6; -inline bool DescriptorDatabaseRequest::has_all_extension_numbers_of_type() const { +inline bool ServerReflectionRequest::has_all_extension_numbers_of_type() const { return message_request_case() == kAllExtensionNumbersOfType; } -inline void DescriptorDatabaseRequest::set_has_all_extension_numbers_of_type() { +inline void ServerReflectionRequest::set_has_all_extension_numbers_of_type() { _oneof_case_[0] = kAllExtensionNumbersOfType; } -inline void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { +inline void ServerReflectionRequest::clear_all_extension_numbers_of_type() { if (has_all_extension_numbers_of_type()) { message_request_.all_extension_numbers_of_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } -inline const ::std::string& DescriptorDatabaseRequest::all_extension_numbers_of_type() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) +inline const ::std::string& ServerReflectionRequest::all_extension_numbers_of_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (has_all_extension_numbers_of_type()) { return message_request_.all_extension_numbers_of_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } -inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) +inline void ServerReflectionRequest::set_all_extension_numbers_of_type(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } -inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value) { +inline void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value) { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); @@ -1077,9 +1241,9 @@ inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const c } message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } -inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { +inline void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); @@ -1087,18 +1251,18 @@ inline void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const c } message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } -inline ::std::string* DescriptorDatabaseRequest::mutable_all_extension_numbers_of_type() { +inline ::std::string* ServerReflectionRequest::mutable_all_extension_numbers_of_type() { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* DescriptorDatabaseRequest::release_all_extension_numbers_of_type() { +inline ::std::string* ServerReflectionRequest::release_all_extension_numbers_of_type() { if (has_all_extension_numbers_of_type()) { clear_has_message_request(); return message_request_.all_extension_numbers_of_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1106,7 +1270,7 @@ inline ::std::string* DescriptorDatabaseRequest::release_all_extension_numbers_o return NULL; } } -inline void DescriptorDatabaseRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { +inline void ServerReflectionRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { if (!has_all_extension_numbers_of_type()) { message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1116,40 +1280,40 @@ inline void DescriptorDatabaseRequest::set_allocated_all_extension_numbers_of_ty message_request_.all_extension_numbers_of_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), all_extension_numbers_of_type); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } // optional string list_services = 7; -inline bool DescriptorDatabaseRequest::has_list_services() const { +inline bool ServerReflectionRequest::has_list_services() const { return message_request_case() == kListServices; } -inline void DescriptorDatabaseRequest::set_has_list_services() { +inline void ServerReflectionRequest::set_has_list_services() { _oneof_case_[0] = kListServices; } -inline void DescriptorDatabaseRequest::clear_list_services() { +inline void ServerReflectionRequest::clear_list_services() { if (has_list_services()) { message_request_.list_services_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } -inline const ::std::string& DescriptorDatabaseRequest::list_services() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) +inline const ::std::string& ServerReflectionRequest::list_services() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (has_list_services()) { return message_request_.list_services_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } -inline void DescriptorDatabaseRequest::set_list_services(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) +inline void ServerReflectionRequest::set_list_services(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (!has_list_services()) { clear_message_request(); set_has_list_services(); message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } -inline void DescriptorDatabaseRequest::set_list_services(const char* value) { +inline void ServerReflectionRequest::set_list_services(const char* value) { if (!has_list_services()) { clear_message_request(); set_has_list_services(); @@ -1157,9 +1321,9 @@ inline void DescriptorDatabaseRequest::set_list_services(const char* value) { } message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } -inline void DescriptorDatabaseRequest::set_list_services(const char* value, size_t size) { +inline void ServerReflectionRequest::set_list_services(const char* value, size_t size) { if (!has_list_services()) { clear_message_request(); set_has_list_services(); @@ -1167,18 +1331,18 @@ inline void DescriptorDatabaseRequest::set_list_services(const char* value, size } message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } -inline ::std::string* DescriptorDatabaseRequest::mutable_list_services() { +inline ::std::string* ServerReflectionRequest::mutable_list_services() { if (!has_list_services()) { clear_message_request(); set_has_list_services(); message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* DescriptorDatabaseRequest::release_list_services() { +inline ::std::string* ServerReflectionRequest::release_list_services() { if (has_list_services()) { clear_has_message_request(); return message_request_.list_services_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1186,7 +1350,7 @@ inline ::std::string* DescriptorDatabaseRequest::release_list_services() { return NULL; } } -inline void DescriptorDatabaseRequest::set_allocated_list_services(::std::string* list_services) { +inline void ServerReflectionRequest::set_allocated_list_services(::std::string* list_services) { if (!has_list_services()) { message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1196,17 +1360,17 @@ inline void DescriptorDatabaseRequest::set_allocated_list_services(::std::string message_request_.list_services_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), list_services); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } -inline bool DescriptorDatabaseRequest::has_message_request() const { +inline bool ServerReflectionRequest::has_message_request() const { return message_request_case() != MESSAGE_REQUEST_NOT_SET; } -inline void DescriptorDatabaseRequest::clear_has_message_request() { +inline void ServerReflectionRequest::clear_has_message_request() { _oneof_case_[0] = MESSAGE_REQUEST_NOT_SET; } -inline DescriptorDatabaseRequest::MessageRequestCase DescriptorDatabaseRequest::message_request_case() const { - return DescriptorDatabaseRequest::MessageRequestCase(_oneof_case_[0]); +inline ServerReflectionRequest::MessageRequestCase ServerReflectionRequest::message_request_case() const { + return ServerReflectionRequest::MessageRequestCase(_oneof_case_[0]); } // ------------------------------------------------------------------- @@ -1271,78 +1435,78 @@ inline void ExtensionRequest::set_extension_number(::google::protobuf::int32 val // ------------------------------------------------------------------- -// DescriptorDatabaseResponse +// ServerReflectionResponse // optional string valid_host = 1; -inline void DescriptorDatabaseResponse::clear_valid_host() { +inline void ServerReflectionResponse::clear_valid_host() { valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline const ::std::string& DescriptorDatabaseResponse::valid_host() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) +inline const ::std::string& ServerReflectionResponse::valid_host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void DescriptorDatabaseResponse::set_valid_host(const ::std::string& value) { +inline void ServerReflectionResponse::set_valid_host(const ::std::string& value) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } -inline void DescriptorDatabaseResponse::set_valid_host(const char* value) { +inline void ServerReflectionResponse::set_valid_host(const char* value) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } -inline void DescriptorDatabaseResponse::set_valid_host(const char* value, size_t size) { +inline void ServerReflectionResponse::set_valid_host(const char* value, size_t size) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } -inline ::std::string* DescriptorDatabaseResponse::mutable_valid_host() { +inline ::std::string* ServerReflectionResponse::mutable_valid_host() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* DescriptorDatabaseResponse::release_valid_host() { +inline ::std::string* ServerReflectionResponse::release_valid_host() { return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void DescriptorDatabaseResponse::set_allocated_valid_host(::std::string* valid_host) { +inline void ServerReflectionResponse::set_allocated_valid_host(::std::string* valid_host) { if (valid_host != NULL) { } else { } valid_host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), valid_host); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } -// optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; -inline bool DescriptorDatabaseResponse::has_original_request() const { +// optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; +inline bool ServerReflectionResponse::has_original_request() const { return !_is_default_instance_ && original_request_ != NULL; } -inline void DescriptorDatabaseResponse::clear_original_request() { +inline void ServerReflectionResponse::clear_original_request() { if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; original_request_ = NULL; } -inline const ::grpc::reflection::v1alpha::DescriptorDatabaseRequest& DescriptorDatabaseResponse::original_request() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) +inline const ::grpc::reflection::v1alpha::ServerReflectionRequest& ServerReflectionResponse::original_request() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) return original_request_ != NULL ? *original_request_ : *default_instance_->original_request_; } -inline ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::mutable_original_request() { +inline ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::mutable_original_request() { if (original_request_ == NULL) { - original_request_ = new ::grpc::reflection::v1alpha::DescriptorDatabaseRequest; + original_request_ = new ::grpc::reflection::v1alpha::ServerReflectionRequest; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) return original_request_; } -inline ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::release_original_request() { +inline ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::release_original_request() { - ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* temp = original_request_; + ::grpc::reflection::v1alpha::ServerReflectionRequest* temp = original_request_; original_request_ = NULL; return temp; } -inline void DescriptorDatabaseResponse::set_allocated_original_request(::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request) { +inline void ServerReflectionResponse::set_allocated_original_request(::grpc::reflection::v1alpha::ServerReflectionRequest* original_request) { delete original_request_; original_request_ = original_request; if (original_request) { @@ -1350,118 +1514,85 @@ inline void DescriptorDatabaseResponse::set_allocated_original_request(::grpc::r } else { } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) } -// optional bytes file_descriptor_proto = 4; -inline bool DescriptorDatabaseResponse::has_file_descriptor_proto() const { - return message_response_case() == kFileDescriptorProto; +// optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; +inline bool ServerReflectionResponse::has_file_descriptor_response() const { + return message_response_case() == kFileDescriptorResponse; } -inline void DescriptorDatabaseResponse::set_has_file_descriptor_proto() { - _oneof_case_[0] = kFileDescriptorProto; +inline void ServerReflectionResponse::set_has_file_descriptor_response() { + _oneof_case_[0] = kFileDescriptorResponse; } -inline void DescriptorDatabaseResponse::clear_file_descriptor_proto() { - if (has_file_descriptor_proto()) { - message_response_.file_descriptor_proto_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline void ServerReflectionResponse::clear_file_descriptor_response() { + if (has_file_descriptor_response()) { + delete message_response_.file_descriptor_response_; clear_has_message_response(); } } -inline const ::std::string& DescriptorDatabaseResponse::file_descriptor_proto() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) - if (has_file_descriptor_proto()) { - return message_response_.file_descriptor_proto_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); -} -inline void DescriptorDatabaseResponse::set_file_descriptor_proto(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) - if (!has_file_descriptor_proto()) { - clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) -} -inline void DescriptorDatabaseResponse::set_file_descriptor_proto(const char* value) { - if (!has_file_descriptor_proto()) { - clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) -} -inline void DescriptorDatabaseResponse::set_file_descriptor_proto(const void* value, size_t size) { - if (!has_file_descriptor_proto()) { - clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) +inline const ::grpc::reflection::v1alpha::FileDescriptorResponse& ServerReflectionResponse::file_descriptor_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) + return has_file_descriptor_response() + ? *message_response_.file_descriptor_response_ + : ::grpc::reflection::v1alpha::FileDescriptorResponse::default_instance(); } -inline ::std::string* DescriptorDatabaseResponse::mutable_file_descriptor_proto() { - if (!has_file_descriptor_proto()) { +inline ::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::mutable_file_descriptor_response() { + if (!has_file_descriptor_response()) { clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + set_has_file_descriptor_response(); + message_response_.file_descriptor_response_ = new ::grpc::reflection::v1alpha::FileDescriptorResponse; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) - return message_response_.file_descriptor_proto_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) + return message_response_.file_descriptor_response_; } -inline ::std::string* DescriptorDatabaseResponse::release_file_descriptor_proto() { - if (has_file_descriptor_proto()) { +inline ::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::release_file_descriptor_response() { + if (has_file_descriptor_response()) { clear_has_message_response(); - return message_response_.file_descriptor_proto_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::grpc::reflection::v1alpha::FileDescriptorResponse* temp = message_response_.file_descriptor_response_; + message_response_.file_descriptor_response_ = NULL; + return temp; } else { return NULL; } } -inline void DescriptorDatabaseResponse::set_allocated_file_descriptor_proto(::std::string* file_descriptor_proto) { - if (!has_file_descriptor_proto()) { - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } +inline void ServerReflectionResponse::set_allocated_file_descriptor_response(::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response) { clear_message_response(); - if (file_descriptor_proto != NULL) { - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - file_descriptor_proto); + if (file_descriptor_response) { + set_has_file_descriptor_response(); + message_response_.file_descriptor_response_ = file_descriptor_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) } // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; -inline bool DescriptorDatabaseResponse::has_all_extension_numbers_response() const { +inline bool ServerReflectionResponse::has_all_extension_numbers_response() const { return message_response_case() == kAllExtensionNumbersResponse; } -inline void DescriptorDatabaseResponse::set_has_all_extension_numbers_response() { +inline void ServerReflectionResponse::set_has_all_extension_numbers_response() { _oneof_case_[0] = kAllExtensionNumbersResponse; } -inline void DescriptorDatabaseResponse::clear_all_extension_numbers_response() { +inline void ServerReflectionResponse::clear_all_extension_numbers_response() { if (has_all_extension_numbers_response()) { delete message_response_.all_extension_numbers_response_; clear_has_message_response(); } } -inline const ::grpc::reflection::v1alpha::ExtensionNumberResponse& DescriptorDatabaseResponse::all_extension_numbers_response() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) +inline const ::grpc::reflection::v1alpha::ExtensionNumberResponse& ServerReflectionResponse::all_extension_numbers_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) return has_all_extension_numbers_response() ? *message_response_.all_extension_numbers_response_ : ::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance(); } -inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::mutable_all_extension_numbers_response() { +inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::mutable_all_extension_numbers_response() { if (!has_all_extension_numbers_response()) { clear_message_response(); set_has_all_extension_numbers_response(); message_response_.all_extension_numbers_response_ = new ::grpc::reflection::v1alpha::ExtensionNumberResponse; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) return message_response_.all_extension_numbers_response_; } -inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::release_all_extension_numbers_response() { +inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::release_all_extension_numbers_response() { if (has_all_extension_numbers_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ExtensionNumberResponse* temp = message_response_.all_extension_numbers_response_; @@ -1471,44 +1602,44 @@ inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseR return NULL; } } -inline void DescriptorDatabaseResponse::set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response) { +inline void ServerReflectionResponse::set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response) { clear_message_response(); if (all_extension_numbers_response) { set_has_all_extension_numbers_response(); message_response_.all_extension_numbers_response_ = all_extension_numbers_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) } // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; -inline bool DescriptorDatabaseResponse::has_list_services_response() const { +inline bool ServerReflectionResponse::has_list_services_response() const { return message_response_case() == kListServicesResponse; } -inline void DescriptorDatabaseResponse::set_has_list_services_response() { +inline void ServerReflectionResponse::set_has_list_services_response() { _oneof_case_[0] = kListServicesResponse; } -inline void DescriptorDatabaseResponse::clear_list_services_response() { +inline void ServerReflectionResponse::clear_list_services_response() { if (has_list_services_response()) { delete message_response_.list_services_response_; clear_has_message_response(); } } -inline const ::grpc::reflection::v1alpha::ListServiceResponse& DescriptorDatabaseResponse::list_services_response() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) +inline const ::grpc::reflection::v1alpha::ListServiceResponse& ServerReflectionResponse::list_services_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) return has_list_services_response() ? *message_response_.list_services_response_ : ::grpc::reflection::v1alpha::ListServiceResponse::default_instance(); } -inline ::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::mutable_list_services_response() { +inline ::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::mutable_list_services_response() { if (!has_list_services_response()) { clear_message_response(); set_has_list_services_response(); message_response_.list_services_response_ = new ::grpc::reflection::v1alpha::ListServiceResponse; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) return message_response_.list_services_response_; } -inline ::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::release_list_services_response() { +inline ::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::release_list_services_response() { if (has_list_services_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ListServiceResponse* temp = message_response_.list_services_response_; @@ -1518,44 +1649,44 @@ inline ::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseRespo return NULL; } } -inline void DescriptorDatabaseResponse::set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response) { +inline void ServerReflectionResponse::set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response) { clear_message_response(); if (list_services_response) { set_has_list_services_response(); message_response_.list_services_response_ = list_services_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) } // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; -inline bool DescriptorDatabaseResponse::has_error_response() const { +inline bool ServerReflectionResponse::has_error_response() const { return message_response_case() == kErrorResponse; } -inline void DescriptorDatabaseResponse::set_has_error_response() { +inline void ServerReflectionResponse::set_has_error_response() { _oneof_case_[0] = kErrorResponse; } -inline void DescriptorDatabaseResponse::clear_error_response() { +inline void ServerReflectionResponse::clear_error_response() { if (has_error_response()) { delete message_response_.error_response_; clear_has_message_response(); } } -inline const ::grpc::reflection::v1alpha::ErrorResponse& DescriptorDatabaseResponse::error_response() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) +inline const ::grpc::reflection::v1alpha::ErrorResponse& ServerReflectionResponse::error_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) return has_error_response() ? *message_response_.error_response_ : ::grpc::reflection::v1alpha::ErrorResponse::default_instance(); } -inline ::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::mutable_error_response() { +inline ::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::mutable_error_response() { if (!has_error_response()) { clear_message_response(); set_has_error_response(); message_response_.error_response_ = new ::grpc::reflection::v1alpha::ErrorResponse; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) return message_response_.error_response_; } -inline ::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::release_error_response() { +inline ::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::release_error_response() { if (has_error_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ErrorResponse* temp = message_response_.error_response_; @@ -1565,24 +1696,82 @@ inline ::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::r return NULL; } } -inline void DescriptorDatabaseResponse::set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response) { +inline void ServerReflectionResponse::set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response) { clear_message_response(); if (error_response) { set_has_error_response(); message_response_.error_response_ = error_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) } -inline bool DescriptorDatabaseResponse::has_message_response() const { +inline bool ServerReflectionResponse::has_message_response() const { return message_response_case() != MESSAGE_RESPONSE_NOT_SET; } -inline void DescriptorDatabaseResponse::clear_has_message_response() { +inline void ServerReflectionResponse::clear_has_message_response() { _oneof_case_[0] = MESSAGE_RESPONSE_NOT_SET; } -inline DescriptorDatabaseResponse::MessageResponseCase DescriptorDatabaseResponse::message_response_case() const { - return DescriptorDatabaseResponse::MessageResponseCase(_oneof_case_[0]); +inline ServerReflectionResponse::MessageResponseCase ServerReflectionResponse::message_response_case() const { + return ServerReflectionResponse::MessageResponseCase(_oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// FileDescriptorResponse + +// repeated bytes file_descriptor_proto = 1; +inline int FileDescriptorResponse::file_descriptor_proto_size() const { + return file_descriptor_proto_.size(); +} +inline void FileDescriptorResponse::clear_file_descriptor_proto() { + file_descriptor_proto_.Clear(); +} +inline const ::std::string& FileDescriptorResponse::file_descriptor_proto(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_.Get(index); +} +inline ::std::string* FileDescriptorResponse::mutable_file_descriptor_proto(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_.Mutable(index); +} +inline void FileDescriptorResponse::set_file_descriptor_proto(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + file_descriptor_proto_.Mutable(index)->assign(value); +} +inline void FileDescriptorResponse::set_file_descriptor_proto(int index, const char* value) { + file_descriptor_proto_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline void FileDescriptorResponse::set_file_descriptor_proto(int index, const void* value, size_t size) { + file_descriptor_proto_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline ::std::string* FileDescriptorResponse::add_file_descriptor_proto() { + return file_descriptor_proto_.Add(); +} +inline void FileDescriptorResponse::add_file_descriptor_proto(const ::std::string& value) { + file_descriptor_proto_.Add()->assign(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline void FileDescriptorResponse::add_file_descriptor_proto(const char* value) { + file_descriptor_proto_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline void FileDescriptorResponse::add_file_descriptor_proto(const void* value, size_t size) { + file_descriptor_proto_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +FileDescriptorResponse::file_descriptor_proto() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +FileDescriptorResponse::mutable_file_descriptor_proto() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return &file_descriptor_proto_; } + // ------------------------------------------------------------------- // ExtensionNumberResponse @@ -1664,58 +1853,81 @@ ExtensionNumberResponse::mutable_extension_number() { // ListServiceResponse -// repeated string service = 1; +// repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; inline int ListServiceResponse::service_size() const { return service_.size(); } inline void ListServiceResponse::clear_service() { service_.Clear(); } -inline const ::std::string& ListServiceResponse::service(int index) const { +inline const ::grpc::reflection::v1alpha::ServiceResponse& ListServiceResponse::service(int index) const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.service) return service_.Get(index); } -inline ::std::string* ListServiceResponse::mutable_service(int index) { +inline ::grpc::reflection::v1alpha::ServiceResponse* ListServiceResponse::mutable_service(int index) { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.service) return service_.Mutable(index); } -inline void ListServiceResponse::set_service(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.service) - service_.Mutable(index)->assign(value); +inline ::grpc::reflection::v1alpha::ServiceResponse* ListServiceResponse::add_service() { + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Add(); } -inline void ListServiceResponse::set_service(int index, const char* value) { - service_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.service) +inline ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >* +ListServiceResponse::mutable_service() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return &service_; } -inline void ListServiceResponse::set_service(int index, const char* value, size_t size) { - service_.Mutable(index)->assign( - reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) +inline const ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >& +ListServiceResponse::service() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_; } -inline ::std::string* ListServiceResponse::add_service() { - return service_.Add(); + +// ------------------------------------------------------------------- + +// ServiceResponse + +// optional string name = 1; +inline void ServiceResponse::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void ListServiceResponse::add_service(const ::std::string& value) { - service_.Add()->assign(value); - // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.service) +inline const ::std::string& ServiceResponse::name() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServiceResponse.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void ListServiceResponse::add_service(const char* value) { - service_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.service) +inline void ServiceResponse::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServiceResponse.name) } -inline void ListServiceResponse::add_service(const char* value, size_t size) { - service_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) +inline void ServiceResponse::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServiceResponse.name) } -inline const ::google::protobuf::RepeatedPtrField< ::std::string>& -ListServiceResponse::service() const { - // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.service) - return service_; +inline void ServiceResponse::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServiceResponse.name) } -inline ::google::protobuf::RepeatedPtrField< ::std::string>* -ListServiceResponse::mutable_service() { - // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.service) - return &service_; +inline ::std::string* ServiceResponse::mutable_name() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServiceResponse.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* ServiceResponse::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void ServiceResponse::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServiceResponse.name) } // ------------------------------------------------------------------- @@ -1790,6 +2002,10 @@ inline void ErrorResponse::set_allocated_error_message(::std::string* error_mess // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/extensions/reflection/proto_server_reflection.cc b/extensions/reflection/proto_server_reflection.cc index 1befb1d2f5b..ec82d5f18e3 100644 --- a/extensions/reflection/proto_server_reflection.cc +++ b/extensions/reflection/proto_server_reflection.cc @@ -51,12 +51,14 @@ using google::protobuf::FileDescriptor; using google::protobuf::FieldDescriptor; using google::protobuf::DescriptorPool; using google::protobuf::FileDescriptorProto; -using grpc::reflection::v1alpha::DescriptorDatabaseRequest; +using grpc::reflection::v1alpha::ServerReflectionRequest; using grpc::reflection::v1alpha::ExtensionRequest; -using grpc::reflection::v1alpha::DescriptorDatabaseResponse; +using grpc::reflection::v1alpha::ServerReflectionResponse; using grpc::reflection::v1alpha::ListServiceResponse; +using grpc::reflection::v1alpha::ServiceResponse; using grpc::reflection::v1alpha::ExtensionNumberResponse; using grpc::reflection::v1alpha::ErrorResponse; +using grpc::reflection::v1alpha::FileDescriptorResponse; namespace grpc { @@ -68,34 +70,34 @@ void ProtoServerReflection::SetServiceList( services_ = services; } -Status ProtoServerReflection::DescriptorDatabaseInfo( +Status ProtoServerReflection::ServerReflectionInfo( ServerContext* context, - ServerReaderWriter* + ServerReaderWriter* stream) { - DescriptorDatabaseRequest request; - DescriptorDatabaseResponse response; + ServerReflectionRequest request; + ServerReflectionResponse response; Status status; while (stream->Read(&request)) { switch (request.message_request_case()) { - case DescriptorDatabaseRequest::MessageRequestCase::kFileByFilename: + case ServerReflectionRequest::MessageRequestCase::kFileByFilename: status = GetFileByName(context, request.file_by_filename(), &response); break; - case DescriptorDatabaseRequest::MessageRequestCase::kFileContainingSymbol: + case ServerReflectionRequest::MessageRequestCase::kFileContainingSymbol: status = GetFileContainingSymbol( context, request.file_containing_symbol(), &response); break; - case DescriptorDatabaseRequest::MessageRequestCase:: + case ServerReflectionRequest::MessageRequestCase:: kFileContainingExtension: status = GetFileContainingExtension( context, &request.file_containing_extension(), &response); break; - case DescriptorDatabaseRequest::MessageRequestCase:: + case ServerReflectionRequest::MessageRequestCase:: kAllExtensionNumbersOfType: status = GetAllExtensionNumbers( context, request.all_extension_numbers_of_type(), response.mutable_all_extension_numbers_response()); break; - case DescriptorDatabaseRequest::MessageRequestCase::kListServices: + case ServerReflectionRequest::MessageRequestCase::kListServices: status = ListService(context, response.mutable_list_services_response()); break; @@ -105,7 +107,7 @@ Status ProtoServerReflection::DescriptorDatabaseInfo( response.set_valid_host(request.host()); response.set_allocated_original_request( - new DescriptorDatabaseRequest(request)); + new ServerReflectionRequest(request)); stream->Write(response); } @@ -124,14 +126,15 @@ Status ProtoServerReflection::ListService(ServerContext* context, return Status(StatusCode::NOT_FOUND, "Services not found."); } for (auto it = services_->begin(); it != services_->end(); ++it) { - response->add_service(*it); + ServiceResponse* service_response = response->add_service(); + service_response->set_name(*it); } return Status::OK; } Status ProtoServerReflection::GetFileByName( ServerContext* context, const grpc::string& filename, - DescriptorDatabaseResponse* response) { + ServerReflectionResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; } @@ -146,7 +149,7 @@ Status ProtoServerReflection::GetFileByName( Status ProtoServerReflection::GetFileContainingSymbol( ServerContext* context, const grpc::string& symbol, - DescriptorDatabaseResponse* response) { + ServerReflectionResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; } @@ -162,7 +165,7 @@ Status ProtoServerReflection::GetFileContainingSymbol( Status ProtoServerReflection::GetFileContainingExtension( ServerContext* context, const ExtensionRequest* request, - DescriptorDatabaseResponse* response) { + ServerReflectionResponse* response) { if (descriptor_pool_ == nullptr) { return Status::CANCELLED; } @@ -204,12 +207,12 @@ Status ProtoServerReflection::GetAllExtensionNumbers( } void ProtoServerReflection::FillFileDescriptorProtoResponse( - const FileDescriptor* file_desc, DescriptorDatabaseResponse* response) { + const FileDescriptor* file_desc, ServerReflectionResponse* response) { FileDescriptorProto file_desc_proto; grpc::string data; file_desc->CopyTo(&file_desc_proto); file_desc_proto.SerializeToString(&data); - response->set_file_descriptor_proto(data); + response->mutable_file_descriptor_response()->add_file_descriptor_proto(data); } } // namespace grpc diff --git a/extensions/reflection/proto_server_reflection.h b/extensions/reflection/proto_server_reflection.h index c32ee9ff54b..f86d6f1bf4e 100644 --- a/extensions/reflection/proto_server_reflection.h +++ b/extensions/reflection/proto_server_reflection.h @@ -54,10 +54,10 @@ class ProtoServerReflection GRPC_FINAL void SetServiceList(const std::vector* services); - Status DescriptorDatabaseInfo( + Status ServerReflectionInfo( ServerContext* context, - ServerReaderWriter* + ServerReaderWriter* stream) GRPC_OVERRIDE; private: @@ -66,16 +66,16 @@ class ProtoServerReflection GRPC_FINAL Status GetFileByName( ServerContext* context, const grpc::string& file_name, - reflection::v1alpha::DescriptorDatabaseResponse* response); + reflection::v1alpha::ServerReflectionResponse* response); Status GetFileContainingSymbol( ServerContext* context, const grpc::string& symbol, - reflection::v1alpha::DescriptorDatabaseResponse* response); + reflection::v1alpha::ServerReflectionResponse* response); Status GetFileContainingExtension( ServerContext* context, const reflection::v1alpha::ExtensionRequest* request, - reflection::v1alpha::DescriptorDatabaseResponse* response); + reflection::v1alpha::ServerReflectionResponse* response); Status GetAllExtensionNumbers( ServerContext* context, const grpc::string& type, @@ -83,7 +83,7 @@ class ProtoServerReflection GRPC_FINAL void FillFileDescriptorProtoResponse( const google::protobuf::FileDescriptor* file_desc, - reflection::v1alpha::DescriptorDatabaseResponse* response); + reflection::v1alpha::ServerReflectionResponse* response); void FillErrorResponse(Status* status, reflection::v1alpha::ErrorResponse* error_response); diff --git a/extensions/reflection/reflection.grpc.pb.cc b/extensions/reflection/reflection.grpc.pb.cc index 83a63529fcb..e8a376c3f29 100644 --- a/extensions/reflection/reflection.grpc.pb.cc +++ b/extensions/reflection/reflection.grpc.pb.cc @@ -52,7 +52,7 @@ namespace reflection { namespace v1alpha { static const char* ServerReflection_method_names[] = { - "/grpc.reflection.v1alpha.ServerReflection/DescriptorDatabaseInfo", + "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", }; std::unique_ptr< ServerReflection::Stub> ServerReflection::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { @@ -61,15 +61,15 @@ std::unique_ptr< ServerReflection::Stub> ServerReflection::NewStub(const std::sh } ServerReflection::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) - : channel_(channel), rpcmethod_DescriptorDatabaseInfo_(ServerReflection_method_names[0], ::grpc::RpcMethod::BIDI_STREAMING, channel) + : channel_(channel), rpcmethod_ServerReflectionInfo_(ServerReflection_method_names[0], ::grpc::RpcMethod::BIDI_STREAMING, channel) {} -::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* ServerReflection::Stub::DescriptorDatabaseInfoRaw(::grpc::ClientContext* context) { - return new ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>(channel_.get(), rpcmethod_DescriptorDatabaseInfo_, context); +::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflection::Stub::ServerReflectionInfoRaw(::grpc::ClientContext* context) { + return new ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>(channel_.get(), rpcmethod_ServerReflectionInfo_, context); } -::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>* ServerReflection::Stub::AsyncDescriptorDatabaseInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { - return new ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>(channel_.get(), cq, rpcmethod_DescriptorDatabaseInfo_, context, tag); +::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflection::Stub::AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) { + return new ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>(channel_.get(), cq, rpcmethod_ServerReflectionInfo_, context, tag); } ServerReflection::Service::Service() { @@ -77,14 +77,14 @@ ServerReflection::Service::Service() { AddMethod(new ::grpc::RpcServiceMethod( ServerReflection_method_names[0], ::grpc::RpcMethod::BIDI_STREAMING, - new ::grpc::BidiStreamingHandler< ServerReflection::Service, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest, ::grpc::reflection::v1alpha::DescriptorDatabaseResponse>( - std::mem_fn(&ServerReflection::Service::DescriptorDatabaseInfo), this))); + new ::grpc::BidiStreamingHandler< ServerReflection::Service, ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>( + std::mem_fn(&ServerReflection::Service::ServerReflectionInfo), this))); } ServerReflection::Service::~Service() { } -::grpc::Status ServerReflection::Service::DescriptorDatabaseInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::DescriptorDatabaseResponse, ::grpc::reflection::v1alpha::DescriptorDatabaseRequest>* stream) { +::grpc::Status ServerReflection::Service::ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) { (void) context; (void) stream; return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); diff --git a/extensions/reflection/reflection.pb.cc b/extensions/reflection/reflection.pb.cc index 0c9bfe79a4c..946709f20ff 100644 --- a/extensions/reflection/reflection.pb.cc +++ b/extensions/reflection/reflection.pb.cc @@ -57,34 +57,40 @@ namespace v1alpha { namespace { -const ::google::protobuf::Descriptor* DescriptorDatabaseRequest_descriptor_ = NULL; +const ::google::protobuf::Descriptor* ServerReflectionRequest_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - DescriptorDatabaseRequest_reflection_ = NULL; -struct DescriptorDatabaseRequestOneofInstance { + ServerReflectionRequest_reflection_ = NULL; +struct ServerReflectionRequestOneofInstance { ::google::protobuf::internal::ArenaStringPtr file_by_filename_; ::google::protobuf::internal::ArenaStringPtr file_containing_symbol_; const ::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension_; ::google::protobuf::internal::ArenaStringPtr all_extension_numbers_of_type_; ::google::protobuf::internal::ArenaStringPtr list_services_; -}* DescriptorDatabaseRequest_default_oneof_instance_ = NULL; +}* ServerReflectionRequest_default_oneof_instance_ = NULL; const ::google::protobuf::Descriptor* ExtensionRequest_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* ExtensionRequest_reflection_ = NULL; -const ::google::protobuf::Descriptor* DescriptorDatabaseResponse_descriptor_ = NULL; +const ::google::protobuf::Descriptor* ServerReflectionResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* - DescriptorDatabaseResponse_reflection_ = NULL; -struct DescriptorDatabaseResponseOneofInstance { - ::google::protobuf::internal::ArenaStringPtr file_descriptor_proto_; + ServerReflectionResponse_reflection_ = NULL; +struct ServerReflectionResponseOneofInstance { + const ::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response_; const ::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response_; const ::grpc::reflection::v1alpha::ListServiceResponse* list_services_response_; const ::grpc::reflection::v1alpha::ErrorResponse* error_response_; -}* DescriptorDatabaseResponse_default_oneof_instance_ = NULL; +}* ServerReflectionResponse_default_oneof_instance_ = NULL; +const ::google::protobuf::Descriptor* FileDescriptorResponse_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FileDescriptorResponse_reflection_ = NULL; const ::google::protobuf::Descriptor* ExtensionNumberResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* ExtensionNumberResponse_reflection_ = NULL; const ::google::protobuf::Descriptor* ListServiceResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* ListServiceResponse_reflection_ = NULL; +const ::google::protobuf::Descriptor* ServiceResponse_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ServiceResponse_reflection_ = NULL; const ::google::protobuf::Descriptor* ErrorResponse_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* ErrorResponse_reflection_ = NULL; @@ -98,29 +104,29 @@ void protobuf_AssignDesc_reflection_2eproto() { ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( "reflection.proto"); GOOGLE_CHECK(file != NULL); - DescriptorDatabaseRequest_descriptor_ = file->message_type(0); - static const int DescriptorDatabaseRequest_offsets_[7] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, host_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, file_by_filename_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, file_containing_symbol_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, file_containing_extension_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, all_extension_numbers_of_type_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseRequest_default_oneof_instance_, list_services_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, message_request_), + ServerReflectionRequest_descriptor_ = file->message_type(0); + static const int ServerReflectionRequest_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, host_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionRequest_default_oneof_instance_, file_by_filename_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionRequest_default_oneof_instance_, file_containing_symbol_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionRequest_default_oneof_instance_, file_containing_extension_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionRequest_default_oneof_instance_, all_extension_numbers_of_type_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionRequest_default_oneof_instance_, list_services_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, message_request_), }; - DescriptorDatabaseRequest_reflection_ = + ServerReflectionRequest_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - DescriptorDatabaseRequest_descriptor_, - DescriptorDatabaseRequest::default_instance_, - DescriptorDatabaseRequest_offsets_, + ServerReflectionRequest_descriptor_, + ServerReflectionRequest::default_instance_, + ServerReflectionRequest_offsets_, -1, -1, -1, - DescriptorDatabaseRequest_default_oneof_instance_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, _oneof_case_[0]), - sizeof(DescriptorDatabaseRequest), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseRequest, _is_default_instance_)); + ServerReflectionRequest_default_oneof_instance_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, _oneof_case_[0]), + sizeof(ServerReflectionRequest), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionRequest, _is_default_instance_)); ExtensionRequest_descriptor_ = file->message_type(1); static const int ExtensionRequest_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, containing_type_), @@ -137,30 +143,45 @@ void protobuf_AssignDesc_reflection_2eproto() { sizeof(ExtensionRequest), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, _internal_metadata_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionRequest, _is_default_instance_)); - DescriptorDatabaseResponse_descriptor_ = file->message_type(2); - static const int DescriptorDatabaseResponse_offsets_[7] = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, valid_host_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, original_request_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, file_descriptor_proto_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, all_extension_numbers_response_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, list_services_response_), - PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(DescriptorDatabaseResponse_default_oneof_instance_, error_response_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, message_response_), + ServerReflectionResponse_descriptor_ = file->message_type(2); + static const int ServerReflectionResponse_offsets_[7] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, valid_host_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, original_request_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionResponse_default_oneof_instance_, file_descriptor_response_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionResponse_default_oneof_instance_, all_extension_numbers_response_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionResponse_default_oneof_instance_, list_services_response_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ServerReflectionResponse_default_oneof_instance_, error_response_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, message_response_), + }; + ServerReflectionResponse_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + ServerReflectionResponse_descriptor_, + ServerReflectionResponse::default_instance_, + ServerReflectionResponse_offsets_, + -1, + -1, + -1, + ServerReflectionResponse_default_oneof_instance_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, _oneof_case_[0]), + sizeof(ServerReflectionResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServerReflectionResponse, _is_default_instance_)); + FileDescriptorResponse_descriptor_ = file->message_type(3); + static const int FileDescriptorResponse_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorResponse, file_descriptor_proto_), }; - DescriptorDatabaseResponse_reflection_ = + FileDescriptorResponse_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( - DescriptorDatabaseResponse_descriptor_, - DescriptorDatabaseResponse::default_instance_, - DescriptorDatabaseResponse_offsets_, + FileDescriptorResponse_descriptor_, + FileDescriptorResponse::default_instance_, + FileDescriptorResponse_offsets_, -1, -1, -1, - DescriptorDatabaseResponse_default_oneof_instance_, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, _oneof_case_[0]), - sizeof(DescriptorDatabaseResponse), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, _internal_metadata_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DescriptorDatabaseResponse, _is_default_instance_)); - ExtensionNumberResponse_descriptor_ = file->message_type(3); + sizeof(FileDescriptorResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileDescriptorResponse, _is_default_instance_)); + ExtensionNumberResponse_descriptor_ = file->message_type(4); static const int ExtensionNumberResponse_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, base_type_name_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, extension_number_), @@ -176,7 +197,7 @@ void protobuf_AssignDesc_reflection_2eproto() { sizeof(ExtensionNumberResponse), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, _internal_metadata_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ExtensionNumberResponse, _is_default_instance_)); - ListServiceResponse_descriptor_ = file->message_type(4); + ListServiceResponse_descriptor_ = file->message_type(5); static const int ListServiceResponse_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, service_), }; @@ -191,7 +212,22 @@ void protobuf_AssignDesc_reflection_2eproto() { sizeof(ListServiceResponse), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, _internal_metadata_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListServiceResponse, _is_default_instance_)); - ErrorResponse_descriptor_ = file->message_type(5); + ServiceResponse_descriptor_ = file->message_type(6); + static const int ServiceResponse_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceResponse, name_), + }; + ServiceResponse_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + ServiceResponse_descriptor_, + ServiceResponse::default_instance_, + ServiceResponse_offsets_, + -1, + -1, + -1, + sizeof(ServiceResponse), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceResponse, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ServiceResponse, _is_default_instance_)); + ErrorResponse_descriptor_ = file->message_type(7); static const int ErrorResponse_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, error_code_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, error_message_), @@ -220,15 +256,19 @@ inline void protobuf_AssignDescriptorsOnce() { void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - DescriptorDatabaseRequest_descriptor_, &DescriptorDatabaseRequest::default_instance()); + ServerReflectionRequest_descriptor_, &ServerReflectionRequest::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( ExtensionRequest_descriptor_, &ExtensionRequest::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( - DescriptorDatabaseResponse_descriptor_, &DescriptorDatabaseResponse::default_instance()); + ServerReflectionResponse_descriptor_, &ServerReflectionResponse::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FileDescriptorResponse_descriptor_, &FileDescriptorResponse::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( ExtensionNumberResponse_descriptor_, &ExtensionNumberResponse::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( ListServiceResponse_descriptor_, &ListServiceResponse::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ServiceResponse_descriptor_, &ServiceResponse::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( ErrorResponse_descriptor_, &ErrorResponse::default_instance()); } @@ -236,18 +276,22 @@ void protobuf_RegisterTypes(const ::std::string&) { } // namespace void protobuf_ShutdownFile_reflection_2eproto() { - delete DescriptorDatabaseRequest::default_instance_; - delete DescriptorDatabaseRequest_default_oneof_instance_; - delete DescriptorDatabaseRequest_reflection_; + delete ServerReflectionRequest::default_instance_; + delete ServerReflectionRequest_default_oneof_instance_; + delete ServerReflectionRequest_reflection_; delete ExtensionRequest::default_instance_; delete ExtensionRequest_reflection_; - delete DescriptorDatabaseResponse::default_instance_; - delete DescriptorDatabaseResponse_default_oneof_instance_; - delete DescriptorDatabaseResponse_reflection_; + delete ServerReflectionResponse::default_instance_; + delete ServerReflectionResponse_default_oneof_instance_; + delete ServerReflectionResponse_reflection_; + delete FileDescriptorResponse::default_instance_; + delete FileDescriptorResponse_reflection_; delete ExtensionNumberResponse::default_instance_; delete ExtensionNumberResponse_reflection_; delete ListServiceResponse::default_instance_; delete ListServiceResponse_reflection_; + delete ServiceResponse::default_instance_; + delete ServiceResponse_reflection_; delete ErrorResponse::default_instance_; delete ErrorResponse_reflection_; } @@ -260,49 +304,57 @@ void protobuf_AddDesc_reflection_2eproto() { ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n\020reflection.proto\022\027grpc.reflection.v1al" - "pha\"\214\002\n\031DescriptorDatabaseRequest\022\014\n\004hos" - "t\030\001 \001(\t\022\032\n\020file_by_filename\030\003 \001(\tH\000\022 \n\026f" - "ile_containing_symbol\030\004 \001(\tH\000\022N\n\031file_co" - "ntaining_extension\030\005 \001(\0132).grpc.reflecti" - "on.v1alpha.ExtensionRequestH\000\022\'\n\035all_ext" - "ension_numbers_of_type\030\006 \001(\tH\000\022\027\n\rlist_s" - "ervices\030\007 \001(\tH\000B\021\n\017message_request\"E\n\020Ex" - "tensionRequest\022\027\n\017containing_type\030\001 \001(\t\022" - "\030\n\020extension_number\030\002 \001(\005\"\241\003\n\032Descriptor" - "DatabaseResponse\022\022\n\nvalid_host\030\001 \001(\t\022L\n\020" - "original_request\030\002 \001(\01322.grpc.reflection" - ".v1alpha.DescriptorDatabaseRequest\022\037\n\025fi" - "le_descriptor_proto\030\004 \001(\014H\000\022Z\n\036all_exten" - "sion_numbers_response\030\005 \001(\01320.grpc.refle" - "ction.v1alpha.ExtensionNumberResponseH\000\022" - "N\n\026list_services_response\030\006 \001(\0132,.grpc.r" - "eflection.v1alpha.ListServiceResponseH\000\022" - "@\n\016error_response\030\007 \001(\0132&.grpc.reflectio" - "n.v1alpha.ErrorResponseH\000B\022\n\020message_res" - "ponse\"K\n\027ExtensionNumberResponse\022\026\n\016base" - "_type_name\030\001 \001(\t\022\030\n\020extension_number\030\002 \003" - "(\005\"&\n\023ListServiceResponse\022\017\n\007service\030\001 \003" - "(\t\":\n\rErrorResponse\022\022\n\nerror_code\030\001 \001(\005\022" - "\025\n\rerror_message\030\002 \001(\t2\232\001\n\020ServerReflect" - "ion\022\205\001\n\026DescriptorDatabaseInfo\0222.grpc.re" - "flection.v1alpha.DescriptorDatabaseReque" - "st\0323.grpc.reflection.v1alpha.DescriptorD" - "atabaseResponse(\0010\001b\006proto3", 1147); + "pha\"\212\002\n\027ServerReflectionRequest\022\014\n\004host\030" + "\001 \001(\t\022\032\n\020file_by_filename\030\003 \001(\tH\000\022 \n\026fil" + "e_containing_symbol\030\004 \001(\tH\000\022N\n\031file_cont" + "aining_extension\030\005 \001(\0132).grpc.reflection" + ".v1alpha.ExtensionRequestH\000\022\'\n\035all_exten" + "sion_numbers_of_type\030\006 \001(\tH\000\022\027\n\rlist_ser" + "vices\030\007 \001(\tH\000B\021\n\017message_request\"E\n\020Exte" + "nsionRequest\022\027\n\017containing_type\030\001 \001(\t\022\030\n" + "\020extension_number\030\002 \001(\005\"\321\003\n\030ServerReflec" + "tionResponse\022\022\n\nvalid_host\030\001 \001(\t\022J\n\020orig" + "inal_request\030\002 \001(\01320.grpc.reflection.v1a" + "lpha.ServerReflectionRequest\022S\n\030file_des" + "criptor_response\030\004 \001(\0132/.grpc.reflection" + ".v1alpha.FileDescriptorResponseH\000\022Z\n\036all" + "_extension_numbers_response\030\005 \001(\01320.grpc" + ".reflection.v1alpha.ExtensionNumberRespo" + "nseH\000\022N\n\026list_services_response\030\006 \001(\0132,." + "grpc.reflection.v1alpha.ListServiceRespo" + "nseH\000\022@\n\016error_response\030\007 \001(\0132&.grpc.ref" + "lection.v1alpha.ErrorResponseH\000B\022\n\020messa" + "ge_response\"7\n\026FileDescriptorResponse\022\035\n" + "\025file_descriptor_proto\030\001 \003(\014\"K\n\027Extensio" + "nNumberResponse\022\026\n\016base_type_name\030\001 \001(\t\022" + "\030\n\020extension_number\030\002 \003(\005\"P\n\023ListService" + "Response\0229\n\007service\030\001 \003(\0132(.grpc.reflect" + "ion.v1alpha.ServiceResponse\"\037\n\017ServiceRe" + "sponse\022\014\n\004name\030\001 \001(\t\":\n\rErrorResponse\022\022\n" + "\nerror_code\030\001 \001(\005\022\025\n\rerror_message\030\002 \001(\t" + "2\223\001\n\020ServerReflection\022\177\n\024ServerReflectio" + "nInfo\0220.grpc.reflection.v1alpha.ServerRe" + "flectionRequest\0321.grpc.reflection.v1alph" + "a.ServerReflectionResponse(\0010\001b\006proto3", 1318); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "reflection.proto", &protobuf_RegisterTypes); - DescriptorDatabaseRequest::default_instance_ = new DescriptorDatabaseRequest(); - DescriptorDatabaseRequest_default_oneof_instance_ = new DescriptorDatabaseRequestOneofInstance(); + ServerReflectionRequest::default_instance_ = new ServerReflectionRequest(); + ServerReflectionRequest_default_oneof_instance_ = new ServerReflectionRequestOneofInstance(); ExtensionRequest::default_instance_ = new ExtensionRequest(); - DescriptorDatabaseResponse::default_instance_ = new DescriptorDatabaseResponse(); - DescriptorDatabaseResponse_default_oneof_instance_ = new DescriptorDatabaseResponseOneofInstance(); + ServerReflectionResponse::default_instance_ = new ServerReflectionResponse(); + ServerReflectionResponse_default_oneof_instance_ = new ServerReflectionResponseOneofInstance(); + FileDescriptorResponse::default_instance_ = new FileDescriptorResponse(); ExtensionNumberResponse::default_instance_ = new ExtensionNumberResponse(); ListServiceResponse::default_instance_ = new ListServiceResponse(); + ServiceResponse::default_instance_ = new ServiceResponse(); ErrorResponse::default_instance_ = new ErrorResponse(); - DescriptorDatabaseRequest::default_instance_->InitAsDefaultInstance(); + ServerReflectionRequest::default_instance_->InitAsDefaultInstance(); ExtensionRequest::default_instance_->InitAsDefaultInstance(); - DescriptorDatabaseResponse::default_instance_->InitAsDefaultInstance(); + ServerReflectionResponse::default_instance_->InitAsDefaultInstance(); + FileDescriptorResponse::default_instance_->InitAsDefaultInstance(); ExtensionNumberResponse::default_instance_->InitAsDefaultInstance(); ListServiceResponse::default_instance_->InitAsDefaultInstance(); + ServiceResponse::default_instance_->InitAsDefaultInstance(); ErrorResponse::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_reflection_2eproto); } @@ -327,38 +379,38 @@ static void MergeFromFail(int line) { // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int DescriptorDatabaseRequest::kHostFieldNumber; -const int DescriptorDatabaseRequest::kFileByFilenameFieldNumber; -const int DescriptorDatabaseRequest::kFileContainingSymbolFieldNumber; -const int DescriptorDatabaseRequest::kFileContainingExtensionFieldNumber; -const int DescriptorDatabaseRequest::kAllExtensionNumbersOfTypeFieldNumber; -const int DescriptorDatabaseRequest::kListServicesFieldNumber; +const int ServerReflectionRequest::kHostFieldNumber; +const int ServerReflectionRequest::kFileByFilenameFieldNumber; +const int ServerReflectionRequest::kFileContainingSymbolFieldNumber; +const int ServerReflectionRequest::kFileContainingExtensionFieldNumber; +const int ServerReflectionRequest::kAllExtensionNumbersOfTypeFieldNumber; +const int ServerReflectionRequest::kListServicesFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -DescriptorDatabaseRequest::DescriptorDatabaseRequest() +ServerReflectionRequest::ServerReflectionRequest() : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ServerReflectionRequest) } -void DescriptorDatabaseRequest::InitAsDefaultInstance() { +void ServerReflectionRequest::InitAsDefaultInstance() { _is_default_instance_ = true; - DescriptorDatabaseRequest_default_oneof_instance_->file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - DescriptorDatabaseRequest_default_oneof_instance_->file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - DescriptorDatabaseRequest_default_oneof_instance_->file_containing_extension_ = const_cast< ::grpc::reflection::v1alpha::ExtensionRequest*>(&::grpc::reflection::v1alpha::ExtensionRequest::default_instance()); - DescriptorDatabaseRequest_default_oneof_instance_->all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - DescriptorDatabaseRequest_default_oneof_instance_->list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ServerReflectionRequest_default_oneof_instance_->file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ServerReflectionRequest_default_oneof_instance_->file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ServerReflectionRequest_default_oneof_instance_->file_containing_extension_ = const_cast< ::grpc::reflection::v1alpha::ExtensionRequest*>(&::grpc::reflection::v1alpha::ExtensionRequest::default_instance()); + ServerReflectionRequest_default_oneof_instance_->all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ServerReflectionRequest_default_oneof_instance_->list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -DescriptorDatabaseRequest::DescriptorDatabaseRequest(const DescriptorDatabaseRequest& from) +ServerReflectionRequest::ServerReflectionRequest(const ServerReflectionRequest& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ServerReflectionRequest) } -void DescriptorDatabaseRequest::SharedCtor() { +void ServerReflectionRequest::SharedCtor() { _is_default_instance_ = false; ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; @@ -366,12 +418,12 @@ void DescriptorDatabaseRequest::SharedCtor() { clear_has_message_request(); } -DescriptorDatabaseRequest::~DescriptorDatabaseRequest() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.DescriptorDatabaseRequest) +ServerReflectionRequest::~ServerReflectionRequest() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ServerReflectionRequest) SharedDtor(); } -void DescriptorDatabaseRequest::SharedDtor() { +void ServerReflectionRequest::SharedDtor() { host_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (has_message_request()) { clear_message_request(); @@ -380,32 +432,32 @@ void DescriptorDatabaseRequest::SharedDtor() { } } -void DescriptorDatabaseRequest::SetCachedSize(int size) const { +void ServerReflectionRequest::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } -const ::google::protobuf::Descriptor* DescriptorDatabaseRequest::descriptor() { +const ::google::protobuf::Descriptor* ServerReflectionRequest::descriptor() { protobuf_AssignDescriptorsOnce(); - return DescriptorDatabaseRequest_descriptor_; + return ServerReflectionRequest_descriptor_; } -const DescriptorDatabaseRequest& DescriptorDatabaseRequest::default_instance() { +const ServerReflectionRequest& ServerReflectionRequest::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); return *default_instance_; } -DescriptorDatabaseRequest* DescriptorDatabaseRequest::default_instance_ = NULL; +ServerReflectionRequest* ServerReflectionRequest::default_instance_ = NULL; -DescriptorDatabaseRequest* DescriptorDatabaseRequest::New(::google::protobuf::Arena* arena) const { - DescriptorDatabaseRequest* n = new DescriptorDatabaseRequest; +ServerReflectionRequest* ServerReflectionRequest::New(::google::protobuf::Arena* arena) const { + ServerReflectionRequest* n = new ServerReflectionRequest; if (arena != NULL) { arena->Own(n); } return n; } -void DescriptorDatabaseRequest::clear_message_request() { +void ServerReflectionRequest::clear_message_request() { switch(message_request_case()) { case kFileByFilename: { message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -435,16 +487,16 @@ void DescriptorDatabaseRequest::clear_message_request() { } -void DescriptorDatabaseRequest::Clear() { +void ServerReflectionRequest::Clear() { host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_message_request(); } -bool DescriptorDatabaseRequest::MergePartialFromCodedStream( +bool ServerReflectionRequest::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ServerReflectionRequest) for (;;) { ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; @@ -458,7 +510,7 @@ bool DescriptorDatabaseRequest::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->host().data(), this->host().length(), ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.host")); + "grpc.reflection.v1alpha.ServerReflectionRequest.host")); } else { goto handle_unusual; } @@ -475,7 +527,7 @@ bool DescriptorDatabaseRequest::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->file_by_filename().data(), this->file_by_filename().length(), ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename")); + "grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename")); } else { goto handle_unusual; } @@ -492,7 +544,7 @@ bool DescriptorDatabaseRequest::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->file_containing_symbol().data(), this->file_containing_symbol().length(), ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol")); + "grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol")); } else { goto handle_unusual; } @@ -522,7 +574,7 @@ bool DescriptorDatabaseRequest::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->all_extension_numbers_of_type().data(), this->all_extension_numbers_of_type().length(), ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type")); + "grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type")); } else { goto handle_unusual; } @@ -539,7 +591,7 @@ bool DescriptorDatabaseRequest::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->list_services().data(), this->list_services().length(), ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services")); + "grpc.reflection.v1alpha.ServerReflectionRequest.list_services")); } else { goto handle_unusual; } @@ -560,23 +612,23 @@ bool DescriptorDatabaseRequest::MergePartialFromCodedStream( } } success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ServerReflectionRequest) return true; failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ServerReflectionRequest) return false; #undef DO_ } -void DescriptorDatabaseRequest::SerializeWithCachedSizes( +void ServerReflectionRequest::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ServerReflectionRequest) // optional string host = 1; if (this->host().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->host().data(), this->host().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.host"); + "grpc.reflection.v1alpha.ServerReflectionRequest.host"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 1, this->host(), output); } @@ -586,7 +638,7 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->file_by_filename().data(), this->file_by_filename().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename"); + "grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 3, this->file_by_filename(), output); } @@ -596,7 +648,7 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->file_containing_symbol().data(), this->file_containing_symbol().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol"); + "grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 4, this->file_containing_symbol(), output); } @@ -612,7 +664,7 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->all_extension_numbers_of_type().data(), this->all_extension_numbers_of_type().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type"); + "grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 6, this->all_extension_numbers_of_type(), output); } @@ -622,23 +674,23 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->list_services().data(), this->list_services().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services"); + "grpc.reflection.v1alpha.ServerReflectionRequest.list_services"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 7, this->list_services(), output); } - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ServerReflectionRequest) } -::google::protobuf::uint8* DescriptorDatabaseRequest::SerializeWithCachedSizesToArray( +::google::protobuf::uint8* ServerReflectionRequest::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ServerReflectionRequest) // optional string host = 1; if (this->host().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->host().data(), this->host().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.host"); + "grpc.reflection.v1alpha.ServerReflectionRequest.host"); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->host(), target); @@ -649,7 +701,7 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->file_by_filename().data(), this->file_by_filename().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename"); + "grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename"); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 3, this->file_by_filename(), target); @@ -660,7 +712,7 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->file_containing_symbol().data(), this->file_containing_symbol().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol"); + "grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol"); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 4, this->file_containing_symbol(), target); @@ -678,7 +730,7 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->all_extension_numbers_of_type().data(), this->all_extension_numbers_of_type().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type"); + "grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type"); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 6, this->all_extension_numbers_of_type(), target); @@ -689,17 +741,17 @@ void DescriptorDatabaseRequest::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->list_services().data(), this->list_services().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services"); + "grpc.reflection.v1alpha.ServerReflectionRequest.list_services"); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 7, this->list_services(), target); } - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.DescriptorDatabaseRequest) + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ServerReflectionRequest) return target; } -int DescriptorDatabaseRequest::ByteSize() const { +int ServerReflectionRequest::ByteSize() const { int total_size = 0; // optional string host = 1; @@ -755,10 +807,10 @@ int DescriptorDatabaseRequest::ByteSize() const { return total_size; } -void DescriptorDatabaseRequest::MergeFrom(const ::google::protobuf::Message& from) { +void ServerReflectionRequest::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const DescriptorDatabaseRequest* source = - ::google::protobuf::internal::DynamicCastToGenerated( + const ServerReflectionRequest* source = + ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); @@ -767,7 +819,7 @@ void DescriptorDatabaseRequest::MergeFrom(const ::google::protobuf::Message& fro } } -void DescriptorDatabaseRequest::MergeFrom(const DescriptorDatabaseRequest& from) { +void ServerReflectionRequest::MergeFrom(const ServerReflectionRequest& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); switch (from.message_request_case()) { case kFileByFilename: { @@ -800,28 +852,28 @@ void DescriptorDatabaseRequest::MergeFrom(const DescriptorDatabaseRequest& from) } } -void DescriptorDatabaseRequest::CopyFrom(const ::google::protobuf::Message& from) { +void ServerReflectionRequest::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } -void DescriptorDatabaseRequest::CopyFrom(const DescriptorDatabaseRequest& from) { +void ServerReflectionRequest::CopyFrom(const ServerReflectionRequest& from) { if (&from == this) return; Clear(); MergeFrom(from); } -bool DescriptorDatabaseRequest::IsInitialized() const { +bool ServerReflectionRequest::IsInitialized() const { return true; } -void DescriptorDatabaseRequest::Swap(DescriptorDatabaseRequest* other) { +void ServerReflectionRequest::Swap(ServerReflectionRequest* other) { if (other == this) return; InternalSwap(other); } -void DescriptorDatabaseRequest::InternalSwap(DescriptorDatabaseRequest* other) { +void ServerReflectionRequest::InternalSwap(ServerReflectionRequest* other) { host_.Swap(&other->host_); std::swap(message_request_, other->message_request_); std::swap(_oneof_case_[0], other->_oneof_case_[0]); @@ -829,91 +881,91 @@ void DescriptorDatabaseRequest::InternalSwap(DescriptorDatabaseRequest* other) { std::swap(_cached_size_, other->_cached_size_); } -::google::protobuf::Metadata DescriptorDatabaseRequest::GetMetadata() const { +::google::protobuf::Metadata ServerReflectionRequest::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; - metadata.descriptor = DescriptorDatabaseRequest_descriptor_; - metadata.reflection = DescriptorDatabaseRequest_reflection_; + metadata.descriptor = ServerReflectionRequest_descriptor_; + metadata.reflection = ServerReflectionRequest_reflection_; return metadata; } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// DescriptorDatabaseRequest +// ServerReflectionRequest // optional string host = 1; -void DescriptorDatabaseRequest::clear_host() { +void ServerReflectionRequest::clear_host() { host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& DescriptorDatabaseRequest::host() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + const ::std::string& ServerReflectionRequest::host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void DescriptorDatabaseRequest::set_host(const ::std::string& value) { + void ServerReflectionRequest::set_host(const ::std::string& value) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.host) } - void DescriptorDatabaseRequest::set_host(const char* value) { + void ServerReflectionRequest::set_host(const char* value) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.host) } - void DescriptorDatabaseRequest::set_host(const char* value, size_t size) { + void ServerReflectionRequest::set_host(const char* value, size_t size) { host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.host) } - ::std::string* DescriptorDatabaseRequest::mutable_host() { + ::std::string* ServerReflectionRequest::mutable_host() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* DescriptorDatabaseRequest::release_host() { + ::std::string* ServerReflectionRequest::release_host() { return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void DescriptorDatabaseRequest::set_allocated_host(::std::string* host) { + void ServerReflectionRequest::set_allocated_host(::std::string* host) { if (host != NULL) { } else { } host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), host); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.host) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.host) } // optional string file_by_filename = 3; -bool DescriptorDatabaseRequest::has_file_by_filename() const { +bool ServerReflectionRequest::has_file_by_filename() const { return message_request_case() == kFileByFilename; } -void DescriptorDatabaseRequest::set_has_file_by_filename() { +void ServerReflectionRequest::set_has_file_by_filename() { _oneof_case_[0] = kFileByFilename; } -void DescriptorDatabaseRequest::clear_file_by_filename() { +void ServerReflectionRequest::clear_file_by_filename() { if (has_file_by_filename()) { message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } - const ::std::string& DescriptorDatabaseRequest::file_by_filename() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + const ::std::string& ServerReflectionRequest::file_by_filename() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (has_file_by_filename()) { return message_request_.file_by_filename_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void DescriptorDatabaseRequest::set_file_by_filename(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + void ServerReflectionRequest::set_file_by_filename(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } - void DescriptorDatabaseRequest::set_file_by_filename(const char* value) { + void ServerReflectionRequest::set_file_by_filename(const char* value) { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); @@ -921,9 +973,9 @@ void DescriptorDatabaseRequest::clear_file_by_filename() { } message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } - void DescriptorDatabaseRequest::set_file_by_filename(const char* value, size_t size) { + void ServerReflectionRequest::set_file_by_filename(const char* value, size_t size) { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); @@ -931,18 +983,18 @@ void DescriptorDatabaseRequest::clear_file_by_filename() { } message_request_.file_by_filename_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } - ::std::string* DescriptorDatabaseRequest::mutable_file_by_filename() { + ::std::string* ServerReflectionRequest::mutable_file_by_filename() { if (!has_file_by_filename()) { clear_message_request(); set_has_file_by_filename(); message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* DescriptorDatabaseRequest::release_file_by_filename() { + ::std::string* ServerReflectionRequest::release_file_by_filename() { if (has_file_by_filename()) { clear_has_message_request(); return message_request_.file_by_filename_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -950,7 +1002,7 @@ void DescriptorDatabaseRequest::clear_file_by_filename() { return NULL; } } - void DescriptorDatabaseRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { + void ServerReflectionRequest::set_allocated_file_by_filename(::std::string* file_by_filename) { if (!has_file_by_filename()) { message_request_.file_by_filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -960,40 +1012,40 @@ void DescriptorDatabaseRequest::clear_file_by_filename() { message_request_.file_by_filename_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_by_filename); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_by_filename) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) } // optional string file_containing_symbol = 4; -bool DescriptorDatabaseRequest::has_file_containing_symbol() const { +bool ServerReflectionRequest::has_file_containing_symbol() const { return message_request_case() == kFileContainingSymbol; } -void DescriptorDatabaseRequest::set_has_file_containing_symbol() { +void ServerReflectionRequest::set_has_file_containing_symbol() { _oneof_case_[0] = kFileContainingSymbol; } -void DescriptorDatabaseRequest::clear_file_containing_symbol() { +void ServerReflectionRequest::clear_file_containing_symbol() { if (has_file_containing_symbol()) { message_request_.file_containing_symbol_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } - const ::std::string& DescriptorDatabaseRequest::file_containing_symbol() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + const ::std::string& ServerReflectionRequest::file_containing_symbol() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (has_file_containing_symbol()) { return message_request_.file_containing_symbol_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void DescriptorDatabaseRequest::set_file_containing_symbol(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + void ServerReflectionRequest::set_file_containing_symbol(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } - void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value) { + void ServerReflectionRequest::set_file_containing_symbol(const char* value) { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); @@ -1001,9 +1053,9 @@ void DescriptorDatabaseRequest::clear_file_containing_symbol() { } message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } - void DescriptorDatabaseRequest::set_file_containing_symbol(const char* value, size_t size) { + void ServerReflectionRequest::set_file_containing_symbol(const char* value, size_t size) { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); @@ -1011,18 +1063,18 @@ void DescriptorDatabaseRequest::clear_file_containing_symbol() { } message_request_.file_containing_symbol_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } - ::std::string* DescriptorDatabaseRequest::mutable_file_containing_symbol() { + ::std::string* ServerReflectionRequest::mutable_file_containing_symbol() { if (!has_file_containing_symbol()) { clear_message_request(); set_has_file_containing_symbol(); message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* DescriptorDatabaseRequest::release_file_containing_symbol() { + ::std::string* ServerReflectionRequest::release_file_containing_symbol() { if (has_file_containing_symbol()) { clear_has_message_request(); return message_request_.file_containing_symbol_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1030,7 +1082,7 @@ void DescriptorDatabaseRequest::clear_file_containing_symbol() { return NULL; } } - void DescriptorDatabaseRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { + void ServerReflectionRequest::set_allocated_file_containing_symbol(::std::string* file_containing_symbol) { if (!has_file_containing_symbol()) { message_request_.file_containing_symbol_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1040,38 +1092,38 @@ void DescriptorDatabaseRequest::clear_file_containing_symbol() { message_request_.file_containing_symbol_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_containing_symbol); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_symbol) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) } // optional .grpc.reflection.v1alpha.ExtensionRequest file_containing_extension = 5; -bool DescriptorDatabaseRequest::has_file_containing_extension() const { +bool ServerReflectionRequest::has_file_containing_extension() const { return message_request_case() == kFileContainingExtension; } -void DescriptorDatabaseRequest::set_has_file_containing_extension() { +void ServerReflectionRequest::set_has_file_containing_extension() { _oneof_case_[0] = kFileContainingExtension; } -void DescriptorDatabaseRequest::clear_file_containing_extension() { +void ServerReflectionRequest::clear_file_containing_extension() { if (has_file_containing_extension()) { delete message_request_.file_containing_extension_; clear_has_message_request(); } } - const ::grpc::reflection::v1alpha::ExtensionRequest& DescriptorDatabaseRequest::file_containing_extension() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + const ::grpc::reflection::v1alpha::ExtensionRequest& ServerReflectionRequest::file_containing_extension() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) return has_file_containing_extension() ? *message_request_.file_containing_extension_ : ::grpc::reflection::v1alpha::ExtensionRequest::default_instance(); } -::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::mutable_file_containing_extension() { +::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::mutable_file_containing_extension() { if (!has_file_containing_extension()) { clear_message_request(); set_has_file_containing_extension(); message_request_.file_containing_extension_ = new ::grpc::reflection::v1alpha::ExtensionRequest; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) return message_request_.file_containing_extension_; } -::grpc::reflection::v1alpha::ExtensionRequest* DescriptorDatabaseRequest::release_file_containing_extension() { +::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::release_file_containing_extension() { if (has_file_containing_extension()) { clear_has_message_request(); ::grpc::reflection::v1alpha::ExtensionRequest* temp = message_request_.file_containing_extension_; @@ -1081,46 +1133,46 @@ void DescriptorDatabaseRequest::clear_file_containing_extension() { return NULL; } } -void DescriptorDatabaseRequest::set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension) { +void ServerReflectionRequest::set_allocated_file_containing_extension(::grpc::reflection::v1alpha::ExtensionRequest* file_containing_extension) { clear_message_request(); if (file_containing_extension) { set_has_file_containing_extension(); message_request_.file_containing_extension_ = file_containing_extension; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.file_containing_extension) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) } // optional string all_extension_numbers_of_type = 6; -bool DescriptorDatabaseRequest::has_all_extension_numbers_of_type() const { +bool ServerReflectionRequest::has_all_extension_numbers_of_type() const { return message_request_case() == kAllExtensionNumbersOfType; } -void DescriptorDatabaseRequest::set_has_all_extension_numbers_of_type() { +void ServerReflectionRequest::set_has_all_extension_numbers_of_type() { _oneof_case_[0] = kAllExtensionNumbersOfType; } -void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { +void ServerReflectionRequest::clear_all_extension_numbers_of_type() { if (has_all_extension_numbers_of_type()) { message_request_.all_extension_numbers_of_type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } - const ::std::string& DescriptorDatabaseRequest::all_extension_numbers_of_type() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + const ::std::string& ServerReflectionRequest::all_extension_numbers_of_type() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (has_all_extension_numbers_of_type()) { return message_request_.all_extension_numbers_of_type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + void ServerReflectionRequest::set_all_extension_numbers_of_type(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } - void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value) { + void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value) { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); @@ -1128,9 +1180,9 @@ void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { } message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } - void DescriptorDatabaseRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { + void ServerReflectionRequest::set_all_extension_numbers_of_type(const char* value, size_t size) { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); @@ -1138,18 +1190,18 @@ void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { } message_request_.all_extension_numbers_of_type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } - ::std::string* DescriptorDatabaseRequest::mutable_all_extension_numbers_of_type() { + ::std::string* ServerReflectionRequest::mutable_all_extension_numbers_of_type() { if (!has_all_extension_numbers_of_type()) { clear_message_request(); set_has_all_extension_numbers_of_type(); message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* DescriptorDatabaseRequest::release_all_extension_numbers_of_type() { + ::std::string* ServerReflectionRequest::release_all_extension_numbers_of_type() { if (has_all_extension_numbers_of_type()) { clear_has_message_request(); return message_request_.all_extension_numbers_of_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1157,7 +1209,7 @@ void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { return NULL; } } - void DescriptorDatabaseRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { + void ServerReflectionRequest::set_allocated_all_extension_numbers_of_type(::std::string* all_extension_numbers_of_type) { if (!has_all_extension_numbers_of_type()) { message_request_.all_extension_numbers_of_type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1167,40 +1219,40 @@ void DescriptorDatabaseRequest::clear_all_extension_numbers_of_type() { message_request_.all_extension_numbers_of_type_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), all_extension_numbers_of_type); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.all_extension_numbers_of_type) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) } // optional string list_services = 7; -bool DescriptorDatabaseRequest::has_list_services() const { +bool ServerReflectionRequest::has_list_services() const { return message_request_case() == kListServices; } -void DescriptorDatabaseRequest::set_has_list_services() { +void ServerReflectionRequest::set_has_list_services() { _oneof_case_[0] = kListServices; } -void DescriptorDatabaseRequest::clear_list_services() { +void ServerReflectionRequest::clear_list_services() { if (has_list_services()) { message_request_.list_services_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_has_message_request(); } } - const ::std::string& DescriptorDatabaseRequest::list_services() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + const ::std::string& ServerReflectionRequest::list_services() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (has_list_services()) { return message_request_.list_services_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); } - void DescriptorDatabaseRequest::set_list_services(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + void ServerReflectionRequest::set_list_services(const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (!has_list_services()) { clear_message_request(); set_has_list_services(); message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } - void DescriptorDatabaseRequest::set_list_services(const char* value) { + void ServerReflectionRequest::set_list_services(const char* value) { if (!has_list_services()) { clear_message_request(); set_has_list_services(); @@ -1208,9 +1260,9 @@ void DescriptorDatabaseRequest::clear_list_services() { } message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } - void DescriptorDatabaseRequest::set_list_services(const char* value, size_t size) { + void ServerReflectionRequest::set_list_services(const char* value, size_t size) { if (!has_list_services()) { clear_message_request(); set_has_list_services(); @@ -1218,18 +1270,18 @@ void DescriptorDatabaseRequest::clear_list_services() { } message_request_.list_services_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } - ::std::string* DescriptorDatabaseRequest::mutable_list_services() { + ::std::string* ServerReflectionRequest::mutable_list_services() { if (!has_list_services()) { clear_message_request(); set_has_list_services(); message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* DescriptorDatabaseRequest::release_list_services() { + ::std::string* ServerReflectionRequest::release_list_services() { if (has_list_services()) { clear_has_message_request(); return message_request_.list_services_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1237,7 +1289,7 @@ void DescriptorDatabaseRequest::clear_list_services() { return NULL; } } - void DescriptorDatabaseRequest::set_allocated_list_services(::std::string* list_services) { + void ServerReflectionRequest::set_allocated_list_services(::std::string* list_services) { if (!has_list_services()) { message_request_.list_services_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1247,17 +1299,17 @@ void DescriptorDatabaseRequest::clear_list_services() { message_request_.list_services_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), list_services); } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseRequest.list_services) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) } -bool DescriptorDatabaseRequest::has_message_request() const { +bool ServerReflectionRequest::has_message_request() const { return message_request_case() != MESSAGE_REQUEST_NOT_SET; } -void DescriptorDatabaseRequest::clear_has_message_request() { +void ServerReflectionRequest::clear_has_message_request() { _oneof_case_[0] = MESSAGE_REQUEST_NOT_SET; } -DescriptorDatabaseRequest::MessageRequestCase DescriptorDatabaseRequest::message_request_case() const { - return DescriptorDatabaseRequest::MessageRequestCase(_oneof_case_[0]); +ServerReflectionRequest::MessageRequestCase ServerReflectionRequest::message_request_case() const { + return ServerReflectionRequest::MessageRequestCase(_oneof_case_[0]); } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS @@ -1588,38 +1640,38 @@ void ExtensionRequest::clear_extension_number() { // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int DescriptorDatabaseResponse::kValidHostFieldNumber; -const int DescriptorDatabaseResponse::kOriginalRequestFieldNumber; -const int DescriptorDatabaseResponse::kFileDescriptorProtoFieldNumber; -const int DescriptorDatabaseResponse::kAllExtensionNumbersResponseFieldNumber; -const int DescriptorDatabaseResponse::kListServicesResponseFieldNumber; -const int DescriptorDatabaseResponse::kErrorResponseFieldNumber; +const int ServerReflectionResponse::kValidHostFieldNumber; +const int ServerReflectionResponse::kOriginalRequestFieldNumber; +const int ServerReflectionResponse::kFileDescriptorResponseFieldNumber; +const int ServerReflectionResponse::kAllExtensionNumbersResponseFieldNumber; +const int ServerReflectionResponse::kListServicesResponseFieldNumber; +const int ServerReflectionResponse::kErrorResponseFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -DescriptorDatabaseResponse::DescriptorDatabaseResponse() +ServerReflectionResponse::ServerReflectionResponse() : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); - // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ServerReflectionResponse) } -void DescriptorDatabaseResponse::InitAsDefaultInstance() { +void ServerReflectionResponse::InitAsDefaultInstance() { _is_default_instance_ = true; - original_request_ = const_cast< ::grpc::reflection::v1alpha::DescriptorDatabaseRequest*>(&::grpc::reflection::v1alpha::DescriptorDatabaseRequest::default_instance()); - DescriptorDatabaseResponse_default_oneof_instance_->file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - DescriptorDatabaseResponse_default_oneof_instance_->all_extension_numbers_response_ = const_cast< ::grpc::reflection::v1alpha::ExtensionNumberResponse*>(&::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance()); - DescriptorDatabaseResponse_default_oneof_instance_->list_services_response_ = const_cast< ::grpc::reflection::v1alpha::ListServiceResponse*>(&::grpc::reflection::v1alpha::ListServiceResponse::default_instance()); - DescriptorDatabaseResponse_default_oneof_instance_->error_response_ = const_cast< ::grpc::reflection::v1alpha::ErrorResponse*>(&::grpc::reflection::v1alpha::ErrorResponse::default_instance()); + original_request_ = const_cast< ::grpc::reflection::v1alpha::ServerReflectionRequest*>(&::grpc::reflection::v1alpha::ServerReflectionRequest::default_instance()); + ServerReflectionResponse_default_oneof_instance_->file_descriptor_response_ = const_cast< ::grpc::reflection::v1alpha::FileDescriptorResponse*>(&::grpc::reflection::v1alpha::FileDescriptorResponse::default_instance()); + ServerReflectionResponse_default_oneof_instance_->all_extension_numbers_response_ = const_cast< ::grpc::reflection::v1alpha::ExtensionNumberResponse*>(&::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance()); + ServerReflectionResponse_default_oneof_instance_->list_services_response_ = const_cast< ::grpc::reflection::v1alpha::ListServiceResponse*>(&::grpc::reflection::v1alpha::ListServiceResponse::default_instance()); + ServerReflectionResponse_default_oneof_instance_->error_response_ = const_cast< ::grpc::reflection::v1alpha::ErrorResponse*>(&::grpc::reflection::v1alpha::ErrorResponse::default_instance()); } -DescriptorDatabaseResponse::DescriptorDatabaseResponse(const DescriptorDatabaseResponse& from) +ServerReflectionResponse::ServerReflectionResponse(const ServerReflectionResponse& from) : ::google::protobuf::Message(), _internal_metadata_(NULL) { SharedCtor(); MergeFrom(from); - // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ServerReflectionResponse) } -void DescriptorDatabaseResponse::SharedCtor() { +void ServerReflectionResponse::SharedCtor() { _is_default_instance_ = false; ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; @@ -1628,12 +1680,12 @@ void DescriptorDatabaseResponse::SharedCtor() { clear_has_message_response(); } -DescriptorDatabaseResponse::~DescriptorDatabaseResponse() { - // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.DescriptorDatabaseResponse) +ServerReflectionResponse::~ServerReflectionResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ServerReflectionResponse) SharedDtor(); } -void DescriptorDatabaseResponse::SharedDtor() { +void ServerReflectionResponse::SharedDtor() { valid_host_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (has_message_response()) { clear_message_response(); @@ -1643,35 +1695,35 @@ void DescriptorDatabaseResponse::SharedDtor() { } } -void DescriptorDatabaseResponse::SetCachedSize(int size) const { +void ServerReflectionResponse::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); } -const ::google::protobuf::Descriptor* DescriptorDatabaseResponse::descriptor() { +const ::google::protobuf::Descriptor* ServerReflectionResponse::descriptor() { protobuf_AssignDescriptorsOnce(); - return DescriptorDatabaseResponse_descriptor_; + return ServerReflectionResponse_descriptor_; } -const DescriptorDatabaseResponse& DescriptorDatabaseResponse::default_instance() { +const ServerReflectionResponse& ServerReflectionResponse::default_instance() { if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); return *default_instance_; } -DescriptorDatabaseResponse* DescriptorDatabaseResponse::default_instance_ = NULL; +ServerReflectionResponse* ServerReflectionResponse::default_instance_ = NULL; -DescriptorDatabaseResponse* DescriptorDatabaseResponse::New(::google::protobuf::Arena* arena) const { - DescriptorDatabaseResponse* n = new DescriptorDatabaseResponse; +ServerReflectionResponse* ServerReflectionResponse::New(::google::protobuf::Arena* arena) const { + ServerReflectionResponse* n = new ServerReflectionResponse; if (arena != NULL) { arena->Own(n); } return n; } -void DescriptorDatabaseResponse::clear_message_response() { +void ServerReflectionResponse::clear_message_response() { switch(message_response_case()) { - case kFileDescriptorProto: { - message_response_.file_descriptor_proto_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + case kFileDescriptorResponse: { + delete message_response_.file_descriptor_response_; break; } case kAllExtensionNumbersResponse: { @@ -1694,18 +1746,18 @@ void DescriptorDatabaseResponse::clear_message_response() { } -void DescriptorDatabaseResponse::Clear() { +void ServerReflectionResponse::Clear() { valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; original_request_ = NULL; clear_message_response(); } -bool DescriptorDatabaseResponse::MergePartialFromCodedStream( +bool ServerReflectionResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; - // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ServerReflectionResponse) for (;;) { ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); tag = p.first; @@ -1719,7 +1771,7 @@ bool DescriptorDatabaseResponse::MergePartialFromCodedStream( DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->valid_host().data(), this->valid_host().length(), ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host")); + "grpc.reflection.v1alpha.ServerReflectionResponse.valid_host")); } else { goto handle_unusual; } @@ -1727,7 +1779,7 @@ bool DescriptorDatabaseResponse::MergePartialFromCodedStream( break; } - // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; case 2: { if (tag == 18) { parse_original_request: @@ -1736,16 +1788,16 @@ bool DescriptorDatabaseResponse::MergePartialFromCodedStream( } else { goto handle_unusual; } - if (input->ExpectTag(34)) goto parse_file_descriptor_proto; + if (input->ExpectTag(34)) goto parse_file_descriptor_response; break; } - // optional bytes file_descriptor_proto = 4; + // optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; case 4: { if (tag == 34) { - parse_file_descriptor_proto: - DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( - input, this->mutable_file_descriptor_proto())); + parse_file_descriptor_response: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_file_descriptor_response())); } else { goto handle_unusual; } @@ -1805,37 +1857,37 @@ bool DescriptorDatabaseResponse::MergePartialFromCodedStream( } } success: - // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ServerReflectionResponse) return true; failure: - // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ServerReflectionResponse) return false; #undef DO_ } -void DescriptorDatabaseResponse::SerializeWithCachedSizes( +void ServerReflectionResponse::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { - // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ServerReflectionResponse) // optional string valid_host = 1; if (this->valid_host().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->valid_host().data(), this->valid_host().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host"); + "grpc.reflection.v1alpha.ServerReflectionResponse.valid_host"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 1, this->valid_host(), output); } - // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; if (this->has_original_request()) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 2, *this->original_request_, output); } - // optional bytes file_descriptor_proto = 4; - if (has_file_descriptor_proto()) { - ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( - 4, this->file_descriptor_proto(), output); + // optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; + if (has_file_descriptor_response()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, *message_response_.file_descriptor_response_, output); } // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; @@ -1856,35 +1908,35 @@ void DescriptorDatabaseResponse::SerializeWithCachedSizes( 7, *message_response_.error_response_, output); } - // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ServerReflectionResponse) } -::google::protobuf::uint8* DescriptorDatabaseResponse::SerializeWithCachedSizesToArray( +::google::protobuf::uint8* ServerReflectionResponse::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { - // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ServerReflectionResponse) // optional string valid_host = 1; if (this->valid_host().size() > 0) { ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( this->valid_host().data(), this->valid_host().length(), ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host"); + "grpc.reflection.v1alpha.ServerReflectionResponse.valid_host"); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 1, this->valid_host(), target); } - // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; if (this->has_original_request()) { target = ::google::protobuf::internal::WireFormatLite:: WriteMessageNoVirtualToArray( 2, *this->original_request_, target); } - // optional bytes file_descriptor_proto = 4; - if (has_file_descriptor_proto()) { - target = - ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( - 4, this->file_descriptor_proto(), target); + // optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; + if (has_file_descriptor_response()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 4, *message_response_.file_descriptor_response_, target); } // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; @@ -1908,11 +1960,11 @@ void DescriptorDatabaseResponse::SerializeWithCachedSizes( 7, *message_response_.error_response_, target); } - // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.DescriptorDatabaseResponse) + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ServerReflectionResponse) return target; } -int DescriptorDatabaseResponse::ByteSize() const { +int ServerReflectionResponse::ByteSize() const { int total_size = 0; // optional string valid_host = 1; @@ -1922,7 +1974,7 @@ int DescriptorDatabaseResponse::ByteSize() const { this->valid_host()); } - // optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; + // optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; if (this->has_original_request()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( @@ -1930,11 +1982,11 @@ int DescriptorDatabaseResponse::ByteSize() const { } switch (message_response_case()) { - // optional bytes file_descriptor_proto = 4; - case kFileDescriptorProto: { + // optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; + case kFileDescriptorResponse: { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::BytesSize( - this->file_descriptor_proto()); + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *message_response_.file_descriptor_response_); break; } // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; @@ -1968,10 +2020,10 @@ int DescriptorDatabaseResponse::ByteSize() const { return total_size; } -void DescriptorDatabaseResponse::MergeFrom(const ::google::protobuf::Message& from) { +void ServerReflectionResponse::MergeFrom(const ::google::protobuf::Message& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); - const DescriptorDatabaseResponse* source = - ::google::protobuf::internal::DynamicCastToGenerated( + const ServerReflectionResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { ::google::protobuf::internal::ReflectionOps::Merge(from, this); @@ -1980,11 +2032,11 @@ void DescriptorDatabaseResponse::MergeFrom(const ::google::protobuf::Message& fr } } -void DescriptorDatabaseResponse::MergeFrom(const DescriptorDatabaseResponse& from) { +void ServerReflectionResponse::MergeFrom(const ServerReflectionResponse& from) { if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); switch (from.message_response_case()) { - case kFileDescriptorProto: { - set_file_descriptor_proto(from.file_descriptor_proto()); + case kFileDescriptorResponse: { + mutable_file_descriptor_response()->::grpc::reflection::v1alpha::FileDescriptorResponse::MergeFrom(from.file_descriptor_response()); break; } case kAllExtensionNumbersResponse: { @@ -2008,32 +2060,32 @@ void DescriptorDatabaseResponse::MergeFrom(const DescriptorDatabaseResponse& fro valid_host_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.valid_host_); } if (from.has_original_request()) { - mutable_original_request()->::grpc::reflection::v1alpha::DescriptorDatabaseRequest::MergeFrom(from.original_request()); + mutable_original_request()->::grpc::reflection::v1alpha::ServerReflectionRequest::MergeFrom(from.original_request()); } } -void DescriptorDatabaseResponse::CopyFrom(const ::google::protobuf::Message& from) { +void ServerReflectionResponse::CopyFrom(const ::google::protobuf::Message& from) { if (&from == this) return; Clear(); MergeFrom(from); } -void DescriptorDatabaseResponse::CopyFrom(const DescriptorDatabaseResponse& from) { +void ServerReflectionResponse::CopyFrom(const ServerReflectionResponse& from) { if (&from == this) return; Clear(); MergeFrom(from); } -bool DescriptorDatabaseResponse::IsInitialized() const { +bool ServerReflectionResponse::IsInitialized() const { return true; } -void DescriptorDatabaseResponse::Swap(DescriptorDatabaseResponse* other) { +void ServerReflectionResponse::Swap(ServerReflectionResponse* other) { if (other == this) return; InternalSwap(other); } -void DescriptorDatabaseResponse::InternalSwap(DescriptorDatabaseResponse* other) { +void ServerReflectionResponse::InternalSwap(ServerReflectionResponse* other) { valid_host_.Swap(&other->valid_host_); std::swap(original_request_, other->original_request_); std::swap(message_response_, other->message_response_); @@ -2042,87 +2094,87 @@ void DescriptorDatabaseResponse::InternalSwap(DescriptorDatabaseResponse* other) std::swap(_cached_size_, other->_cached_size_); } -::google::protobuf::Metadata DescriptorDatabaseResponse::GetMetadata() const { +::google::protobuf::Metadata ServerReflectionResponse::GetMetadata() const { protobuf_AssignDescriptorsOnce(); ::google::protobuf::Metadata metadata; - metadata.descriptor = DescriptorDatabaseResponse_descriptor_; - metadata.reflection = DescriptorDatabaseResponse_reflection_; + metadata.descriptor = ServerReflectionResponse_descriptor_; + metadata.reflection = ServerReflectionResponse_reflection_; return metadata; } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// DescriptorDatabaseResponse +// ServerReflectionResponse // optional string valid_host = 1; -void DescriptorDatabaseResponse::clear_valid_host() { +void ServerReflectionResponse::clear_valid_host() { valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::std::string& DescriptorDatabaseResponse::valid_host() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + const ::std::string& ServerReflectionResponse::valid_host() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void DescriptorDatabaseResponse::set_valid_host(const ::std::string& value) { + void ServerReflectionResponse::set_valid_host(const ::std::string& value) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } - void DescriptorDatabaseResponse::set_valid_host(const char* value) { + void ServerReflectionResponse::set_valid_host(const char* value) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } - void DescriptorDatabaseResponse::set_valid_host(const char* value, size_t size) { + void ServerReflectionResponse::set_valid_host(const char* value, size_t size) { valid_host_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } - ::std::string* DescriptorDatabaseResponse::mutable_valid_host() { + ::std::string* ServerReflectionResponse::mutable_valid_host() { - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* DescriptorDatabaseResponse::release_valid_host() { + ::std::string* ServerReflectionResponse::release_valid_host() { return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void DescriptorDatabaseResponse::set_allocated_valid_host(::std::string* valid_host) { + void ServerReflectionResponse::set_allocated_valid_host(::std::string* valid_host) { if (valid_host != NULL) { } else { } valid_host_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), valid_host); - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.valid_host) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) } -// optional .grpc.reflection.v1alpha.DescriptorDatabaseRequest original_request = 2; -bool DescriptorDatabaseResponse::has_original_request() const { +// optional .grpc.reflection.v1alpha.ServerReflectionRequest original_request = 2; +bool ServerReflectionResponse::has_original_request() const { return !_is_default_instance_ && original_request_ != NULL; } -void DescriptorDatabaseResponse::clear_original_request() { +void ServerReflectionResponse::clear_original_request() { if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; original_request_ = NULL; } -const ::grpc::reflection::v1alpha::DescriptorDatabaseRequest& DescriptorDatabaseResponse::original_request() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) +const ::grpc::reflection::v1alpha::ServerReflectionRequest& ServerReflectionResponse::original_request() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) return original_request_ != NULL ? *original_request_ : *default_instance_->original_request_; } -::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::mutable_original_request() { +::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::mutable_original_request() { if (original_request_ == NULL) { - original_request_ = new ::grpc::reflection::v1alpha::DescriptorDatabaseRequest; + original_request_ = new ::grpc::reflection::v1alpha::ServerReflectionRequest; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) return original_request_; } -::grpc::reflection::v1alpha::DescriptorDatabaseRequest* DescriptorDatabaseResponse::release_original_request() { +::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::release_original_request() { - ::grpc::reflection::v1alpha::DescriptorDatabaseRequest* temp = original_request_; + ::grpc::reflection::v1alpha::ServerReflectionRequest* temp = original_request_; original_request_ = NULL; return temp; } -void DescriptorDatabaseResponse::set_allocated_original_request(::grpc::reflection::v1alpha::DescriptorDatabaseRequest* original_request) { +void ServerReflectionResponse::set_allocated_original_request(::grpc::reflection::v1alpha::ServerReflectionRequest* original_request) { delete original_request_; original_request_ = original_request; if (original_request) { @@ -2130,118 +2182,85 @@ void DescriptorDatabaseResponse::set_allocated_original_request(::grpc::reflecti } else { } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.original_request) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) } -// optional bytes file_descriptor_proto = 4; -bool DescriptorDatabaseResponse::has_file_descriptor_proto() const { - return message_response_case() == kFileDescriptorProto; +// optional .grpc.reflection.v1alpha.FileDescriptorResponse file_descriptor_response = 4; +bool ServerReflectionResponse::has_file_descriptor_response() const { + return message_response_case() == kFileDescriptorResponse; } -void DescriptorDatabaseResponse::set_has_file_descriptor_proto() { - _oneof_case_[0] = kFileDescriptorProto; +void ServerReflectionResponse::set_has_file_descriptor_response() { + _oneof_case_[0] = kFileDescriptorResponse; } -void DescriptorDatabaseResponse::clear_file_descriptor_proto() { - if (has_file_descriptor_proto()) { - message_response_.file_descriptor_proto_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +void ServerReflectionResponse::clear_file_descriptor_response() { + if (has_file_descriptor_response()) { + delete message_response_.file_descriptor_response_; clear_has_message_response(); } } - const ::std::string& DescriptorDatabaseResponse::file_descriptor_proto() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) - if (has_file_descriptor_proto()) { - return message_response_.file_descriptor_proto_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); -} - void DescriptorDatabaseResponse::set_file_descriptor_proto(const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) - if (!has_file_descriptor_proto()) { - clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) -} - void DescriptorDatabaseResponse::set_file_descriptor_proto(const char* value) { - if (!has_file_descriptor_proto()) { - clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + const ::grpc::reflection::v1alpha::FileDescriptorResponse& ServerReflectionResponse::file_descriptor_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) + return has_file_descriptor_response() + ? *message_response_.file_descriptor_response_ + : ::grpc::reflection::v1alpha::FileDescriptorResponse::default_instance(); } - void DescriptorDatabaseResponse::set_file_descriptor_proto(const void* value, size_t size) { - if (!has_file_descriptor_proto()) { +::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::mutable_file_descriptor_response() { + if (!has_file_descriptor_response()) { clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + set_has_file_descriptor_response(); + message_response_.file_descriptor_response_ = new ::grpc::reflection::v1alpha::FileDescriptorResponse; } - message_response_.file_descriptor_proto_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( - reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) + return message_response_.file_descriptor_response_; } - ::std::string* DescriptorDatabaseResponse::mutable_file_descriptor_proto() { - if (!has_file_descriptor_proto()) { - clear_message_response(); - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) - return message_response_.file_descriptor_proto_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - ::std::string* DescriptorDatabaseResponse::release_file_descriptor_proto() { - if (has_file_descriptor_proto()) { +::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::release_file_descriptor_response() { + if (has_file_descriptor_response()) { clear_has_message_response(); - return message_response_.file_descriptor_proto_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::grpc::reflection::v1alpha::FileDescriptorResponse* temp = message_response_.file_descriptor_response_; + message_response_.file_descriptor_response_ = NULL; + return temp; } else { return NULL; } } - void DescriptorDatabaseResponse::set_allocated_file_descriptor_proto(::std::string* file_descriptor_proto) { - if (!has_file_descriptor_proto()) { - message_response_.file_descriptor_proto_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - } +void ServerReflectionResponse::set_allocated_file_descriptor_response(::grpc::reflection::v1alpha::FileDescriptorResponse* file_descriptor_response) { clear_message_response(); - if (file_descriptor_proto != NULL) { - set_has_file_descriptor_proto(); - message_response_.file_descriptor_proto_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - file_descriptor_proto); + if (file_descriptor_response) { + set_has_file_descriptor_response(); + message_response_.file_descriptor_response_ = file_descriptor_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.file_descriptor_proto) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) } // optional .grpc.reflection.v1alpha.ExtensionNumberResponse all_extension_numbers_response = 5; -bool DescriptorDatabaseResponse::has_all_extension_numbers_response() const { +bool ServerReflectionResponse::has_all_extension_numbers_response() const { return message_response_case() == kAllExtensionNumbersResponse; } -void DescriptorDatabaseResponse::set_has_all_extension_numbers_response() { +void ServerReflectionResponse::set_has_all_extension_numbers_response() { _oneof_case_[0] = kAllExtensionNumbersResponse; } -void DescriptorDatabaseResponse::clear_all_extension_numbers_response() { +void ServerReflectionResponse::clear_all_extension_numbers_response() { if (has_all_extension_numbers_response()) { delete message_response_.all_extension_numbers_response_; clear_has_message_response(); } } - const ::grpc::reflection::v1alpha::ExtensionNumberResponse& DescriptorDatabaseResponse::all_extension_numbers_response() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + const ::grpc::reflection::v1alpha::ExtensionNumberResponse& ServerReflectionResponse::all_extension_numbers_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) return has_all_extension_numbers_response() ? *message_response_.all_extension_numbers_response_ : ::grpc::reflection::v1alpha::ExtensionNumberResponse::default_instance(); } -::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::mutable_all_extension_numbers_response() { +::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::mutable_all_extension_numbers_response() { if (!has_all_extension_numbers_response()) { clear_message_response(); set_has_all_extension_numbers_response(); message_response_.all_extension_numbers_response_ = new ::grpc::reflection::v1alpha::ExtensionNumberResponse; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) return message_response_.all_extension_numbers_response_; } -::grpc::reflection::v1alpha::ExtensionNumberResponse* DescriptorDatabaseResponse::release_all_extension_numbers_response() { +::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::release_all_extension_numbers_response() { if (has_all_extension_numbers_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ExtensionNumberResponse* temp = message_response_.all_extension_numbers_response_; @@ -2251,44 +2270,44 @@ void DescriptorDatabaseResponse::clear_all_extension_numbers_response() { return NULL; } } -void DescriptorDatabaseResponse::set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response) { +void ServerReflectionResponse::set_allocated_all_extension_numbers_response(::grpc::reflection::v1alpha::ExtensionNumberResponse* all_extension_numbers_response) { clear_message_response(); if (all_extension_numbers_response) { set_has_all_extension_numbers_response(); message_response_.all_extension_numbers_response_ = all_extension_numbers_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.all_extension_numbers_response) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) } // optional .grpc.reflection.v1alpha.ListServiceResponse list_services_response = 6; -bool DescriptorDatabaseResponse::has_list_services_response() const { +bool ServerReflectionResponse::has_list_services_response() const { return message_response_case() == kListServicesResponse; } -void DescriptorDatabaseResponse::set_has_list_services_response() { +void ServerReflectionResponse::set_has_list_services_response() { _oneof_case_[0] = kListServicesResponse; } -void DescriptorDatabaseResponse::clear_list_services_response() { +void ServerReflectionResponse::clear_list_services_response() { if (has_list_services_response()) { delete message_response_.list_services_response_; clear_has_message_response(); } } - const ::grpc::reflection::v1alpha::ListServiceResponse& DescriptorDatabaseResponse::list_services_response() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + const ::grpc::reflection::v1alpha::ListServiceResponse& ServerReflectionResponse::list_services_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) return has_list_services_response() ? *message_response_.list_services_response_ : ::grpc::reflection::v1alpha::ListServiceResponse::default_instance(); } -::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::mutable_list_services_response() { +::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::mutable_list_services_response() { if (!has_list_services_response()) { clear_message_response(); set_has_list_services_response(); message_response_.list_services_response_ = new ::grpc::reflection::v1alpha::ListServiceResponse; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) return message_response_.list_services_response_; } -::grpc::reflection::v1alpha::ListServiceResponse* DescriptorDatabaseResponse::release_list_services_response() { +::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::release_list_services_response() { if (has_list_services_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ListServiceResponse* temp = message_response_.list_services_response_; @@ -2298,44 +2317,44 @@ void DescriptorDatabaseResponse::clear_list_services_response() { return NULL; } } -void DescriptorDatabaseResponse::set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response) { +void ServerReflectionResponse::set_allocated_list_services_response(::grpc::reflection::v1alpha::ListServiceResponse* list_services_response) { clear_message_response(); if (list_services_response) { set_has_list_services_response(); message_response_.list_services_response_ = list_services_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.list_services_response) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) } // optional .grpc.reflection.v1alpha.ErrorResponse error_response = 7; -bool DescriptorDatabaseResponse::has_error_response() const { +bool ServerReflectionResponse::has_error_response() const { return message_response_case() == kErrorResponse; } -void DescriptorDatabaseResponse::set_has_error_response() { +void ServerReflectionResponse::set_has_error_response() { _oneof_case_[0] = kErrorResponse; } -void DescriptorDatabaseResponse::clear_error_response() { +void ServerReflectionResponse::clear_error_response() { if (has_error_response()) { delete message_response_.error_response_; clear_has_message_response(); } } - const ::grpc::reflection::v1alpha::ErrorResponse& DescriptorDatabaseResponse::error_response() const { - // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + const ::grpc::reflection::v1alpha::ErrorResponse& ServerReflectionResponse::error_response() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) return has_error_response() ? *message_response_.error_response_ : ::grpc::reflection::v1alpha::ErrorResponse::default_instance(); } -::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::mutable_error_response() { +::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::mutable_error_response() { if (!has_error_response()) { clear_message_response(); set_has_error_response(); message_response_.error_response_ = new ::grpc::reflection::v1alpha::ErrorResponse; } - // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) return message_response_.error_response_; } -::grpc::reflection::v1alpha::ErrorResponse* DescriptorDatabaseResponse::release_error_response() { +::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::release_error_response() { if (has_error_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ErrorResponse* temp = message_response_.error_response_; @@ -2345,28 +2364,294 @@ void DescriptorDatabaseResponse::clear_error_response() { return NULL; } } -void DescriptorDatabaseResponse::set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response) { +void ServerReflectionResponse::set_allocated_error_response(::grpc::reflection::v1alpha::ErrorResponse* error_response) { clear_message_response(); if (error_response) { set_has_error_response(); message_response_.error_response_ = error_response; } - // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.DescriptorDatabaseResponse.error_response) + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) } -bool DescriptorDatabaseResponse::has_message_response() const { +bool ServerReflectionResponse::has_message_response() const { return message_response_case() != MESSAGE_RESPONSE_NOT_SET; } -void DescriptorDatabaseResponse::clear_has_message_response() { +void ServerReflectionResponse::clear_has_message_response() { _oneof_case_[0] = MESSAGE_RESPONSE_NOT_SET; } -DescriptorDatabaseResponse::MessageResponseCase DescriptorDatabaseResponse::message_response_case() const { - return DescriptorDatabaseResponse::MessageResponseCase(_oneof_case_[0]); +ServerReflectionResponse::MessageResponseCase ServerReflectionResponse::message_response_case() const { + return ServerReflectionResponse::MessageResponseCase(_oneof_case_[0]); } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int FileDescriptorResponse::kFileDescriptorProtoFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +FileDescriptorResponse::FileDescriptorResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.FileDescriptorResponse) +} + +void FileDescriptorResponse::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +FileDescriptorResponse::FileDescriptorResponse(const FileDescriptorResponse& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.FileDescriptorResponse) +} + +void FileDescriptorResponse::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; +} + +FileDescriptorResponse::~FileDescriptorResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.FileDescriptorResponse) + SharedDtor(); +} + +void FileDescriptorResponse::SharedDtor() { + if (this != default_instance_) { + } +} + +void FileDescriptorResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FileDescriptorResponse::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FileDescriptorResponse_descriptor_; +} + +const FileDescriptorResponse& FileDescriptorResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +FileDescriptorResponse* FileDescriptorResponse::default_instance_ = NULL; + +FileDescriptorResponse* FileDescriptorResponse::New(::google::protobuf::Arena* arena) const { + FileDescriptorResponse* n = new FileDescriptorResponse; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void FileDescriptorResponse::Clear() { + file_descriptor_proto_.Clear(); +} + +bool FileDescriptorResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.FileDescriptorResponse) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated bytes file_descriptor_proto = 1; + case 1: { + if (tag == 10) { + parse_file_descriptor_proto: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_file_descriptor_proto())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(10)) goto parse_file_descriptor_proto; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.FileDescriptorResponse) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.FileDescriptorResponse) + return false; +#undef DO_ +} + +void FileDescriptorResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.FileDescriptorResponse) + // repeated bytes file_descriptor_proto = 1; + for (int i = 0; i < this->file_descriptor_proto_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 1, this->file_descriptor_proto(i), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.FileDescriptorResponse) +} + +::google::protobuf::uint8* FileDescriptorResponse::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.FileDescriptorResponse) + // repeated bytes file_descriptor_proto = 1; + for (int i = 0; i < this->file_descriptor_proto_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteBytesToArray(1, this->file_descriptor_proto(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.FileDescriptorResponse) + return target; +} + +int FileDescriptorResponse::ByteSize() const { + int total_size = 0; + + // repeated bytes file_descriptor_proto = 1; + total_size += 1 * this->file_descriptor_proto_size(); + for (int i = 0; i < this->file_descriptor_proto_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->file_descriptor_proto(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FileDescriptorResponse::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const FileDescriptorResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FileDescriptorResponse::MergeFrom(const FileDescriptorResponse& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + file_descriptor_proto_.MergeFrom(from.file_descriptor_proto_); +} + +void FileDescriptorResponse::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FileDescriptorResponse::CopyFrom(const FileDescriptorResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FileDescriptorResponse::IsInitialized() const { + + return true; +} + +void FileDescriptorResponse::Swap(FileDescriptorResponse* other) { + if (other == this) return; + InternalSwap(other); +} +void FileDescriptorResponse::InternalSwap(FileDescriptorResponse* other) { + file_descriptor_proto_.UnsafeArenaSwap(&other->file_descriptor_proto_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata FileDescriptorResponse::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FileDescriptorResponse_descriptor_; + metadata.reflection = FileDescriptorResponse_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// FileDescriptorResponse + +// repeated bytes file_descriptor_proto = 1; +int FileDescriptorResponse::file_descriptor_proto_size() const { + return file_descriptor_proto_.size(); +} +void FileDescriptorResponse::clear_file_descriptor_proto() { + file_descriptor_proto_.Clear(); +} + const ::std::string& FileDescriptorResponse::file_descriptor_proto(int index) const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_.Get(index); +} + ::std::string* FileDescriptorResponse::mutable_file_descriptor_proto(int index) { + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_.Mutable(index); +} + void FileDescriptorResponse::set_file_descriptor_proto(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + file_descriptor_proto_.Mutable(index)->assign(value); +} + void FileDescriptorResponse::set_file_descriptor_proto(int index, const char* value) { + file_descriptor_proto_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} + void FileDescriptorResponse::set_file_descriptor_proto(int index, const void* value, size_t size) { + file_descriptor_proto_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} + ::std::string* FileDescriptorResponse::add_file_descriptor_proto() { + return file_descriptor_proto_.Add(); +} + void FileDescriptorResponse::add_file_descriptor_proto(const ::std::string& value) { + file_descriptor_proto_.Add()->assign(value); + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} + void FileDescriptorResponse::add_file_descriptor_proto(const char* value) { + file_descriptor_proto_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} + void FileDescriptorResponse::add_file_descriptor_proto(const void* value, size_t size) { + file_descriptor_proto_.Add()->assign(reinterpret_cast(value), size); + // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) +} + const ::google::protobuf::RepeatedPtrField< ::std::string>& +FileDescriptorResponse::file_descriptor_proto() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return file_descriptor_proto_; +} + ::google::protobuf::RepeatedPtrField< ::std::string>* +FileDescriptorResponse::mutable_file_descriptor_proto() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) + return &file_descriptor_proto_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ExtensionNumberResponse::kBaseTypeNameFieldNumber; const int ExtensionNumberResponse::kExtensionNumberFieldNumber; @@ -2755,7 +3040,6 @@ ListServiceResponse::ListServiceResponse(const ListServiceResponse& from) void ListServiceResponse::SharedCtor() { _is_default_instance_ = false; - ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; } @@ -2808,21 +3092,18 @@ bool ListServiceResponse::MergePartialFromCodedStream( tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated string service = 1; + // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; case 1: { if (tag == 10) { - parse_service: - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_service())); - DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->service(this->service_size() - 1).data(), - this->service(this->service_size() - 1).length(), - ::google::protobuf::internal::WireFormatLite::PARSE, - "grpc.reflection.v1alpha.ListServiceResponse.service")); + DO_(input->IncrementRecursionDepth()); + parse_loop_service: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( + input, add_service())); } else { goto handle_unusual; } - if (input->ExpectTag(10)) goto parse_service; + if (input->ExpectTag(10)) goto parse_loop_service; + input->UnsafeDecrementRecursionDepth(); if (input->ExpectAtEnd()) goto success; break; } @@ -2851,13 +3132,9 @@ failure: void ListServiceResponse::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ListServiceResponse) - // repeated string service = 1; - for (int i = 0; i < this->service_size(); i++) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->service(i).data(), this->service(i).length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.ListServiceResponse.service"); - ::google::protobuf::internal::WireFormatLite::WriteString( + // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; + for (unsigned int i = 0, n = this->service_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 1, this->service(i), output); } @@ -2867,14 +3144,11 @@ void ListServiceResponse::SerializeWithCachedSizes( ::google::protobuf::uint8* ListServiceResponse::SerializeWithCachedSizesToArray( ::google::protobuf::uint8* target) const { // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ListServiceResponse) - // repeated string service = 1; - for (int i = 0; i < this->service_size(); i++) { - ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( - this->service(i).data(), this->service(i).length(), - ::google::protobuf::internal::WireFormatLite::SERIALIZE, - "grpc.reflection.v1alpha.ListServiceResponse.service"); + // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; + for (unsigned int i = 0, n = this->service_size(); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - WriteStringToArray(1, this->service(i), target); + WriteMessageNoVirtualToArray( + 1, this->service(i), target); } // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ListServiceResponse) @@ -2884,11 +3158,12 @@ void ListServiceResponse::SerializeWithCachedSizes( int ListServiceResponse::ByteSize() const { int total_size = 0; - // repeated string service = 1; + // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; total_size += 1 * this->service_size(); for (int i = 0; i < this->service_size(); i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->service(i)); + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->service(i)); } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); @@ -2952,58 +3227,305 @@ void ListServiceResponse::InternalSwap(ListServiceResponse* other) { #if PROTOBUF_INLINE_NOT_IN_HEADERS // ListServiceResponse -// repeated string service = 1; +// repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; int ListServiceResponse::service_size() const { return service_.size(); } void ListServiceResponse::clear_service() { service_.Clear(); } - const ::std::string& ListServiceResponse::service(int index) const { +const ::grpc::reflection::v1alpha::ServiceResponse& ListServiceResponse::service(int index) const { // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ListServiceResponse.service) return service_.Get(index); } - ::std::string* ListServiceResponse::mutable_service(int index) { +::grpc::reflection::v1alpha::ServiceResponse* ListServiceResponse::mutable_service(int index) { // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ListServiceResponse.service) return service_.Mutable(index); } - void ListServiceResponse::set_service(int index, const ::std::string& value) { - // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ListServiceResponse.service) - service_.Mutable(index)->assign(value); +::grpc::reflection::v1alpha::ServiceResponse* ListServiceResponse::add_service() { + // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_.Add(); } - void ListServiceResponse::set_service(int index, const char* value) { - service_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ListServiceResponse.service) +::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >* +ListServiceResponse::mutable_service() { + // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return &service_; } - void ListServiceResponse::set_service(int index, const char* value, size_t size) { - service_.Mutable(index)->assign( - reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) +const ::google::protobuf::RepeatedPtrField< ::grpc::reflection::v1alpha::ServiceResponse >& +ListServiceResponse::service() const { + // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.service) + return service_; } - ::std::string* ListServiceResponse::add_service() { - return service_.Add(); + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int ServiceResponse::kNameFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +ServiceResponse::ServiceResponse() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:grpc.reflection.v1alpha.ServiceResponse) } - void ListServiceResponse::add_service(const ::std::string& value) { - service_.Add()->assign(value); - // @@protoc_insertion_point(field_add:grpc.reflection.v1alpha.ListServiceResponse.service) + +void ServiceResponse::InitAsDefaultInstance() { + _is_default_instance_ = true; } - void ListServiceResponse::add_service(const char* value) { - service_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:grpc.reflection.v1alpha.ListServiceResponse.service) + +ServiceResponse::ServiceResponse(const ServiceResponse& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:grpc.reflection.v1alpha.ServiceResponse) } - void ListServiceResponse::add_service(const char* value, size_t size) { - service_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:grpc.reflection.v1alpha.ListServiceResponse.service) + +void ServiceResponse::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - const ::google::protobuf::RepeatedPtrField< ::std::string>& -ListServiceResponse::service() const { - // @@protoc_insertion_point(field_list:grpc.reflection.v1alpha.ListServiceResponse.service) - return service_; + +ServiceResponse::~ServiceResponse() { + // @@protoc_insertion_point(destructor:grpc.reflection.v1alpha.ServiceResponse) + SharedDtor(); } - ::google::protobuf::RepeatedPtrField< ::std::string>* -ListServiceResponse::mutable_service() { - // @@protoc_insertion_point(field_mutable_list:grpc.reflection.v1alpha.ListServiceResponse.service) - return &service_; + +void ServiceResponse::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void ServiceResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ServiceResponse::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ServiceResponse_descriptor_; +} + +const ServiceResponse& ServiceResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_reflection_2eproto(); + return *default_instance_; +} + +ServiceResponse* ServiceResponse::default_instance_ = NULL; + +ServiceResponse* ServiceResponse::New(::google::protobuf::Arena* arena) const { + ServiceResponse* n = new ServiceResponse; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void ServiceResponse::Clear() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool ServiceResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ServiceResponse) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormatLite::PARSE, + "grpc.reflection.v1alpha.ServiceResponse.name")); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:grpc.reflection.v1alpha.ServiceResponse) + return true; +failure: + // @@protoc_insertion_point(parse_failure:grpc.reflection.v1alpha.ServiceResponse) + return false; +#undef DO_ +} + +void ServiceResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:grpc.reflection.v1alpha.ServiceResponse) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ServiceResponse.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->name(), output); + } + + // @@protoc_insertion_point(serialize_end:grpc.reflection.v1alpha.ServiceResponse) +} + +::google::protobuf::uint8* ServiceResponse::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:grpc.reflection.v1alpha.ServiceResponse) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormatLite::SERIALIZE, + "grpc.reflection.v1alpha.ServiceResponse.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:grpc.reflection.v1alpha.ServiceResponse) + return target; +} + +int ServiceResponse::ByteSize() const { + int total_size = 0; + + // optional string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ServiceResponse* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ServiceResponse::MergeFrom(const ServiceResponse& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } +} + +void ServiceResponse::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ServiceResponse::CopyFrom(const ServiceResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ServiceResponse::IsInitialized() const { + + return true; +} + +void ServiceResponse::Swap(ServiceResponse* other) { + if (other == this) return; + InternalSwap(other); +} +void ServiceResponse::InternalSwap(ServiceResponse* other) { + name_.Swap(&other->name_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata ServiceResponse::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ServiceResponse_descriptor_; + metadata.reflection = ServiceResponse_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// ServiceResponse + +// optional string name = 1; +void ServiceResponse::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& ServiceResponse::name() const { + // @@protoc_insertion_point(field_get:grpc.reflection.v1alpha.ServiceResponse.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void ServiceResponse::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:grpc.reflection.v1alpha.ServiceResponse.name) +} + void ServiceResponse::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:grpc.reflection.v1alpha.ServiceResponse.name) +} + void ServiceResponse::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.ServiceResponse.name) +} + ::std::string* ServiceResponse::mutable_name() { + + // @@protoc_insertion_point(field_mutable:grpc.reflection.v1alpha.ServiceResponse.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* ServiceResponse::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void ServiceResponse::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:grpc.reflection.v1alpha.ServiceResponse.name) } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS diff --git a/src/proto/grpc/reflection/v1alpha/reflection.proto b/src/proto/grpc/reflection/v1alpha/reflection.proto index 6e6a0b08644..276ff0e255d 100644 --- a/src/proto/grpc/reflection/v1alpha/reflection.proto +++ b/src/proto/grpc/reflection/v1alpha/reflection.proto @@ -36,12 +36,12 @@ package grpc.reflection.v1alpha; service ServerReflection { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - rpc DescriptorDatabaseInfo(stream DescriptorDatabaseRequest) - returns (stream DescriptorDatabaseResponse); + rpc ServerReflectionInfo(stream ServerReflectionRequest) + returns (stream ServerReflectionResponse); } -// The message sent by the client when calling DescriptorDatabaseInfo method. -message DescriptorDatabaseRequest { +// The message sent by the client when calling ServerReflectionInfo method. +message ServerReflectionRequest { string host = 1; // To use reflection service, the client should set one of the following // fields in message_request. The server distinguishes requests by their @@ -83,18 +83,20 @@ message ExtensionRequest { int32 extension_number = 2; } -// The message sent by the server to answer DescriptorDatabaseInfo method. -message DescriptorDatabaseResponse { +// The message sent by the server to answer ServerReflectionInfo method. +message ServerReflectionResponse { string valid_host = 1; - DescriptorDatabaseRequest original_request = 2; + ServerReflectionRequest original_request = 2; // The server set one of the following fields accroding to the message_request // in the request. oneof message_response { - // A serialized FileDescriptorProto message. We avoid taking a dependency on - // descriptor.proto, which uses proto2 only features, by making them opaque - // bytes instead. This message is used to answer file_by_filename, - // file_containing_symbol, file_containing_extension requests. - bytes file_descriptor_proto = 4; + // This message is used to answer file_by_filename, file_containing_symbol, + // file_containing_extension requests with transitive dependencies. As + // the repeated label is not allowed in oneof fields, we use a + // FileDescriptorResponse message to encapsulate the repeated fields. + // The reflection service is allowed to avoid sending FileDescriptorProtos + // that were previously sent in response to earlier requests in the stream. + FileDescriptorResponse file_descriptor_response = 4; // This message is used to answer all_extension_numbers_of_type requst. ExtensionNumberResponse all_extension_numbers_response = 5; @@ -107,6 +109,16 @@ message DescriptorDatabaseResponse { } } +// Serialized FileDescriptorProto messages sent by the server answering +// a file_by_filename, file_containing_symbol, or file_containing_extension +// request. +message FileDescriptorResponse { + // Serialized FileDescriptorProto messages. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. + repeated bytes file_descriptor_proto = 1; +} + // A list of extension numbers sent by the server answering // all_extension_numbers_of_type request. message ExtensionNumberResponse { @@ -116,11 +128,19 @@ message ExtensionNumberResponse { repeated int32 extension_number = 2; } -// A list of service names sent by the server answering list_services request. +// A list of ServiceResponse sent by the server answering list_services request. message ListServiceResponse { - // Full names of registered services, including package names. The format + // The information of each service may be expanded in the future, so we use + // ServiceResponse message to encapsulate it. + repeated ServiceResponse service = 1; +} + +// The information of a single service used by ListServiceResponse to answer +// list_services request. +message ServiceResponse { + // Full name of a registered service, including its package name. The format // is . - repeated string service = 1; + string name = 1; } // The error code and error message sent by the server when an error occurs. From b0dd253a60921d0ec08d41af1204237a570d59d5 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 19:14:51 -0700 Subject: [PATCH 025/175] Added grpc_channel_get_default_compression_level() --- src/core/lib/surface/channel.c | 25 +++++++++++++++++++++++++ src/core/lib/surface/channel.h | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/src/core/lib/surface/channel.c b/src/core/lib/surface/channel.c index b6b760b5d8d..a7aa9365a0b 100644 --- a/src/core/lib/surface/channel.c +++ b/src/core/lib/surface/channel.c @@ -68,7 +68,13 @@ struct grpc_channel { gpr_mu registered_call_mu; registered_call *registered_calls; + char *target; + + struct { + bool is_set; + grpc_compression_level default_compression_level; + } maybe_default_compression_level; }; #define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1)) @@ -151,6 +157,13 @@ grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target, ":authority", args->args[i].value.string); } } + } else if (0 == strcmp(args->args[i].key, + GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL)) { + channel->maybe_default_compression_level.is_set = true; + GPR_ASSERT(args->args[i].value.integer >= 0 && + args->args[i].value.integer < GRPC_COMPRESS_LEVEL_COUNT); + channel->maybe_default_compression_level.default_compression_level = + (grpc_compression_level)args->args[i].value.integer; } } grpc_channel_args_destroy(args); @@ -324,3 +337,15 @@ grpc_mdelem *grpc_channel_get_reffed_status_elem(grpc_channel *channel, int i) { uint32_t grpc_channel_get_max_message_length(grpc_channel *channel) { return channel->max_message_length; } + +bool grpc_channel_default_compression_level(grpc_channel *channel, + grpc_compression_level *level) { + if (channel->maybe_default_compression_level.is_set) { + *level = channel->maybe_default_compression_level.default_compression_level; + return true; + } + return false; +} + +bool grpc_channel_default_compression_algorithm( + grpc_channel *channel, grpc_compression_algorithm *algorithm); diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h index 22dae930e4c..a8631eea87f 100644 --- a/src/core/lib/surface/channel.h +++ b/src/core/lib/surface/channel.h @@ -71,4 +71,9 @@ void grpc_channel_internal_unref(grpc_exec_ctx *exec_ctx, grpc_channel_internal_unref(exec_ctx, channel) #endif +/** If the channel has an associated default compression level, return it in \a + * level and return true. Otherwise return false. */ +bool grpc_channel_default_compression_level(grpc_channel *channel, + grpc_compression_level *level); + #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_H */ From 749367fd004373c0dd0f0abebe36ad36275d0d51 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 19:15:24 -0700 Subject: [PATCH 026/175] Fixes to surface/call.c to consider the channel's default compression level. --- src/core/lib/surface/call.c | 40 ++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 7f5b48480c5..579c02c4932 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -178,8 +178,8 @@ struct grpc_call { /* Call stats: only valid after trailing metadata received */ grpc_transport_stream_stats stats; - /* Compression algorithm for the call */ - grpc_compression_algorithm compression_algorithm; + /* Compression algorithm for *incoming* data */ + grpc_compression_algorithm incoming_compression_algorithm; /* Supported encodings (compression algorithms), a bitset */ uint32_t encodings_accepted_by_peer; @@ -406,16 +406,16 @@ static void set_status_code(grpc_call *call, status_source source, /* TODO(ctiller): what to do about the flush that was previously here */ } -static void set_compression_algorithm(grpc_call *call, - grpc_compression_algorithm algo) { - call->compression_algorithm = algo; +static void set_incoming_compression_algorithm( + grpc_call *call, grpc_compression_algorithm algo) { + call->incoming_compression_algorithm = algo; } grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm( grpc_call *call) { grpc_compression_algorithm algorithm; gpr_mu_lock(&call->mu); - algorithm = call->compression_algorithm; + algorithm = call->incoming_compression_algorithm; gpr_mu_unlock(&call->mu); return algorithm; } @@ -968,9 +968,9 @@ static grpc_mdelem *recv_initial_filter(void *callp, grpc_mdelem *elem) { if (elem == NULL) { return NULL; } else if (elem->key == GRPC_MDSTR_GRPC_ENCODING) { - GPR_TIMER_BEGIN("compression_algorithm", 0); - set_compression_algorithm(call, decode_compression(elem)); - GPR_TIMER_END("compression_algorithm", 0); + GPR_TIMER_BEGIN("incoming_compression_algorithm", 0); + set_incoming_compression_algorithm(call, decode_compression(elem)); + GPR_TIMER_END("incoming_compression_algorithm", 0); return NULL; } else if (elem->key == GRPC_MDSTR_GRPC_ACCEPT_ENCODING) { GPR_TIMER_BEGIN("encodings_accepted_by_peer", 0); @@ -1133,9 +1133,9 @@ static void process_data_after_md(grpc_exec_ctx *exec_ctx, batch_control *bctl, } else { call->test_only_last_message_flags = call->receiving_stream->flags; if ((call->receiving_stream->flags & GRPC_WRITE_INTERNAL_COMPRESS) && - (call->compression_algorithm > GRPC_COMPRESS_NONE)) { + (call->incoming_compression_algorithm > GRPC_COMPRESS_NONE)) { *call->receiving_buffer = grpc_raw_compressed_byte_buffer_create( - NULL, 0, call->compression_algorithm); + NULL, 0, call->incoming_compression_algorithm); } else { *call->receiving_buffer = grpc_raw_byte_buffer_create(NULL, 0); } @@ -1323,17 +1323,25 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, grpc_metadata compression_md; memset(&compression_md, 0, sizeof(grpc_metadata)); size_t additional_metadata_count = 0; - if (op->data.send_initial_metadata.maybe_compression_level.is_set && - op->data.send_initial_metadata.maybe_compression_level - .compression_level > GRPC_COMPRESS_LEVEL_NONE) { + grpc_compression_level effective_compression_level; + bool level_set = false; + if (op->data.send_initial_metadata.maybe_compression_level.is_set) { if (call->is_client) { error = GRPC_CALL_ERROR_NOT_ON_CLIENT; goto done_with_error; } + effective_compression_level = + op->data.send_initial_metadata.maybe_compression_level + .compression_level; + level_set = true; + } else { + level_set = grpc_channel_default_compression_level( + call->channel, &effective_compression_level); + } + if (level_set) { const grpc_compression_algorithm calgo = compression_algorithm_for_level_locked( - call, op->data.send_initial_metadata.maybe_compression_level - .compression_level); + call, effective_compression_level); char *calgo_name; grpc_compression_algorithm_name(calgo, &calgo_name); compression_md.key = GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY; From 1ebf1f15985804f93ed533fe2e1aaa0ec371d657 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 19:15:43 -0700 Subject: [PATCH 027/175] Compression test fixes --- test/core/end2end/tests/compressed_payload.c | 29 ++++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 368b3968cb5..1e2932a78c6 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -110,7 +110,7 @@ static void request_with_payload_template( grpc_compression_algorithm default_server_channel_compression_algorithm, grpc_compression_algorithm expected_algorithm_from_client, grpc_compression_algorithm expected_algorithm_from_server, - grpc_metadata *client_init_metadata, + grpc_metadata *client_init_metadata, bool set_server_level, grpc_compression_level server_compression_level) { grpc_call *c; grpc_call *s; @@ -212,9 +212,11 @@ static void request_with_payload_template( op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.maybe_compression_level.is_set = true; - op->data.send_initial_metadata.maybe_compression_level.compression_level = - server_compression_level; + if (set_server_level) { + op->data.send_initial_metadata.maybe_compression_level.is_set = true; + op->data.send_initial_metadata.maybe_compression_level.compression_level = + server_compression_level; + } op->flags = 0; op->reserved = NULL; op++; @@ -352,7 +354,8 @@ static void test_invoke_request_with_exceptionally_uncompressed_payload( request_with_payload_template( config, "test_invoke_request_with_exceptionally_uncompressed_payload", GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, NULL, GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, NULL, false, + /* ignored */ GRPC_COMPRESS_LEVEL_NONE); } static void test_invoke_request_with_uncompressed_payload( @@ -360,7 +363,7 @@ static void test_invoke_request_with_uncompressed_payload( request_with_payload_template( config, "test_invoke_request_with_uncompressed_payload", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, - GRPC_COMPRESS_NONE, NULL, GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_NONE, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE); } static void test_invoke_request_with_compressed_payload( @@ -368,7 +371,7 @@ static void test_invoke_request_with_compressed_payload( request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_GZIP, NULL, GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE); } static void test_invoke_request_with_server_level( @@ -376,7 +379,7 @@ static void test_invoke_request_with_server_level( request_with_payload_template( config, "test_invoke_request_with_server_level", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE /* ignored */, - NULL, GRPC_COMPRESS_LEVEL_HIGH); + NULL, true, GRPC_COMPRESS_LEVEL_HIGH); } static void test_invoke_request_with_compressed_payload_md_override( @@ -402,20 +405,22 @@ static void test_invoke_request_with_compressed_payload_md_override( request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_1", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_NONE, &gzip_compression_override, GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_NONE, &gzip_compression_override, false, + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); /* Channel default DEFLATE, call override to GZIP */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_2", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_NONE, &gzip_compression_override, GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_NONE, &gzip_compression_override, false, + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); /* Channel default DEFLATE, call override to NONE (aka IDENTITY) */ request_with_payload_template( config, "test_invoke_request_with_compressed_payload_md_override_3", 0, GRPC_COMPRESS_DEFLATE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, - GRPC_COMPRESS_NONE, &identity_compression_override, - GRPC_COMPRESS_LEVEL_NONE); + GRPC_COMPRESS_NONE, &identity_compression_override, false, + /*ignored*/ GRPC_COMPRESS_LEVEL_NONE); } void compressed_payload(grpc_end2end_test_config config) { From 025b4a677719b5885d4b6f558e7564814e6dfb32 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 21:05:00 -0700 Subject: [PATCH 028/175] Removed spurious compression check --- src/core/lib/surface/call.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 579c02c4932..893ba2aacf4 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1326,10 +1326,6 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, grpc_compression_level effective_compression_level; bool level_set = false; if (op->data.send_initial_metadata.maybe_compression_level.is_set) { - if (call->is_client) { - error = GRPC_CALL_ERROR_NOT_ON_CLIENT; - goto done_with_error; - } effective_compression_level = op->data.send_initial_metadata.maybe_compression_level .compression_level; From e825df736ae3681270e9cde4b8ccc07b70205516 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 22:11:18 -0700 Subject: [PATCH 029/175] updated obj-c code --- src/objective-c/GRPCClient/private/GRPCWrappedCall.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index f72ec9068e7..27723afb0e9 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -72,7 +72,8 @@ _op.op = GRPC_OP_SEND_INITIAL_METADATA; _op.data.send_initial_metadata.count = metadata.count; _op.data.send_initial_metadata.metadata = metadata.grpc_metadataArray; - _op.data.send_initial_metadata.compression_level = 0; + _op.data.send_initial_metadata.maybe_compression_level.is_set = false; + _op.data.send_initial_metadata.maybe_compression_level.compression_level = 0; _handler = handler; } return self; From 2d02456e785053735172186868300d0f4dde3d9e Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 23:24:39 -0700 Subject: [PATCH 030/175] got rid of grpc_compression_options --- include/grpc++/server_builder.h | 48 +++++++++---- include/grpc/compression.h | 14 ---- include/grpc/impl/codegen/compression_types.h | 26 ------- .../lib/compression/compression_algorithm.c | 22 ------ src/cpp/server/server_builder.cc | 71 ++++++++++++++----- test/core/compression/compression_test.c | 30 -------- 6 files changed, 90 insertions(+), 121 deletions(-) diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index ad629521cbe..c48c86d2b88 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -66,29 +66,43 @@ class ServerBuilder { /// The service must exist for the lifetime of the \a Server instance returned /// by \a BuildAndStart(). /// Matches requests with any :authority - void RegisterService(Service* service); + ServerBuilder& RegisterService(Service* service); /// Register a generic service. /// Matches requests with any :authority - void RegisterAsyncGenericService(AsyncGenericService* service); + ServerBuilder& RegisterAsyncGenericService(AsyncGenericService* service); /// Register a service. This call does not take ownership of the service. /// The service must exist for the lifetime of the \a Server instance returned /// by BuildAndStart(). /// Only matches requests with :authority \a host - void RegisterService(const grpc::string& host, Service* service); + ServerBuilder& RegisterService(const grpc::string& host, Service* service); /// Set max message size in bytes. - void SetMaxMessageSize(int max_message_size) { + ServerBuilder& SetMaxMessageSize(int max_message_size) { max_message_size_ = max_message_size; + return *this; } - /// Set the compression options to be used by the server. - void SetCompressionOptions(const grpc_compression_options& options) { - compression_options_ = options; - } + /// Set the support status for compression algorithms. All algorithms are + /// enabled by default. + /// + /// Incoming calls compressed with an unsupported algorithm will fail with + /// GRPC_STATUS_UNIMPLEMENTED. + ServerBuilder& SetCompressionAlgorithmSupportStatus( + grpc_compression_algorithm algorithm, bool enabled); + + /// The default compression level to use for all channel calls in the + /// absence of a call-specific level. + ServerBuilder& SetDefaultCompressionLevel(grpc_compression_level level); + + /// The default compression algorithm to use for all channel calls in the + /// absence of a call-specific level. Note that it overrides any compression + /// level set by \a SetDefaultCompressionLevel. + ServerBuilder& SetDefaultCompressionAlgorithm( + grpc_compression_algorithm algorithm); - void SetOption(std::unique_ptr option); + ServerBuilder& SetOption(std::unique_ptr option); /// Tries to bind \a server to the given \a addr. /// @@ -101,9 +115,9 @@ class ServerBuilder { /// number. \a nullptr otherwise. /// // TODO(dgq): the "port" part seems to be a misnomer. - void AddListeningPort(const grpc::string& addr, - std::shared_ptr creds, - int* selected_port = nullptr); + ServerBuilder& AddListeningPort(const grpc::string& addr, + std::shared_ptr creds, + int* selected_port = nullptr); /// Add a completion queue for handling asynchronous services /// Caller is required to keep this completion queue live until @@ -136,7 +150,6 @@ class ServerBuilder { }; int max_message_size_; - grpc_compression_options compression_options_; std::vector> options_; std::vector> services_; std::vector ports_; @@ -144,6 +157,15 @@ class ServerBuilder { std::shared_ptr creds_; std::map> plugins_; AsyncGenericService* generic_service_; + struct { + bool is_set; + grpc_compression_level level; + } maybe_default_compression_level_; + struct { + bool is_set; + grpc_compression_algorithm algorithm; + } maybe_default_compression_algorithm_; + uint32_t enabled_compression_algorithms_bitset_; }; } // namespace grpc diff --git a/include/grpc/compression.h b/include/grpc/compression.h index 04816b9f3a9..3eba00c9864 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -55,20 +55,6 @@ GRPCAPI int grpc_compression_algorithm_parse( GRPCAPI int grpc_compression_algorithm_name( grpc_compression_algorithm algorithm, char **name); -GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts); - -/** Mark \a algorithm as enabled in \a opts. */ -GRPCAPI void grpc_compression_options_enable_algorithm( - grpc_compression_options *opts, grpc_compression_algorithm algorithm); - -/** Mark \a algorithm as disabled in \a opts. */ -GRPCAPI void grpc_compression_options_disable_algorithm( - grpc_compression_options *opts, grpc_compression_algorithm algorithm); - -/** Returns true if \a algorithm is marked as enabled in \a opts. */ -GRPCAPI int grpc_compression_options_is_algorithm_enabled( - const grpc_compression_options *opts, grpc_compression_algorithm algorithm); - #ifdef __cplusplus } #endif diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h index 7cf68bfaf89..19c2cefcf4c 100644 --- a/include/grpc/impl/codegen/compression_types.h +++ b/include/grpc/impl/codegen/compression_types.h @@ -74,32 +74,6 @@ typedef enum { GRPC_COMPRESS_LEVEL_COUNT } grpc_compression_level; -typedef struct grpc_compression_options { - /** All algs are enabled by default. This option corresponds to the channel - * argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET - */ - uint32_t enabled_algorithms_bitset; - - /** The default channel compression level. It'll be used in the absence of - * call specific settings. This option corresponds to the channel argument key - * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present, takes - * precedence over \a default_algorithm. - * TODO(dgq): currently only available for server channels. */ - struct { - bool is_set; - grpc_compression_algorithm level; - } default_level; - - /** The default channel compression algorithm. It'll be used in the absence of - * call specific settings. This option corresponds to the channel argument key - * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */ - struct { - bool is_set; - grpc_compression_algorithm algorithm; - } default_algorithm; - -} grpc_compression_options; - #ifdef __cplusplus } #endif diff --git a/src/core/lib/compression/compression_algorithm.c b/src/core/lib/compression/compression_algorithm.c index c7f834d9891..6cbdbd81b0e 100644 --- a/src/core/lib/compression/compression_algorithm.c +++ b/src/core/lib/compression/compression_algorithm.c @@ -124,25 +124,3 @@ grpc_mdelem *grpc_compression_encoding_mdelem( } return NULL; } - -void grpc_compression_options_init(grpc_compression_options *opts) { - opts->enabled_algorithms_bitset = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; - opts->default_level.is_set = false; - opts->default_algorithm.is_set = false; -} - -void grpc_compression_options_enable_algorithm( - grpc_compression_options *opts, grpc_compression_algorithm algorithm) { - GPR_BITSET(&opts->enabled_algorithms_bitset, algorithm); -} - -void grpc_compression_options_disable_algorithm( - grpc_compression_options *opts, grpc_compression_algorithm algorithm) { - GPR_BITCLEAR(&opts->enabled_algorithms_bitset, algorithm); -} - -int grpc_compression_options_is_algorithm_enabled( - const grpc_compression_options *opts, - grpc_compression_algorithm algorithm) { - return GPR_BITGET(opts->enabled_algorithms_bitset, algorithm); -} diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index e6050c3b522..bbea9355bab 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -37,6 +37,8 @@ #include #include #include + +#include "include/grpc/support/useful.h" #include "src/cpp/server/thread_pool_interface.h" namespace grpc { @@ -52,12 +54,18 @@ static void do_plugin_list_init(void) { ServerBuilder::ServerBuilder() : max_message_size_(-1), generic_service_(nullptr) { - grpc_compression_options_init(&compression_options_); gpr_once_init(&once_init_plugin_list, do_plugin_list_init); for (auto factory : (*g_plugin_factory_list)) { std::unique_ptr plugin = factory(); plugins_[plugin->name()] = std::move(plugin); } + // all compression algorithms enabled by default. + enabled_compression_algorithms_bitset_ = + (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; + memset(&maybe_default_compression_level_, 0, + sizeof(maybe_default_compression_level_)); + memset(&maybe_default_compression_algorithm_, 0, + sizeof(maybe_default_compression_algorithm_)); } std::unique_ptr ServerBuilder::AddCompletionQueue() { @@ -66,35 +74,65 @@ std::unique_ptr ServerBuilder::AddCompletionQueue() { return std::unique_ptr(cq); } -void ServerBuilder::RegisterService(Service* service) { +ServerBuilder& ServerBuilder::RegisterService(Service* service) { services_.emplace_back(new NamedService(service)); + return *this; } -void ServerBuilder::RegisterService(const grpc::string& addr, - Service* service) { +ServerBuilder& ServerBuilder::RegisterService(const grpc::string& addr, + Service* service) { services_.emplace_back(new NamedService(addr, service)); + return *this; } -void ServerBuilder::RegisterAsyncGenericService(AsyncGenericService* service) { +ServerBuilder& ServerBuilder::RegisterAsyncGenericService( + AsyncGenericService* service) { if (generic_service_) { gpr_log(GPR_ERROR, "Adding multiple AsyncGenericService is unsupported for now. " "Dropping the service %p", service); - return; + } else { + generic_service_ = service; } - generic_service_ = service; + return *this; } -void ServerBuilder::SetOption(std::unique_ptr option) { +ServerBuilder& ServerBuilder::SetOption( + std::unique_ptr option) { options_.push_back(std::move(option)); + return *this; +} + +ServerBuilder& ServerBuilder::SetCompressionAlgorithmSupportStatus( + grpc_compression_algorithm algorithm, bool enabled) { + if (enabled) { + GPR_BITSET(&enabled_compression_algorithms_bitset_, algorithm); + } else { + GPR_BITCLEAR(&enabled_compression_algorithms_bitset_, algorithm); + } + return *this; } -void ServerBuilder::AddListeningPort(const grpc::string& addr, - std::shared_ptr creds, - int* selected_port) { +ServerBuilder& ServerBuilder::SetDefaultCompressionLevel( + grpc_compression_level level) { + maybe_default_compression_level_.level = level; + return *this; +} + +ServerBuilder& ServerBuilder::SetDefaultCompressionAlgorithm( + grpc_compression_algorithm algorithm) { + maybe_default_compression_algorithm_.is_set = true; + maybe_default_compression_algorithm_.algorithm = algorithm; + return *this; +} + +ServerBuilder& ServerBuilder::AddListeningPort( + const grpc::string& addr, std::shared_ptr creds, + int* selected_port) { Port port = {addr, creds, selected_port}; ports_.push_back(port); + return *this; } std::unique_ptr ServerBuilder::BuildAndStart() { @@ -124,13 +162,14 @@ std::unique_ptr ServerBuilder::BuildAndStart() { args.SetInt(GRPC_ARG_MAX_MESSAGE_LENGTH, max_message_size_); } args.SetInt(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, - compression_options_.enabled_algorithms_bitset); - if (compression_options_.default_level.is_set) { + enabled_compression_algorithms_bitset_); + if (maybe_default_compression_level_.is_set) { args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL, - compression_options_.default_level.level); - } else if (compression_options_.default_algorithm.is_set) { + maybe_default_compression_level_.level); + } + if (maybe_default_compression_algorithm_.is_set) { args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, - compression_options_.default_algorithm.algorithm); + maybe_default_compression_algorithm_.algorithm); } std::unique_ptr server( new Server(thread_pool.release(), true, max_message_size_, &args)); diff --git a/test/core/compression/compression_test.c b/test/core/compression/compression_test.c index ed6f9e72142..5ee1805222b 100644 --- a/test/core/compression/compression_test.c +++ b/test/core/compression/compression_test.c @@ -92,40 +92,10 @@ static void test_compression_algorithm_name(void) { /* the value of "name" is undefined upon failure */ } -static void test_compression_enable_disable_algorithm(void) { - grpc_compression_options options; - grpc_compression_algorithm algorithm; - - gpr_log(GPR_DEBUG, "test_compression_enable_disable_algorithm"); - - grpc_compression_options_init(&options); - for (algorithm = GRPC_COMPRESS_NONE; - algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) { - /* all algorithms are enabled by default */ - GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options, - algorithm) != 0); - } - /* disable one by one */ - for (algorithm = GRPC_COMPRESS_NONE; - algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) { - grpc_compression_options_disable_algorithm(&options, algorithm); - GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options, - algorithm) == 0); - } - /* re-enable one by one */ - for (algorithm = GRPC_COMPRESS_NONE; - algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) { - grpc_compression_options_enable_algorithm(&options, algorithm); - GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options, - algorithm) != 0); - } -} - int main(int argc, char **argv) { grpc_init(); test_compression_algorithm_parse(); test_compression_algorithm_name(); - test_compression_enable_disable_algorithm(); grpc_shutdown(); return 0; From 51341eaa06d2d92950972bfbc515243362b10597 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 17 May 2016 23:47:55 -0700 Subject: [PATCH 031/175] regenerated projects --- grpc.def | 4 ---- src/python/grpcio/grpc/_cython/imports.generated.c | 8 -------- src/python/grpcio/grpc/_cython/imports.generated.h | 12 ------------ src/ruby/ext/grpc/rb_grpc_imports.generated.c | 8 -------- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 12 ------------ 5 files changed, 44 deletions(-) diff --git a/grpc.def b/grpc.def index e807b8cf8ff..656f74c12f5 100644 --- a/grpc.def +++ b/grpc.def @@ -34,10 +34,6 @@ EXPORTS census_view_reset grpc_compression_algorithm_parse grpc_compression_algorithm_name - grpc_compression_options_init - grpc_compression_options_enable_algorithm - grpc_compression_options_disable_algorithm - grpc_compression_options_is_algorithm_enabled grpc_metadata_array_init grpc_metadata_array_destroy grpc_call_details_init diff --git a/src/python/grpcio/grpc/_cython/imports.generated.c b/src/python/grpcio/grpc/_cython/imports.generated.c index 3daa6d6affc..c557d9e964e 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.c +++ b/src/python/grpcio/grpc/_cython/imports.generated.c @@ -72,10 +72,6 @@ census_view_get_data_type census_view_get_data_import; census_view_reset_type census_view_reset_import; grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import; grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; -grpc_compression_options_init_type grpc_compression_options_init_import; -grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import; -grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import; -grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import; grpc_metadata_array_init_type grpc_metadata_array_init_import; grpc_metadata_array_destroy_type grpc_metadata_array_destroy_import; grpc_call_details_init_type grpc_call_details_init_import; @@ -342,10 +338,6 @@ void pygrpc_load_imports(HMODULE library) { census_view_reset_import = (census_view_reset_type) GetProcAddress(library, "census_view_reset"); grpc_compression_algorithm_parse_import = (grpc_compression_algorithm_parse_type) GetProcAddress(library, "grpc_compression_algorithm_parse"); grpc_compression_algorithm_name_import = (grpc_compression_algorithm_name_type) GetProcAddress(library, "grpc_compression_algorithm_name"); - grpc_compression_options_init_import = (grpc_compression_options_init_type) GetProcAddress(library, "grpc_compression_options_init"); - grpc_compression_options_enable_algorithm_import = (grpc_compression_options_enable_algorithm_type) GetProcAddress(library, "grpc_compression_options_enable_algorithm"); - grpc_compression_options_disable_algorithm_import = (grpc_compression_options_disable_algorithm_type) GetProcAddress(library, "grpc_compression_options_disable_algorithm"); - grpc_compression_options_is_algorithm_enabled_import = (grpc_compression_options_is_algorithm_enabled_type) GetProcAddress(library, "grpc_compression_options_is_algorithm_enabled"); grpc_metadata_array_init_import = (grpc_metadata_array_init_type) GetProcAddress(library, "grpc_metadata_array_init"); grpc_metadata_array_destroy_import = (grpc_metadata_array_destroy_type) GetProcAddress(library, "grpc_metadata_array_destroy"); grpc_call_details_init_import = (grpc_call_details_init_type) GetProcAddress(library, "grpc_call_details_init"); diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index 2a81352f0b5..2f4523411a0 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -167,18 +167,6 @@ extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_im typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, char **name); extern grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; #define grpc_compression_algorithm_name grpc_compression_algorithm_name_import -typedef void(*grpc_compression_options_init_type)(grpc_compression_options *opts); -extern grpc_compression_options_init_type grpc_compression_options_init_import; -#define grpc_compression_options_init grpc_compression_options_init_import -typedef void(*grpc_compression_options_enable_algorithm_type)(grpc_compression_options *opts, grpc_compression_algorithm algorithm); -extern grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import; -#define grpc_compression_options_enable_algorithm grpc_compression_options_enable_algorithm_import -typedef void(*grpc_compression_options_disable_algorithm_type)(grpc_compression_options *opts, grpc_compression_algorithm algorithm); -extern grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import; -#define grpc_compression_options_disable_algorithm grpc_compression_options_disable_algorithm_import -typedef int(*grpc_compression_options_is_algorithm_enabled_type)(const grpc_compression_options *opts, grpc_compression_algorithm algorithm); -extern grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import; -#define grpc_compression_options_is_algorithm_enabled grpc_compression_options_is_algorithm_enabled_import typedef void(*grpc_metadata_array_init_type)(grpc_metadata_array *array); extern grpc_metadata_array_init_type grpc_metadata_array_init_import; #define grpc_metadata_array_init grpc_metadata_array_init_import diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 07d52d83daa..7994822a068 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -72,10 +72,6 @@ census_view_get_data_type census_view_get_data_import; census_view_reset_type census_view_reset_import; grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import; grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; -grpc_compression_options_init_type grpc_compression_options_init_import; -grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import; -grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import; -grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import; grpc_metadata_array_init_type grpc_metadata_array_init_import; grpc_metadata_array_destroy_type grpc_metadata_array_destroy_import; grpc_call_details_init_type grpc_call_details_init_import; @@ -338,10 +334,6 @@ void grpc_rb_load_imports(HMODULE library) { census_view_reset_import = (census_view_reset_type) GetProcAddress(library, "census_view_reset"); grpc_compression_algorithm_parse_import = (grpc_compression_algorithm_parse_type) GetProcAddress(library, "grpc_compression_algorithm_parse"); grpc_compression_algorithm_name_import = (grpc_compression_algorithm_name_type) GetProcAddress(library, "grpc_compression_algorithm_name"); - grpc_compression_options_init_import = (grpc_compression_options_init_type) GetProcAddress(library, "grpc_compression_options_init"); - grpc_compression_options_enable_algorithm_import = (grpc_compression_options_enable_algorithm_type) GetProcAddress(library, "grpc_compression_options_enable_algorithm"); - grpc_compression_options_disable_algorithm_import = (grpc_compression_options_disable_algorithm_type) GetProcAddress(library, "grpc_compression_options_disable_algorithm"); - grpc_compression_options_is_algorithm_enabled_import = (grpc_compression_options_is_algorithm_enabled_type) GetProcAddress(library, "grpc_compression_options_is_algorithm_enabled"); grpc_metadata_array_init_import = (grpc_metadata_array_init_type) GetProcAddress(library, "grpc_metadata_array_init"); grpc_metadata_array_destroy_import = (grpc_metadata_array_destroy_type) GetProcAddress(library, "grpc_metadata_array_destroy"); grpc_call_details_init_import = (grpc_call_details_init_type) GetProcAddress(library, "grpc_call_details_init"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 6885e3926aa..fd573808d80 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -167,18 +167,6 @@ extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_im typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, char **name); extern grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import; #define grpc_compression_algorithm_name grpc_compression_algorithm_name_import -typedef void(*grpc_compression_options_init_type)(grpc_compression_options *opts); -extern grpc_compression_options_init_type grpc_compression_options_init_import; -#define grpc_compression_options_init grpc_compression_options_init_import -typedef void(*grpc_compression_options_enable_algorithm_type)(grpc_compression_options *opts, grpc_compression_algorithm algorithm); -extern grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import; -#define grpc_compression_options_enable_algorithm grpc_compression_options_enable_algorithm_import -typedef void(*grpc_compression_options_disable_algorithm_type)(grpc_compression_options *opts, grpc_compression_algorithm algorithm); -extern grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import; -#define grpc_compression_options_disable_algorithm grpc_compression_options_disable_algorithm_import -typedef int(*grpc_compression_options_is_algorithm_enabled_type)(const grpc_compression_options *opts, grpc_compression_algorithm algorithm); -extern grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import; -#define grpc_compression_options_is_algorithm_enabled grpc_compression_options_is_algorithm_enabled_import typedef void(*grpc_metadata_array_init_type)(grpc_metadata_array *array); extern grpc_metadata_array_init_type grpc_metadata_array_init_import; #define grpc_metadata_array_init grpc_metadata_array_init_import From efb01ded5e64ad22241aeb9d54ff94cc50b9921f Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 18 May 2016 09:06:14 -0700 Subject: [PATCH 032/175] php: update package.xml after fixes --- package.xml | 23 +++++++++++++++++++---- templates/package.xml.template | 23 +++++++++++++++++++---- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/package.xml b/package.xml index e8386948a6d..66f54a77ecb 100644 --- a/package.xml +++ b/package.xml @@ -10,7 +10,7 @@ grpc-packages@google.com yes - 2016-04-19 + 2016-05-18 0.14.2 @@ -22,7 +22,7 @@ BSD -- destroy grpc_byte_buffer after startBatch #6096 +- Updated functions with TSRM macros for ZTS support #6607 @@ -1014,8 +1014,8 @@ Update to wrap gRPC C Core version 0.10.0 - 0.14.2 - 0.14.2 + 0.14.0 + 0.14.0 beta @@ -1027,5 +1027,20 @@ Update to wrap gRPC C Core version 0.10.0 - destroy grpc_byte_buffer after startBatch #6096 + + + 0.14.2 + 0.14.2 + + + beta + beta + + 2016-05-18 + BSD + +- Updated functions with TSRM macros for ZTS support #6607 + + diff --git a/templates/package.xml.template b/templates/package.xml.template index 63132dac947..7ba73d26ca4 100644 --- a/templates/package.xml.template +++ b/templates/package.xml.template @@ -12,7 +12,7 @@ grpc-packages@google.com yes - 2016-04-19 + 2016-05-18 ${settings.php_version.php()} @@ -24,7 +24,7 @@ BSD - - destroy grpc_byte_buffer after startBatch #6096 + - Updated functions with TSRM macros for ZTS support #6607 @@ -172,8 +172,8 @@ - ${settings.php_version.php()} - ${settings.php_version.php()} + 0.14.0 + 0.14.0 beta @@ -185,5 +185,20 @@ - destroy grpc_byte_buffer after startBatch #6096 + + + ${settings.php_version.php()} + ${settings.php_version.php()} + + + beta + beta + + 2016-05-18 + BSD + + - Updated functions with TSRM macros for ZTS support #6607 + + From 3e71f774c8c004d97fea6d48dbb89341c71195ad Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 18 May 2016 10:14:32 -0700 Subject: [PATCH 033/175] moved md compression validation outside of md filter --- src/core/lib/surface/call.c | 61 ++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 63d22af7115..99bb4798aaf 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -414,30 +414,7 @@ static void set_status_code(grpc_call *call, status_source source, static void set_compression_algorithm(grpc_call *call, grpc_compression_algorithm algo) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - char *error_msg = NULL; - const grpc_compression_options compression_options = - grpc_channel_get_compression_options(call->channel); - - /* check if algorithm is known */ - if (algo >= GRPC_COMPRESS_ALGORITHMS_COUNT) { - gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.", algo); - gpr_log(GPR_ERROR, error_msg); - close_with_status(&exec_ctx, call, GRPC_STATUS_INTERNAL, error_msg); - } else if (grpc_compression_options_is_algorithm_enabled(&compression_options, - algo) == 0) { - /* check if algorithm is supported by current channel config */ - char *algo_name; - grpc_compression_algorithm_name(algo, &algo_name); - gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.", - algo_name); - gpr_log(GPR_ERROR, error_msg); - close_with_status(&exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg); - } else { - call->compression_algorithm = algo; - } - gpr_free(error_msg); - grpc_exec_ctx_finish(&exec_ctx); + call->compression_algorithm = algo; } grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm( @@ -748,7 +725,7 @@ static void done_termination(grpc_exec_ctx *exec_ctx, void *tcp, bool success) { } gpr_slice_unref(tc->optional_message); if (tc->op_closure != NULL) { - grpc_exec_ctx_enqueue(exec_ctx, tc->op_closure, false, NULL); + grpc_exec_ctx_enqueue(exec_ctx, tc->op_closure, true, NULL); } gpr_free(tc); } @@ -1156,6 +1133,36 @@ static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp, } } +static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx, + batch_control *bctl) { + grpc_call *call = bctl->call; + if (call->compression_algorithm != GRPC_COMPRESS_NONE) { + const grpc_compression_algorithm algo = call->compression_algorithm; + char *error_msg = NULL; + const grpc_compression_options compression_options = + grpc_channel_get_compression_options(call->channel); + /* check if algorithm is known */ + if (algo >= GRPC_COMPRESS_ALGORITHMS_COUNT) { + gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.", + algo); + gpr_log(GPR_ERROR, error_msg); + close_with_status(exec_ctx, call, GRPC_STATUS_INTERNAL, error_msg); + } else if (grpc_compression_options_is_algorithm_enabled( + &compression_options, algo) == 0) { + /* check if algorithm is supported by current channel config */ + char *algo_name; + grpc_compression_algorithm_name(algo, &algo_name); + gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.", + algo_name); + gpr_log(GPR_ERROR, error_msg); + close_with_status(exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg); + } else { + call->compression_algorithm = algo; + } + gpr_free(error_msg); + } +} + static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx, void *bctlp, bool success) { batch_control *bctl = bctlp; @@ -1170,6 +1177,10 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx, &call->metadata_batch[1 /* is_receiving */][0 /* is_trailing */]; grpc_metadata_batch_filter(md, recv_initial_filter, call); + GPR_TIMER_BEGIN("validate_filtered_metadata", 0); + validate_filtered_metadata(exec_ctx, bctl); + GPR_TIMER_END("validate_filtered_metadata", 0); + if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) != 0 && !call->is_client) { From 7c7195d8c8f7143ab65dce572f348745c2636962 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 18 May 2016 11:26:11 -0700 Subject: [PATCH 034/175] removed references to grpc_compress_options from Python --- .../grpcio/grpc/_cython/_cygrpc/grpc.pxi | 14 ---------- .../grpc/_cython/_cygrpc/records.pxd.pxi | 5 ---- .../grpc/_cython/_cygrpc/records.pyx.pxi | 26 ------------------- 3 files changed, 45 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 66e6e6b549a..2fced6cf471 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -442,10 +442,6 @@ cdef extern from "grpc/_cython/loader.h": GRPC_COMPRESS_LEVEL_HIGH GRPC_COMPRESS_LEVEL_COUNT - ctypedef struct grpc_compression_options: - uint32_t enabled_algorithms_bitset - grpc_compression_algorithm default_compression_algorithm - int grpc_compression_algorithm_parse( const char *name, size_t name_length, grpc_compression_algorithm *algorithm) nogil @@ -453,13 +449,3 @@ cdef extern from "grpc/_cython/loader.h": char **name) nogil grpc_compression_algorithm grpc_compression_algorithm_for_level( grpc_compression_level level, uint32_t accepted_encodings) nogil - void grpc_compression_options_init(grpc_compression_options *opts) nogil - void grpc_compression_options_enable_algorithm( - grpc_compression_options *opts, - grpc_compression_algorithm algorithm) nogil - void grpc_compression_options_disable_algorithm( - grpc_compression_options *opts, - grpc_compression_algorithm algorithm) nogil - int grpc_compression_options_is_algorithm_enabled( - const grpc_compression_options *opts, - grpc_compression_algorithm algorithm) nogil diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi index 0474697af82..8ac18f0c3e7 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pxd.pxi @@ -123,8 +123,3 @@ cdef class Operations: cdef grpc_op *c_ops cdef size_t c_nops cdef list operations - - -cdef class CompressionOptions: - - cdef grpc_compression_options c_options diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index c7539f0d490..fda317b9a16 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -718,32 +718,6 @@ cdef class Operations: return _OperationsIterator(self) -cdef class CompressionOptions: - - def __cinit__(self): - with nogil: - grpc_compression_options_init(&self.c_options) - - def enable_algorithm(self, grpc_compression_algorithm algorithm): - with nogil: - grpc_compression_options_enable_algorithm(&self.c_options, algorithm) - - def disable_algorithm(self, grpc_compression_algorithm algorithm): - with nogil: - grpc_compression_options_disable_algorithm(&self.c_options, algorithm) - - def is_algorithm_enabled(self, grpc_compression_algorithm algorithm): - cdef int result - with nogil: - result = grpc_compression_options_is_algorithm_enabled( - &self.c_options, algorithm) - return result - - def to_channel_arg(self): - return ChannelArg(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, - self.c_options.enabled_algorithms_bitset) - - def compression_algorithm_name(grpc_compression_algorithm algorithm): cdef char* name with nogil: From 697a41f682f718f059505f7c3384004f4f0fa5cf Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 18 May 2016 15:26:42 -0700 Subject: [PATCH 035/175] fixes to grpc++/impl/codegen/call.h --- include/grpc++/impl/codegen/call.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index aac78eddedb..a9e5978b43b 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -190,7 +190,7 @@ class CallOpSendInitialMetadata { initial_metadata_count_ = metadata.size(); initial_metadata_ = FillMetadataArray(metadata); // TODO(dgq): expose compression level in API so it can be properly set. - compression_level_ = GRPC_COMPRESS_LEVEL_NONE; + maybe_compression_level_.is_set = false; } protected: @@ -202,9 +202,8 @@ class CallOpSendInitialMetadata { op->reserved = NULL; op->data.send_initial_metadata.count = initial_metadata_count_; op->data.send_initial_metadata.metadata = initial_metadata_; - op->data.send_initial_metadata.maybe_compression_level.is_set = true; - op->data.send_initial_metadata.maybe_compression_level.compression_level = - compression_level_; + memcpy(&op->data.send_initial_metadata.maybe_compression_level, + &maybe_compression_level_, sizeof(maybe_compression_level_)); } void FinishOp(bool* status, int max_message_size) { if (!send_) return; @@ -216,7 +215,10 @@ class CallOpSendInitialMetadata { uint32_t flags_; size_t initial_metadata_count_; grpc_metadata* initial_metadata_; - grpc_compression_level compression_level_; + struct { + bool is_set; + grpc_compression_level level; + } maybe_compression_level_; }; class CallOpSendMessage { From ddefbb82270d97d8b87cac4959993ae61e204d1c Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 18 May 2016 17:15:11 -0700 Subject: [PATCH 036/175] force-set support for identity alg. in channel arg bitset --- src/core/lib/channel/channel_args.c | 7 ++++--- src/core/lib/channel/compress_filter.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 920b632abfe..a171b41b357 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -199,7 +199,8 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args *a, !strcmp(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, a->args[i].key)) { *states_arg = &a->args[i].value.integer; - return 1; /* GPR_TRUE */ + **states_arg |= 0x1; /* forcefully enable support for no compression */ + return 1; } } } @@ -216,7 +217,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( if (states_arg_found) { if (state != 0) { GPR_BITSET((unsigned *)states_arg, algorithm); - } else { + } else if (algorithm != GRPC_COMPRESS_NONE) { GPR_BITCLEAR((unsigned *)states_arg, algorithm); } } else { @@ -228,7 +229,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( tmp.value.integer = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; if (state != 0) { GPR_BITSET((unsigned *)&tmp.value.integer, algorithm); - } else { + } else if (algorithm != GRPC_COMPRESS_NONE) { GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm); } result = grpc_channel_args_copy_and_add(*a, &tmp, 1); diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index 9bda1aa47b7..16e82ddee9a 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -296,8 +296,8 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx, channeld->default_compression_algorithm = GRPC_COMPRESS_NONE; } - channeld->supported_compression_algorithms = 0; - for (grpc_compression_algorithm algo_idx = 0; + channeld->supported_compression_algorithms = 1; /* always support identity */ + for (grpc_compression_algorithm algo_idx = 1; algo_idx < GRPC_COMPRESS_ALGORITHMS_COUNT; ++algo_idx) { /* skip disabled algorithms */ if (!GPR_BITGET(channeld->enabled_algorithms_bitset, algo_idx)) { From 824f83758d80717f910c2cf973ff41fd98f8d81e Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 18 May 2016 17:52:46 -0700 Subject: [PATCH 037/175] s/INTERNAL/UNIMPLEMENTED --- src/core/lib/surface/call.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index b5469e1ff9c..e7e1434d114 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1154,7 +1154,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx, gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.", algo); gpr_log(GPR_ERROR, error_msg); - close_with_status(exec_ctx, call, GRPC_STATUS_INTERNAL, error_msg); + close_with_status(exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg); } else if (grpc_compression_options_is_algorithm_enabled( &compression_options, algo) == 0) { /* check if algorithm is supported by current channel config */ From 3f8d199bbc5a14694c3b6b03c55236f5e25788d8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 12 May 2016 08:38:41 -0700 Subject: [PATCH 038/175] improve channel behavior in shutdown situations --- src/csharp/Grpc.Core.Tests/ChannelTest.cs | 39 +++++++++++++++++++++++ src/csharp/Grpc.Core/Channel.cs | 34 ++++++++++++++++++-- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ChannelTest.cs b/src/csharp/Grpc.Core.Tests/ChannelTest.cs index 6330f50faed..850d70ce926 100644 --- a/src/csharp/Grpc.Core.Tests/ChannelTest.cs +++ b/src/csharp/Grpc.Core.Tests/ChannelTest.cs @@ -32,6 +32,7 @@ #endregion using System; +using System.Threading.Tasks; using Grpc.Core; using Grpc.Core.Internal; using Grpc.Core.Utils; @@ -89,5 +90,43 @@ namespace Grpc.Core.Tests channel.ShutdownAsync().Wait(); Assert.ThrowsAsync(typeof(InvalidOperationException), async () => await channel.ShutdownAsync()); } + + [Test] + public async Task ShutdownTokenCancelledAfterShutdown() + { + var channel = new Channel("localhost", ChannelCredentials.Insecure); + Assert.IsFalse(channel.ShutdownToken.IsCancellationRequested); + var shutdownTask = channel.ShutdownAsync(); + Assert.IsTrue(channel.ShutdownToken.IsCancellationRequested); + await shutdownTask; + } + + [Test] + public async Task StateIsFatalFailureAfterShutdown() + { + var channel = new Channel("localhost", ChannelCredentials.Insecure); + await channel.ShutdownAsync(); + Assert.AreEqual(ChannelState.FatalFailure, channel.State); + } + + [Test] + public async Task ShutdownFinishesWaitForStateChangedAsync() + { + var channel = new Channel("localhost", ChannelCredentials.Insecure); + var stateChangedTask = channel.WaitForStateChangedAsync(ChannelState.Idle); + var shutdownTask = channel.ShutdownAsync(); + await stateChangedTask; + await shutdownTask; + } + + [Test] + public async Task OperationsThrowAfterShutdown() + { + var channel = new Channel("localhost", ChannelCredentials.Insecure); + await channel.ShutdownAsync(); + Assert.ThrowsAsync(typeof(ObjectDisposedException), async () => await channel.WaitForStateChangedAsync(ChannelState.Idle)); + Assert.Throws(typeof(ObjectDisposedException), () => { var x = channel.ResolvedTarget; }); + Assert.ThrowsAsync(typeof(TaskCanceledException), async () => await channel.ConnectAsync()); + } } } diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs index 89981b1849b..93a6e6a3d95 100644 --- a/src/csharp/Grpc.Core/Channel.cs +++ b/src/csharp/Grpc.Core/Channel.cs @@ -32,6 +32,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Grpc.Core.Internal; @@ -51,6 +52,7 @@ namespace Grpc.Core readonly object myLock = new object(); readonly AtomicCounter activeCallCounter = new AtomicCounter(); + readonly CancellationTokenSource shutdownTokenSource = new CancellationTokenSource(); readonly string target; readonly GrpcEnvironment environment; @@ -101,12 +103,13 @@ namespace Grpc.Core /// /// Gets current connectivity state of this channel. + /// After channel is has been shutdown, ChannelState.FatalFailure will be returned. /// public ChannelState State { get { - return handle.CheckConnectivityState(false); + return GetConnectivityState(false); } } @@ -154,6 +157,17 @@ namespace Grpc.Core } } + /// + /// Returns a token that gets cancelled once ShutdownAsync is invoked. + /// + public CancellationToken ShutdownToken + { + get + { + return this.shutdownTokenSource.Token; + } + } + /// /// Allows explicitly requesting channel to connect without starting an RPC. /// Returned task completes once state Ready was seen. If the deadline is reached, @@ -164,7 +178,7 @@ namespace Grpc.Core /// The deadline. null indicates no deadline. public async Task ConnectAsync(DateTime? deadline = null) { - var currentState = handle.CheckConnectivityState(true); + var currentState = GetConnectivityState(true); while (currentState != ChannelState.Ready) { if (currentState == ChannelState.FatalFailure) @@ -172,7 +186,7 @@ namespace Grpc.Core throw new OperationCanceledException("Channel has reached FatalFailure state."); } await WaitForStateChangedAsync(currentState, deadline).ConfigureAwait(false); - currentState = handle.CheckConnectivityState(false); + currentState = GetConnectivityState(false); } } @@ -188,6 +202,8 @@ namespace Grpc.Core shutdownRequested = true; } + shutdownTokenSource.Cancel(); + var activeCallCount = activeCallCounter.Count; if (activeCallCount > 0) { @@ -231,6 +247,18 @@ namespace Grpc.Core activeCallCounter.Decrement(); } + private ChannelState GetConnectivityState(bool tryToConnect) + { + try + { + return handle.CheckConnectivityState(tryToConnect); + } + catch (ObjectDisposedException) + { + return ChannelState.FatalFailure; + } + } + private static void EnsureUserAgentChannelOption(Dictionary options) { var key = ChannelOptions.PrimaryUserAgentString; From 013f5a7c4012ca5c5f1e8dc80df09d12780df4a8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 9 May 2016 12:44:11 -0700 Subject: [PATCH 039/175] add more tests --- .../Grpc.Core.Tests/Internal/AsyncCallTest.cs | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs index abe9d4a2e62..6f8668d143e 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs @@ -181,13 +181,14 @@ namespace Grpc.Core.Internal.Tests } [Test] - public void ClientStreaming_WriteFailure() + public void ClientStreaming_WriteCompletionFailure() { var resultTask = asyncCall.ClientStreamingCallAsync(); var requestStream = new ClientRequestStream(asyncCall); var writeTask = requestStream.WriteAsync("request1"); fakeCall.SendCompletionHandler(false); + // TODO: maybe IOException or waiting for RPCException is more appropriate here. Assert.ThrowsAsync(typeof(InvalidOperationException), async () => await writeTask); fakeCall.UnaryResponseClientHandler(true, @@ -199,7 +200,7 @@ namespace Grpc.Core.Internal.Tests } [Test] - public void ClientStreaming_WriteAfterReceivingStatusFails() + public void ClientStreaming_WriteAfterReceivingStatusThrowsRpcException() { var resultTask = asyncCall.ClientStreamingCallAsync(); var requestStream = new ClientRequestStream(asyncCall); @@ -210,7 +211,28 @@ namespace Grpc.Core.Internal.Tests new Metadata()); AssertUnaryResponseSuccess(asyncCall, fakeCall, resultTask); + var ex = Assert.Throws(() => requestStream.WriteAsync("request1")); + //TODO: add assert. + } + + [Test] + public void ClientStreaming_WriteAfterCompleteThrowsInvalidOperationException() + { + var resultTask = asyncCall.ClientStreamingCallAsync(); + var requestStream = new ClientRequestStream(asyncCall); + + requestStream.CompleteAsync(); + Assert.Throws(typeof(InvalidOperationException), () => requestStream.WriteAsync("request1")); + + fakeCall.SendCompletionHandler(true); + + fakeCall.UnaryResponseClientHandler(true, + new ClientSideStatus(Status.DefaultSuccess, new Metadata()), + CreateResponsePayload(), + new Metadata()); + + AssertUnaryResponseSuccess(asyncCall, fakeCall, resultTask); } [Test] @@ -229,7 +251,7 @@ namespace Grpc.Core.Internal.Tests } [Test] - public void ClientStreaming_WriteAfterCancellationRequestFails() + public void ClientStreaming_WriteAfterCancellationRequestThrowsOperationCancelledException() { var resultTask = asyncCall.ClientStreamingCallAsync(); var requestStream = new ClientRequestStream(asyncCall); @@ -340,7 +362,7 @@ namespace Grpc.Core.Internal.Tests } [Test] - public void DuplexStreaming_WriteAfterReceivingStatusFails() + public void DuplexStreaming_WriteAfterReceivingStatusThrowsRpcException() { asyncCall.StartDuplexStreamingCall(); var requestStream = new ClientRequestStream(asyncCall); @@ -352,7 +374,8 @@ namespace Grpc.Core.Internal.Tests AssertStreamingResponseSuccess(asyncCall, fakeCall, readTask); - Assert.ThrowsAsync(typeof(InvalidOperationException), async () => await requestStream.WriteAsync("request1")); + var ex = Assert.ThrowsAsync(async () => await requestStream.WriteAsync("request1")); + //TODO: add assert. } [Test] @@ -372,7 +395,7 @@ namespace Grpc.Core.Internal.Tests } [Test] - public void DuplexStreaming_WriteAfterCancellationRequestFails() + public void DuplexStreaming_WriteAfterCancellationRequestThrowsOperationCancelledException() { asyncCall.StartDuplexStreamingCall(); var requestStream = new ClientRequestStream(asyncCall); From 18ef23ee39739c7393b997aaaba5908be16b8af9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 9 May 2016 12:45:27 -0700 Subject: [PATCH 040/175] change typo in the comment --- src/csharp/Grpc.Core/Internal/AsyncCall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index f522174bd0f..da1e6592d19 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -57,7 +57,7 @@ namespace Grpc.Core.Internal // Completion of a pending unary response if not null. TaskCompletionSource unaryResponseTcs; - // Indicates that steaming call has finished. + // Indicates that response streaming call has finished. TaskCompletionSource streamingCallFinishedTcs = new TaskCompletionSource(); // Response headers set here once received. From a41c58c26d33a99eba8b0dede0fbafbfdfe99e5c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 9 May 2016 13:03:59 -0700 Subject: [PATCH 041/175] fixup tests --- .../Grpc.Core.Tests/Internal/AsyncCallTest.cs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs index 6f8668d143e..777a1c8c500 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs @@ -212,7 +212,23 @@ namespace Grpc.Core.Internal.Tests AssertUnaryResponseSuccess(asyncCall, fakeCall, resultTask); var ex = Assert.Throws(() => requestStream.WriteAsync("request1")); - //TODO: add assert. + Assert.AreEqual(Status.DefaultSuccess, ex.Status); + } + + [Test] + public void ClientStreaming_WriteAfterReceivingStatusThrowsRpcException2() + { + var resultTask = asyncCall.ClientStreamingCallAsync(); + var requestStream = new ClientRequestStream(asyncCall); + + fakeCall.UnaryResponseClientHandler(true, + new ClientSideStatus(new Status(StatusCode.OutOfRange, ""), new Metadata()), + CreateResponsePayload(), + new Metadata()); + + AssertUnaryResponseError(asyncCall, fakeCall, resultTask, StatusCode.OutOfRange); + var ex = Assert.Throws(() => requestStream.WriteAsync("request1")); + Assert.AreEqual(StatusCode.OutOfRange, ex.Status.StatusCode); } [Test] @@ -375,7 +391,7 @@ namespace Grpc.Core.Internal.Tests AssertStreamingResponseSuccess(asyncCall, fakeCall, readTask); var ex = Assert.ThrowsAsync(async () => await requestStream.WriteAsync("request1")); - //TODO: add assert. + Assert.AreEqual(Status.DefaultSuccess, ex.Status); } [Test] From 144a698f0c910ad753fbc774830f91f7071ef8e8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 9 May 2016 13:04:30 -0700 Subject: [PATCH 042/175] throw RpcException from writes after finishing --- src/csharp/Grpc.Core/Internal/AsyncCall.cs | 13 +++++++++++++ src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index da1e6592d19..55351869b5c 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -443,6 +443,19 @@ namespace Grpc.Core.Internal } } + protected override void CheckSendingAllowed(bool allowFinished) + { + base.CheckSendingAllowed(true); + + // throwing RpcException if we already received status on client + // side makes the most sense. + // Note that this throws even for StatusCode.OK. + if (!allowFinished && finishedStatus.HasValue) + { + throw new RpcException(finishedStatus.Value.Status); + } + } + /// /// Handles receive status completion for calls with streaming response. /// diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index 42234dcac21..4de23706b28 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -213,7 +213,7 @@ namespace Grpc.Core.Internal { } - protected void CheckSendingAllowed(bool allowFinished) + protected virtual void CheckSendingAllowed(bool allowFinished) { GrpcPreconditions.CheckState(started); CheckNotCancelled(); From f1cdc33d17f6ada964fc9ba18ac210c3f5b7f561 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 10 May 2016 09:57:51 -0700 Subject: [PATCH 043/175] fix TimeoutOnSleepingServer interop test --- src/csharp/Grpc.IntegrationTesting/InteropClient.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 70355b37c52..1541cfd7bb1 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -492,6 +492,10 @@ namespace Grpc.IntegrationTesting { // Deadline was reached before write has started. Eat the exception and continue. } + catch (RpcException) + { + // Deadline was reached before write has started. Eat the exception and continue. + } var ex = Assert.ThrowsAsync(async () => await call.ResponseStream.MoveNext()); // We can't guarantee the status code always DeadlineExceeded. See issue #2685. From 3e4f49f88d611efb9573972a18ca727f50292d14 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 18 May 2016 23:59:02 -0700 Subject: [PATCH 044/175] Added check for client in call.c's default level processing code. --- src/core/lib/surface/call.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index d081e03e2c0..69eb43c9529 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1406,12 +1406,14 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, effective_compression_level = copts.default_level.level; } } - if (level_set) { + if (level_set && !call->is_client) { const grpc_compression_algorithm calgo = compression_algorithm_for_level_locked( call, effective_compression_level); char *calgo_name; grpc_compression_algorithm_name(calgo, &calgo_name); + // the following will be picked up by the compress filter and used as + // the call's compression algorithm. compression_md.key = GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY; compression_md.value = calgo_name; compression_md.value_length = strlen(calgo_name); From a20a2ad41bfb1c30b0442578fa9fa1754bc60d53 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 19 May 2016 10:53:44 -0700 Subject: [PATCH 045/175] moved core_codegen from src/cpp/... to include/grpc++/... --- BUILD | 5 +++-- Makefile | 2 ++ build.yaml | 4 ++-- .../grpc++/impl/codegen}/core_codegen.h | 0 include/grpc++/impl/grpc_library.h | 3 +-- src/cpp/common/core_codegen.cc | 2 +- tools/doxygen/Doxyfile.c++ | 1 + tools/doxygen/Doxyfile.c++.internal | 3 ++- tools/run_tests/sources_and_headers.json | 8 ++++---- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 3 ++- vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters | 9 ++++++--- .../vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj | 2 +- .../grpc++_unsecure/grpc++_unsecure.vcxproj.filters | 6 +++--- 13 files changed, 28 insertions(+), 20 deletions(-) rename {src/cpp/common => include/grpc++/impl/codegen}/core_codegen.h (100%) diff --git a/BUILD b/BUILD index 793c1c714de..c7fe6312651 100644 --- a/BUILD +++ b/BUILD @@ -844,8 +844,8 @@ cc_library( cc_library( name = "grpc++", srcs = [ + "include/grpc++/impl/codegen/core_codegen.h", "src/cpp/client/secure_credentials.h", - "src/cpp/common/core_codegen.h", "src/cpp/common/secure_auth_context.h", "src/cpp/server/secure_server_credentials.h", "src/cpp/client/create_channel_internal.h", @@ -894,6 +894,7 @@ cc_library( "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/core_codegen.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -1001,7 +1002,6 @@ cc_library( name = "grpc++_unsecure", srcs = [ "src/cpp/client/create_channel_internal.h", - "src/cpp/common/core_codegen.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/common/insecure_create_auth_context.cc", @@ -1042,6 +1042,7 @@ cc_library( "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/core_codegen.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", diff --git a/Makefile b/Makefile index 42cedf51c3a..d42e672cd5d 100644 --- a/Makefile +++ b/Makefile @@ -3216,6 +3216,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ + include/grpc++/impl/codegen/core_codegen.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ @@ -3522,6 +3523,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ + include/grpc++/impl/codegen/core_codegen.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ diff --git a/build.yaml b/build.yaml index ac61612da40..fff4a49c2d0 100644 --- a/build.yaml +++ b/build.yaml @@ -597,6 +597,7 @@ filegroups: - include/grpc++/grpc++.h - include/grpc++/impl/call.h - include/grpc++/impl/client_unary_call.h + - include/grpc++/impl/codegen/core_codegen.h - include/grpc++/impl/grpc_library.h - include/grpc++/impl/method_handler_impl.h - include/grpc++/impl/proto_utils.h @@ -633,7 +634,6 @@ filegroups: - include/grpc++/support/time.h headers: - src/cpp/client/create_channel_internal.h - - src/cpp/common/core_codegen.h - src/cpp/server/dynamic_thread_pool.h - src/cpp/server/thread_pool_interface.h src: @@ -880,8 +880,8 @@ libs: build: all language: c++ headers: + - include/grpc++/impl/codegen/core_codegen.h - src/cpp/client/secure_credentials.h - - src/cpp/common/core_codegen.h - src/cpp/common/secure_auth_context.h - src/cpp/server/secure_server_credentials.h src: diff --git a/src/cpp/common/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h similarity index 100% rename from src/cpp/common/core_codegen.h rename to include/grpc++/impl/codegen/core_codegen.h diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h index 175cf99a82b..aaa9e4c8a54 100644 --- a/include/grpc++/impl/grpc_library.h +++ b/include/grpc++/impl/grpc_library.h @@ -38,10 +38,9 @@ #include #include +#include #include -#include "src/cpp/common/core_codegen.h" - namespace grpc { namespace internal { diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index 8e8d42eb294..cc35aa69bab 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -31,7 +31,7 @@ * */ -#include "src/cpp/common/core_codegen.h" +#include #include diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 798d68b0181..c92259f991b 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -770,6 +770,7 @@ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ +include/grpc++/impl/codegen/core_codegen.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index ce1d6ac3c1b..bdc4534c90d 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -770,6 +770,7 @@ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ +include/grpc++/impl/codegen/core_codegen.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ @@ -859,8 +860,8 @@ include/grpc++/impl/codegen/config.h \ include/grpc++/impl/codegen/config_protobuf.h \ include/grpc++/support/config.h \ include/grpc++/support/config_protobuf.h \ +include/grpc++/impl/codegen/core_codegen.h \ src/cpp/client/secure_credentials.h \ -src/cpp/common/core_codegen.h \ src/cpp/common/secure_auth_context.h \ src/cpp/server/secure_server_credentials.h \ src/cpp/client/create_channel_internal.h \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 3866ebb0e55..840fc3be4b6 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -4325,18 +4325,18 @@ "grpc++_codegen" ], "headers": [ + "include/grpc++/impl/codegen/core_codegen.h", "src/cpp/client/secure_credentials.h", - "src/cpp/common/core_codegen.h", "src/cpp/common/secure_auth_context.h", "src/cpp/server/secure_server_credentials.h" ], "language": "c++", "name": "grpc++", "src": [ + "include/grpc++/impl/codegen/core_codegen.h", "src/cpp/client/secure_credentials.cc", "src/cpp/client/secure_credentials.h", "src/cpp/common/auth_property_iterator.cc", - "src/cpp/common/core_codegen.h", "src/cpp/common/secure_auth_context.cc", "src/cpp/common/secure_auth_context.h", "src/cpp/common/secure_channel_arguments.cc", @@ -6380,6 +6380,7 @@ "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/core_codegen.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -6415,7 +6416,6 @@ "include/grpc++/support/sync_stream.h", "include/grpc++/support/time.h", "src/cpp/client/create_channel_internal.h", - "src/cpp/common/core_codegen.h", "src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/thread_pool_interface.h" ], @@ -6432,6 +6432,7 @@ "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/core_codegen.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -6477,7 +6478,6 @@ "src/cpp/common/channel_arguments.cc", "src/cpp/common/completion_queue.cc", "src/cpp/common/core_codegen.cc", - "src/cpp/common/core_codegen.h", "src/cpp/common/rpc_method.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/create_default_thread_pool.cc", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 65de5e97175..6a1ae52924a 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -268,6 +268,7 @@ + @@ -359,8 +360,8 @@ + - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index ce50bd9de8d..2116d6a6558 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -126,6 +126,9 @@ include\grpc++\impl + + include\grpc++\impl\codegen + include\grpc++\impl @@ -395,12 +398,12 @@ + + include\grpc++\impl\codegen + src\cpp\client - - src\cpp\common - src\cpp\common diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 895e2233518..82240a79c04 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -268,6 +268,7 @@ + @@ -360,7 +361,6 @@ - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index ab305fa9297..60f5d4182ea 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -111,6 +111,9 @@ include\grpc++\impl + + include\grpc++\impl\codegen + include\grpc++\impl @@ -383,9 +386,6 @@ src\cpp\client - - src\cpp\common - src\cpp\server From ace4986e653e51e1e7dcab0beabdfa460e0a61c8 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 19 May 2016 15:10:22 -0700 Subject: [PATCH 046/175] Update reflection implementation along with API changes --- .../impl/proto_server_reflection_plugin.h | 17 ++- .../reflection/proto_server_reflection.cc | 9 +- .../reflection/proto_server_reflection.h | 2 +- .../proto_server_reflection_plugin.cc | 12 +- .../proto_reflection_descriptor_database.cc | 106 ++++++++++-------- .../proto_reflection_descriptor_database.h | 9 +- 6 files changed, 89 insertions(+), 66 deletions(-) diff --git a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h index adc6eb7bc3f..e09c4132510 100644 --- a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h +++ b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h @@ -61,13 +61,22 @@ class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { std::shared_ptr<::grpc::ProtoServerReflection> reflection_service; }; -std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { - return std::unique_ptr<::grpc::ServerBuilderPlugin>( - new ProtoServerReflectionPlugin()); -} +// std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { +// return std::unique_ptr<::grpc::ServerBuilderPlugin>( +// new ProtoServerReflectionPlugin()); +// } + +std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection(); void grpc_AddServerBuilderPlugin_reflection(); +// Force AddServerBuilderPlugin() to be called at static initialization time. +struct StaticPluginInitializer_reflection { + StaticPluginInitializer_reflection() { + grpc_AddServerBuilderPlugin_reflection(); + } +} static_plugin_initializer_reflection_; + } // namespace reflection } // namespace grpc diff --git a/extensions/reflection/proto_server_reflection.cc b/extensions/reflection/proto_server_reflection.cc index ec82d5f18e3..28292a42d60 100644 --- a/extensions/reflection/proto_server_reflection.cc +++ b/extensions/reflection/proto_server_reflection.cc @@ -105,6 +105,9 @@ Status ProtoServerReflection::ServerReflectionInfo( status = Status(StatusCode::UNIMPLEMENTED, ""); } + if (!status.ok()) { + FillErrorResponse(status, response.mutable_error_response()); + } response.set_valid_host(request.host()); response.set_allocated_original_request( new ServerReflectionRequest(request)); @@ -114,10 +117,10 @@ Status ProtoServerReflection::ServerReflectionInfo( return Status::OK; } -void ProtoServerReflection::FillErrorResponse(Status* status, +void ProtoServerReflection::FillErrorResponse(const Status& status, ErrorResponse* error_response) { - error_response->set_error_code(status->error_code()); - error_response->set_error_message(status->error_message()); + error_response->set_error_code(status.error_code()); + error_response->set_error_message(status.error_message()); } Status ProtoServerReflection::ListService(ServerContext* context, diff --git a/extensions/reflection/proto_server_reflection.h b/extensions/reflection/proto_server_reflection.h index f86d6f1bf4e..53deef906cf 100644 --- a/extensions/reflection/proto_server_reflection.h +++ b/extensions/reflection/proto_server_reflection.h @@ -85,7 +85,7 @@ class ProtoServerReflection GRPC_FINAL const google::protobuf::FileDescriptor* file_desc, reflection::v1alpha::ServerReflectionResponse* response); - void FillErrorResponse(Status* status, + void FillErrorResponse(const Status& status, reflection::v1alpha::ErrorResponse* error_response); const google::protobuf::DescriptorPool* descriptor_pool_; diff --git a/extensions/reflection/proto_server_reflection_plugin.cc b/extensions/reflection/proto_server_reflection_plugin.cc index 6adfa450473..d038a7fff59 100644 --- a/extensions/reflection/proto_server_reflection_plugin.cc +++ b/extensions/reflection/proto_server_reflection_plugin.cc @@ -71,6 +71,11 @@ bool ProtoServerReflectionPlugin::has_async_methods() const { return false; } +std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { + return std::unique_ptr<::grpc::ServerBuilderPlugin>( + new ProtoServerReflectionPlugin()); +} + void grpc_AddServerBuilderPlugin_reflection() { static bool already_here = false; if (already_here) return; @@ -78,12 +83,5 @@ void grpc_AddServerBuilderPlugin_reflection() { ::grpc::ServerBuilder::InternalAddPluginFactory(&CreateProtoReflection); } -// Force AddServerBuilderPlugin() to be called at static initialization time. -struct StaticPluginInitializer_reflection { - StaticPluginInitializer_reflection() { - grpc_AddServerBuilderPlugin_reflection(); - } -} static_plugin_initializer_reflection_; - } // namespace reflection } // namespace grpc diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc index 4ed069ffc26..3963b0c0938 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -38,8 +38,8 @@ #include using grpc::reflection::v1alpha::ServerReflection; -using grpc::reflection::v1alpha::DescriptorDatabaseRequest; -using grpc::reflection::v1alpha::DescriptorDatabaseResponse; +using grpc::reflection::v1alpha::ServerReflectionRequest; +using grpc::reflection::v1alpha::ServerReflectionResponse; using grpc::reflection::v1alpha::ListServiceResponse; using grpc::reflection::v1alpha::ErrorResponse; @@ -65,21 +65,22 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName( return false; } - DescriptorDatabaseRequest request; + ServerReflectionRequest request; request.set_file_by_filename(filename); - DescriptorDatabaseResponse response; + ServerReflectionResponse response; GetStream()->Write(request); GetStream()->Read(&response); if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto) { - const google::protobuf::FileDescriptorProto file_proto = - ParseFileDescriptorProtoResponse(response.file_descriptor_proto()); - known_files_.insert(file_proto.name()); - cached_db_.Add(file_proto); + ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { + AddFileFromResponse(response.file_descriptor_response()); + // const google::protobuf::FileDescriptorProto file_proto = + // ParseFileDescriptorProtoResponse(response.file_descriptor_response()); + // known_files_.insert(file_proto.name()); + // cached_db_.Add(file_proto); } else if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { gpr_log(GPR_INFO, "NOT_FOUND from server for FindFileByName(%s)", @@ -97,7 +98,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName( "Error on FindFileByName(%s) response type\n" "\tExpecting: %d\n\tReceived: %d", filename.c_str(), - DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto, + ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse, response.message_response_case()); } @@ -114,24 +115,25 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( return false; } - DescriptorDatabaseRequest request; + ServerReflectionRequest request; request.set_file_containing_symbol(symbol_name); - DescriptorDatabaseResponse response; + ServerReflectionResponse response; GetStream()->Write(request); GetStream()->Read(&response); // Status status = stub_->GetFileContainingSymbol(&ctx, request, &response); if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto) { - const google::protobuf::FileDescriptorProto file_proto = - ParseFileDescriptorProtoResponse(response.file_descriptor_proto()); - if (known_files_.find(file_proto.name()) == known_files_.end()) { - known_files_.insert(file_proto.name()); - cached_db_.Add(file_proto); - } + ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { + AddFileFromResponse(response.file_descriptor_response()); + // const google::protobuf::FileDescriptorProto file_proto = + // ParseFileDescriptorProtoResponse(response.file_descriptor_response()); + // if (known_files_.find(file_proto.name()) == known_files_.end()) { + // known_files_.insert(file_proto.name()); + // cached_db_.Add(file_proto); + // } } else if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { missing_symbols_.insert(symbol_name); @@ -151,7 +153,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( "Error on FindFileContainingSymbol(%s) response type\n" "\tExpecting: %d\n\tReceived: %d", symbol_name.c_str(), - DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto, + ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse, response.message_response_case()); } return cached_db_.FindFileContainingSymbol(symbol_name, output); @@ -172,12 +174,12 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( return false; } - DescriptorDatabaseRequest request; + ServerReflectionRequest request; request.mutable_file_containing_extension()->set_containing_type( containing_type); request.mutable_file_containing_extension()->set_extension_number( field_number); - DescriptorDatabaseResponse response; + ServerReflectionResponse response; GetStream()->Write(request); GetStream()->Read(&response); @@ -185,15 +187,16 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( // Status status = stub_->GetFileContainingExtension(&ctx, request, // &response); if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto) { - const google::protobuf::FileDescriptorProto file_proto = - ParseFileDescriptorProtoResponse(response.file_descriptor_proto()); - if (known_files_.find(file_proto.name()) == known_files_.end()) { - known_files_.insert(file_proto.name()); - cached_db_.Add(file_proto); - } + ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { + AddFileFromResponse(response.file_descriptor_response()); + // const google::protobuf::FileDescriptorProto file_proto = + // ParseFileDescriptorProtoResponse(response.file_descriptor_response()); + // if (known_files_.find(file_proto.name()) == known_files_.end()) { + // known_files_.insert(file_proto.name()); + // cached_db_.Add(file_proto); + // } } else if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { if (missing_extensions_.find(containing_type) == @@ -217,7 +220,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( "Error on FindFileContainingExtension(%s, %d) response type\n" "\tExpecting: %d\n\tReceived: %d", containing_type.c_str(), field_number, - DescriptorDatabaseResponse::MessageResponseCase::kFileDescriptorProto, + ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse, response.message_response_case()); } @@ -233,23 +236,22 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( return true; } - DescriptorDatabaseRequest request; + ServerReflectionRequest request; request.set_all_extension_numbers_of_type(extendee_type); - DescriptorDatabaseResponse response; + ServerReflectionResponse response; GetStream()->Write(request); GetStream()->Read(&response); - // Status status = stub_->GetAllExtensionNumbers(&ctx, request, &response); if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase:: + ServerReflectionResponse::MessageResponseCase:: kAllExtensionNumbersResponse) { auto number = response.all_extension_numbers_response().extension_number(); *output = std::vector(number.begin(), number.end()); cached_extension_numbers_[extendee_type] = *output; return true; } else if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); if (error.error_code() == StatusCode::NOT_FOUND) { gpr_log(GPR_INFO, "NOT_FOUND from server for FindAllExtensionNumbers(%s)", @@ -267,22 +269,21 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( bool ProtoReflectionDescriptorDatabase::GetServices( std::vector* output) { - DescriptorDatabaseRequest request; + ServerReflectionRequest request; request.set_list_services(""); - DescriptorDatabaseResponse response; + ServerReflectionResponse response; GetStream()->Write(request); GetStream()->Read(&response); - // Status status = stub_->ListService(&ctx, request, &response); if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kListServicesResponse) { + ServerReflectionResponse::MessageResponseCase::kListServicesResponse) { const ListServiceResponse ls_response = response.list_services_response(); for (int i = 0; i < ls_response.service_size(); ++i) { - (*output).push_back(ls_response.service(i)); + (*output).push_back(ls_response.service(i).name()); } return true; } else if (response.message_response_case() == - DescriptorDatabaseResponse::MessageResponseCase::kErrorResponse) { + ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); gpr_log(GPR_INFO, "Error on GetServices()\n\tError code: %d\n" @@ -292,7 +293,7 @@ bool ProtoReflectionDescriptorDatabase::GetServices( gpr_log( GPR_INFO, "Error on GetServices() response type\n\tExpecting: %d\n\tReceived: %d", - DescriptorDatabaseResponse::MessageResponseCase::kListServicesResponse, + ServerReflectionResponse::MessageResponseCase::kListServicesResponse, response.message_response_case()); } return false; @@ -306,11 +307,22 @@ ProtoReflectionDescriptorDatabase::ParseFileDescriptorProtoResponse( return file_desc_proto; } +void ProtoReflectionDescriptorDatabase::AddFileFromResponse( + const grpc::reflection::v1alpha::FileDescriptorResponse& response) { + for (int i = 0; i < response.file_descriptor_proto_size(); ++i) { + const google::protobuf::FileDescriptorProto file_proto = + ParseFileDescriptorProtoResponse(response.file_descriptor_proto(i)); + if (known_files_.find(file_proto.name()) == known_files_.end()) { + known_files_.insert(file_proto.name()); + cached_db_.Add(file_proto); + } + } +} + const std::shared_ptr ProtoReflectionDescriptorDatabase::GetStream() { if (stream_ == nullptr) { - stream_ = stub_->DescriptorDatabaseInfo(&ctx_); - // stream_.reset(std::move(stub_->DescriptorDatabaseInfo(&ctx_))); + stream_ = stub_->ServerReflectionInfo(&ctx_); } return stream_; } diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index f37135e681f..4bb9c21a927 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -42,8 +42,6 @@ #include #include -// #include "reflection.grpc.pb.h" - namespace grpc { class ProtoReflectionDescriptorDatabase @@ -81,13 +79,16 @@ class ProtoReflectionDescriptorDatabase private: typedef ClientReaderWriter< - grpc::reflection::v1alpha::DescriptorDatabaseRequest, - grpc::reflection::v1alpha::DescriptorDatabaseResponse> + grpc::reflection::v1alpha::ServerReflectionRequest, + grpc::reflection::v1alpha::ServerReflectionResponse> ClientStream; const google::protobuf::FileDescriptorProto ParseFileDescriptorProtoResponse( const std::string& byte_fd_proto); + void AddFileFromResponse( + const grpc::reflection::v1alpha::FileDescriptorResponse& response); + const std::shared_ptr GetStream(); std::shared_ptr stream_; From d55ddbcbe34f69d7971908c148b8a24fb95f04f8 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 19 May 2016 16:24:59 -0700 Subject: [PATCH 047/175] php: ran php-cs-fixer again --- src/php/tests/interop/interop_client.php | 3 +- src/php/tests/interop/metrics_client.php | 6 +- src/php/tests/interop/stress_client.php | 103 ++++++++++++----------- 3 files changed, 58 insertions(+), 54 deletions(-) diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index 565bfce74f7..c5bb7c490e2 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -477,7 +477,8 @@ function _makeStub($args) return $stub; } -function interop_main($args, $stub = false) { +function interop_main($args, $stub = false) +{ if (!$stub) { $stub = _makeStub($args); } diff --git a/src/php/tests/interop/metrics_client.php b/src/php/tests/interop/metrics_client.php index 46f4212f773..19510dc5d82 100644 --- a/src/php/tests/interop/metrics_client.php +++ b/src/php/tests/interop/metrics_client.php @@ -39,11 +39,11 @@ $server_port = (count($parts) == 2) ? $parts[1] : ''; $socket = socket_create(AF_INET, SOCK_STREAM, 0); if (@!socket_connect($socket, $server_host, $server_port)) { - echo "Cannot connect to merics server...\n"; - exit(1); + echo "Cannot connect to merics server...\n"; + exit(1); } socket_write($socket, 'qps'); while ($out = socket_read($socket, 1024)) { - echo "$out\n"; + echo "$out\n"; } socket_close($socket); diff --git a/src/php/tests/interop/stress_client.php b/src/php/tests/interop/stress_client.php index 2339f0d105d..419ef5be438 100644 --- a/src/php/tests/interop/stress_client.php +++ b/src/php/tests/interop/stress_client.php @@ -32,50 +32,52 @@ * */ -include_once('interop_client.php'); +include_once 'interop_client.php'; -function stress_main($args) { - mt_srand(); - set_time_limit(0); +function stress_main($args) +{ + mt_srand(); + set_time_limit(0); - // open socket to listen as metrics server - $socket = socket_create(AF_INET, SOCK_STREAM, 0); - socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1); - if (@!socket_bind($socket, 'localhost', $args['metrics_port'])) { - echo "Cannot create socket for metrics server...\n"; - exit(1); - } - socket_listen($socket); - socket_set_nonblock($socket); + // open socket to listen as metrics server + $socket = socket_create(AF_INET, SOCK_STREAM, 0); + socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1); + if (@!socket_bind($socket, 'localhost', $args['metrics_port'])) { + echo "Cannot create socket for metrics server...\n"; + exit(1); + } + socket_listen($socket); + socket_set_nonblock($socket); - $start_time = microtime(true); - $count = 0; - $deadline = $args['test_duration_secs'] ? - ($start_time + $args['test_duration_secs']) : false; - $num_test_cases = count($args['test_cases']); - $stub = false; + $start_time = microtime(true); + $count = 0; + $deadline = $args['test_duration_secs'] ? + ($start_time + $args['test_duration_secs']) : false; + $num_test_cases = count($args['test_cases']); + $stub = false; - while (true) { - $current_time = microtime(true); - if ($deadline && $current_time > $deadline) { - break; - } - if ($client_connection = socket_accept($socket)) { - // there is an incoming request, respond with qps metrics - $input = socket_read($client_connection, 1024); - $qps = round($count / ($current_time - $start_time)); - socket_write($client_connection, "qps: $qps"); - socket_close($client_connection); - } else { - // do actual work, run one interop test case - $args['test_case'] = - $args['test_cases'][mt_rand(0, $num_test_cases - 1)]; - $stub = @interop_main($args, $stub); - $count++; + while (true) { + $current_time = microtime(true); + if ($deadline && $current_time > $deadline) { + break; + } + if ($client_connection = socket_accept($socket)) { + // there is an incoming request, respond with qps metrics + $input = socket_read($client_connection, 1024); + $qps = round($count / ($current_time - $start_time)); + socket_write($client_connection, "qps: $qps"); + socket_close($client_connection); + } else { + // do actual work, run one interop test case + $args['test_case'] = + $args['test_cases'][mt_rand(0, $num_test_cases - 1)]; + $stub = @interop_main($args, $stub); + ++$count; + } } - } - socket_close($socket); - echo "Number of interop tests run in $args[test_duration_secs] seconds: $count.\n"; + socket_close($socket); + echo "Number of interop tests run in $args[test_duration_secs] ". + "seconds: $count.\n"; } // process command line arguments @@ -85,31 +87,32 @@ $raw_args = getopt('', 'metrics_port::', 'test_duration_secs::', 'num_channels_per_server::', - 'num_stubs_per_channel::']); + 'num_stubs_per_channel::', + ]); $args = []; if (empty($raw_args['server_addresses'])) { - $args['server_host'] = 'localhost'; - $args['server_port'] = '8080'; + $args['server_host'] = 'localhost'; + $args['server_port'] = '8080'; } else { - $parts = explode(':', $raw_args['server_addresses']); - $args['server_host'] = $parts[0]; - $args['server_port'] = (count($parts) == 2) ? $parts[1] : ''; + $parts = explode(':', $raw_args['server_addresses']); + $args['server_host'] = $parts[0]; + $args['server_port'] = (count($parts) == 2) ? $parts[1] : ''; } $args['metrics_port'] = empty($raw_args['metrics_port']) ? - '8081' : $args['metrics_port']; + '8081' : $args['metrics_port']; $args['test_duration_secs'] = empty($raw_args['test_duration_secs']) || - $raw_args['test_duration_secs'] == -1 ? - false : $raw_args['test_duration_secs']; + $raw_args['test_duration_secs'] == -1 ? + false : $raw_args['test_duration_secs']; $test_cases = []; $test_case_strs = explode(',', $raw_args['test_cases']); foreach ($test_case_strs as $test_case_str) { - $parts = explode(':', $test_case_str); - $test_cases = array_merge($test_cases, array_fill(0, $parts[1], $parts[0])); + $parts = explode(':', $test_case_str); + $test_cases = array_merge($test_cases, array_fill(0, $parts[1], $parts[0])); } $args['test_cases'] = $test_cases; From 46d94bb4aac9f075008229afe815d58072b8baea Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 19 May 2016 16:47:52 -0700 Subject: [PATCH 048/175] php: fix examples/ directory as well --- examples/php/greeter_client.php | 26 +- examples/php/helloworld.php | 160 ++-- examples/php/route_guide/route_guide.php | 768 ++++++++++-------- .../php/route_guide/route_guide_client.php | 264 +++--- 4 files changed, 648 insertions(+), 570 deletions(-) diff --git a/examples/php/greeter_client.php b/examples/php/greeter_client.php index 718ef88c644..a5c0865393d 100644 --- a/examples/php/greeter_client.php +++ b/examples/php/greeter_client.php @@ -32,19 +32,21 @@ * */ -require dirname(__FILE__) . '/vendor/autoload.php'; -require dirname(__FILE__) . '/helloworld.php'; +require dirname(__FILE__).'/vendor/autoload.php'; +require dirname(__FILE__).'/helloworld.php'; -function greet($name) { - $client = new helloworld\GreeterClient('localhost:50051', [ - 'credentials' => Grpc\ChannelCredentials::createInsecure() - ]); - $request = new helloworld\HelloRequest(); - $request->setName($name); - list($reply, $status) = $client->SayHello($request)->wait(); - $message = $reply->getMessage(); - return $message; +function greet($name) +{ + $client = new helloworld\GreeterClient('localhost:50051', [ + 'credentials' => Grpc\ChannelCredentials::createInsecure(), + ]); + $request = new helloworld\HelloRequest(); + $request->setName($name); + list($reply, $status) = $client->SayHello($request)->wait(); + $message = $reply->getMessage(); + + return $message; } $name = !empty($argv[1]) ? $argv[1] : 'world'; -print(greet($name)."\n"); +echo greet($name)."\n"; diff --git a/examples/php/helloworld.php b/examples/php/helloworld.php index 50923e6fcdc..697f52aa653 100644 --- a/examples/php/helloworld.php +++ b/examples/php/helloworld.php @@ -5,154 +5,164 @@ namespace helloworld { - class HelloRequest extends \DrSlump\Protobuf\Message { - - /** @var string */ + class HelloRequest extends \DrSlump\Protobuf\Message + { + /** @var string */ public $name = null; - /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloRequest'); + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloRequest'); // OPTIONAL STRING name = 1 $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } + $f->number = 1; + $f->name = 'name'; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); - return $descriptor; - } + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasName(){ - return $this->_has(1); + public function hasName() + { + return $this->_has(1); } - + /** - * Clear value + * Clear value. * * @return \helloworld\HelloRequest */ - public function clearName(){ - return $this->_clear(1); + public function clearName() + { + return $this->_clear(1); } - + /** - * Get value + * Get value. * * @return string */ - public function getName(){ - return $this->_get(1); + public function getName() + { + return $this->_get(1); } - + /** - * Set value + * Set value. * * @param string $value + * * @return \helloworld\HelloRequest */ - public function setName( $value){ - return $this->_set(1, $value); + public function setName($value) + { + return $this->_set(1, $value); } } } namespace helloworld { - class HelloReply extends \DrSlump\Protobuf\Message { - - /** @var string */ + class HelloReply extends \DrSlump\Protobuf\Message + { + /** @var string */ public $message = null; - /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloReply'); + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloReply'); // OPTIONAL STRING message = 1 $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "message"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } + $f->number = 1; + $f->name = 'message'; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); - return $descriptor; - } + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasMessage(){ - return $this->_has(1); + public function hasMessage() + { + return $this->_has(1); } - + /** - * Clear value + * Clear value. * * @return \helloworld\HelloReply */ - public function clearMessage(){ - return $this->_clear(1); + public function clearMessage() + { + return $this->_clear(1); } - + /** - * Get value + * Get value. * * @return string */ - public function getMessage(){ - return $this->_get(1); + public function getMessage() + { + return $this->_get(1); } - + /** - * Set value + * Set value. * * @param string $value + * * @return \helloworld\HelloReply */ - public function setMessage( $value){ - return $this->_set(1, $value); + public function setMessage($value) + { + return $this->_set(1, $value); } } } namespace helloworld { - class GreeterClient extends \Grpc\BaseStub { - - public function __construct($hostname, $opts) { - parent::__construct($hostname, $opts); - } + class GreeterClient extends \Grpc\BaseStub + { + public function __construct($hostname, $opts) + { + parent::__construct($hostname, $opts); + } /** * @param helloworld\HelloRequest $input */ - public function SayHello(\helloworld\HelloRequest $argument, $metadata = array(), $options = array()) { - return $this->_simpleRequest('/helloworld.Greeter/SayHello', $argument, '\helloworld\HelloReply::deserialize', $metadata, $options); + public function SayHello(\helloworld\HelloRequest $argument, $metadata = array(), $options = array()) + { + return $this->_simpleRequest('/helloworld.Greeter/SayHello', $argument, '\helloworld\HelloReply::deserialize', $metadata, $options); } } } diff --git a/examples/php/route_guide/route_guide.php b/examples/php/route_guide/route_guide.php index 0de319890d5..65045d01e17 100644 --- a/examples/php/route_guide/route_guide.php +++ b/examples/php/route_guide/route_guide.php @@ -5,725 +5,785 @@ namespace routeguide { - class Point extends \DrSlump\Protobuf\Message { - - /** @var int */ + class Point extends \DrSlump\Protobuf\Message + { + /** @var int */ public $latitude = 0; - + /** @var int */ public $longitude = 0; - /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Point'); + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Point'); // OPTIONAL INT32 latitude = 1 $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "latitude"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->default = 0; - $descriptor->addField($f); + $f->number = 1; + $f->name = 'latitude'; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = 0; + $descriptor->addField($f); // OPTIONAL INT32 longitude = 2 $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "longitude"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->default = 0; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); + $f->number = 2; + $f->name = 'longitude'; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = 0; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; } - return $descriptor; - } - /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasLatitude(){ - return $this->_has(1); + public function hasLatitude() + { + return $this->_has(1); } - + /** - * Clear value + * Clear value. * * @return \routeguide\Point */ - public function clearLatitude(){ - return $this->_clear(1); + public function clearLatitude() + { + return $this->_clear(1); } - + /** - * Get value + * Get value. * * @return int */ - public function getLatitude(){ - return $this->_get(1); + public function getLatitude() + { + return $this->_get(1); } - + /** - * Set value + * Set value. * * @param int $value + * * @return \routeguide\Point */ - public function setLatitude( $value){ - return $this->_set(1, $value); + public function setLatitude($value) + { + return $this->_set(1, $value); } - + /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasLongitude(){ - return $this->_has(2); + public function hasLongitude() + { + return $this->_has(2); } - + /** - * Clear value + * Clear value. * * @return \routeguide\Point */ - public function clearLongitude(){ - return $this->_clear(2); + public function clearLongitude() + { + return $this->_clear(2); } - + /** - * Get value + * Get value. * * @return int */ - public function getLongitude(){ - return $this->_get(2); + public function getLongitude() + { + return $this->_get(2); } - + /** - * Set value + * Set value. * * @param int $value + * * @return \routeguide\Point */ - public function setLongitude( $value){ - return $this->_set(2, $value); + public function setLongitude($value) + { + return $this->_set(2, $value); } } } namespace routeguide { - class Rectangle extends \DrSlump\Protobuf\Message { - - /** @var \routeguide\Point */ + class Rectangle extends \DrSlump\Protobuf\Message + { + /** @var \routeguide\Point */ public $lo = null; - + /** @var \routeguide\Point */ public $hi = null; - /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Rectangle'); + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Rectangle'); // OPTIONAL MESSAGE lo = 1 $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "lo"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\routeguide\Point'; - $descriptor->addField($f); + $f->number = 1; + $f->name = 'lo'; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\routeguide\Point'; + $descriptor->addField($f); // OPTIONAL MESSAGE hi = 2 $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "hi"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\routeguide\Point'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); + $f->number = 2; + $f->name = 'hi'; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\routeguide\Point'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; } - return $descriptor; - } - /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasLo(){ - return $this->_has(1); + public function hasLo() + { + return $this->_has(1); } - + /** - * Clear value + * Clear value. * * @return \routeguide\Rectangle */ - public function clearLo(){ - return $this->_clear(1); + public function clearLo() + { + return $this->_clear(1); } - + /** - * Get value + * Get value. * * @return \routeguide\Point */ - public function getLo(){ - return $this->_get(1); + public function getLo() + { + return $this->_get(1); } - + /** - * Set value + * Set value. * * @param \routeguide\Point $value + * * @return \routeguide\Rectangle */ - public function setLo(\routeguide\Point $value){ - return $this->_set(1, $value); + public function setLo(\routeguide\Point $value) + { + return $this->_set(1, $value); } - + /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasHi(){ - return $this->_has(2); + public function hasHi() + { + return $this->_has(2); } - + /** - * Clear value + * Clear value. * * @return \routeguide\Rectangle */ - public function clearHi(){ - return $this->_clear(2); + public function clearHi() + { + return $this->_clear(2); } - + /** - * Get value + * Get value. * * @return \routeguide\Point */ - public function getHi(){ - return $this->_get(2); + public function getHi() + { + return $this->_get(2); } - + /** - * Set value + * Set value. * * @param \routeguide\Point $value + * * @return \routeguide\Rectangle */ - public function setHi(\routeguide\Point $value){ - return $this->_set(2, $value); + public function setHi(\routeguide\Point $value) + { + return $this->_set(2, $value); } } } namespace routeguide { - class Feature extends \DrSlump\Protobuf\Message { - - /** @var string */ + class Feature extends \DrSlump\Protobuf\Message + { + /** @var string */ public $name = null; - + /** @var \routeguide\Point */ public $location = null; - /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Feature'); + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Feature'); // OPTIONAL STRING name = 1 $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "name"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); + $f->number = 1; + $f->name = 'name'; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); // OPTIONAL MESSAGE location = 2 $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "location"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\routeguide\Point'; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); + $f->number = 2; + $f->name = 'location'; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\routeguide\Point'; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; } - return $descriptor; - } - /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasName(){ - return $this->_has(1); + public function hasName() + { + return $this->_has(1); } - + /** - * Clear value + * Clear value. * * @return \routeguide\Feature */ - public function clearName(){ - return $this->_clear(1); + public function clearName() + { + return $this->_clear(1); } - + /** - * Get value + * Get value. * * @return string */ - public function getName(){ - return $this->_get(1); + public function getName() + { + return $this->_get(1); } - + /** - * Set value + * Set value. * * @param string $value + * * @return \routeguide\Feature */ - public function setName( $value){ - return $this->_set(1, $value); + public function setName($value) + { + return $this->_set(1, $value); } - + /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasLocation(){ - return $this->_has(2); + public function hasLocation() + { + return $this->_has(2); } - + /** - * Clear value + * Clear value. * * @return \routeguide\Feature */ - public function clearLocation(){ - return $this->_clear(2); + public function clearLocation() + { + return $this->_clear(2); } - + /** - * Get value + * Get value. * * @return \routeguide\Point */ - public function getLocation(){ - return $this->_get(2); + public function getLocation() + { + return $this->_get(2); } - + /** - * Set value + * Set value. * * @param \routeguide\Point $value + * * @return \routeguide\Feature */ - public function setLocation(\routeguide\Point $value){ - return $this->_set(2, $value); + public function setLocation(\routeguide\Point $value) + { + return $this->_set(2, $value); } } } namespace routeguide { - class RouteNote extends \DrSlump\Protobuf\Message { - - /** @var \routeguide\Point */ + class RouteNote extends \DrSlump\Protobuf\Message + { + /** @var \routeguide\Point */ public $location = null; - + /** @var string */ public $message = null; - /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteNote'); + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteNote'); // OPTIONAL MESSAGE location = 1 $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "location"; - $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->reference = '\routeguide\Point'; - $descriptor->addField($f); + $f->number = 1; + $f->name = 'location'; + $f->type = \DrSlump\Protobuf::TYPE_MESSAGE; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->reference = '\routeguide\Point'; + $descriptor->addField($f); // OPTIONAL STRING message = 2 $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "message"; - $f->type = \DrSlump\Protobuf::TYPE_STRING; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); - } + $f->number = 2; + $f->name = 'message'; + $f->type = \DrSlump\Protobuf::TYPE_STRING; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $descriptor->addField($f); - return $descriptor; - } + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; + } /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasLocation(){ - return $this->_has(1); + public function hasLocation() + { + return $this->_has(1); } - + /** - * Clear value + * Clear value. * * @return \routeguide\RouteNote */ - public function clearLocation(){ - return $this->_clear(1); + public function clearLocation() + { + return $this->_clear(1); } - + /** - * Get value + * Get value. * * @return \routeguide\Point */ - public function getLocation(){ - return $this->_get(1); + public function getLocation() + { + return $this->_get(1); } - + /** - * Set value + * Set value. * * @param \routeguide\Point $value + * * @return \routeguide\RouteNote */ - public function setLocation(\routeguide\Point $value){ - return $this->_set(1, $value); + public function setLocation(\routeguide\Point $value) + { + return $this->_set(1, $value); } - + /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasMessage(){ - return $this->_has(2); + public function hasMessage() + { + return $this->_has(2); } - + /** - * Clear value + * Clear value. * * @return \routeguide\RouteNote */ - public function clearMessage(){ - return $this->_clear(2); + public function clearMessage() + { + return $this->_clear(2); } - + /** - * Get value + * Get value. * * @return string */ - public function getMessage(){ - return $this->_get(2); + public function getMessage() + { + return $this->_get(2); } - + /** - * Set value + * Set value. * * @param string $value + * * @return \routeguide\RouteNote */ - public function setMessage( $value){ - return $this->_set(2, $value); + public function setMessage($value) + { + return $this->_set(2, $value); } } } namespace routeguide { - class RouteSummary extends \DrSlump\Protobuf\Message { - - /** @var int */ + class RouteSummary extends \DrSlump\Protobuf\Message + { + /** @var int */ public $point_count = 0; - + /** @var int */ public $feature_count = 0; - + /** @var int */ public $distance = 0; - + /** @var int */ public $elapsed_time = 0; - /** @var \Closure[] */ protected static $__extensions = array(); - public static function descriptor() - { - $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteSummary'); + public static function descriptor() + { + $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteSummary'); // OPTIONAL INT32 point_count = 1 $f = new \DrSlump\Protobuf\Field(); - $f->number = 1; - $f->name = "point_count"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->default = 0; - $descriptor->addField($f); + $f->number = 1; + $f->name = 'point_count'; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = 0; + $descriptor->addField($f); // OPTIONAL INT32 feature_count = 2 $f = new \DrSlump\Protobuf\Field(); - $f->number = 2; - $f->name = "feature_count"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->default = 0; - $descriptor->addField($f); + $f->number = 2; + $f->name = 'feature_count'; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = 0; + $descriptor->addField($f); // OPTIONAL INT32 distance = 3 $f = new \DrSlump\Protobuf\Field(); - $f->number = 3; - $f->name = "distance"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->default = 0; - $descriptor->addField($f); + $f->number = 3; + $f->name = 'distance'; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = 0; + $descriptor->addField($f); // OPTIONAL INT32 elapsed_time = 4 $f = new \DrSlump\Protobuf\Field(); - $f->number = 4; - $f->name = "elapsed_time"; - $f->type = \DrSlump\Protobuf::TYPE_INT32; - $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; - $f->default = 0; - $descriptor->addField($f); - - foreach (self::$__extensions as $cb) { - $descriptor->addField($cb(), true); + $f->number = 4; + $f->name = 'elapsed_time'; + $f->type = \DrSlump\Protobuf::TYPE_INT32; + $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; + $f->default = 0; + $descriptor->addField($f); + + foreach (self::$__extensions as $cb) { + $descriptor->addField($cb(), true); + } + + return $descriptor; } - return $descriptor; - } - /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasPointCount(){ - return $this->_has(1); + public function hasPointCount() + { + return $this->_has(1); } - + /** - * Clear value + * Clear value. * * @return \routeguide\RouteSummary */ - public function clearPointCount(){ - return $this->_clear(1); + public function clearPointCount() + { + return $this->_clear(1); } - + /** - * Get value + * Get value. * * @return int */ - public function getPointCount(){ - return $this->_get(1); + public function getPointCount() + { + return $this->_get(1); } - + /** - * Set value + * Set value. * * @param int $value + * * @return \routeguide\RouteSummary */ - public function setPointCount( $value){ - return $this->_set(1, $value); + public function setPointCount($value) + { + return $this->_set(1, $value); } - + /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasFeatureCount(){ - return $this->_has(2); + public function hasFeatureCount() + { + return $this->_has(2); } - + /** - * Clear value + * Clear value. * * @return \routeguide\RouteSummary */ - public function clearFeatureCount(){ - return $this->_clear(2); + public function clearFeatureCount() + { + return $this->_clear(2); } - + /** - * Get value + * Get value. * * @return int */ - public function getFeatureCount(){ - return $this->_get(2); + public function getFeatureCount() + { + return $this->_get(2); } - + /** - * Set value + * Set value. * * @param int $value + * * @return \routeguide\RouteSummary */ - public function setFeatureCount( $value){ - return $this->_set(2, $value); + public function setFeatureCount($value) + { + return $this->_set(2, $value); } - + /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasDistance(){ - return $this->_has(3); + public function hasDistance() + { + return $this->_has(3); } - + /** - * Clear value + * Clear value. * * @return \routeguide\RouteSummary */ - public function clearDistance(){ - return $this->_clear(3); + public function clearDistance() + { + return $this->_clear(3); } - + /** - * Get value + * Get value. * * @return int */ - public function getDistance(){ - return $this->_get(3); + public function getDistance() + { + return $this->_get(3); } - + /** - * Set value + * Set value. * * @param int $value + * * @return \routeguide\RouteSummary */ - public function setDistance( $value){ - return $this->_set(3, $value); + public function setDistance($value) + { + return $this->_set(3, $value); } - + /** - * Check if has a value + * Check if has a value. * - * @return boolean + * @return bool */ - public function hasElapsedTime(){ - return $this->_has(4); + public function hasElapsedTime() + { + return $this->_has(4); } - + /** - * Clear value + * Clear value. * * @return \routeguide\RouteSummary */ - public function clearElapsedTime(){ - return $this->_clear(4); + public function clearElapsedTime() + { + return $this->_clear(4); } - + /** - * Get value + * Get value. * * @return int */ - public function getElapsedTime(){ - return $this->_get(4); + public function getElapsedTime() + { + return $this->_get(4); } - + /** - * Set value + * Set value. * * @param int $value + * * @return \routeguide\RouteSummary */ - public function setElapsedTime( $value){ - return $this->_set(4, $value); + public function setElapsedTime($value) + { + return $this->_set(4, $value); } } } namespace routeguide { - class RouteGuideClient extends \Grpc\BaseStub { - - public function __construct($hostname, $opts) { - parent::__construct($hostname, $opts); - } + class RouteGuideClient extends \Grpc\BaseStub + { + public function __construct($hostname, $opts) + { + parent::__construct($hostname, $opts); + } /** * @param routeguide\Point $input */ - public function GetFeature(\routeguide\Point $argument, $metadata = array(), $options = array()) { - return $this->_simpleRequest('/routeguide.RouteGuide/GetFeature', $argument, '\routeguide\Feature::deserialize', $metadata, $options); + public function GetFeature(\routeguide\Point $argument, $metadata = array(), $options = array()) + { + return $this->_simpleRequest('/routeguide.RouteGuide/GetFeature', $argument, '\routeguide\Feature::deserialize', $metadata, $options); } /** * @param routeguide\Rectangle $input */ - public function ListFeatures($argument, $metadata = array(), $options = array()) { - return $this->_serverStreamRequest('/routeguide.RouteGuide/ListFeatures', $argument, '\routeguide\Feature::deserialize', $metadata, $options); + public function ListFeatures($argument, $metadata = array(), $options = array()) + { + return $this->_serverStreamRequest('/routeguide.RouteGuide/ListFeatures', $argument, '\routeguide\Feature::deserialize', $metadata, $options); } /** * @param routeguide\Point $input */ - public function RecordRoute($metadata = array()) { - return $this->_clientStreamRequest('/routeguide.RouteGuide/RecordRoute', '\routeguide\RouteSummary::deserialize', $metadata); + public function RecordRoute($metadata = array()) + { + return $this->_clientStreamRequest('/routeguide.RouteGuide/RecordRoute', '\routeguide\RouteSummary::deserialize', $metadata); } /** * @param routeguide\RouteNote $input */ - public function RouteChat($metadata = array()) { - return $this->_bidiRequest('/routeguide.RouteGuide/RouteChat', '\routeguide\RouteNote::deserialize', $metadata); + public function RouteChat($metadata = array()) + { + return $this->_bidiRequest('/routeguide.RouteGuide/RouteChat', '\routeguide\RouteNote::deserialize', $metadata); } } } diff --git a/examples/php/route_guide/route_guide_client.php b/examples/php/route_guide/route_guide_client.php index 2f9533be4b7..595dacd9870 100644 --- a/examples/php/route_guide/route_guide_client.php +++ b/examples/php/route_guide/route_guide_client.php @@ -32,48 +32,50 @@ * */ -require dirname(__FILE__) . '/../vendor/autoload.php'; -require dirname(__FILE__) . '/route_guide.php'; +require dirname(__FILE__).'/../vendor/autoload.php'; +require dirname(__FILE__).'/route_guide.php'; define('COORD_FACTOR', 1e7); $client = new routeguide\RouteGuideClient('localhost:50051', [ - 'credentials' => Grpc\ChannelCredentials::createInsecure() + 'credentials' => Grpc\ChannelCredentials::createInsecure(), ]); -function printFeature($feature) { - $name = $feature->getName(); - if (!$name) { - $name_str = "no feature"; - } else { - $name_str = "feature called $name"; - } - print sprintf("Found %s \n at %f, %f\n", $name_str, - $feature->getLocation()->getLatitude() / COORD_FACTOR, - $feature->getLocation()->getLongitude() / COORD_FACTOR); +function printFeature($feature) +{ + $name = $feature->getName(); + if (!$name) { + $name_str = 'no feature'; + } else { + $name_str = "feature called $name"; + } + echo sprintf("Found %s \n at %f, %f\n", $name_str, + $feature->getLocation()->getLatitude() / COORD_FACTOR, + $feature->getLocation()->getLongitude() / COORD_FACTOR); } /** * Run the getFeature demo. Calls getFeature with a point known to have a * feature and a point known not to have a feature. */ -function runGetFeature() { - print "Running GetFeature...\n"; - global $client; - - $point = new routeguide\Point(); - $points = array( - array(409146138, -746188906), - array(0, 0), - ); - - foreach ($points as $p) { - $point->setLatitude($p[0]); - $point->setLongitude($p[1]); - // make a unary grpc call - list($feature, $status) = $client->GetFeature($point)->wait(); - printFeature($feature); - } +function runGetFeature() +{ + echo "Running GetFeature...\n"; + global $client; + + $point = new routeguide\Point(); + $points = array( + array(409146138, -746188906), + array(0, 0), + ); + + foreach ($points as $p) { + $point->setLatitude($p[0]); + $point->setLongitude($p[1]); + // make a unary grpc call + list($feature, $status) = $client->GetFeature($point)->wait(); + printFeature($feature); + } } /** @@ -81,29 +83,30 @@ function runGetFeature() { * containing all of the features in the pre-generated * database. Prints each response as it comes in. */ -function runListFeatures() { - print "Running ListFeatures...\n"; - global $client; - - $lo_point = new routeguide\Point(); - $hi_point = new routeguide\Point(); - - $lo_point->setLatitude(400000000); - $lo_point->setLongitude(-750000000); - $hi_point->setLatitude(420000000); - $hi_point->setLongitude(-730000000); - - $rectangle = new routeguide\Rectangle(); - $rectangle->setLo($lo_point); - $rectangle->setHi($hi_point); - - // start the server streaming call - $call = $client->ListFeatures($rectangle); - // an iterator over the server streaming responses - $features = $call->responses(); - foreach ($features as $feature) { - printFeature($feature); - } +function runListFeatures() +{ + echo "Running ListFeatures...\n"; + global $client; + + $lo_point = new routeguide\Point(); + $hi_point = new routeguide\Point(); + + $lo_point->setLatitude(400000000); + $lo_point->setLongitude(-750000000); + $hi_point->setLatitude(420000000); + $hi_point->setLongitude(-730000000); + + $rectangle = new routeguide\Rectangle(); + $rectangle->setLo($lo_point); + $rectangle->setHi($hi_point); + + // start the server streaming call + $call = $client->ListFeatures($rectangle); + // an iterator over the server streaming responses + $features = $call->responses(); + foreach ($features as $feature) { + printFeature($feature); + } } /** @@ -111,96 +114,99 @@ function runListFeatures() { * pre-generated feature database with a variable delay in between. Prints * the statistics when they are sent from the server. */ -function runRecordRoute() { - print "Running RecordRoute...\n"; - global $client, $argv; - - // start the client streaming call - $call = $client->RecordRoute(); - - $db = json_decode(file_get_contents($argv[1]), true); - $num_points_in_db = count($db); - $num_points = 10; - for ($i = 0; $i < $num_points; $i++) { - $point = new routeguide\Point(); - $index = rand(0, $num_points_in_db - 1); - $lat = $db[$index]['location']['latitude']; - $long = $db[$index]['location']['longitude']; - $feature_name = $db[$index]['name']; - $point->setLatitude($lat); - $point->setLongitude($long); - print sprintf("Visiting point %f, %f,\n with feature name: %s\n", - $lat / COORD_FACTOR, $long / COORD_FACTOR, - $feature_name ? $feature_name : ''); - usleep(rand(300000, 800000)); - $call->write($point); - } - list($route_summary, $status) = $call->wait(); - print sprintf("Finished trip with %d points\nPassed %d features\n". - "Travelled %d meters\nIt took %d seconds\n", - $route_summary->getPointCount(), - $route_summary->getFeatureCount(), - $route_summary->getDistance(), - $route_summary->getElapsedTime()); +function runRecordRoute() +{ + echo "Running RecordRoute...\n"; + global $client, $argv; + + // start the client streaming call + $call = $client->RecordRoute(); + + $db = json_decode(file_get_contents($argv[1]), true); + $num_points_in_db = count($db); + $num_points = 10; + for ($i = 0; $i < $num_points; ++$i) { + $point = new routeguide\Point(); + $index = rand(0, $num_points_in_db - 1); + $lat = $db[$index]['location']['latitude']; + $long = $db[$index]['location']['longitude']; + $feature_name = $db[$index]['name']; + $point->setLatitude($lat); + $point->setLongitude($long); + echo sprintf("Visiting point %f, %f,\n with feature name: %s\n", + $lat / COORD_FACTOR, $long / COORD_FACTOR, + $feature_name ? $feature_name : ''); + usleep(rand(300000, 800000)); + $call->write($point); + } + list($route_summary, $status) = $call->wait(); + echo sprintf("Finished trip with %d points\nPassed %d features\n". + "Travelled %d meters\nIt took %d seconds\n", + $route_summary->getPointCount(), + $route_summary->getFeatureCount(), + $route_summary->getDistance(), + $route_summary->getElapsedTime()); } /** * Run the routeChat demo. Send some chat messages, and print any chat * messages that are sent from the server. */ -function runRouteChat() { - print "Running RouteChat...\n"; - global $client; - - // start the bidirectional streaming call - $call = $client->RouteChat(); - - $notes = array( - array(1, 1, 'first message'), - array(1, 2, 'second message'), - array(2, 1, 'third message'), - array(1, 1, 'fourth message'), - array(1, 1, 'fifth message'), - ); - - foreach ($notes as $n) { - $point = new routeguide\Point(); - $point->setLatitude($lat = $n[0]); - $point->setLongitude($long = $n[1]); - - $route_note = new routeguide\RouteNote(); - $route_note->setLocation($point); - $route_note->setMessage($message = $n[2]); - - print sprintf("Sending message: '%s' at (%d, %d)\n", - $message, $lat, $long); - // send a bunch of messages to the server - $call->write($route_note); - } - $call->writesDone(); - - // read from the server until there's no more - while ($route_note_reply = $call->read()) { - print sprintf("Previous left message at (%d, %d): '%s'\n", - $route_note_reply->getLocation()->getLatitude(), - $route_note_reply->getLocation()->getLongitude(), - $route_note_reply->getMessage()); +function runRouteChat() +{ + echo "Running RouteChat...\n"; + global $client; + + // start the bidirectional streaming call + $call = $client->RouteChat(); + + $notes = array( + array(1, 1, 'first message'), + array(1, 2, 'second message'), + array(2, 1, 'third message'), + array(1, 1, 'fourth message'), + array(1, 1, 'fifth message'), + ); + + foreach ($notes as $n) { + $point = new routeguide\Point(); + $point->setLatitude($lat = $n[0]); + $point->setLongitude($long = $n[1]); + + $route_note = new routeguide\RouteNote(); + $route_note->setLocation($point); + $route_note->setMessage($message = $n[2]); + + echo sprintf("Sending message: '%s' at (%d, %d)\n", + $message, $lat, $long); + // send a bunch of messages to the server + $call->write($route_note); + } + $call->writesDone(); + + // read from the server until there's no more + while ($route_note_reply = $call->read()) { + echo sprintf("Previous left message at (%d, %d): '%s'\n", + $route_note_reply->getLocation()->getLatitude(), + $route_note_reply->getLocation()->getLongitude(), + $route_note_reply->getMessage()); } } /** - * Run all of the demos in order + * Run all of the demos in order. */ -function main() { - runGetFeature(); - runListFeatures(); - runRecordRoute(); - runRouteChat(); +function main() +{ + runGetFeature(); + runListFeatures(); + runRecordRoute(); + runRouteChat(); } if (empty($argv[1])) { - print "Usage: php -d extension=grpc.so route_guide_client.php " . + echo 'Usage: php -d extension=grpc.so route_guide_client.php '. "\n"; - exit(1); + exit(1); } main(); From 803c7ff9734649c09d7de892530d57ed570be1fa Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 19 May 2016 16:51:49 -0700 Subject: [PATCH 049/175] php: one little thing missed --- examples/php/route_guide/route_guide_client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/php/route_guide/route_guide_client.php b/examples/php/route_guide/route_guide_client.php index 595dacd9870..b3cd6067972 100644 --- a/examples/php/route_guide/route_guide_client.php +++ b/examples/php/route_guide/route_guide_client.php @@ -190,7 +190,7 @@ function runRouteChat() $route_note_reply->getLocation()->getLatitude(), $route_note_reply->getLocation()->getLongitude(), $route_note_reply->getMessage()); - } + } } /** From c23f556fb216fb8e11836cf30bb72a35e78496af Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 May 2016 11:05:23 -0700 Subject: [PATCH 050/175] =?UTF-8?q?Install=20Cocoapods=201.0.0=20now=20tha?= =?UTF-8?q?t=20it=E2=80=99s=20released?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1966d30f74d..d98d36e7485 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ env: - TEST=objc - JOBS=1 before_install: - - gem install cocoapods -v '1.0.0.beta.4' + - gem install cocoapods -v '1.0.0' - brew install gflags # Pod install does this too, but we don't want the output. - pod repo update --silent From 44477d2661b79de1d487e757e5deff199e4f8d19 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 May 2016 11:06:04 -0700 Subject: [PATCH 051/175] Use workaround at https://github.com/travis-ci/travis-ci/issues/5827 And print version before and after install, so we can always check. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index d98d36e7485..93fc9e1acdf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,10 @@ env: - TEST=objc - JOBS=1 before_install: + - pod --version + - gem uninstall cocoapods -a - gem install cocoapods -v '1.0.0' + - pod --version - brew install gflags # Pod install does this too, but we don't want the output. - pod repo update --silent From eba2b1c09c80ba119574d312a49845b77f40bda8 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 May 2016 11:06:33 -0700 Subject: [PATCH 052/175] =?UTF-8?q?Cleanup=20now=20that=20we=20don?= =?UTF-8?q?=E2=80=99t=20use=20OpenSSL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93fc9e1acdf..a993b551da8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,15 +11,10 @@ before_install: - gem install cocoapods -v '1.0.0' - pod --version - brew install gflags - # Pod install does this too, but we don't want the output. - - pod repo update --silent install: - make grpc_objective_c_plugin - pushd src/objective-c/tests - # Needs to be verbose, or otherwise OpenSSL's prepare_command makes Travis - # time out: - - pod --version - - pod install --verbose + - pod install - popd before_script: - make interop_server From 0ee18c2f2a6e11c7d2af7624f0a9604b7263ed5c Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 May 2016 11:06:58 -0700 Subject: [PATCH 053/175] Use Xcode 7.3 and SDK 9.3 in Travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a993b551da8..75b14406306 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode7.2 +osx_image: xcode7.3 env: global: - CONFIG=opt @@ -27,6 +27,6 @@ xcode_scheme: - InteropTestsLocalCleartext # TODO(jcanizales): Investigate why they time out: # - InteropTestsRemote -xcode_sdk: iphonesimulator9.2 +xcode_sdk: iphonesimulator9.3 notifications: email: false From 92e56bb0fc1ee46430746f7b91839eea2200960e Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 May 2016 13:28:26 -0700 Subject: [PATCH 054/175] Update tests XCode project to Cocoapods 1.0.0 --- .../tests/Tests.xcodeproj/project.pbxproj | 252 +++++++++++------- 1 file changed, 162 insertions(+), 90 deletions(-) diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index b0429617c01..89e0ea60b9e 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -7,33 +7,34 @@ objects = { /* Begin PBXBuildFile section */ - 036D953EE34B1FD523647ACD /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */; }; - 08A8BB02D19A53D902B214B8 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */; }; - 50267643BA114A2A724D4FDF /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */; }; + 0F9232F984C08643FD40C34F /* libPods-InteropTestsRemote.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DBE059B4AC7A51919467EEC0 /* libPods-InteropTestsRemote.a */; }; + 16A9E77B6E336B3C0B9BA6E0 /* libPods-InteropTestsLocalSSL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */; }; + 20DFDF829DD993A4A00D5662 /* libPods-RxLibraryUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */; }; + 333E8FC01C8285B7C547D799 /* libPods-InteropTestsLocalCleartext.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */; }; + 3D7C85F6AA68C4A205E3BA16 /* libPods-Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */; }; 6312AE4E1B1BF49B00341DEE /* GRPCClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6312AE4D1B1BF49B00341DEE /* GRPCClientTests.m */; }; 63423F4A1B150A5F006CF63C /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; 635697CD1B14FC11007A7283 /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635697CC1B14FC11007A7283 /* Tests.m */; }; 635ED2EC1B1A3BC400FDE5C3 /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; 63715F561B780C020029CB0B /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; - 6379CC4D1BE1662A001BC0A1 /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; settings = {ASSET_TAGS = (); }; }; - 6379CC4E1BE1662B001BC0A1 /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; settings = {ASSET_TAGS = (); }; }; - 6379CC501BE16703001BC0A1 /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 6379CC4F1BE16703001BC0A1 /* InteropTestsRemote.m */; settings = {ASSET_TAGS = (); }; }; - 6379CC511BE1683B001BC0A1 /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 6379CC4F1BE16703001BC0A1 /* InteropTestsRemote.m */; settings = {ASSET_TAGS = (); }; }; - 6379CC531BE17709001BC0A1 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; settings = {ASSET_TAGS = (); }; }; - 63DC84181BE15179000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; settings = {ASSET_TAGS = (); }; }; - 63DC841E1BE15180000708E8 /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */; settings = {ASSET_TAGS = (); }; }; - 63DC84281BE15267000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; settings = {ASSET_TAGS = (); }; }; - 63DC842E1BE15278000708E8 /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */; settings = {ASSET_TAGS = (); }; }; - 63DC842F1BE1527D000708E8 /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; settings = {ASSET_TAGS = (); }; }; - 63DC84391BE15294000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; settings = {ASSET_TAGS = (); }; }; - 63DC84481BE152B5000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; settings = {ASSET_TAGS = (); }; }; - 63DC844E1BE15350000708E8 /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; settings = {ASSET_TAGS = (); }; }; - 63DC844F1BE15353000708E8 /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; settings = {ASSET_TAGS = (); }; }; - 63DC84501BE153AA000708E8 /* GRPCClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6312AE4D1B1BF49B00341DEE /* GRPCClientTests.m */; settings = {ASSET_TAGS = (); }; }; + 6379CC4D1BE1662A001BC0A1 /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; + 6379CC4E1BE1662B001BC0A1 /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; + 6379CC501BE16703001BC0A1 /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 6379CC4F1BE16703001BC0A1 /* InteropTestsRemote.m */; }; + 6379CC511BE1683B001BC0A1 /* InteropTestsRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 6379CC4F1BE16703001BC0A1 /* InteropTestsRemote.m */; }; + 6379CC531BE17709001BC0A1 /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; + 63DC84181BE15179000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; + 63DC841E1BE15180000708E8 /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */; }; + 63DC84281BE15267000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; + 63DC842E1BE15278000708E8 /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */; }; + 63DC842F1BE1527D000708E8 /* InteropTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635ED2EB1B1A3BC400FDE5C3 /* InteropTests.m */; }; + 63DC84391BE15294000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; + 63DC84481BE152B5000708E8 /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; + 63DC844E1BE15350000708E8 /* InteropTestsLocalCleartext.m in Sources */ = {isa = PBXBuildFile; fileRef = 63715F551B780C020029CB0B /* InteropTestsLocalCleartext.m */; }; + 63DC844F1BE15353000708E8 /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; + 63DC84501BE153AA000708E8 /* GRPCClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6312AE4D1B1BF49B00341DEE /* GRPCClientTests.m */; }; 63E240CE1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */; }; 63E240D01B6C63DC005F3B0E /* TestCertificates.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */; }; - 7D8A186224D39101F90230F6 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */; }; - DCFAE001609CCBFE69DFA6A1 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */; }; + F15EF7852DC70770EFDB1D2C /* libPods-AllTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -87,8 +88,15 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 060EF32D7EC0DF67ED617507 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = ""; }; + 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.debug.xcconfig"; sourceTree = ""; }; 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxLibraryUnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests.release.xcconfig"; sourceTree = ""; }; + 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.release.xcconfig"; sourceTree = ""; }; + 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.debug.xcconfig"; sourceTree = ""; }; + 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.release.xcconfig"; sourceTree = ""; }; 6312AE4D1B1BF49B00341DEE /* GRPCClientTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GRPCClientTests.m; sourceTree = ""; }; 63423F441B150A5F006CF63C /* AllTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AllTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; @@ -105,6 +113,17 @@ 63E240CC1B6C4D3A005F3B0E /* InteropTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InteropTests.h; sourceTree = ""; }; 63E240CD1B6C4E2B005F3B0E /* InteropTestsLocalSSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InteropTestsLocalSSL.m; sourceTree = ""; }; 63E240CF1B6C63DC005F3B0E /* TestCertificates.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TestCertificates.bundle; sourceTree = ""; }; + 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalSSL.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL.release.xcconfig"; sourceTree = ""; }; + A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RxLibraryUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AllTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AllTests/Pods-AllTests.debug.xcconfig"; sourceTree = ""; }; + CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AllTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + DBE059B4AC7A51919467EEC0 /* libPods-InteropTestsRemote.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsRemote.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalSSL.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.debug.xcconfig"; sourceTree = ""; }; + E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsLocalCleartext.debug.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext.debug.xcconfig"; sourceTree = ""; }; + E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InteropTestsRemote.release.xcconfig"; path = "Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote.release.xcconfig"; sourceTree = ""; }; + E6733B838B28453434B556E2 /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = ""; }; + FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-InteropTestsLocalCleartext.a"; sourceTree = BUILT_PRODUCTS_DIR; }; FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -114,7 +133,7 @@ buildActionMask = 2147483647; files = ( 63423F4A1B150A5F006CF63C /* libTests.a in Frameworks */, - 7D8A186224D39101F90230F6 /* libPods.a in Frameworks */, + F15EF7852DC70770EFDB1D2C /* libPods-AllTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -122,6 +141,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3D7C85F6AA68C4A205E3BA16 /* libPods-Tests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -130,7 +150,7 @@ buildActionMask = 2147483647; files = ( 63DC84181BE15179000708E8 /* libTests.a in Frameworks */, - 036D953EE34B1FD523647ACD /* libPods.a in Frameworks */, + 20DFDF829DD993A4A00D5662 /* libPods-RxLibraryUnitTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -139,7 +159,7 @@ buildActionMask = 2147483647; files = ( 63DC84281BE15267000708E8 /* libTests.a in Frameworks */, - DCFAE001609CCBFE69DFA6A1 /* libPods.a in Frameworks */, + 0F9232F984C08643FD40C34F /* libPods-InteropTestsRemote.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -148,7 +168,7 @@ buildActionMask = 2147483647; files = ( 63DC84391BE15294000708E8 /* libTests.a in Frameworks */, - 08A8BB02D19A53D902B214B8 /* libPods.a in Frameworks */, + 16A9E77B6E336B3C0B9BA6E0 /* libPods-InteropTestsLocalSSL.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -157,7 +177,7 @@ buildActionMask = 2147483647; files = ( 63DC84481BE152B5000708E8 /* libTests.a in Frameworks */, - 50267643BA114A2A724D4FDF /* libPods.a in Frameworks */, + 333E8FC01C8285B7C547D799 /* libPods-InteropTestsLocalCleartext.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -168,6 +188,12 @@ isa = PBXGroup; children = ( 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */, + CAE086D5B470DA367D415AB0 /* libPods-AllTests.a */, + FD346DB2C23F676C4842F3FF /* libPods-InteropTestsLocalCleartext.a */, + DBEDE45BDA60DF1E1C8950C0 /* libPods-InteropTestsLocalSSL.a */, + DBE059B4AC7A51919467EEC0 /* libPods-InteropTestsRemote.a */, + A58BE6DF1C62D1739EBB2C78 /* libPods-RxLibraryUnitTests.a */, + 20DFF2F3C97EF098FE5A3171 /* libPods-Tests.a */, ); name = Frameworks; sourceTree = ""; @@ -177,6 +203,18 @@ children = ( FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */, 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */, + B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */, + 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */, + E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */, + 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */, + 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */, + 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */, + DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */, + E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */, + 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */, + 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */, + 060EF32D7EC0DF67ED617507 /* Pods-Tests.debug.xcconfig */, + E6733B838B28453434B556E2 /* Pods-Tests.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -236,12 +274,12 @@ isa = PBXNativeTarget; buildConfigurationList = 63423F4D1B150A5F006CF63C /* Build configuration list for PBXNativeTarget "AllTests" */; buildPhases = ( - 914ADDD7106BA9BB8A7E569F /* Check Pods Manifest.lock */, + 914ADDD7106BA9BB8A7E569F /* 📦 Check Pods Manifest.lock */, 63423F401B150A5F006CF63C /* Sources */, 63423F411B150A5F006CF63C /* Frameworks */, 63423F421B150A5F006CF63C /* Resources */, - A441F71824DCB9D0CA297748 /* Copy Pods Resources */, - 5F14F59509E10C2852014F9E /* Embed Pods Frameworks */, + A441F71824DCB9D0CA297748 /* 📦 Copy Pods Resources */, + 5F14F59509E10C2852014F9E /* 📦 Embed Pods Frameworks */, ); buildRules = ( ); @@ -257,9 +295,11 @@ isa = PBXNativeTarget; buildConfigurationList = 635697DB1B14FC11007A7283 /* Build configuration list for PBXNativeTarget "Tests" */; buildPhases = ( + 796680C7599CB4ED736DD62A /* 📦 Check Pods Manifest.lock */, 635697C31B14FC11007A7283 /* Sources */, 635697C41B14FC11007A7283 /* Frameworks */, 635697C51B14FC11007A7283 /* CopyFiles */, + AEEBFC914CBAEE347382E8C4 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -274,12 +314,12 @@ isa = PBXNativeTarget; buildConfigurationList = 63DC841B1BE15179000708E8 /* Build configuration list for PBXNativeTarget "RxLibraryUnitTests" */; buildPhases = ( - B2986CEEE8CDD4901C97598B /* Check Pods Manifest.lock */, + B2986CEEE8CDD4901C97598B /* 📦 Check Pods Manifest.lock */, 63DC840F1BE15179000708E8 /* Sources */, 63DC84101BE15179000708E8 /* Frameworks */, 63DC84111BE15179000708E8 /* Resources */, - 4F5690DC0E6AD6663FE78B8B /* Embed Pods Frameworks */, - C977426A8727267BBAC7D48E /* Copy Pods Resources */, + 4F5690DC0E6AD6663FE78B8B /* 📦 Embed Pods Frameworks */, + C977426A8727267BBAC7D48E /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -295,12 +335,12 @@ isa = PBXNativeTarget; buildConfigurationList = 63DC842B1BE15267000708E8 /* Build configuration list for PBXNativeTarget "InteropTestsRemote" */; buildPhases = ( - 4C406327D3907A5E5FBA8AC9 /* Check Pods Manifest.lock */, + 4C406327D3907A5E5FBA8AC9 /* 📦 Check Pods Manifest.lock */, 63DC841F1BE15267000708E8 /* Sources */, 63DC84201BE15267000708E8 /* Frameworks */, 63DC84211BE15267000708E8 /* Resources */, - 900B6EDD4D16BE7D765C3885 /* Embed Pods Frameworks */, - C2E09DC4BD239F71160F0CC1 /* Copy Pods Resources */, + 900B6EDD4D16BE7D765C3885 /* 📦 Embed Pods Frameworks */, + C2E09DC4BD239F71160F0CC1 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -316,12 +356,12 @@ isa = PBXNativeTarget; buildConfigurationList = 63DC843C1BE15294000708E8 /* Build configuration list for PBXNativeTarget "InteropTestsLocalSSL" */; buildPhases = ( - 5C20DCCB71C3991E6FE78C22 /* Check Pods Manifest.lock */, + 5C20DCCB71C3991E6FE78C22 /* 📦 Check Pods Manifest.lock */, 63DC84301BE15294000708E8 /* Sources */, 63DC84311BE15294000708E8 /* Frameworks */, 63DC84321BE15294000708E8 /* Resources */, - C591129ACE9F6CC5EE03FCDE /* Embed Pods Frameworks */, - 693DD0B453431D64EA24FD66 /* Copy Pods Resources */, + C591129ACE9F6CC5EE03FCDE /* 📦 Embed Pods Frameworks */, + 693DD0B453431D64EA24FD66 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -337,12 +377,12 @@ isa = PBXNativeTarget; buildConfigurationList = 63DC844B1BE152B5000708E8 /* Build configuration list for PBXNativeTarget "InteropTestsLocalCleartext" */; buildPhases = ( - 7418AC7B3844B29E48D24FC7 /* Check Pods Manifest.lock */, + 7418AC7B3844B29E48D24FC7 /* 📦 Check Pods Manifest.lock */, 63DC843F1BE152B5000708E8 /* Sources */, 63DC84401BE152B5000708E8 /* Frameworks */, 63DC84411BE152B5000708E8 /* Resources */, - A8E3AC66DF770B774114A30E /* Embed Pods Frameworks */, - 8AD3130D3C58A0FB32FF2A36 /* Copy Pods Resources */, + A8E3AC66DF770B774114A30E /* 📦 Embed Pods Frameworks */, + 8AD3130D3C58A0FB32FF2A36 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -446,14 +486,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 4C406327D3907A5E5FBA8AC9 /* Check Pods Manifest.lock */ = { + 4C406327D3907A5E5FBA8AC9 /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -461,29 +501,29 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - 4F5690DC0E6AD6663FE78B8B /* Embed Pods Frameworks */ = { + 4F5690DC0E6AD6663FE78B8B /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 5C20DCCB71C3991E6FE78C22 /* Check Pods Manifest.lock */ = { + 5C20DCCB71C3991E6FE78C22 /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -491,44 +531,44 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - 5F14F59509E10C2852014F9E /* Embed Pods Frameworks */ = { + 5F14F59509E10C2852014F9E /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AllTests/Pods-AllTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 693DD0B453431D64EA24FD66 /* Copy Pods Resources */ = { + 693DD0B453431D64EA24FD66 /* 📦 Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "📦 Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 7418AC7B3844B29E48D24FC7 /* Check Pods Manifest.lock */ = { + 7418AC7B3844B29E48D24FC7 /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -536,44 +576,59 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - 8AD3130D3C58A0FB32FF2A36 /* Copy Pods Resources */ = { + 796680C7599CB4ED736DD62A /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 8AD3130D3C58A0FB32FF2A36 /* 📦 Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 900B6EDD4D16BE7D765C3885 /* Embed Pods Frameworks */ = { + 900B6EDD4D16BE7D765C3885 /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 914ADDD7106BA9BB8A7E569F /* Check Pods Manifest.lock */ = { + 914ADDD7106BA9BB8A7E569F /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -581,44 +636,59 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - A441F71824DCB9D0CA297748 /* Copy Pods Resources */ = { + A441F71824DCB9D0CA297748 /* 📦 Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AllTests/Pods-AllTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + A8E3AC66DF770B774114A30E /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalCleartext/Pods-InteropTestsLocalCleartext-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - A8E3AC66DF770B774114A30E /* Embed Pods Frameworks */ = { + AEEBFC914CBAEE347382E8C4 /* 📦 Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "📦 Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - B2986CEEE8CDD4901C97598B /* Check Pods Manifest.lock */ = { + B2986CEEE8CDD4901C97598B /* 📦 Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "📦 Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -626,49 +696,49 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - C2E09DC4BD239F71160F0CC1 /* Copy Pods Resources */ = { + C2E09DC4BD239F71160F0CC1 /* 📦 Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "📦 Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsRemote/Pods-InteropTestsRemote-resources.sh\"\n"; showEnvVarsInLog = 0; }; - C591129ACE9F6CC5EE03FCDE /* Embed Pods Frameworks */ = { + C591129ACE9F6CC5EE03FCDE /* 📦 Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Embed Pods Frameworks"; + name = "📦 Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-InteropTestsLocalSSL/Pods-InteropTestsLocalSSL-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - C977426A8727267BBAC7D48E /* Copy Pods Resources */ = { + C977426A8727267BBAC7D48E /* 📦 Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "📦 Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxLibraryUnitTests/Pods-RxLibraryUnitTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -764,7 +834,7 @@ /* Begin XCBuildConfiguration section */ 63423F4E1B150A5F006CF63C /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */; + baseConfigurationReference = B94C27C06733CF98CE1B2757 /* Pods-AllTests.debug.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -782,7 +852,7 @@ }; 63423F4F1B150A5F006CF63C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */; + baseConfigurationReference = 5761E98978DDDF136A58CB7E /* Pods-AllTests.release.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -874,6 +944,7 @@ }; 635697DC1B14FC11007A7283 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 060EF32D7EC0DF67ED617507 /* Pods-Tests.debug.xcconfig */; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -882,6 +953,7 @@ }; 635697DD1B14FC11007A7283 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = E6733B838B28453434B556E2 /* Pods-Tests.release.xcconfig */; buildSettings = { PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -890,7 +962,7 @@ }; 63DC841C1BE15179000708E8 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */; + baseConfigurationReference = 07D10A965323BEA7FE59A74B /* Pods-RxLibraryUnitTests.debug.xcconfig */; buildSettings = { DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; @@ -904,7 +976,7 @@ }; 63DC841D1BE15179000708E8 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */; + baseConfigurationReference = 3B0861FC805389C52DB260D4 /* Pods-RxLibraryUnitTests.release.xcconfig */; buildSettings = { INFOPLIST_FILE = Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -916,7 +988,7 @@ }; 63DC842C1BE15267000708E8 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */; + baseConfigurationReference = DC3CA1D948F068E76957A861 /* Pods-InteropTestsRemote.debug.xcconfig */; buildSettings = { DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; @@ -930,7 +1002,7 @@ }; 63DC842D1BE15267000708E8 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */; + baseConfigurationReference = E4275A759BDBDF143B9B438F /* Pods-InteropTestsRemote.release.xcconfig */; buildSettings = { INFOPLIST_FILE = Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -942,7 +1014,7 @@ }; 63DC843D1BE15294000708E8 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */; + baseConfigurationReference = 553BBBED24E4162D1F769D65 /* Pods-InteropTestsLocalSSL.debug.xcconfig */; buildSettings = { DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; @@ -956,7 +1028,7 @@ }; 63DC843E1BE15294000708E8 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */; + baseConfigurationReference = 7A2E97E3F469CC2A758D77DE /* Pods-InteropTestsLocalSSL.release.xcconfig */; buildSettings = { INFOPLIST_FILE = Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -968,7 +1040,7 @@ }; 63DC844C1BE152B5000708E8 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */; + baseConfigurationReference = E1486220285AF123EB124008 /* Pods-InteropTestsLocalCleartext.debug.xcconfig */; buildSettings = { DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; @@ -982,7 +1054,7 @@ }; 63DC844D1BE152B5000708E8 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */; + baseConfigurationReference = 51A275E86C141416ED63FF76 /* Pods-InteropTestsLocalCleartext.release.xcconfig */; buildSettings = { INFOPLIST_FILE = Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; From e83eff4bb3aeaae7bad608a8b20550ccc7c9966f Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Fri, 20 May 2016 13:34:56 -0700 Subject: [PATCH 055/175] Use protobuf 3-beta-3 on Travis, which supports Cocoapods 1 --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 75b14406306..16c6390a54a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,9 @@ before_install: - gem install cocoapods -v '1.0.0' - pod --version - brew install gflags + - pushd third_party/protobuf + - git checkout v3.0.0-beta-3 + - popd install: - make grpc_objective_c_plugin - pushd src/objective-c/tests From 8ba60db6ed050a53a5e97d5da176363ef5e4b2d4 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 20 May 2016 13:53:14 -0700 Subject: [PATCH 056/175] Check content type on the client response path --- src/core/lib/channel/http_client_filter.c | 20 ++++++++++++++++++++ src/core/lib/channel/http_server_filter.c | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 516e708d1f0..d56e3ab6728 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -39,6 +39,9 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/static_metadata.h" +#define EXPECTED_CONTENT_TYPE "application/grpc" +#define EXPECTED_CONTENT_TYPE_LENGTH sizeof(EXPECTED_CONTENT_TYPE) - 1 + typedef struct call_data { grpc_linked_mdelem method; grpc_linked_mdelem scheme; @@ -74,7 +77,24 @@ static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) { } else if (md->key == GRPC_MDSTR_STATUS) { grpc_call_element_send_cancel(a->exec_ctx, a->elem); return NULL; + } else if (md == GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC) { + return NULL; } else if (md->key == GRPC_MDSTR_CONTENT_TYPE) { + const char *value_str = grpc_mdstr_as_c_string(md->value); + if (strncmp(value_str, EXPECTED_CONTENT_TYPE, + EXPECTED_CONTENT_TYPE_LENGTH) == 0 && + (value_str[EXPECTED_CONTENT_TYPE_LENGTH] == '+' || + value_str[EXPECTED_CONTENT_TYPE_LENGTH] == ';')) { + /* Although the C implementation doesn't (currently) generate them, + any custom +-suffix is explicitly valid. */ + /* TODO(klempner): We should consider preallocating common values such + as +proto or +json, or at least stashing them if we see them. */ + /* TODO(klempner): Should we be surfacing this to application code? */ + } else { + /* TODO(klempner): We're currently allowing this, but we shouldn't + see it without a proxy so log for now. */ + gpr_log(GPR_INFO, "Unexpected content-type '%s'", value_str); + } return NULL; } return md; diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index ba865416dec..cbc8b189b4b 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -108,7 +108,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) { } else { /* TODO(klempner): We're currently allowing this, but we shouldn't see it without a proxy so log for now. */ - gpr_log(GPR_INFO, "Unexpected content-type %s", value_str); + gpr_log(GPR_INFO, "Unexpected content-type '%s'", value_str); } return NULL; } else if (md->key == GRPC_MDSTR_TE || md->key == GRPC_MDSTR_METHOD || From 91c51a7abaa43317df37e5b159491024678cf47d Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 20 May 2016 14:46:49 -0700 Subject: [PATCH 057/175] Add proto_server_reflection_test --- Makefile | 100 ++++---- build.yaml | 30 +-- .../impl/proto_server_reflection_plugin.h | 7 +- .../end2end/proto_server_reflection_test.cc | 165 +++++++++++++ test/cpp/util/reflection_debug/Makefile | 50 ---- .../reflection_debug/reflection_client.cc | 219 ------------------ tools/run_tests/sources_and_headers.json | 43 ++-- tools/run_tests/tests.json | 26 +-- .../proto_server_reflection_test.vcxproj} | 19 +- ...to_server_reflection_test.vcxproj.filters} | 18 +- 10 files changed, 292 insertions(+), 385 deletions(-) create mode 100644 test/cpp/end2end/proto_server_reflection_test.cc delete mode 100644 test/cpp/util/reflection_debug/Makefile delete mode 100644 test/cpp/util/reflection_debug/reflection_client.cc rename vsprojects/vcxproj/test/{reflection_debug_test/reflection_debug_test.vcxproj => proto_server_reflection_test/proto_server_reflection_test.vcxproj} (93%) rename vsprojects/vcxproj/test/{reflection_debug_test/reflection_debug_test.vcxproj.filters => proto_server_reflection_test/proto_server_reflection_test.vcxproj.filters} (62%) diff --git a/Makefile b/Makefile index 673fbf2f153..97377dba034 100644 --- a/Makefile +++ b/Makefile @@ -1034,6 +1034,7 @@ interop_test: $(BINDIR)/$(CONFIG)/interop_test json_run_localhost: $(BINDIR)/$(CONFIG)/json_run_localhost metrics_client: $(BINDIR)/$(CONFIG)/metrics_client mock_test: $(BINDIR)/$(CONFIG)/mock_test +proto_server_reflection_test: $(BINDIR)/$(CONFIG)/proto_server_reflection_test qps_interarrival_test: $(BINDIR)/$(CONFIG)/qps_interarrival_test qps_json_driver: $(BINDIR)/$(CONFIG)/qps_json_driver qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test @@ -1041,7 +1042,6 @@ qps_test: $(BINDIR)/$(CONFIG)/qps_test qps_worker: $(BINDIR)/$(CONFIG)/qps_worker reconnect_interop_client: $(BINDIR)/$(CONFIG)/reconnect_interop_client reconnect_interop_server: $(BINDIR)/$(CONFIG)/reconnect_interop_server -reflection_debug_test: $(BINDIR)/$(CONFIG)/reflection_debug_test secure_auth_context_test: $(BINDIR)/$(CONFIG)/secure_auth_context_test secure_sync_unary_ping_pong_test: $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test server_builder_plugin_test: $(BINDIR)/$(CONFIG)/server_builder_plugin_test @@ -1404,6 +1404,7 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \ $(BINDIR)/$(CONFIG)/json_run_localhost \ $(BINDIR)/$(CONFIG)/metrics_client \ $(BINDIR)/$(CONFIG)/mock_test \ + $(BINDIR)/$(CONFIG)/proto_server_reflection_test \ $(BINDIR)/$(CONFIG)/qps_interarrival_test \ $(BINDIR)/$(CONFIG)/qps_json_driver \ $(BINDIR)/$(CONFIG)/qps_openloop_test \ @@ -1411,7 +1412,6 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \ $(BINDIR)/$(CONFIG)/qps_worker \ $(BINDIR)/$(CONFIG)/reconnect_interop_client \ $(BINDIR)/$(CONFIG)/reconnect_interop_server \ - $(BINDIR)/$(CONFIG)/reflection_debug_test \ $(BINDIR)/$(CONFIG)/secure_auth_context_test \ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \ @@ -1740,12 +1740,12 @@ test_cxx: test_zookeeper buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/interop_test || ( echo test interop_test failed ; exit 1 ) $(E) "[RUN] Testing mock_test" $(Q) $(BINDIR)/$(CONFIG)/mock_test || ( echo test mock_test failed ; exit 1 ) + $(E) "[RUN] Testing proto_server_reflection_test" + $(Q) $(BINDIR)/$(CONFIG)/proto_server_reflection_test || ( echo test proto_server_reflection_test failed ; exit 1 ) $(E) "[RUN] Testing qps_openloop_test" $(Q) $(BINDIR)/$(CONFIG)/qps_openloop_test || ( echo test qps_openloop_test failed ; exit 1 ) $(E) "[RUN] Testing qps_test" $(Q) $(BINDIR)/$(CONFIG)/qps_test || ( echo test qps_test failed ; exit 1 ) - $(E) "[RUN] Testing reflection_debug_test" - $(Q) $(BINDIR)/$(CONFIG)/reflection_debug_test || ( echo test reflection_debug_test failed ; exit 1 ) $(E) "[RUN] Testing secure_auth_context_test" $(Q) $(BINDIR)/$(CONFIG)/secure_auth_context_test || ( echo test secure_auth_context_test failed ; exit 1 ) $(E) "[RUN] Testing secure_sync_unary_ping_pong_test" @@ -11193,6 +11193,52 @@ endif endif +PROTO_SERVER_REFLECTION_TEST_SRC = \ + test/cpp/end2end/proto_server_reflection_test.cc \ + test/cpp/util/proto_reflection_descriptor_database.cc \ + +PROTO_SERVER_REFLECTION_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PROTO_SERVER_REFLECTION_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/proto_server_reflection_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/proto_server_reflection_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/proto_server_reflection_test: $(PROTOBUF_DEP) $(PROTO_SERVER_REFLECTION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(PROTO_SERVER_REFLECTION_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/proto_server_reflection_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/end2end/proto_server_reflection_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +$(OBJDIR)/$(CONFIG)/test/cpp/util/proto_reflection_descriptor_database.o: $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_proto_server_reflection_test: $(PROTO_SERVER_REFLECTION_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(PROTO_SERVER_REFLECTION_TEST_OBJS:.o=.dep) +endif +endif + + QPS_INTERARRIVAL_TEST_SRC = \ test/cpp/qps/qps_interarrival_test.cc \ @@ -11517,52 +11563,6 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/interop/reconnect_interop_server.o: $(GENDIR)/src/proto/grpc/testing/empty.pb.cc $(GENDIR)/src/proto/grpc/testing/empty.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/test.pb.cc $(GENDIR)/src/proto/grpc/testing/test.grpc.pb.cc -REFLECTION_DEBUG_TEST_SRC = \ - test/cpp/util/proto_reflection_descriptor_database.cc \ - test/cpp/util/reflection_debug/reflection_client.cc \ - -REFLECTION_DEBUG_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(REFLECTION_DEBUG_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/reflection_debug_test: openssl_dep_error - -else - - - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/reflection_debug_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/reflection_debug_test: $(PROTOBUF_DEP) $(REFLECTION_DEBUG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(REFLECTION_DEBUG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/reflection_debug_test - -endif - -endif - -$(OBJDIR)/$(CONFIG)/test/cpp/util/proto_reflection_descriptor_database.o: $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a - -$(OBJDIR)/$(CONFIG)/test/cpp/util/reflection_debug/reflection_client.o: $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a - -deps_reflection_debug_test: $(REFLECTION_DEBUG_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(REFLECTION_DEBUG_TEST_OBJS:.o=.dep) -endif -endif - - SECURE_AUTH_CONTEXT_TEST_SRC = \ test/cpp/common/secure_auth_context_test.cc \ diff --git a/build.yaml b/build.yaml index c165304c909..5465c3b8820 100644 --- a/build.yaml +++ b/build.yaml @@ -2787,6 +2787,23 @@ targets: - grpc - gpr_test_util - gpr +- name: proto_server_reflection_test + gtest: true + build: test + language: c++ + headers: + - test/cpp/util/proto_reflection_descriptor_database.h + src: + - test/cpp/end2end/proto_server_reflection_test.cc + - test/cpp/util/proto_reflection_descriptor_database.cc + deps: + - grpc++_reflection + - grpc++_test_util + - grpc_test_util + - grpc++ + - grpc + - gpr_test_util + - gpr - name: qps_interarrival_test build: test run: false @@ -2915,19 +2932,6 @@ targets: - gpr_test_util - gpr - grpc++_test_config -- name: reflection_debug_test - build: test - language: c++ - headers: - - test/cpp/util/proto_reflection_descriptor_database.h - src: - - test/cpp/util/proto_reflection_descriptor_database.cc - - test/cpp/util/reflection_debug/reflection_client.cc - deps: - - grpc++_reflection - - grpc++ - - grpc - - gpr - name: secure_auth_context_test gtest: true build: test diff --git a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h index e09c4132510..df0abb2b16f 100644 --- a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h +++ b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h @@ -61,17 +61,12 @@ class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { std::shared_ptr<::grpc::ProtoServerReflection> reflection_service; }; -// std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { -// return std::unique_ptr<::grpc::ServerBuilderPlugin>( -// new ProtoServerReflectionPlugin()); -// } - std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection(); void grpc_AddServerBuilderPlugin_reflection(); // Force AddServerBuilderPlugin() to be called at static initialization time. -struct StaticPluginInitializer_reflection { +static struct StaticPluginInitializer_reflection { StaticPluginInitializer_reflection() { grpc_AddServerBuilderPlugin_reflection(); } diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc new file mode 100644 index 00000000000..ae770654ffe --- /dev/null +++ b/test/cpp/end2end/proto_server_reflection_test.cc @@ -0,0 +1,165 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "src/proto/grpc/testing/echo.grpc.pb.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" +#include "test/cpp/end2end/test_service_impl.h" +#include "test/cpp/util/proto_reflection_descriptor_database.h" + +namespace grpc { +namespace testing { + +class ProtoServerReflectionTest : public ::testing::Test { + public: + ProtoServerReflectionTest() {} + + void SetUp() GRPC_OVERRIDE { + port_ = grpc_pick_unused_port_or_die(); + ref_desc_pool_ = google::protobuf::DescriptorPool::generated_pool(); + + ServerBuilder builder; + grpc::string server_address = "localhost:" + to_string(port_); + builder.AddListeningPort(server_address, InsecureServerCredentials()); + server_ = builder.BuildAndStart(); + } + + void ResetStub() { + string target = "dns:localhost:" + to_string(port_); + std::shared_ptr channel = + CreateChannel(target, InsecureChannelCredentials()); + stub_ = grpc::testing::EchoTestService::NewStub(channel); + desc_db_.reset(new ProtoReflectionDescriptorDatabase(channel)); + desc_pool_.reset(new google::protobuf::DescriptorPool(desc_db_.get())); + } + + string to_string(const int number) { + std::stringstream strs; + strs << number; + return strs.str(); + } + + void CompareService(const grpc::string& service) { + const google::protobuf::ServiceDescriptor* service_desc = + desc_pool_->FindServiceByName(service); + const google::protobuf::ServiceDescriptor* ref_service_desc = + ref_desc_pool_->FindServiceByName(service); + EXPECT_TRUE(service_desc != nullptr); + EXPECT_TRUE(ref_service_desc != nullptr); + EXPECT_EQ(service_desc->DebugString(), ref_service_desc->DebugString()); + + const google::protobuf::FileDescriptor* file_desc = service_desc->file(); + if (known_files_.find(file_desc->package() + "/" + file_desc->name()) != + known_files_.end()) { + EXPECT_EQ(file_desc->DebugString(), + ref_service_desc->file()->DebugString()); + known_files_.insert(file_desc->package() + "/" + file_desc->name()); + } + + for (int i = 0; i < service_desc->method_count(); ++i) { + CompareMethod(service_desc->method(i)->full_name()); + } + } + + void CompareMethod(const grpc::string& method) { + const google::protobuf::MethodDescriptor* method_desc = + desc_pool_->FindMethodByName(method); + const google::protobuf::MethodDescriptor* ref_method_desc = + ref_desc_pool_->FindMethodByName(method); + EXPECT_TRUE(method_desc != nullptr); + EXPECT_TRUE(ref_method_desc != nullptr); + EXPECT_EQ(method_desc->DebugString(), ref_method_desc->DebugString()); + + CompareType(method_desc->input_type()->full_name()); + CompareType(method_desc->output_type()->full_name()); + } + + void CompareType(const grpc::string& type) { + if (known_types_.find(type) != known_types_.end()) { + return; + } + + const google::protobuf::Descriptor* desc = + desc_pool_->FindMessageTypeByName(type); + const google::protobuf::Descriptor* ref_desc = + ref_desc_pool_->FindMessageTypeByName(type); + EXPECT_TRUE(desc != nullptr); + EXPECT_TRUE(ref_desc != nullptr); + EXPECT_EQ(desc->DebugString(), ref_desc->DebugString()); + } + + protected: + std::unique_ptr server_; + std::unique_ptr stub_; + std::unique_ptr desc_db_; + std::unique_ptr desc_pool_; + std::unordered_set known_files_; + std::unordered_set known_types_; + const google::protobuf::DescriptorPool* ref_desc_pool_; + int port_; +}; + +TEST_F(ProtoServerReflectionTest, CheckResponseWithLocalDescriptorPool) { + ResetStub(); + + std::vector services; + desc_db_->GetServices(&services); + // The service list has at least one service (reflection servcie). + EXPECT_TRUE(services.size() > 0); + + for (auto it = services.begin(); it != services.end(); ++it) { + CompareService(*it); + } +} + +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/cpp/util/reflection_debug/Makefile b/test/cpp/util/reflection_debug/Makefile deleted file mode 100644 index 9eea5ae7347..00000000000 --- a/test/cpp/util/reflection_debug/Makefile +++ /dev/null @@ -1,50 +0,0 @@ - -# Copyright 2015-2016, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -CXX = g++ -INCLUDES += -I. -I.. -CPPFLAGS += -I/usr/local/include -pthread -CXXFLAGS += -std=c++11 ${INCLUDES} -LDFLAGS += -L/usr/local/lib -lgrpc++_unsecure -lgrpc -lgrpc++_reflection -lprotobuf -lpthread -ldl -VPATH = .. - -# PROTOS_PATH = ../../../src/cpp/plugin/reflection - -vpath %.proto $(PROTOS_PATH) - -all: reflection_client - -reflection_client: proto_reflection_descriptor_database.o reflection_client.o - $(CXX) $(INCLUDES) $^ $(LDFLAGS) -o $@ - - -clean: - rm -f *.o reflection_client diff --git a/test/cpp/util/reflection_debug/reflection_client.cc b/test/cpp/util/reflection_debug/reflection_client.cc deleted file mode 100644 index a1e97f7edec..00000000000 --- a/test/cpp/util/reflection_debug/reflection_client.cc +++ /dev/null @@ -1,219 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include "proto_reflection_descriptor_database.h" -// #include "reflection.grpc.pb.h" - -using grpc::Channel; -using grpc::ClientContext; -using grpc::Status; -using grpc::ProtoReflectionDescriptorDatabase; -using grpc::reflection::v1alpha::ServerReflection; -// using grpc::reflection::v1alpha::EmptyRequest; -// using grpc::reflection::v1alpha::ListServiceResponse; -using google::protobuf::FileDescriptorProto; -using google::protobuf::DescriptorPool; -using google::protobuf::ServiceDescriptor; -using google::protobuf::MethodDescriptor; -using google::protobuf::Descriptor; -using google::protobuf::FieldDescriptor; - -class ReflectionClient { - public: - ReflectionClient(std::shared_ptr channel) - : db_(new ProtoReflectionDescriptorDatabase( - ServerReflection::NewStub(channel))), - desc_pool_(new DescriptorPool(db_.get())) {} - - void PrintInfo() { - std::vector services; - bool found_services = db_->GetServices(&services); - if (found_services) { - std::string padding = ""; - std::cout << "Service amount:" << services.size() << std::endl; - for (auto it = services.begin(); it != services.end(); ++it) { - if (it != services.end() - 1) { - std::cout << padding << "│ " << std::endl; - std::cout << padding << "├─" << *it << std::endl; - PrintService(desc_pool_->FindServiceByName(*it), padding + "│ "); - } else { - std::cout << padding << "│ " << std::endl; - std::cout << padding << "└─" << *it << std::endl; - PrintService(desc_pool_->FindServiceByName(*it), padding + " "); - } - } - } - } - - void PrintService(const ServiceDescriptor* service_desc, - const std::string padding) { - if (service_desc != nullptr) { - std::cout << padding << "│ Method amount:" << service_desc->method_count() - << std::endl; - for (int i = 0; i < service_desc->method_count(); ++i) { - if (i != service_desc->method_count() - 1) { - std::cout << padding << "├─" << service_desc->method(i)->name() - << std::endl; - PrintMethod(service_desc->method(i), padding + "│ "); - } else { - std::cout << padding << "└─" << service_desc->method(i)->name() - << std::endl; - PrintMethod(service_desc->method(i), padding + " "); - } - } - } - } - - void PrintMethod(const MethodDescriptor* method_desc, - const std::string padding) { - if (method_desc != nullptr) { - std::cout << padding - << "├─input type: " << method_desc->input_type()->name() - << std::endl; - PrintMessageType(method_desc->input_type(), padding + "│ "); - std::cout << padding - << "└─output type: " << method_desc->output_type()->name() - << std::endl; - PrintMessageType(method_desc->output_type(), padding + " "); - } - } - - void PrintMessageType(const Descriptor* type_desc, - const std::string padding) { - if (type_desc != nullptr) { - if (type_desc->field_count() > 0) { - std::cout << padding << "│ Field amount:" << type_desc->field_count() - << std::endl; - } - for (int i = 0; i < type_desc->field_count(); ++i) { - if (i != type_desc->field_count() - 1) { - const FieldDescriptor* field = type_desc->field(i); - std::cout << padding << "├─ " << std::left << std::setw(15) - << kLabelToName[field->label()] << std::setw(30) - << " name: " + field->name() << std::setw(50) - << " type: " + - (field->type() == FieldDescriptor::Type::TYPE_MESSAGE - ? field->message_type()->name() - : field->type_name()) - << std::endl; - } else { - const FieldDescriptor* field = type_desc->field(i); - std::cout << padding << "└─ " << std::left << std::setw(15) - << kLabelToName[field->label()] << std::setw(30) - << " name: " + field->name() << std::setw(50) - << " type: " + - (field->type() == FieldDescriptor::Type::TYPE_MESSAGE - ? field->message_type()->name() - : field->type_name()) - << std::endl; - } - } - } - } - - void Test() { - { - std::vector services; - bool found = db_->GetServices(&services); - if (found) { - for (auto it : services) { - std::cout << it << std::endl; - } - } - } - { - FileDescriptorProto output; - bool found = db_->FindFileByName("helloworld.proto", &output); - if (found) std::cout << output.name() << std::endl; - } - { - FileDescriptorProto output; - bool found = - db_->FindFileContainingSymbol("helloworld.Greeter.SayHello", &output); - if (found) std::cout << output.name() << std::endl; - } - { - FileDescriptorProto output; - bool found = db_->FindFileContainingExtension( - "helloworld.Greeter.HelloRequest", 1, &output); - found = db_->FindFileContainingExtension( - "helloworld.Greeter.HelloRequest", 1, &output); - if (found) std::cout << output.name() << std::endl; - } - // DescriptorPool pool(db_.get()); - // std::cout << pool.FindServiceByName("helloworld.Greeter")->name() - // << std::endl; - } - - private: - const char* const kLabelToName[FieldDescriptor::Label::MAX_LABEL + 1] = { - "ERROR", // 0 is reserved for errors - - "optional", // LABEL_OPTIONAL - "required", // LABEL_REQUIRED - "repeated", // LABEL_REPEATED - }; - - std::unique_ptr db_; - std::unique_ptr desc_pool_; -}; - -int main(int argc, char** argv) { - int port = 50051; - if (argc == 2) { - try { - port = std::stoi(argv[1]); - if (port > 65535 || port < 1024) { - throw std::out_of_range("Port number out of range."); - } - } catch (std::invalid_argument&) { - } catch (std::out_of_range&) { - } - } - - ReflectionClient reflection_client(grpc::CreateChannel( - "localhost:" + std::to_string(port), grpc::InsecureChannelCredentials())); - - reflection_client.PrintInfo(); - - return 0; -} diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 3eae7857540..f1d344b613b 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -2389,6 +2389,29 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc++", + "grpc++_reflection", + "grpc++_test_util", + "grpc_test_util" + ], + "headers": [ + "test/cpp/util/proto_reflection_descriptor_database.h" + ], + "language": "c++", + "name": "proto_server_reflection_test", + "src": [ + "test/cpp/end2end/proto_server_reflection_test.cc", + "test/cpp/util/proto_reflection_descriptor_database.cc", + "test/cpp/util/proto_reflection_descriptor_database.h" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -2551,26 +2574,6 @@ "third_party": false, "type": "target" }, - { - "deps": [ - "gpr", - "grpc", - "grpc++", - "grpc++_reflection" - ], - "headers": [ - "test/cpp/util/proto_reflection_descriptor_database.h" - ], - "language": "c++", - "name": "reflection_debug_test", - "src": [ - "test/cpp/util/proto_reflection_descriptor_database.cc", - "test/cpp/util/proto_reflection_descriptor_database.h", - "test/cpp/util/reflection_debug/reflection_client.cc" - ], - "third_party": false, - "type": "target" - }, { "deps": [ "gpr", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 0025b48c331..47098fb14b1 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -2375,18 +2375,20 @@ "ci_platforms": [ "linux", "mac", - "posix" + "posix", + "windows" ], - "cpu_cost": 0.5, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, - "gtest": false, + "gtest": true, "language": "c++", - "name": "qps_openloop_test", + "name": "proto_server_reflection_test", "platforms": [ "linux", "mac", - "posix" + "posix", + "windows" ] }, { @@ -2396,12 +2398,12 @@ "mac", "posix" ], - "cpu_cost": 10, + "cpu_cost": 0.5, "exclude_configs": [], "flaky": false, "gtest": false, "language": "c++", - "name": "qps_test", + "name": "qps_openloop_test", "platforms": [ "linux", "mac", @@ -2413,20 +2415,18 @@ "ci_platforms": [ "linux", "mac", - "posix", - "windows" + "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 10, "exclude_configs": [], "flaky": false, "gtest": false, "language": "c++", - "name": "reflection_debug_test", + "name": "qps_test", "platforms": [ "linux", "mac", - "posix", - "windows" + "posix" ] }, { diff --git a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj similarity index 93% rename from vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj rename to vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj index 757e1cd5358..27fc168946b 100644 --- a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj +++ b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj @@ -20,7 +20,7 @@ - {037B9EA1-03CC-6A3B-4E4B-DB17C3D59CF8} + {1881E6A1-EAD4-A68C-9727-FF1956B66185} true $(SolutionDir)IntDir\$(MSBuildProjectName)\ @@ -62,14 +62,14 @@ - reflection_debug_test + proto_server_reflection_test static Debug static Debug - reflection_debug_test + proto_server_reflection_test static Release static @@ -163,21 +163,30 @@ - + - + {5F575402-3F89-5D1A-6910-9DB8BF5D2BAB} + + {0BE77741-552A-929B-A497-4EF7ECE17A64} + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} diff --git a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj.filters similarity index 62% rename from vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters rename to vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj.filters index 6258acedcc0..6d6e5c1f32c 100644 --- a/vsprojects/vcxproj/test/reflection_debug_test/reflection_debug_test.vcxproj.filters +++ b/vsprojects/vcxproj/test/proto_server_reflection_test/proto_server_reflection_test.vcxproj.filters @@ -1,12 +1,12 @@ + + test\cpp\end2end + test\cpp\util - - test\cpp\util\reflection_debug - @@ -16,16 +16,16 @@ - {fdf7e642-420d-9e18-7a3c-19dca964f218} + {354831a1-52fb-6364-b568-c8c49bfb8d29} - {562b3927-e256-190d-ab72-6b4b04ffb8b2} + {b4d957ef-f9fd-2a14-078c-b72f80096f70} - - {8ed08be4-a27c-d51c-d587-a02cf3dc5abc} + + {130f224c-89a5-54ea-7045-b54b4188c52b} - - {b84b1385-e0b2-239b-bac2-81a16bc90249} + + {aae81aad-5563-fceb-1461-10fdec84c5b0} From 8d1e8d0e9d1edbefdd3c10f8bce6ec365a0f44a4 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 5 May 2016 10:55:25 -0700 Subject: [PATCH 058/175] Disable deterministic UUIDs in the test Podfile --- src/objective-c/tests/Podfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 30725a0f781..7fe047aa21f 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -1,6 +1,8 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' +install! 'cocoapods', :deterministic_uuids => false + def shared_pods pod 'Protobuf', :path => "../../../third_party/protobuf" pod 'BoringSSL', :podspec => ".." From 46bf1467c5d070c5ff72a33fb60ef5c5bb45f71c Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 24 May 2016 06:47:28 -0700 Subject: [PATCH 059/175] Add transitive dependencies in FileDescriptorResponse --- .../reflection/proto_server_reflection.cc | 24 +++++++++++++++---- .../reflection/proto_server_reflection.h | 6 +++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/extensions/reflection/proto_server_reflection.cc b/extensions/reflection/proto_server_reflection.cc index 28292a42d60..fe4564ab723 100644 --- a/extensions/reflection/proto_server_reflection.cc +++ b/extensions/reflection/proto_server_reflection.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -146,7 +147,8 @@ Status ProtoServerReflection::GetFileByName( if (file_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "File not found."); } - FillFileDescriptorProtoResponse(file_desc, response); + std::unordered_set seen_files; + FillFileDescriptorResponse(file_desc, response, &seen_files); return Status::OK; } @@ -162,7 +164,8 @@ Status ProtoServerReflection::GetFileContainingSymbol( if (file_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Symbol not found."); } - FillFileDescriptorProtoResponse(file_desc, response); + std::unordered_set seen_files; + FillFileDescriptorResponse(file_desc, response, &seen_files); return Status::OK; } @@ -184,7 +187,8 @@ Status ProtoServerReflection::GetFileContainingExtension( if (field_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Extension not found."); } - FillFileDescriptorProtoResponse(field_desc->file(), response); + std::unordered_set seen_files; + FillFileDescriptorResponse(field_desc->file(), response, &seen_files); return Status::OK; } @@ -209,13 +213,23 @@ Status ProtoServerReflection::GetAllExtensionNumbers( return Status::OK; } -void ProtoServerReflection::FillFileDescriptorProtoResponse( - const FileDescriptor* file_desc, ServerReflectionResponse* response) { +void ProtoServerReflection::FillFileDescriptorResponse( + const FileDescriptor* file_desc, ServerReflectionResponse* response, + std::unordered_set* seen_files) { + if (seen_files->find(file_desc->name()) != seen_files->end()) { + return; + } + seen_files->insert(file_desc->name()); + FileDescriptorProto file_desc_proto; grpc::string data; file_desc->CopyTo(&file_desc_proto); file_desc_proto.SerializeToString(&data); response->mutable_file_descriptor_response()->add_file_descriptor_proto(data); + + for (int i = 0; i < file_desc->dependency_count(); ++i) { + FillFileDescriptorResponse(file_desc->dependency(i), response, seen_files); + } } } // namespace grpc diff --git a/extensions/reflection/proto_server_reflection.h b/extensions/reflection/proto_server_reflection.h index 53deef906cf..d288b73d928 100644 --- a/extensions/reflection/proto_server_reflection.h +++ b/extensions/reflection/proto_server_reflection.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -81,9 +82,10 @@ class ProtoServerReflection GRPC_FINAL ServerContext* context, const grpc::string& type, reflection::v1alpha::ExtensionNumberResponse* response); - void FillFileDescriptorProtoResponse( + void FillFileDescriptorResponse( const google::protobuf::FileDescriptor* file_desc, - reflection::v1alpha::ServerReflectionResponse* response); + reflection::v1alpha::ServerReflectionResponse* response, + std::unordered_set* seen_files); void FillErrorResponse(const Status& status, reflection::v1alpha::ErrorResponse* error_response); From 933fbaf5acbd292887c584e997811326247a65ea Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 24 May 2016 11:45:42 -0700 Subject: [PATCH 060/175] Add distrib test support for c++. --- test/distrib/cpp/run_distrib_test.sh | 46 ++++++++++++++++ .../distribtest/cpp_jessie_x64/Dockerfile | 53 +++++++++++++++++++ tools/run_tests/distribtest_targets.py | 30 ++++++++++- 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 test/distrib/cpp/run_distrib_test.sh create mode 100644 tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile diff --git a/test/distrib/cpp/run_distrib_test.sh b/test/distrib/cpp/run_distrib_test.sh new file mode 100644 index 00000000000..7b6418db5fd --- /dev/null +++ b/test/distrib/cpp/run_distrib_test.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +cd $EXTERNAL_GIT_ROOT + +cd examples/cpp/helloworld + +make + +make clean + +cd ../../../examples/cpp/route_guide + +make + +make clean + diff --git a/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile b/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile new file mode 100644 index 00000000000..4bbbddd3b5c --- /dev/null +++ b/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile @@ -0,0 +1,53 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +FROM debian:jessie + +# Install packages for gRPC and protobuf +RUN apt-get update && apt-get install -y \ + autoconf \ + automake \ + build-essential \ + curl \ + git \ + g++ \ + libtool \ + make \ + pkg-config \ + unzip && apt-get clean + +RUN git clone https://github.com/grpc/grpc.git +RUN cd grpc && git submodule update --init + +RUN cd grpc/third_party/protobuf && ./autogen.sh && \ + ./configure && make -j12 && make check && make install && ldconfig + +RUN cd grpc && make -j12 && make install + +CMD ["bash"] diff --git a/tools/run_tests/distribtest_targets.py b/tools/run_tests/distribtest_targets.py index ae918be21d2..1a7aa0bfc80 100644 --- a/tools/run_tests/distribtest_targets.py +++ b/tools/run_tests/distribtest_targets.py @@ -238,9 +238,37 @@ class PHPDistribTest(object): return self.name +class CppDistribTest(object): + """Tests Cpp make intall by building examples.""" + + def __init__(self, platform, arch, docker_suffix=None): + self.name = 'cpp_%s_%s_%s' % (platform, arch, docker_suffix) + self.platform = platform + self.arch = arch + self.docker_suffix = docker_suffix + self.labels = ['distribtest', 'cpp', platform, arch, docker_suffix] + + def pre_build_jobspecs(self): + return [] + + def build_jobspec(self): + if self.platform == 'linux': + return create_docker_jobspec(self.name, + 'tools/dockerfile/distribtest/cpp_%s_%s' % ( + self.docker_suffix, + self.arch), + 'test/distrib/cpp/run_distrib_test.sh') + else: + raise Exception("Not supported yet.") + + def __str__(self): + return self.name + + def targets(): """Gets list of supported targets""" - return [CSharpDistribTest('linux', 'x64', 'wheezy'), + return [CppDistribTest('linux', 'x64', 'jessie'), + CSharpDistribTest('linux', 'x64', 'wheezy'), CSharpDistribTest('linux', 'x64', 'jessie'), CSharpDistribTest('linux', 'x86', 'jessie'), CSharpDistribTest('linux', 'x64', 'centos7'), From c92fe25af5b29f0cb54b06bdcd768a98d749d7b7 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 25 May 2016 07:18:57 -0700 Subject: [PATCH 061/175] Add mutex for stream in ProtoReflectionDescriptorDatabase, fix headers check --- build.yaml | 2 ++ .../proto_reflection_descriptor_database.cc | 32 +++++++------------ .../proto_reflection_descriptor_database.h | 2 ++ .../sanity/check_sources_and_headers.py | 3 ++ tools/run_tests/sources_and_headers.json | 4 ++- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/build.yaml b/build.yaml index 5465c3b8820..420a64bcf7f 100644 --- a/build.yaml +++ b/build.yaml @@ -914,6 +914,8 @@ libs: - extensions/reflection/proto_server_reflection_plugin.cc - extensions/reflection/reflection.grpc.pb.cc - extensions/reflection/reflection.pb.cc + uses: + - grpc++_base - name: grpc++_test_config build: private language: c++ diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc index 3963b0c0938..6513a149928 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -31,7 +31,7 @@ * */ -#include "proto_reflection_descriptor_database.h" +#include "test/cpp/util/proto_reflection_descriptor_database.h" #include @@ -69,16 +69,14 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName( request.set_file_by_filename(filename); ServerReflectionResponse response; + stream_mutex_.lock(); GetStream()->Write(request); GetStream()->Read(&response); + stream_mutex_.unlock(); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { AddFileFromResponse(response.file_descriptor_response()); - // const google::protobuf::FileDescriptorProto file_proto = - // ParseFileDescriptorProtoResponse(response.file_descriptor_response()); - // known_files_.insert(file_proto.name()); - // cached_db_.Add(file_proto); } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); @@ -119,19 +117,14 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( request.set_file_containing_symbol(symbol_name); ServerReflectionResponse response; + stream_mutex_.lock(); GetStream()->Write(request); GetStream()->Read(&response); + stream_mutex_.unlock(); - // Status status = stub_->GetFileContainingSymbol(&ctx, request, &response); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { AddFileFromResponse(response.file_descriptor_response()); - // const google::protobuf::FileDescriptorProto file_proto = - // ParseFileDescriptorProtoResponse(response.file_descriptor_response()); - // if (known_files_.find(file_proto.name()) == known_files_.end()) { - // known_files_.insert(file_proto.name()); - // cached_db_.Add(file_proto); - // } } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); @@ -181,20 +174,14 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( field_number); ServerReflectionResponse response; + stream_mutex_.lock(); GetStream()->Write(request); GetStream()->Read(&response); + stream_mutex_.unlock(); - // Status status = stub_->GetFileContainingExtension(&ctx, request, - // &response); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { AddFileFromResponse(response.file_descriptor_response()); - // const google::protobuf::FileDescriptorProto file_proto = - // ParseFileDescriptorProtoResponse(response.file_descriptor_response()); - // if (known_files_.find(file_proto.name()) == known_files_.end()) { - // known_files_.insert(file_proto.name()); - // cached_db_.Add(file_proto); - // } } else if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kErrorResponse) { const ErrorResponse error = response.error_response(); @@ -240,8 +227,10 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( request.set_all_extension_numbers_of_type(extendee_type); ServerReflectionResponse response; + stream_mutex_.lock(); GetStream()->Write(request); GetStream()->Read(&response); + stream_mutex_.unlock(); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase:: @@ -272,8 +261,11 @@ bool ProtoReflectionDescriptorDatabase::GetServices( ServerReflectionRequest request; request.set_list_services(""); ServerReflectionResponse response; + + stream_mutex_.lock(); GetStream()->Write(request); GetStream()->Read(&response); + stream_mutex_.unlock(); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kListServicesResponse) { diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index 4bb9c21a927..bc25fb0f5c7 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -32,6 +32,7 @@ */ #include +#include #include #include #include @@ -98,6 +99,7 @@ class ProtoReflectionDescriptorDatabase std::unordered_set missing_symbols_; std::unordered_map> missing_extensions_; std::unordered_map> cached_extension_numbers_; + std::mutex stream_mutex_; google::protobuf::SimpleDescriptorDatabase cached_db_; }; diff --git a/tools/run_tests/sanity/check_sources_and_headers.py b/tools/run_tests/sanity/check_sources_and_headers.py index c028499ca63..0eb804eb5b0 100755 --- a/tools/run_tests/sanity/check_sources_and_headers.py +++ b/tools/run_tests/sanity/check_sources_and_headers.py @@ -57,6 +57,9 @@ def target_has_header(target, name): return True if name == 'src/core/lib/profiling/stap_probes.h': return True + if not name.startswith('extensions') \ + and target_has_header(target, 'extensions/' + name): + return True return False def produces_object(name): diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index f1d344b613b..7ad61845d5c 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -4371,7 +4371,9 @@ "type": "lib" }, { - "deps": [], + "deps": [ + "grpc++_base" + ], "headers": [ "extensions/include/grpc++/impl/proto_server_reflection_plugin.h", "extensions/include/grpc++/impl/reflection.grpc.pb.h", From 420999857523b88e00652c143a03c82b26b32c57 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 25 May 2016 10:10:58 -0700 Subject: [PATCH 062/175] make script executable --- test/distrib/cpp/run_distrib_test.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/distrib/cpp/run_distrib_test.sh diff --git a/test/distrib/cpp/run_distrib_test.sh b/test/distrib/cpp/run_distrib_test.sh old mode 100644 new mode 100755 From e3975e72d2e58cbcfcd4cd76db9066fce381593a Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 30 May 2016 12:53:56 -0700 Subject: [PATCH 063/175] Move grpc installation from docker file to script. --- test/distrib/cpp/run_distrib_test.sh | 8 +++++++- tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile | 8 -------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/test/distrib/cpp/run_distrib_test.sh b/test/distrib/cpp/run_distrib_test.sh index 7b6418db5fd..5c21a1e19ec 100755 --- a/test/distrib/cpp/run_distrib_test.sh +++ b/test/distrib/cpp/run_distrib_test.sh @@ -30,7 +30,13 @@ set -ex -cd $EXTERNAL_GIT_ROOT +git clone https://github.com/grpc/grpc.git +cd grpc && git submodule update --init + +cd third_party/protobuf && ./autogen.sh && \ +./configure && make -j12 && make check && make install && ldconfig + +cd ../.. && make -j12 && make install cd examples/cpp/helloworld diff --git a/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile b/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile index 4bbbddd3b5c..b02208faed1 100644 --- a/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile +++ b/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile @@ -42,12 +42,4 @@ RUN apt-get update && apt-get install -y \ pkg-config \ unzip && apt-get clean -RUN git clone https://github.com/grpc/grpc.git -RUN cd grpc && git submodule update --init - -RUN cd grpc/third_party/protobuf && ./autogen.sh && \ - ./configure && make -j12 && make check && make install && ldconfig - -RUN cd grpc && make -j12 && make install - CMD ["bash"] From ea09adc84b89b7c7bf22f46c87c311a515f3144f Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 31 May 2016 10:50:24 -0700 Subject: [PATCH 064/175] Add a sanity test: check if the generated pb files are up-to-date --- .../include/grpc++/impl/reflection.pb.h | 17 ++++ extensions/reflection/reflection.pb.cc | 99 +++++++++++++++++-- .../extensions/gen_reflection_proto.sh | 2 +- tools/distrib/check_generated_pb_files.sh | 40 ++++++++ .../grpc_check_generated_pb_files/Dockerfile | 78 +++++++++++++++ .../check_pb_files.sh | 49 +++++++++ tools/run_tests/sanity/sanity_tests.yaml | 1 + 7 files changed, 277 insertions(+), 9 deletions(-) create mode 100755 tools/distrib/check_generated_pb_files.sh create mode 100644 tools/dockerfile/grpc_check_generated_pb_files/Dockerfile create mode 100755 tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh diff --git a/extensions/include/grpc++/impl/reflection.pb.h b/extensions/include/grpc++/impl/reflection.pb.h index 2a807c1335a..00d07735ee8 100644 --- a/extensions/include/grpc++/impl/reflection.pb.h +++ b/extensions/include/grpc++/impl/reflection.pb.h @@ -983,6 +983,7 @@ inline ::std::string* ServerReflectionRequest::mutable_host() { return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ServerReflectionRequest::release_host() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1056,6 +1057,7 @@ inline ::std::string* ServerReflectionRequest::mutable_file_by_filename() { return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ServerReflectionRequest::release_file_by_filename() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (has_file_by_filename()) { clear_has_message_request(); return message_request_.file_by_filename_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1136,6 +1138,7 @@ inline ::std::string* ServerReflectionRequest::mutable_file_containing_symbol() return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ServerReflectionRequest::release_file_containing_symbol() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (has_file_containing_symbol()) { clear_has_message_request(); return message_request_.file_containing_symbol_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1185,6 +1188,7 @@ inline ::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::m return message_request_.file_containing_extension_; } inline ::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::release_file_containing_extension() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) if (has_file_containing_extension()) { clear_has_message_request(); ::grpc::reflection::v1alpha::ExtensionRequest* temp = message_request_.file_containing_extension_; @@ -1263,6 +1267,7 @@ inline ::std::string* ServerReflectionRequest::mutable_all_extension_numbers_of_ return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ServerReflectionRequest::release_all_extension_numbers_of_type() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (has_all_extension_numbers_of_type()) { clear_has_message_request(); return message_request_.all_extension_numbers_of_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1343,6 +1348,7 @@ inline ::std::string* ServerReflectionRequest::mutable_list_services() { return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ServerReflectionRequest::release_list_services() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (has_list_services()) { clear_has_message_request(); return message_request_.list_services_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1406,6 +1412,7 @@ inline ::std::string* ExtensionRequest::mutable_containing_type() { return containing_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ExtensionRequest::release_containing_type() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionRequest.containing_type) return containing_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1467,6 +1474,7 @@ inline ::std::string* ServerReflectionResponse::mutable_valid_host() { return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ServerReflectionResponse::release_valid_host() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1501,6 +1509,7 @@ inline ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionRes return original_request_; } inline ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::release_original_request() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) ::grpc::reflection::v1alpha::ServerReflectionRequest* temp = original_request_; original_request_ = NULL; @@ -1546,6 +1555,7 @@ inline ::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResp return message_response_.file_descriptor_response_; } inline ::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::release_file_descriptor_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) if (has_file_descriptor_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::FileDescriptorResponse* temp = message_response_.file_descriptor_response_; @@ -1593,6 +1603,7 @@ inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionRes return message_response_.all_extension_numbers_response_; } inline ::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::release_all_extension_numbers_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) if (has_all_extension_numbers_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ExtensionNumberResponse* temp = message_response_.all_extension_numbers_response_; @@ -1640,6 +1651,7 @@ inline ::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionRespons return message_response_.list_services_response_; } inline ::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::release_list_services_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) if (has_list_services_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ListServiceResponse* temp = message_response_.list_services_response_; @@ -1687,6 +1699,7 @@ inline ::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::mut return message_response_.error_response_; } inline ::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::release_error_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) if (has_error_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ErrorResponse* temp = message_response_.error_response_; @@ -1747,6 +1760,7 @@ inline void FileDescriptorResponse::set_file_descriptor_proto(int index, const v // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) } inline ::std::string* FileDescriptorResponse::add_file_descriptor_proto() { + // @@protoc_insertion_point(field_add_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) return file_descriptor_proto_.Add(); } inline void FileDescriptorResponse::add_file_descriptor_proto(const ::std::string& value) { @@ -1806,6 +1820,7 @@ inline ::std::string* ExtensionNumberResponse::mutable_base_type_name() { return base_type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ExtensionNumberResponse::release_base_type_name() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) return base_type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1917,6 +1932,7 @@ inline ::std::string* ServiceResponse::mutable_name() { return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ServiceResponse::release_name() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServiceResponse.name) return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1978,6 +1994,7 @@ inline ::std::string* ErrorResponse::mutable_error_message() { return error_message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } inline ::std::string* ErrorResponse::release_error_message() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ErrorResponse.error_message) return error_message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } diff --git a/extensions/reflection/reflection.pb.cc b/extensions/reflection/reflection.pb.cc index 946709f20ff..a6184f048ff 100644 --- a/extensions/reflection/reflection.pb.cc +++ b/extensions/reflection/reflection.pb.cc @@ -458,6 +458,7 @@ ServerReflectionRequest* ServerReflectionRequest::New(::google::protobuf::Arena* } void ServerReflectionRequest::clear_message_request() { +// @@protoc_insertion_point(one_of_clear_start:grpc.reflection.v1alpha.ServerReflectionRequest) switch(message_request_case()) { case kFileByFilename: { message_request_.file_by_filename_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -488,13 +489,14 @@ void ServerReflectionRequest::clear_message_request() { void ServerReflectionRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.ServerReflectionRequest) host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); clear_message_request(); } bool ServerReflectionRequest::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ServerReflectionRequest) for (;;) { @@ -752,6 +754,7 @@ void ServerReflectionRequest::SerializeWithCachedSizes( } int ServerReflectionRequest::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ServerReflectionRequest) int total_size = 0; // optional string host = 1; @@ -808,18 +811,22 @@ int ServerReflectionRequest::ByteSize() const { } void ServerReflectionRequest::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ServerReflectionRequest) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const ServerReflectionRequest* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.ServerReflectionRequest) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ServerReflectionRequest) MergeFrom(*source); } } void ServerReflectionRequest::MergeFrom(const ServerReflectionRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ServerReflectionRequest) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); switch (from.message_request_case()) { case kFileByFilename: { @@ -853,12 +860,14 @@ void ServerReflectionRequest::MergeFrom(const ServerReflectionRequest& from) { } void ServerReflectionRequest::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.ServerReflectionRequest) if (&from == this) return; Clear(); MergeFrom(from); } void ServerReflectionRequest::CopyFrom(const ServerReflectionRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ServerReflectionRequest) if (&from == this) return; Clear(); MergeFrom(from); @@ -922,6 +931,7 @@ void ServerReflectionRequest::clear_host() { return host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ServerReflectionRequest::release_host() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.host) return host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -995,6 +1005,7 @@ void ServerReflectionRequest::clear_file_by_filename() { return message_request_.file_by_filename_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ServerReflectionRequest::release_file_by_filename() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_by_filename) if (has_file_by_filename()) { clear_has_message_request(); return message_request_.file_by_filename_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1075,6 +1086,7 @@ void ServerReflectionRequest::clear_file_containing_symbol() { return message_request_.file_containing_symbol_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ServerReflectionRequest::release_file_containing_symbol() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_symbol) if (has_file_containing_symbol()) { clear_has_message_request(); return message_request_.file_containing_symbol_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1124,6 +1136,7 @@ void ServerReflectionRequest::clear_file_containing_extension() { return message_request_.file_containing_extension_; } ::grpc::reflection::v1alpha::ExtensionRequest* ServerReflectionRequest::release_file_containing_extension() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension) if (has_file_containing_extension()) { clear_has_message_request(); ::grpc::reflection::v1alpha::ExtensionRequest* temp = message_request_.file_containing_extension_; @@ -1202,6 +1215,7 @@ void ServerReflectionRequest::clear_all_extension_numbers_of_type() { return message_request_.all_extension_numbers_of_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ServerReflectionRequest::release_all_extension_numbers_of_type() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.all_extension_numbers_of_type) if (has_all_extension_numbers_of_type()) { clear_has_message_request(); return message_request_.all_extension_numbers_of_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1282,6 +1296,7 @@ void ServerReflectionRequest::clear_list_services() { return message_request_.list_services_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ServerReflectionRequest::release_list_services() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionRequest.list_services) if (has_list_services()) { clear_has_message_request(); return message_request_.list_services_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); @@ -1383,13 +1398,14 @@ ExtensionRequest* ExtensionRequest::New(::google::protobuf::Arena* arena) const } void ExtensionRequest::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.ExtensionRequest) containing_type_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); extension_number_ = 0; } bool ExtensionRequest::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ExtensionRequest) for (;;) { @@ -1494,6 +1510,7 @@ void ExtensionRequest::SerializeWithCachedSizes( } int ExtensionRequest::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ExtensionRequest) int total_size = 0; // optional string containing_type = 1; @@ -1517,18 +1534,22 @@ int ExtensionRequest::ByteSize() const { } void ExtensionRequest::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ExtensionRequest) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const ExtensionRequest* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.ExtensionRequest) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ExtensionRequest) MergeFrom(*source); } } void ExtensionRequest::MergeFrom(const ExtensionRequest& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ExtensionRequest) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); if (from.containing_type().size() > 0) { @@ -1540,12 +1561,14 @@ void ExtensionRequest::MergeFrom(const ExtensionRequest& from) { } void ExtensionRequest::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.ExtensionRequest) if (&from == this) return; Clear(); MergeFrom(from); } void ExtensionRequest::CopyFrom(const ExtensionRequest& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ExtensionRequest) if (&from == this) return; Clear(); MergeFrom(from); @@ -1608,6 +1631,7 @@ void ExtensionRequest::clear_containing_type() { return containing_type_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ExtensionRequest::release_containing_type() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionRequest.containing_type) return containing_type_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -1721,6 +1745,7 @@ ServerReflectionResponse* ServerReflectionResponse::New(::google::protobuf::Aren } void ServerReflectionResponse::clear_message_response() { +// @@protoc_insertion_point(one_of_clear_start:grpc.reflection.v1alpha.ServerReflectionResponse) switch(message_response_case()) { case kFileDescriptorResponse: { delete message_response_.file_descriptor_response_; @@ -1747,6 +1772,7 @@ void ServerReflectionResponse::clear_message_response() { void ServerReflectionResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.ServerReflectionResponse) valid_host_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (GetArenaNoVirtual() == NULL && original_request_ != NULL) delete original_request_; original_request_ = NULL; @@ -1755,7 +1781,7 @@ void ServerReflectionResponse::Clear() { bool ServerReflectionResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ServerReflectionResponse) for (;;) { @@ -1965,6 +1991,7 @@ void ServerReflectionResponse::SerializeWithCachedSizes( } int ServerReflectionResponse::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ServerReflectionResponse) int total_size = 0; // optional string valid_host = 1; @@ -2021,18 +2048,22 @@ int ServerReflectionResponse::ByteSize() const { } void ServerReflectionResponse::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ServerReflectionResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const ServerReflectionResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.ServerReflectionResponse) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ServerReflectionResponse) MergeFrom(*source); } } void ServerReflectionResponse::MergeFrom(const ServerReflectionResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ServerReflectionResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); switch (from.message_response_case()) { case kFileDescriptorResponse: { @@ -2065,12 +2096,14 @@ void ServerReflectionResponse::MergeFrom(const ServerReflectionResponse& from) { } void ServerReflectionResponse::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.ServerReflectionResponse) if (&from == this) return; Clear(); MergeFrom(from); } void ServerReflectionResponse::CopyFrom(const ServerReflectionResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ServerReflectionResponse) if (&from == this) return; Clear(); MergeFrom(from); @@ -2135,6 +2168,7 @@ void ServerReflectionResponse::clear_valid_host() { return valid_host_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ServerReflectionResponse::release_valid_host() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.valid_host) return valid_host_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -2169,6 +2203,7 @@ const ::grpc::reflection::v1alpha::ServerReflectionRequest& ServerReflectionResp return original_request_; } ::grpc::reflection::v1alpha::ServerReflectionRequest* ServerReflectionResponse::release_original_request() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.original_request) ::grpc::reflection::v1alpha::ServerReflectionRequest* temp = original_request_; original_request_ = NULL; @@ -2214,6 +2249,7 @@ void ServerReflectionResponse::clear_file_descriptor_response() { return message_response_.file_descriptor_response_; } ::grpc::reflection::v1alpha::FileDescriptorResponse* ServerReflectionResponse::release_file_descriptor_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response) if (has_file_descriptor_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::FileDescriptorResponse* temp = message_response_.file_descriptor_response_; @@ -2261,6 +2297,7 @@ void ServerReflectionResponse::clear_all_extension_numbers_response() { return message_response_.all_extension_numbers_response_; } ::grpc::reflection::v1alpha::ExtensionNumberResponse* ServerReflectionResponse::release_all_extension_numbers_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response) if (has_all_extension_numbers_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ExtensionNumberResponse* temp = message_response_.all_extension_numbers_response_; @@ -2308,6 +2345,7 @@ void ServerReflectionResponse::clear_list_services_response() { return message_response_.list_services_response_; } ::grpc::reflection::v1alpha::ListServiceResponse* ServerReflectionResponse::release_list_services_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response) if (has_list_services_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ListServiceResponse* temp = message_response_.list_services_response_; @@ -2355,6 +2393,7 @@ void ServerReflectionResponse::clear_error_response() { return message_response_.error_response_; } ::grpc::reflection::v1alpha::ErrorResponse* ServerReflectionResponse::release_error_response() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServerReflectionResponse.error_response) if (has_error_response()) { clear_has_message_response(); ::grpc::reflection::v1alpha::ErrorResponse* temp = message_response_.error_response_; @@ -2450,12 +2489,13 @@ FileDescriptorResponse* FileDescriptorResponse::New(::google::protobuf::Arena* a } void FileDescriptorResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.FileDescriptorResponse) file_descriptor_proto_.Clear(); } bool FileDescriptorResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.FileDescriptorResponse) for (;;) { @@ -2524,6 +2564,7 @@ void FileDescriptorResponse::SerializeWithCachedSizes( } int FileDescriptorResponse::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.FileDescriptorResponse) int total_size = 0; // repeated bytes file_descriptor_proto = 1; @@ -2540,29 +2581,35 @@ int FileDescriptorResponse::ByteSize() const { } void FileDescriptorResponse::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.FileDescriptorResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const FileDescriptorResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.FileDescriptorResponse) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.FileDescriptorResponse) MergeFrom(*source); } } void FileDescriptorResponse::MergeFrom(const FileDescriptorResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.FileDescriptorResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); file_descriptor_proto_.MergeFrom(from.file_descriptor_proto_); } void FileDescriptorResponse::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.FileDescriptorResponse) if (&from == this) return; Clear(); MergeFrom(from); } void FileDescriptorResponse::CopyFrom(const FileDescriptorResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.FileDescriptorResponse) if (&from == this) return; Clear(); MergeFrom(from); @@ -2623,6 +2670,7 @@ void FileDescriptorResponse::clear_file_descriptor_proto() { // @@protoc_insertion_point(field_set_pointer:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) } ::std::string* FileDescriptorResponse::add_file_descriptor_proto() { + // @@protoc_insertion_point(field_add_mutable:grpc.reflection.v1alpha.FileDescriptorResponse.file_descriptor_proto) return file_descriptor_proto_.Add(); } void FileDescriptorResponse::add_file_descriptor_proto(const ::std::string& value) { @@ -2719,13 +2767,14 @@ ExtensionNumberResponse* ExtensionNumberResponse::New(::google::protobuf::Arena* } void ExtensionNumberResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.ExtensionNumberResponse) base_type_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); extension_number_.Clear(); } bool ExtensionNumberResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ExtensionNumberResponse) for (;;) { @@ -2847,6 +2896,7 @@ void ExtensionNumberResponse::SerializeWithCachedSizes( } int ExtensionNumberResponse::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ExtensionNumberResponse) int total_size = 0; // optional string base_type_name = 1; @@ -2880,18 +2930,22 @@ int ExtensionNumberResponse::ByteSize() const { } void ExtensionNumberResponse::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ExtensionNumberResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const ExtensionNumberResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.ExtensionNumberResponse) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ExtensionNumberResponse) MergeFrom(*source); } } void ExtensionNumberResponse::MergeFrom(const ExtensionNumberResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ExtensionNumberResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); extension_number_.MergeFrom(from.extension_number_); if (from.base_type_name().size() > 0) { @@ -2901,12 +2955,14 @@ void ExtensionNumberResponse::MergeFrom(const ExtensionNumberResponse& from) { } void ExtensionNumberResponse::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.ExtensionNumberResponse) if (&from == this) return; Clear(); MergeFrom(from); } void ExtensionNumberResponse::CopyFrom(const ExtensionNumberResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ExtensionNumberResponse) if (&from == this) return; Clear(); MergeFrom(from); @@ -2969,6 +3025,7 @@ void ExtensionNumberResponse::clear_base_type_name() { return base_type_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ExtensionNumberResponse::release_base_type_name() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ExtensionNumberResponse.base_type_name) return base_type_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -3079,12 +3136,13 @@ ListServiceResponse* ListServiceResponse::New(::google::protobuf::Arena* arena) } void ListServiceResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.ListServiceResponse) service_.Clear(); } bool ListServiceResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ListServiceResponse) for (;;) { @@ -3156,6 +3214,7 @@ void ListServiceResponse::SerializeWithCachedSizes( } int ListServiceResponse::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ListServiceResponse) int total_size = 0; // repeated .grpc.reflection.v1alpha.ServiceResponse service = 1; @@ -3173,29 +3232,35 @@ int ListServiceResponse::ByteSize() const { } void ListServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ListServiceResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const ListServiceResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.ListServiceResponse) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ListServiceResponse) MergeFrom(*source); } } void ListServiceResponse::MergeFrom(const ListServiceResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ListServiceResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); service_.MergeFrom(from.service_); } void ListServiceResponse::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.ListServiceResponse) if (&from == this) return; Clear(); MergeFrom(from); } void ListServiceResponse::CopyFrom(const ListServiceResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ListServiceResponse) if (&from == this) return; Clear(); MergeFrom(from); @@ -3327,12 +3392,13 @@ ServiceResponse* ServiceResponse::New(::google::protobuf::Arena* arena) const { } void ServiceResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.ServiceResponse) name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } bool ServiceResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ServiceResponse) for (;;) { @@ -3412,6 +3478,7 @@ void ServiceResponse::SerializeWithCachedSizes( } int ServiceResponse::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ServiceResponse) int total_size = 0; // optional string name = 1; @@ -3428,18 +3495,22 @@ int ServiceResponse::ByteSize() const { } void ServiceResponse::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ServiceResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const ServiceResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.ServiceResponse) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ServiceResponse) MergeFrom(*source); } } void ServiceResponse::MergeFrom(const ServiceResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ServiceResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); if (from.name().size() > 0) { @@ -3448,12 +3519,14 @@ void ServiceResponse::MergeFrom(const ServiceResponse& from) { } void ServiceResponse::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.ServiceResponse) if (&from == this) return; Clear(); MergeFrom(from); } void ServiceResponse::CopyFrom(const ServiceResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ServiceResponse) if (&from == this) return; Clear(); MergeFrom(from); @@ -3515,6 +3588,7 @@ void ServiceResponse::clear_name() { return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ServiceResponse::release_name() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ServiceResponse.name) return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } @@ -3600,13 +3674,14 @@ ErrorResponse* ErrorResponse::New(::google::protobuf::Arena* arena) const { } void ErrorResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:grpc.reflection.v1alpha.ErrorResponse) error_code_ = 0; error_message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } bool ErrorResponse::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:grpc.reflection.v1alpha.ErrorResponse) for (;;) { @@ -3711,6 +3786,7 @@ void ErrorResponse::SerializeWithCachedSizes( } int ErrorResponse::ByteSize() const { +// @@protoc_insertion_point(message_byte_size_start:grpc.reflection.v1alpha.ErrorResponse) int total_size = 0; // optional int32 error_code = 1; @@ -3734,18 +3810,22 @@ int ErrorResponse::ByteSize() const { } void ErrorResponse::MergeFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:grpc.reflection.v1alpha.ErrorResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); const ErrorResponse* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:grpc.reflection.v1alpha.ErrorResponse) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:grpc.reflection.v1alpha.ErrorResponse) MergeFrom(*source); } } void ErrorResponse::MergeFrom(const ErrorResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:grpc.reflection.v1alpha.ErrorResponse) if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); if (from.error_code() != 0) { set_error_code(from.error_code()); @@ -3757,12 +3837,14 @@ void ErrorResponse::MergeFrom(const ErrorResponse& from) { } void ErrorResponse::CopyFrom(const ::google::protobuf::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:grpc.reflection.v1alpha.ErrorResponse) if (&from == this) return; Clear(); MergeFrom(from); } void ErrorResponse::CopyFrom(const ErrorResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:grpc.reflection.v1alpha.ErrorResponse) if (&from == this) return; Clear(); MergeFrom(from); @@ -3839,6 +3921,7 @@ void ErrorResponse::clear_error_message() { return error_message_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } ::std::string* ErrorResponse::release_error_message() { + // @@protoc_insertion_point(field_release:grpc.reflection.v1alpha.ErrorResponse.error_message) return error_message_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } diff --git a/tools/codegen/extensions/gen_reflection_proto.sh b/tools/codegen/extensions/gen_reflection_proto.sh index 26f9e4711ae..de970b9f7fe 100755 --- a/tools/codegen/extensions/gen_reflection_proto.sh +++ b/tools/codegen/extensions/gen_reflection_proto.sh @@ -36,7 +36,7 @@ SRC_DIR="extensions/reflection" INCLUDE_DIR="grpc++/impl" TMP_DIR="tmp" GRPC_PLUGIN="bins/opt/grpc_cpp_plugin" -PROTOC=protoc +PROTOC=third_party/protobuf/src/protoc set -e diff --git a/tools/distrib/check_generated_pb_files.sh b/tools/distrib/check_generated_pb_files.sh new file mode 100755 index 00000000000..557067883c5 --- /dev/null +++ b/tools/distrib/check_generated_pb_files.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +# change to root directory +cd $(dirname $0)/../.. + +# build grpc_check_generated_pb_files docker image +docker build -t grpc_check_generated_pb_files tools/dockerfile/grpc_check_generated_pb_files + +# run check_pb_files against the checked out codebase +docker run -e TEST=$TEST --rm=true -v ${HOST_GIT_ROOT:-`pwd`}:/var/local/jenkins/grpc -t grpc_check_generated_pb_files /var/local/jenkins/grpc/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh diff --git a/tools/dockerfile/grpc_check_generated_pb_files/Dockerfile b/tools/dockerfile/grpc_check_generated_pb_files/Dockerfile new file mode 100644 index 00000000000..7658991462d --- /dev/null +++ b/tools/dockerfile/grpc_check_generated_pb_files/Dockerfile @@ -0,0 +1,78 @@ +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +FROM debian:jessie + +# Install Git and basic packages. +RUN apt-get update && apt-get install -y \ + autoconf \ + autotools-dev \ + build-essential \ + bzip2 \ + ccache \ + curl \ + gcc \ + gcc-multilib \ + git \ + golang \ + gyp \ + lcov \ + libc6 \ + libc6-dbg \ + libc6-dev \ + libgtest-dev \ + libtool \ + make \ + perl \ + strace \ + python-dev \ + python-setuptools \ + python-yaml \ + telnet \ + unzip \ + wget \ + zip && apt-get clean + +#================ +# Build profiling +RUN apt-get update && apt-get install -y time && apt-get clean + +#================= +# C++ dependencies +RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean + +#====================== +# Zookeeper dependencies +# TODO(jtattermusch): is zookeeper still needed? +RUN apt-get install -y libzookeeper-mt-dev + +RUN mkdir /var/local/jenkins + +# Define the default command. +CMD ["bash"] diff --git a/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh b/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh new file mode 100755 index 00000000000..b1af579a74b --- /dev/null +++ b/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -e + +mkdir -p /var/local/git +git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc + +# copy service account keys if available +cp -r /var/local/jenkins/service_account $HOME || true + +cd /var/local/git/grpc + +# build grpc cpp plugin for generating grpc pb files +make grpc_cpp_plugin + +# generate pb files +tools/codegen/extensions/gen_reflection_proto.sh + +# check if the pb files in the checked out codebase are identical with the newly +# generated ones +git diff --exit-code diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index c5945c602f4..e699c5194df 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -11,3 +11,4 @@ - script: tools/distrib/check_nanopb_output.sh - script: tools/distrib/check_include_guards.py - script: tools/distrib/python/check_grpcio_tools.py +- script: tools/distrib/check_generated_pb_files.sh From 77faeaa188a04f218d6fb3d35234f5051eb343b1 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 31 May 2016 19:30:56 -0700 Subject: [PATCH 065/175] Fix macro args in bin_decoder.c --- src/core/ext/transport/chttp2/transport/bin_decoder.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c index ec252e29b18..b44560b2ebc 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.c +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -81,13 +81,12 @@ static __inline bool input_is_valid(uint8_t *input_ptr, size_t length) { (uint8_t)((decode_table[input_ptr[0]] << 2) | \ (decode_table[input_ptr[1]] >> 4)) -#define COMPOSE_OUTPUT_BYTE_1(input_ptr) \ - (uint8_t)((decode_table[ctx->input_cur[1]] << 4) | \ - (decode_table[ctx->input_cur[2]] >> 2)) +#define COMPOSE_OUTPUT_BYTE_1(input_ptr) \ + (uint8_t)((decode_table[input_ptr[1]] << 4) | \ + (decode_table[input_ptr[2]] >> 2)) -#define COMPOSE_OUTPUT_BYTE_2(input_ptr) \ - (uint8_t)((decode_table[ctx->input_cur[2]] << 6) | \ - decode_table[ctx->input_cur[3]]) +#define COMPOSE_OUTPUT_BYTE_2(input_ptr) \ + (uint8_t)((decode_table[input_ptr[2]] << 6) | decode_table[input_ptr[3]]) bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx) { size_t input_tail; From c045fd964559eed01e27f8f012cd74776b09ddf3 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Mon, 23 May 2016 12:05:54 -0700 Subject: [PATCH 066/175] Add a test for grpc/grpc#6522 --- .../grpcio/tests/unit/_cython/cygrpc_test.py | 284 ++++++++---------- .../tests/unit/_cython/test_utilities.py | 34 ++- 2 files changed, 153 insertions(+), 165 deletions(-) diff --git a/src/python/grpcio/tests/unit/_cython/cygrpc_test.py b/src/python/grpcio/tests/unit/_cython/cygrpc_test.py index 0a511101f0d..4039c1b99bd 100644 --- a/src/python/grpcio/tests/unit/_cython/cygrpc_test.py +++ b/src/python/grpcio/tests/unit/_cython/cygrpc_test.py @@ -143,22 +143,60 @@ class TypeSmokeTest(unittest.TestCase): del completion_queue -class InsecureServerInsecureClient(unittest.TestCase): +class ServerClientMixin(object): - def setUp(self): + def setUpMixin(self, server_credentials, client_credentials, host_override): self.server_completion_queue = cygrpc.CompletionQueue() self.server = cygrpc.Server() self.server.register_completion_queue(self.server_completion_queue) - self.port = self.server.add_http2_port('[::]:0') + if server_credentials: + self.port = self.server.add_http2_port('[::]:0', server_credentials) + else: + self.port = self.server.add_http2_port('[::]:0') self.server.start() self.client_completion_queue = cygrpc.CompletionQueue() - self.client_channel = cygrpc.Channel('localhost:{}'.format(self.port)) - - def tearDown(self): + if client_credentials: + client_channel_arguments = cygrpc.ChannelArgs([ + cygrpc.ChannelArg(cygrpc.ChannelArgKey.ssl_target_name_override, + host_override)]) + self.client_channel = cygrpc.Channel( + 'localhost:{}'.format(self.port), client_channel_arguments, + client_credentials) + else: + self.client_channel = cygrpc.Channel('localhost:{}'.format(self.port)) + if host_override: + self.host_argument = None # default host + self.expected_host = host_override + else: + # arbitrary host name necessitating no further identification + self.host_argument = b'hostess' + self.expected_host = self.host_argument + + def tearDownMixin(self): del self.server del self.client_completion_queue del self.server_completion_queue + def _perform_operations(self, operations, call, queue, deadline, description): + """Perform the list of operations with given call, queue, and deadline. + + Invocation errors are reported with as an exception with `description` in + the message. Performs the operations asynchronously, returning a future. + """ + def performer(): + tag = object() + try: + call_result = call.start_batch(cygrpc.Operations(operations), tag) + self.assertEqual(cygrpc.CallError.ok, call_result) + event = queue.poll(deadline) + self.assertEqual(cygrpc.CompletionType.operation_complete, event.type) + self.assertTrue(event.success) + self.assertIs(tag, event.tag) + except Exception as error: + raise Exception("Error in '{}': {}".format(description, error.message)) + return event + return test_utilities.SimpleFuture(performer) + def testEcho(self): DEADLINE = time.time()+5 DEADLINE_TOLERANCE = 0.25 @@ -175,7 +213,6 @@ class InsecureServerInsecureClient(unittest.TestCase): REQUEST = b'in death a member of project mayhem has a name' RESPONSE = b'his name is robert paulson' METHOD = b'twinkies' - HOST = b'hostess' cygrpc_deadline = cygrpc.Timespec(DEADLINE) @@ -188,7 +225,8 @@ class InsecureServerInsecureClient(unittest.TestCase): client_call_tag = object() client_call = self.client_channel.create_call( - None, 0, self.client_completion_queue, METHOD, HOST, cygrpc_deadline) + None, 0, self.client_completion_queue, METHOD, self.host_argument, + cygrpc_deadline) client_initial_metadata = cygrpc.Metadata([ cygrpc.Metadatum(CLIENT_METADATA_ASCII_KEY, CLIENT_METADATA_ASCII_VALUE), @@ -216,7 +254,8 @@ class InsecureServerInsecureClient(unittest.TestCase): test_common.metadata_transmitted(client_initial_metadata, request_event.request_metadata)) self.assertEqual(METHOD, request_event.request_call_details.method) - self.assertEqual(HOST, request_event.request_call_details.host) + self.assertEqual(self.expected_host, + request_event.request_call_details.host) self.assertLess( abs(DEADLINE - float(request_event.request_call_details.deadline)), DEADLINE_TOLERANCE) @@ -292,172 +331,101 @@ class InsecureServerInsecureClient(unittest.TestCase): del client_call del server_call - -class SecureServerSecureClient(unittest.TestCase): - - def setUp(self): - server_credentials = cygrpc.server_credentials_ssl( - None, [cygrpc.SslPemKeyCertPair(resources.private_key(), - resources.certificate_chain())], False) - channel_credentials = cygrpc.channel_credentials_ssl( - resources.test_root_certificates(), None) - self.server_completion_queue = cygrpc.CompletionQueue() - self.server = cygrpc.Server() - self.server.register_completion_queue(self.server_completion_queue) - self.port = self.server.add_http2_port('[::]:0', server_credentials) - self.server.start() - self.client_completion_queue = cygrpc.CompletionQueue() - client_channel_arguments = cygrpc.ChannelArgs([ - cygrpc.ChannelArg(cygrpc.ChannelArgKey.ssl_target_name_override, - _SSL_HOST_OVERRIDE)]) - self.client_channel = cygrpc.Channel( - 'localhost:{}'.format(self.port), client_channel_arguments, - channel_credentials) - - def tearDown(self): - del self.server - del self.client_completion_queue - del self.server_completion_queue - - def testEcho(self): + def test6522(self): DEADLINE = time.time()+5 DEADLINE_TOLERANCE = 0.25 - CLIENT_METADATA_ASCII_KEY = b'key' - CLIENT_METADATA_ASCII_VALUE = b'val' - CLIENT_METADATA_BIN_KEY = b'key-bin' - CLIENT_METADATA_BIN_VALUE = b'\0'*1000 - SERVER_INITIAL_METADATA_KEY = b'init_me_me_me' - SERVER_INITIAL_METADATA_VALUE = b'whodawha?' - SERVER_TRAILING_METADATA_KEY = b'california_is_in_a_drought' - SERVER_TRAILING_METADATA_VALUE = b'zomg it is' - SERVER_STATUS_CODE = cygrpc.StatusCode.ok - SERVER_STATUS_DETAILS = b'our work is never over' - REQUEST = b'in death a member of project mayhem has a name' - RESPONSE = b'his name is robert paulson' - METHOD = b'/twinkies' - HOST = None # Default host + METHOD = b'twinkies' cygrpc_deadline = cygrpc.Timespec(DEADLINE) + empty_metadata = cygrpc.Metadata([]) server_request_tag = object() - request_call_result = self.server.request_call( + self.server.request_call( self.server_completion_queue, self.server_completion_queue, server_request_tag) + client_call = self.client_channel.create_call( + None, 0, self.client_completion_queue, METHOD, self.host_argument, + cygrpc_deadline) - self.assertEqual(cygrpc.CallError.ok, request_call_result) - - plugin = cygrpc.CredentialsMetadataPlugin(_metadata_plugin_callback, '') - call_credentials = cygrpc.call_credentials_metadata_plugin(plugin) + # Prologue + def perform_client_operations(operations, description): + return self._perform_operations( + operations, client_call, + self.client_completion_queue, cygrpc_deadline, description) - client_call_tag = object() - client_call = self.client_channel.create_call( - None, 0, self.client_completion_queue, METHOD, HOST, cygrpc_deadline) - client_call.set_credentials(call_credentials) - client_initial_metadata = cygrpc.Metadata([ - cygrpc.Metadatum(CLIENT_METADATA_ASCII_KEY, - CLIENT_METADATA_ASCII_VALUE), - cygrpc.Metadatum(CLIENT_METADATA_BIN_KEY, CLIENT_METADATA_BIN_VALUE)]) - client_start_batch_result = client_call.start_batch(cygrpc.Operations([ - cygrpc.operation_send_initial_metadata(client_initial_metadata, - _EMPTY_FLAGS), - cygrpc.operation_send_message(REQUEST, _EMPTY_FLAGS), - cygrpc.operation_send_close_from_client(_EMPTY_FLAGS), - cygrpc.operation_receive_initial_metadata(_EMPTY_FLAGS), - cygrpc.operation_receive_message(_EMPTY_FLAGS), - cygrpc.operation_receive_status_on_client(_EMPTY_FLAGS) - ]), client_call_tag) - self.assertEqual(cygrpc.CallError.ok, client_start_batch_result) - client_event_future = test_utilities.CompletionQueuePollFuture( - self.client_completion_queue, cygrpc_deadline) + client_event_future = perform_client_operations([ + cygrpc.operation_send_initial_metadata(empty_metadata, + _EMPTY_FLAGS), + cygrpc.operation_receive_initial_metadata(_EMPTY_FLAGS), + ], "Client prologue") request_event = self.server_completion_queue.poll(cygrpc_deadline) - self.assertEqual(cygrpc.CompletionType.operation_complete, - request_event.type) - self.assertIsInstance(request_event.operation_call, cygrpc.Call) - self.assertIs(server_request_tag, request_event.tag) - self.assertEqual(0, len(request_event.batch_operations)) - client_metadata_with_credentials = list(client_initial_metadata) + [ - (_CALL_CREDENTIALS_METADATA_KEY, _CALL_CREDENTIALS_METADATA_VALUE)] - self.assertTrue( - test_common.metadata_transmitted(client_metadata_with_credentials, - request_event.request_metadata)) - self.assertEqual(METHOD, request_event.request_call_details.method) - self.assertEqual(_SSL_HOST_OVERRIDE, - request_event.request_call_details.host) - self.assertLess( - abs(DEADLINE - float(request_event.request_call_details.deadline)), - DEADLINE_TOLERANCE) - - server_call_tag = object() server_call = request_event.operation_call - server_initial_metadata = cygrpc.Metadata([ - cygrpc.Metadatum(SERVER_INITIAL_METADATA_KEY, - SERVER_INITIAL_METADATA_VALUE)]) - server_trailing_metadata = cygrpc.Metadata([ - cygrpc.Metadatum(SERVER_TRAILING_METADATA_KEY, - SERVER_TRAILING_METADATA_VALUE)]) - server_start_batch_result = server_call.start_batch([ - cygrpc.operation_send_initial_metadata(server_initial_metadata, - _EMPTY_FLAGS), - cygrpc.operation_receive_message(_EMPTY_FLAGS), - cygrpc.operation_send_message(RESPONSE, _EMPTY_FLAGS), - cygrpc.operation_receive_close_on_server(_EMPTY_FLAGS), - cygrpc.operation_send_status_from_server( - server_trailing_metadata, SERVER_STATUS_CODE, - SERVER_STATUS_DETAILS, _EMPTY_FLAGS) - ], server_call_tag) - self.assertEqual(cygrpc.CallError.ok, server_start_batch_result) - client_event = client_event_future.result() - server_event = self.server_completion_queue.poll(cygrpc_deadline) + def perform_server_operations(operations, description): + return self._perform_operations( + operations, server_call, + self.server_completion_queue, cygrpc_deadline, description) - self.assertEqual(6, len(client_event.batch_operations)) - found_client_op_types = set() - for client_result in client_event.batch_operations: - # we expect each op type to be unique - self.assertNotIn(client_result.type, found_client_op_types) - found_client_op_types.add(client_result.type) - if client_result.type == cygrpc.OperationType.receive_initial_metadata: - self.assertTrue( - test_common.metadata_transmitted(server_initial_metadata, - client_result.received_metadata)) - elif client_result.type == cygrpc.OperationType.receive_message: - self.assertEqual(RESPONSE, client_result.received_message.bytes()) - elif client_result.type == cygrpc.OperationType.receive_status_on_client: - self.assertTrue( - test_common.metadata_transmitted(server_trailing_metadata, - client_result.received_metadata)) - self.assertEqual(SERVER_STATUS_DETAILS, - client_result.received_status_details) - self.assertEqual(SERVER_STATUS_CODE, client_result.received_status_code) - self.assertEqual(set([ - cygrpc.OperationType.send_initial_metadata, - cygrpc.OperationType.send_message, - cygrpc.OperationType.send_close_from_client, - cygrpc.OperationType.receive_initial_metadata, - cygrpc.OperationType.receive_message, - cygrpc.OperationType.receive_status_on_client - ]), found_client_op_types) + server_event_future = perform_server_operations([ + cygrpc.operation_send_initial_metadata(empty_metadata, + _EMPTY_FLAGS), + ], "Server prologue") - self.assertEqual(5, len(server_event.batch_operations)) - found_server_op_types = set() - for server_result in server_event.batch_operations: - self.assertNotIn(client_result.type, found_server_op_types) - found_server_op_types.add(server_result.type) - if server_result.type == cygrpc.OperationType.receive_message: - self.assertEqual(REQUEST, server_result.received_message.bytes()) - elif server_result.type == cygrpc.OperationType.receive_close_on_server: - self.assertFalse(server_result.received_cancelled) - self.assertEqual(set([ - cygrpc.OperationType.send_initial_metadata, - cygrpc.OperationType.receive_message, - cygrpc.OperationType.send_message, - cygrpc.OperationType.receive_close_on_server, - cygrpc.OperationType.send_status_from_server - ]), found_server_op_types) + client_event_future.result() # force completion + server_event_future.result() - del client_call - del server_call + # Messaging + for _ in range(10): + client_event_future = perform_client_operations([ + cygrpc.operation_send_message(b'', _EMPTY_FLAGS), + cygrpc.operation_receive_message(_EMPTY_FLAGS), + ], "Client message") + server_event_future = perform_server_operations([ + cygrpc.operation_send_message(b'', _EMPTY_FLAGS), + cygrpc.operation_receive_message(_EMPTY_FLAGS), + ], "Server receive") + + client_event_future.result() # force completion + server_event_future.result() + + # Epilogue + client_event_future = perform_client_operations([ + cygrpc.operation_send_close_from_client(_EMPTY_FLAGS), + cygrpc.operation_receive_status_on_client(_EMPTY_FLAGS) + ], "Client epilogue") + + server_event_future = perform_server_operations([ + cygrpc.operation_receive_close_on_server(_EMPTY_FLAGS), + cygrpc.operation_send_status_from_server( + empty_metadata, cygrpc.StatusCode.ok, b'', _EMPTY_FLAGS) + ], "Server epilogue") + + client_event_future.result() # force completion + server_event_future.result() + + +class InsecureServerInsecureClient(unittest.TestCase, ServerClientMixin): + + def setUp(self): + self.setUpMixin(None, None, None) + + def tearDown(self): + self.tearDownMixin() + + +class SecureServerSecureClient(unittest.TestCase, ServerClientMixin): + + def setUp(self): + server_credentials = cygrpc.server_credentials_ssl( + None, [cygrpc.SslPemKeyCertPair(resources.private_key(), + resources.certificate_chain())], False) + client_credentials = cygrpc.channel_credentials_ssl( + resources.test_root_certificates(), None) + self.setUpMixin(server_credentials, client_credentials, _SSL_HOST_OVERRIDE) + + def tearDown(self): + self.tearDownMixin() if __name__ == '__main__': diff --git a/src/python/grpcio/tests/unit/_cython/test_utilities.py b/src/python/grpcio/tests/unit/_cython/test_utilities.py index 6a097396431..6280ce74c47 100644 --- a/src/python/grpcio/tests/unit/_cython/test_utilities.py +++ b/src/python/grpcio/tests/unit/_cython/test_utilities.py @@ -32,15 +32,35 @@ import threading from grpc._cython import cygrpc -class CompletionQueuePollFuture: +class SimpleFuture(object): + """A simple future mechanism.""" - def __init__(self, completion_queue, deadline): - def poller_function(): - self._event_result = completion_queue.poll(deadline) - self._event_result = None - self._thread = threading.Thread(target=poller_function) + def __init__(self, function, *args, **kwargs): + def wrapped_function(): + try: + self._result = function(*args, **kwargs) + except Exception as error: + self._error = error + self._result = None + self._error = None + self._thread = threading.Thread(target=wrapped_function) self._thread.start() def result(self): + """The resulting value of this future. + + Re-raises any exceptions. + """ self._thread.join() - return self._event_result + if self._error: + # TODO(atash): re-raise exceptions in a way that preserves tracebacks + raise self._error + return self._result + + +class CompletionQueuePollFuture(SimpleFuture): + + def __init__(self, completion_queue, deadline): + super(CompletionQueuePollFuture, self).__init__( + lambda: completion_queue.poll(deadline)) + From 6ae6fc7a797d1629fb8ceba4c5b8792f7c24c4a3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 1 Jun 2016 16:28:00 -0700 Subject: [PATCH 067/175] Fix server side memory leak If clients send GOAWAY followed by HEADER --- .../chttp2/transport/chttp2_transport.c | 6 +- .../23f261e44d54a2736f6e288128d98db9e5015206 | Bin 0 -> 100 bytes .../552199651d942e7220141a93ec33dd8256210a18 | Bin 0 -> 46 bytes .../7a946bf3cd91b63001f2cf3f40c515c747f2ecde | Bin 0 -> 696 bytes .../7d25c28298fb4d0fe41209d0d14307e4aa67c59e | Bin 0 -> 47 bytes .../8138b18a9a743659befc2f2b23d23cb9c3086a09 | Bin 0 -> 348 bytes .../925011abb99fd56bb0f425ae5e0d92e6d341f804 | Bin 0 -> 49 bytes ...h-c1f66840627e3bfdedf2e4c225bc4de0c267ed37 | Bin 0 -> 100 bytes .../d6bed9cc3c10338a8c5f41064ff8bec0bbc267ce | Bin 0 -> 48 bytes .../dda9643679f8c8b796e64232a7d153e447d64991 | Bin 0 -> 650 bytes .../e7b08e36420fa107f0aee652e62158af85a4ef15 | Bin 0 -> 1091 bytes tools/run_tests/tests.json | 170 ++++++++++++++++++ 12 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/23f261e44d54a2736f6e288128d98db9e5015206 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/552199651d942e7220141a93ec33dd8256210a18 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/7a946bf3cd91b63001f2cf3f40c515c747f2ecde create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/7d25c28298fb4d0fe41209d0d14307e4aa67c59e create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/8138b18a9a743659befc2f2b23d23cb9c3086a09 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/925011abb99fd56bb0f425ae5e0d92e6d341f804 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/crash-c1f66840627e3bfdedf2e4c225bc4de0c267ed37 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/d6bed9cc3c10338a8c5f41064ff8bec0bbc267ce create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/dda9643679f8c8b796e64232a7d153e447d64991 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/e7b08e36420fa107f0aee652e62158af85a4ef15 diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b6886a2201b..d531d215e9d 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -804,8 +804,10 @@ void grpc_chttp2_add_incoming_goaway( gpr_free(msg); gpr_slice_unref(goaway_text); transport_global->seen_goaway = 1; - connectivity_state_set(exec_ctx, transport_global, GRPC_CHANNEL_FATAL_FAILURE, - "got_goaway"); + /* lie: use transient failure from the transport to indicate goaway has been + * received */ + connectivity_state_set(exec_ctx, transport_global, + GRPC_CHANNEL_TRANSIENT_FAILURE, "got_goaway"); } static void maybe_start_some_streams( diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/23f261e44d54a2736f6e288128d98db9e5015206 b/test/core/end2end/fuzzers/server_fuzzer_corpus/23f261e44d54a2736f6e288128d98db9e5015206 new file mode 100644 index 0000000000000000000000000000000000000000..1452256ec7f7ec1680e657f27704cebbd1f0e69a GIT binary patch literal 100 zcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k`Knwzsj35@H08e^RL9%X1W^QVJX$hC1 buR(rsYKlT~F-!$BnhFzz;?(5)yp&=9a@-X& literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/552199651d942e7220141a93ec33dd8256210a18 b/test/core/end2end/fuzzers/server_fuzzer_corpus/552199651d942e7220141a93ec33dd8256210a18 new file mode 100644 index 0000000000000000000000000000000000000000..c8c54f443d7d31d3d2032246c16aa4ecee8999c7 GIT binary patch literal 46 vcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6d=<5yWErZ`A+*u!RQ9 literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/7a946bf3cd91b63001f2cf3f40c515c747f2ecde b/test/core/end2end/fuzzers/server_fuzzer_corpus/7a946bf3cd91b63001f2cf3f40c515c747f2ecde new file mode 100644 index 0000000000000000000000000000000000000000..8ef1b0ad7e9b1b0296610b941a573b75fe88bdef GIT binary patch literal 696 zcmcgqO;5ux40Wa;MqyG8aHiq}Xl*x+yNn|o5Ea`W$kMEhlqFH?N{oNYf8dA&Y1s$b zkl;k5JlWB+WBWOMx(~0zyXiDdZsI{N=mnF91_6Nj>rV#=y#*lbVB|O!-DGZUGUFvX z995!_3rPz^=e>o*!e%s`Oj$7EwRcK|%Ohltnd8*5M1{Y3yu{7R5;{7PY0^G7c_ZAAW(dz1EW#>eXXz&`)}w%Q`F20j7h CKz`Ez literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/7d25c28298fb4d0fe41209d0d14307e4aa67c59e b/test/core/end2end/fuzzers/server_fuzzer_corpus/7d25c28298fb4d0fe41209d0d14307e4aa67c59e new file mode 100644 index 0000000000000000000000000000000000000000..a323f7a1abda4f8abefe0567cf1dc458074b05fb GIT binary patch literal 47 xcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6d=g%q_S!2dg~Lo2eG()fozg(g4rabQ?$Ofcc%sM9whvK>G+GuA>S5xZz$y0BhwtNj4ZsO}W4!by*j8))a31yhm6llKcRO C{$5)E literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/925011abb99fd56bb0f425ae5e0d92e6d341f804 b/test/core/end2end/fuzzers/server_fuzzer_corpus/925011abb99fd56bb0f425ae5e0d92e6d341f804 new file mode 100644 index 0000000000000000000000000000000000000000..948d5fafa33dd00337d84bfac9cd398ff5b479d1 GIT binary patch literal 49 zcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6d=I}L@CXSB&^OXE;N{}w3ibt&3=9k`Knwzs>>w7S08e^RL9%X1W^QVJX$hC1 euR(rsYKlT~F;E2~NCh*R3KNCm)a3lUlwtsMTopM0 literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/d6bed9cc3c10338a8c5f41064ff8bec0bbc267ce b/test/core/end2end/fuzzers/server_fuzzer_corpus/d6bed9cc3c10338a8c5f41064ff8bec0bbc267ce new file mode 100644 index 0000000000000000000000000000000000000000..2b3424a332f810bbcc6519bc6a07ca4d729b8b0e GIT binary patch literal 48 ycmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6d==6^7rU{H$V1xk?(f$F~xyF`U+e$7{Q}MGIk%|-O(DEs9 zl23kTzbD^2=TG<1Wpp>4=E?Oq4Ts@y^3Y{Mi0_t*0r9$>NB1(zPz1@`m}JH(dXUvz zzyf@MXdPMr3RC#`<77&Q8EYJ>B({gjaHd3ABR%FuBWR4VwLqD*N^*wM=%lPHrzc&G z8RuXz2F*<&b$MFATrq@^EF5!$awXf+(g8w%6_X08nuI-Z!|=hSO z%~%n0C7pWI>+mEUUpX_zX>_inZk8A1=CyOe>(X{)+t8u)M|?W?N8zY{SB(st+T%Y7 vg=8O=7C4g5yP)?>KDS>`{xn8km>S;)xGO<-3tRYi7jFCeBI&;cF`B#q0jGhB literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/e7b08e36420fa107f0aee652e62158af85a4ef15 b/test/core/end2end/fuzzers/server_fuzzer_corpus/e7b08e36420fa107f0aee652e62158af85a4ef15 new file mode 100644 index 0000000000000000000000000000000000000000..523c785612efbb325e6812d8beac59ad13bc6832 GIT binary patch literal 1091 zcmcIjJ#WG=5H*mNkQT{9yGNZ`L`Y~mWnpcHs!`z&7{?@*LTn|61pRsaO^h9CCxV8r z0z)n3LsNfL`3@HG`FsAtY{Az2I999-1&b09Fw z8_%9cnS^zQ+f{~c$R-H^){Q>7#C2dMWP~Ry%ds`fS>}*PVcv~N=+K0#ZE&=wIx2dq z;R|09h)s7QggYjg>LRBxtMqgNR-?ok=&Pqw0Ez-kq)a#^z(wk6dhty`GNGGHtO!^$ z@+T9OlKTfny4-BP!kt|dKwYobS9<7q_I<+B+57vik&TIUY5SpPfLsLmGcg=*7wF?Y0WJg PQzTNPy?jUzzaIYqHu%$T literal 0 HcmV?d00001 diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 850f9474aec..c171d053547 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -70513,6 +70513,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/23f261e44d54a2736f6e288128d98db9e5015206" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/2463aea879c5ab49f8409d0e5c062c7e086b034b" @@ -71941,6 +71958,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/552199651d942e7220141a93ec33dd8256210a18" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/55af20415ead0ddd417f37fa91a4c767b749ee34" @@ -72706,6 +72740,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/7a946bf3cd91b63001f2cf3f40c515c747f2ecde" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/7b453adcb9c4bf31dbc448ff32c2bc90ebcbdf0f" @@ -72723,6 +72774,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/7d25c28298fb4d0fe41209d0d14307e4aa67c59e" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/7ddfac7d7845b424bf670070781ca6ff8586c63b" @@ -72774,6 +72842,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/8138b18a9a743659befc2f2b23d23cb9c3086a09" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/8164d3c4af043c47cfd6966873bccd2353d072bf" @@ -73182,6 +73267,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/925011abb99fd56bb0f425ae5e0d92e6d341f804" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/93beeba2.bin" @@ -74593,6 +74695,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/crash-c1f66840627e3bfdedf2e4c225bc4de0c267ed37" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/crash-dae0f07934a527989f23f06e630710ff6ca8c809" @@ -74695,6 +74814,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/d6bed9cc3c10338a8c5f41064ff8bec0bbc267ce" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/d8a1d141a9e3876b71c7decbe6e3affccf6de397" @@ -74848,6 +74984,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/dda9643679f8c8b796e64232a7d153e447d64991" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/df5d3cf5f05eab65ef9d385e263780ae73c42b19" @@ -74950,6 +75103,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/e7b08e36420fa107f0aee652e62158af85a4ef15" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/e96ad9c17795e52edc810a08d4fc61fe8790002a" From a9d8c5564e37e2d42fa3a6f4546ac3507b1b03c8 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 2 Jun 2016 16:11:28 -0700 Subject: [PATCH 068/175] Provide reasons in error messages when streams are canceled with a connection drop --- .../chttp2/transport/chttp2_transport.c | 74 ++++++++++++++++--- .../ext/transport/chttp2/transport/internal.h | 3 + 2 files changed, 65 insertions(+), 12 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b6886a2201b..52ac895271e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -47,6 +47,7 @@ #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/status_conversion.h" #include "src/core/ext/transport/chttp2/transport/timeout_encoding.h" +#include "src/core/lib/http/parser.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/support/string.h" #include "src/core/lib/transport/static_metadata.h" @@ -107,7 +108,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, static void cancel_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, grpc_chttp2_stream_global *stream_global, - grpc_status_code status); + grpc_status_code status, + gpr_slice *optional_message); static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, @@ -161,6 +163,8 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx, GPR_ASSERT(t->ep == NULL); + gpr_slice_unref(t->optional_drop_message); + gpr_slice_buffer_destroy(&t->global.qbuf); gpr_slice_buffer_destroy(&t->writing.outbuf); @@ -260,6 +264,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->parsing.deframe_state = is_client ? GRPC_DTS_FH_0 : GRPC_DTS_CLIENT_PREFIX_0; t->writing.is_client = is_client; + t->optional_drop_message = gpr_empty_slice(); grpc_connectivity_state_init( &t->channel_callback.state_tracker, GRPC_CHANNEL_READY, is_client ? "client_transport" : "server_transport"); @@ -859,7 +864,7 @@ static void maybe_start_some_streams( grpc_chttp2_list_pop_waiting_for_concurrency(transport_global, &stream_global)) { cancel_from_api(exec_ctx, transport_global, stream_global, - GRPC_STATUS_UNAVAILABLE); + GRPC_STATUS_UNAVAILABLE, NULL); } } @@ -936,7 +941,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, if (op->cancel_with_status != GRPC_STATUS_OK) { cancel_from_api(exec_ctx, transport_global, stream_global, - op->cancel_with_status); + op->cancel_with_status, op->optional_close_message); } if (op->close_with_status != GRPC_STATUS_OK) { @@ -960,7 +965,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, "(%lu vs. %lu)", metadata_size, metadata_peer_limit); cancel_from_api(exec_ctx, transport_global, stream_global, - GRPC_STATUS_RESOURCE_EXHAUSTED); + GRPC_STATUS_RESOURCE_EXHAUSTED, NULL); } else { if (contains_non_ok_status(transport_global, op->send_initial_metadata)) { stream_global->seen_error = true; @@ -1015,7 +1020,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, "(%lu vs. %lu)", metadata_size, metadata_peer_limit); cancel_from_api(exec_ctx, transport_global, stream_global, - GRPC_STATUS_RESOURCE_EXHAUSTED); + GRPC_STATUS_RESOURCE_EXHAUSTED, NULL); } else { if (contains_non_ok_status(transport_global, op->send_trailing_metadata)) { @@ -1201,7 +1206,7 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx, } if (stream_global->exceeded_metadata_size) { cancel_from_api(exec_ctx, transport_global, stream_global, - GRPC_STATUS_RESOURCE_EXHAUSTED); + GRPC_STATUS_RESOURCE_EXHAUSTED, NULL); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1240,7 +1245,7 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx, } if (stream_global->exceeded_metadata_size) { cancel_from_api(exec_ctx, transport_global, stream_global, - GRPC_STATUS_RESOURCE_EXHAUSTED); + GRPC_STATUS_RESOURCE_EXHAUSTED, NULL); } } if (stream_global->all_incoming_byte_streams_finished) { @@ -1303,7 +1308,8 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, static void cancel_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, grpc_chttp2_stream_global *stream_global, - grpc_status_code status) { + grpc_status_code status, + gpr_slice *optional_message) { if (!stream_global->read_closed || !stream_global->write_closed) { if (stream_global->id != 0) { gpr_slice_buffer_add( @@ -1313,8 +1319,12 @@ static void cancel_from_api(grpc_exec_ctx *exec_ctx, (uint32_t)grpc_chttp2_grpc_status_to_http2_error(status), &stream_global->stats.outgoing)); } + + if (optional_message) { + gpr_slice_ref(*optional_message); + } grpc_chttp2_fake_status(exec_ctx, transport_global, stream_global, status, - NULL); + optional_message); } if (status != GRPC_STATUS_OK && !stream_global->seen_error) { stream_global->seen_error = true; @@ -1519,16 +1529,23 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, 1); } +typedef struct { + grpc_exec_ctx *exec_ctx; + gpr_slice optional_drop_message; +} cancel_stream_cb_arg; + static void cancel_stream_cb(grpc_chttp2_transport_global *transport_global, void *user_data, grpc_chttp2_stream_global *stream_global) { - cancel_from_api(user_data, transport_global, stream_global, - GRPC_STATUS_UNAVAILABLE); + cancel_stream_cb_arg *arg = user_data; + cancel_from_api(arg->exec_ctx, transport_global, stream_global, + GRPC_STATUS_UNAVAILABLE, &arg->optional_drop_message); } static void end_all_the_calls(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { - grpc_chttp2_for_all_streams(&t->global, exec_ctx, cancel_stream_cb); + cancel_stream_cb_arg arg = {exec_ctx, t->optional_drop_message}; + grpc_chttp2_for_all_streams(&t->global, &arg, cancel_stream_cb); } static void drop_connection(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { @@ -1599,6 +1616,31 @@ static void reading_action_locked(grpc_exec_ctx *exec_ctx, } } +static bool try_http_parsing(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t) { + return false; + grpc_http_parser parser; + size_t i = 0; + bool success = false; + + grpc_http_parser_init(&parser); + grpc_http1_trace = 1; + + for (; i < t->read_buffer.count && + grpc_http_parser_parse(&parser, t->read_buffer.slices[i]); + i++) + ; + if (grpc_http_parser_eof(&parser) && parser.type == GRPC_HTTP_RESPONSE) { + success = true; + GRPC_CHTTP2_IF_TRACING(gpr_log( + GPR_DEBUG, "Trying to connect an http1.x server, received status:%d", + parser.http.response.status)); + } + + grpc_http_parser_destroy(&parser); + return success; +} + static void parsing_action(grpc_exec_ctx *exec_ctx, void *arg, bool success) { grpc_chttp2_transport *t = arg; GPR_TIMER_BEGIN("reading_action.parse", 0); @@ -1610,6 +1652,14 @@ static void parsing_action(grpc_exec_ctx *exec_ctx, void *arg, bool success) { ; if (i != t->read_buffer.count) { success = false; + gpr_slice_unref(t->optional_drop_message); + if (try_http_parsing(exec_ctx, t)) { + t->optional_drop_message = gpr_slice_from_copied_string( + "Connection dropped: received http1.x response"); + } else { + t->optional_drop_message = gpr_slice_from_copied_string( + "Connection dropped: received unparseable response"); + } } GPR_TIMER_END("reading_action.parse", 0); grpc_chttp2_run_with_global_lock(exec_ctx, t, NULL, post_parse_locked, diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 5872fd8e0a4..7f3339a6204 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -383,6 +383,9 @@ struct grpc_chttp2_transport { /** Transport op to be applied post-parsing */ grpc_transport_op *post_parsing_op; + + /** Message explaining the reason of dropping connection */ + gpr_slice optional_drop_message; }; typedef struct { From 82ec451c427c0275964ee444d11238b07efeb94d Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 2 Jun 2016 18:34:34 -0700 Subject: [PATCH 069/175] Check if optional_drop_message is an empty slice --- .../ext/transport/chttp2/transport/chttp2_transport.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 52ac895271e..d0c94e6c463 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1531,7 +1531,7 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, typedef struct { grpc_exec_ctx *exec_ctx; - gpr_slice optional_drop_message; + gpr_slice *optional_drop_message; } cancel_stream_cb_arg; static void cancel_stream_cb(grpc_chttp2_transport_global *transport_global, @@ -1539,12 +1539,15 @@ static void cancel_stream_cb(grpc_chttp2_transport_global *transport_global, grpc_chttp2_stream_global *stream_global) { cancel_stream_cb_arg *arg = user_data; cancel_from_api(arg->exec_ctx, transport_global, stream_global, - GRPC_STATUS_UNAVAILABLE, &arg->optional_drop_message); + GRPC_STATUS_UNAVAILABLE, arg->optional_drop_message); } static void end_all_the_calls(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { - cancel_stream_cb_arg arg = {exec_ctx, t->optional_drop_message}; + cancel_stream_cb_arg arg = {exec_ctx, + GPR_SLICE_IS_EMPTY(t->optional_drop_message) + ? NULL + : &t->optional_drop_message}; grpc_chttp2_for_all_streams(&t->global, &arg, cancel_stream_cb); } @@ -1618,13 +1621,11 @@ static void reading_action_locked(grpc_exec_ctx *exec_ctx, static bool try_http_parsing(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { - return false; grpc_http_parser parser; size_t i = 0; bool success = false; grpc_http_parser_init(&parser); - grpc_http1_trace = 1; for (; i < t->read_buffer.count && grpc_http_parser_parse(&parser, t->read_buffer.slices[i]); From 91630f72e718326b8ab018d6d52f9a3c0bddca47 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 2 Jun 2016 19:03:54 -0700 Subject: [PATCH 070/175] Remove __inline --- src/core/ext/transport/chttp2/transport/bin_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c index b44560b2ebc..38b5e46949b 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.c +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -62,7 +62,7 @@ static uint8_t decode_table[] = { static const uint8_t tail_xtra[4] = {0, 0, 1, 2}; -static __inline bool input_is_valid(uint8_t *input_ptr, size_t length) { +static bool input_is_valid(uint8_t *input_ptr, size_t length) { size_t i; for (i = 0; i < length; ++i) { From 020087035bbaea4f414a5bd25bb820fd52d5ec78 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 2 Jun 2016 21:40:45 -0700 Subject: [PATCH 071/175] Polished RR policy and added policy doc preamble --- .../ext/lb_policy/round_robin/round_robin.c | 40 +++++++++++++++---- test/core/client_config/lb_policies_test.c | 32 ++++++--------- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index dcdc0c62857..a73ab0a4a64 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -31,6 +31,34 @@ * */ +/** Round Robin Policy. + * + * This policy keeps: + * - A circular list of ready (connected) subchannels, the + * *readylist*. An empty readylist consists solely of its root (dummy) node. + * - A pointer to the last element picked from the readylist, the *lastpick*. + * Initially set to point to the readylist's root. + * + * Behavior: + * - When a subchannel connects, it's *prepended* to the readylist's root node. + * Ie, if readylist = A <-> B <-> ROOT <-> C + * ^ ^ + * |____________________| + * and subchannel D becomes connected, the addition of D to the readylist + * results in readylist = A <-> B <-> D <-> ROOT <-> C + * ^ ^ + * |__________________________| + * - When a subchannel disconnects, it's removed from the readylist. If the + * subchannel being removed was the most recently picked, the *lastpick* + * pointer moves to the removed node's previous element. Note that if the + * readylist only had one element, this is still legal, as the lastpick would + * point to the dummy root node, for an empty readylist. + * - Upon picking, *lastpick* is updated to point to the returned (connected) + * subchannel. Note that it possible that the selected subchannel becomes + * disconnected in the interim between the selection and the actual usage of + * the subchannel by the caller. + */ + #include #include @@ -173,9 +201,7 @@ static void remove_disconnected_sc_locked(round_robin_lb_policy *p, return; } if (node == p->ready_list_last_pick) { - /* If removing the lastly picked node, reset the last pick pointer to the - * dummy root of the list */ - p->ready_list_last_pick = &p->ready_list; + p->ready_list_last_pick = p->ready_list_last_pick->prev; } /* removing last item */ @@ -344,8 +370,8 @@ static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, *target = grpc_subchannel_get_connected_subchannel(selected->subchannel); if (grpc_lb_round_robin_trace) { gpr_log(GPR_DEBUG, - "[RR PICK] TARGET <-- CONNECTED SUBCHANNEL %p (NODE %p)", - selected->subchannel, selected); + "[RR PICK] TARGET <-- CONNECTED SUBCHANNEL %p (NODE %p)", *target, + selected); } /* only advance the last picked pointer if the selection was used */ advance_last_picked_locked(p); @@ -524,7 +550,7 @@ static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {} static void round_robin_factory_unref(grpc_lb_policy_factory *factory) {} -static grpc_lb_policy *create_round_robin(grpc_exec_ctx *exec_ctx, +static grpc_lb_policy *round_robin_create(grpc_exec_ctx *exec_ctx, grpc_lb_policy_factory *factory, grpc_lb_policy_args *args) { GPR_ASSERT(args->addresses != NULL); @@ -580,7 +606,7 @@ static grpc_lb_policy *create_round_robin(grpc_exec_ctx *exec_ctx, } static const grpc_lb_policy_factory_vtable round_robin_factory_vtable = { - round_robin_factory_ref, round_robin_factory_unref, create_round_robin, + round_robin_factory_ref, round_robin_factory_unref, round_robin_create, "round_robin"}; static grpc_lb_policy_factory round_robin_lb_policy_factory = { diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index 2ec46124a89..786f0b39b27 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -640,7 +640,7 @@ static void print_failed_expectations(const int *expected_connection_sequence, const size_t num_iters) { size_t i; for (i = 0; i < num_iters; i++) { - gpr_log(GPR_ERROR, "FAILURE: Iter, expected, actual:%d (%d, %d)", i, + gpr_log(GPR_ERROR, "FAILURE: Iter (expected, actual): %d (%d, %d)", i, expected_connection_sequence[i % expected_seq_length], actual_connection_sequence[i]); } @@ -664,8 +664,6 @@ static void verify_vanilla_round_robin(const servers_fixture *f, const int actual = actual_connection_sequence[i]; const int expected = expected_connection_sequence[i % expected_seq_length]; if (actual != expected) { - gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected, - actual, i); print_failed_expectations(expected_connection_sequence, actual_connection_sequence, expected_seq_length, num_iters); @@ -692,24 +690,21 @@ static void verify_vanishing_floor_round_robin( memcpy(expected_connection_sequence, actual_connection_sequence + 2, expected_seq_length * sizeof(int)); - /* first three elements of the sequence should be [<1st>, -1] */ - if (actual_connection_sequence[0] != expected_connection_sequence[0]) { - gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", - expected_connection_sequence[0], actual_connection_sequence[0], 0); - print_failed_expectations(expected_connection_sequence, - actual_connection_sequence, expected_seq_length, - 1u); - abort(); - } - + /* first two elements of the sequence should be [0 (1st server), -1 (failure)] + */ + GPR_ASSERT(actual_connection_sequence[0] == 0); GPR_ASSERT(actual_connection_sequence[1] == -1); + /* the next two element must be [3, 0], repeating from that point: the 3 is + * brought forth by servers 1 and 2 disappearing after the intial pick of 0 */ + GPR_ASSERT(actual_connection_sequence[2] == 3); + GPR_ASSERT(actual_connection_sequence[3] == 0); + + /* make sure that the expectation obliges */ for (i = 2; i < num_iters; i++) { const int actual = actual_connection_sequence[i]; const int expected = expected_connection_sequence[i % expected_seq_length]; if (actual != expected) { - gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected, - actual, i); print_failed_expectations(expected_connection_sequence, actual_connection_sequence, expected_seq_length, num_iters); @@ -757,8 +752,6 @@ static void verify_partial_carnage_round_robin( const int actual = actual_connection_sequence[i]; const int expected = expected_connection_sequence[i % expected_seq_length]; if (actual != expected) { - gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected, - actual, i); print_failed_expectations(expected_connection_sequence, actual_connection_sequence, expected_seq_length, num_iters); @@ -856,8 +849,6 @@ static void verify_rebirth_round_robin(const servers_fixture *f, const int expected = expected_connection_sequence[j++ % expected_seq_length]; if (actual != expected) { - gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected, - actual, i); print_failed_expectations(expected_connection_sequence, actual_connection_sequence, expected_seq_length, num_iters); @@ -887,7 +878,8 @@ int main(int argc, char **argv) { GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, NULL, NULL) == NULL); spec = test_spec_create(NUM_ITERS, NUM_SERVERS); - /* everything is fine, all servers stay up the whole time and life's peachy */ + /* everything is fine, all servers stay up the whole time and life's peachy + */ spec->verifier = verify_vanilla_round_robin; spec->description = "test_all_server_up"; run_spec(spec); From 8d8f9a891baebde4146f85f6c82d0372469f3b33 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 3 Jun 2016 08:49:11 -0700 Subject: [PATCH 072/175] Fix refcounting algorithm --- src/core/lib/transport/metadata.c | 39 +++++++++++++++---------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 82c8e239f68..751305e5d7c 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -129,7 +129,10 @@ typedef struct mdtab_shard { internal_metadata **elems; size_t count; size_t capacity; - size_t free; + /** Estimate of the number of unreferenced mdelems in the hash table. + This will eventually converge to the exact number, but it's instantaneous + accuracy is not guaranteed */ + gpr_atm free_estimate; } mdtab_shard; #define LOG2_STRTAB_SHARD_COUNT 5 @@ -217,7 +220,7 @@ void grpc_mdctx_global_init(void) { mdtab_shard *shard = &g_mdtab_shard[i]; gpr_mu_init(&shard->mu); shard->count = 0; - shard->free = 0; + gpr_atm_no_barrier_store(&shard->free_estimate, 0); shard->capacity = INITIAL_MDTAB_CAPACITY; shard->elems = gpr_malloc(sizeof(*shard->elems) * shard->capacity); memset(shard->elems, 0, sizeof(*shard->elems) * shard->capacity); @@ -281,10 +284,8 @@ static void ref_md_locked(mdtab_shard *shard, grpc_mdstr_as_c_string((grpc_mdstr *)md->key), grpc_mdstr_as_c_string((grpc_mdstr *)md->value)); #endif - if (0 == gpr_atm_no_barrier_fetch_add(&md->refcnt, 2)) { - shard->free--; - } else { - GPR_ASSERT(1 != gpr_atm_no_barrier_fetch_add(&md->refcnt, -1)); + if (0 == gpr_atm_no_barrier_fetch_add(&md->refcnt, 1)) { + gpr_atm_no_barrier_fetch_add(&shard->free_estimate, -1); } } @@ -447,6 +448,7 @@ static void gc_mdtab(mdtab_shard *shard) { size_t i; internal_metadata **prev_next; internal_metadata *md, *next; + gpr_atm num_freed = 0; GPR_TIMER_BEGIN("gc_mdtab", 0); for (i = 0; i < shard->capacity; i++) { @@ -463,13 +465,14 @@ static void gc_mdtab(mdtab_shard *shard) { } gpr_free(md); *prev_next = next; - shard->free--; + num_freed++; shard->count--; } else { prev_next = &md->bucket_next; } } } + gpr_atm_no_barrier_fetch_add(&shard->free_estimate, -num_freed); GPR_TIMER_END("gc_mdtab", 0); } @@ -504,7 +507,8 @@ static void grow_mdtab(mdtab_shard *shard) { } static void rehash_mdtab(mdtab_shard *shard) { - if (shard->free > shard->capacity / 4) { + if ((size_t)gpr_atm_no_barrier_load(&shard->free_estimate) > + shard->capacity / 4) { gc_mdtab(shard); } else { grow_mdtab(shard); @@ -553,7 +557,7 @@ grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_mdstr *mkey, /* not found: create a new pair */ md = gpr_malloc(sizeof(internal_metadata)); - gpr_atm_rel_store(&md->refcnt, 2); + gpr_atm_rel_store(&md->refcnt, 1); md->key = key; md->value = value; md->user_data = 0; @@ -645,7 +649,7 @@ grpc_mdelem *grpc_mdelem_ref(grpc_mdelem *gmd DEBUG_ARGS) { this function - meaning that no adjustment to mdtab_free is necessary, simplifying the logic here to be just an atomic increment */ /* use C assert to have this removed in opt builds */ - assert(gpr_atm_no_barrier_load(&md->refcnt) >= 2); + assert(gpr_atm_no_barrier_load(&md->refcnt) >= 1); gpr_atm_no_barrier_fetch_add(&md->refcnt, 1); return gmd; } @@ -662,18 +666,13 @@ void grpc_mdelem_unref(grpc_mdelem *gmd DEBUG_ARGS) { grpc_mdstr_as_c_string((grpc_mdstr *)md->key), grpc_mdstr_as_c_string((grpc_mdstr *)md->value)); #endif - if (2 == gpr_atm_full_fetch_add(&md->refcnt, -1)) { - uint32_t hash = GRPC_MDSTR_KV_HASH(md->key->hash, md->value->hash); + uint32_t hash = GRPC_MDSTR_KV_HASH(md->key->hash, md->value->hash); + if (1 == gpr_atm_full_fetch_add(&md->refcnt, -1)) { + /* once the refcount hits zero, some other thread can come along and + free md at any time: it's unsafe from this point on to access it */ mdtab_shard *shard = &g_mdtab_shard[SHARD_IDX(hash, LOG2_MDTAB_SHARD_COUNT)]; - GPR_TIMER_BEGIN("grpc_mdelem_unref.to_zero", 0); - gpr_mu_lock(&shard->mu); - if (1 == gpr_atm_no_barrier_load(&md->refcnt)) { - shard->free++; - gpr_atm_no_barrier_store(&md->refcnt, 0); - } - gpr_mu_unlock(&shard->mu); - GPR_TIMER_END("grpc_mdelem_unref.to_zero", 0); + gpr_atm_no_barrier_fetch_add(&shard->free_estimate, 1); } } From 23bb526710e5c95b121908835703525709325ee0 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 3 Jun 2016 13:12:30 -0700 Subject: [PATCH 073/175] fixed typo --- src/core/ext/lb_policy/round_robin/round_robin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index a73ab0a4a64..d7870992f7e 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -34,8 +34,8 @@ /** Round Robin Policy. * * This policy keeps: - * - A circular list of ready (connected) subchannels, the - * *readylist*. An empty readylist consists solely of its root (dummy) node. + * - A circular list of ready (connected) subchannels, the *readylist*. An empty + * readylist consists solely of its root (dummy) node. * - A pointer to the last element picked from the readylist, the *lastpick*. * Initially set to point to the readylist's root. * @@ -54,7 +54,7 @@ * readylist only had one element, this is still legal, as the lastpick would * point to the dummy root node, for an empty readylist. * - Upon picking, *lastpick* is updated to point to the returned (connected) - * subchannel. Note that it possible that the selected subchannel becomes + * subchannel. Note that it's possible that the selected subchannel becomes * disconnected in the interim between the selection and the actual usage of * the subchannel by the caller. */ From 3623dc5cddaee5884c73c9e5c79f80f25e7d3dbe Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 3 Jun 2016 13:41:46 -0700 Subject: [PATCH 074/175] Move protobuf dependencies to config_protobuf.h --- .../reflection/proto_server_reflection.cc | 27 +++++++------------ .../reflection/proto_server_reflection.h | 6 ++--- include/grpc++/impl/codegen/config_protobuf.h | 22 +++++++++++++++ src/compiler/config.h | 18 +------------ 4 files changed, 34 insertions(+), 39 deletions(-) diff --git a/extensions/reflection/proto_server_reflection.cc b/extensions/reflection/proto_server_reflection.cc index fe4564ab723..e41c67cdbcf 100644 --- a/extensions/reflection/proto_server_reflection.cc +++ b/extensions/reflection/proto_server_reflection.cc @@ -37,21 +37,12 @@ #include #include -#include -#include #include #include "reflection/proto_server_reflection.h" using grpc::Status; using grpc::StatusCode; -using google::protobuf::MethodDescriptor; -using google::protobuf::ServiceDescriptor; -using google::protobuf::Descriptor; -using google::protobuf::FileDescriptor; -using google::protobuf::FieldDescriptor; -using google::protobuf::DescriptorPool; -using google::protobuf::FileDescriptorProto; using grpc::reflection::v1alpha::ServerReflectionRequest; using grpc::reflection::v1alpha::ExtensionRequest; using grpc::reflection::v1alpha::ServerReflectionResponse; @@ -64,7 +55,7 @@ using grpc::reflection::v1alpha::FileDescriptorResponse; namespace grpc { ProtoServerReflection::ProtoServerReflection() - : descriptor_pool_(DescriptorPool::generated_pool()) {} + : descriptor_pool_(protobuf::DescriptorPool::generated_pool()) {} void ProtoServerReflection::SetServiceList( const std::vector* services) { @@ -143,7 +134,7 @@ Status ProtoServerReflection::GetFileByName( return Status::CANCELLED; } - const FileDescriptor* file_desc = descriptor_pool_->FindFileByName(filename); + const protobuf::FileDescriptor* file_desc = descriptor_pool_->FindFileByName(filename); if (file_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "File not found."); } @@ -159,7 +150,7 @@ Status ProtoServerReflection::GetFileContainingSymbol( return Status::CANCELLED; } - const FileDescriptor* file_desc = + const protobuf::FileDescriptor* file_desc = descriptor_pool_->FindFileContainingSymbol(symbol); if (file_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Symbol not found."); @@ -176,13 +167,13 @@ Status ProtoServerReflection::GetFileContainingExtension( return Status::CANCELLED; } - const Descriptor* desc = + const protobuf::Descriptor* desc = descriptor_pool_->FindMessageTypeByName(request->containing_type()); if (desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Type not found."); } - const FieldDescriptor* field_desc = descriptor_pool_->FindExtensionByNumber( + const protobuf::FieldDescriptor* field_desc = descriptor_pool_->FindExtensionByNumber( desc, request->extension_number()); if (field_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Extension not found."); @@ -199,12 +190,12 @@ Status ProtoServerReflection::GetAllExtensionNumbers( return Status::CANCELLED; } - const Descriptor* desc = descriptor_pool_->FindMessageTypeByName(type); + const protobuf::Descriptor* desc = descriptor_pool_->FindMessageTypeByName(type); if (desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Type not found."); } - std::vector extensions; + std::vector extensions; descriptor_pool_->FindAllExtensions(desc, &extensions); for (auto extension : extensions) { response->add_extension_number(extension->number()); @@ -214,14 +205,14 @@ Status ProtoServerReflection::GetAllExtensionNumbers( } void ProtoServerReflection::FillFileDescriptorResponse( - const FileDescriptor* file_desc, ServerReflectionResponse* response, + const protobuf::FileDescriptor* file_desc, ServerReflectionResponse* response, std::unordered_set* seen_files) { if (seen_files->find(file_desc->name()) != seen_files->end()) { return; } seen_files->insert(file_desc->name()); - FileDescriptorProto file_desc_proto; + protobuf::FileDescriptorProto file_desc_proto; grpc::string data; file_desc->CopyTo(&file_desc_proto); file_desc_proto.SerializeToString(&data); diff --git a/extensions/reflection/proto_server_reflection.h b/extensions/reflection/proto_server_reflection.h index d288b73d928..f9b98c5fb3a 100644 --- a/extensions/reflection/proto_server_reflection.h +++ b/extensions/reflection/proto_server_reflection.h @@ -40,8 +40,6 @@ #include #include -#include -#include #include #include @@ -83,14 +81,14 @@ class ProtoServerReflection GRPC_FINAL reflection::v1alpha::ExtensionNumberResponse* response); void FillFileDescriptorResponse( - const google::protobuf::FileDescriptor* file_desc, + const protobuf::FileDescriptor* file_desc, reflection::v1alpha::ServerReflectionResponse* response, std::unordered_set* seen_files); void FillErrorResponse(const Status& status, reflection::v1alpha::ErrorResponse* error_response); - const google::protobuf::DescriptorPool* descriptor_pool_; + const protobuf::DescriptorPool* descriptor_pool_; const std::vector* services_; }; diff --git a/include/grpc++/impl/codegen/config_protobuf.h b/include/grpc++/impl/codegen/config_protobuf.h index f1b6beaca73..4bee1bc4227 100644 --- a/include/grpc++/impl/codegen/config_protobuf.h +++ b/include/grpc++/impl/codegen/config_protobuf.h @@ -44,6 +44,19 @@ #define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message #endif +#ifndef GRPC_CUSTOM_DESCRIPTOR +#include +#include +#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor +#define GRPC_CUSTOM_DESCRIPTORPOOL ::google::protobuf::DescriptorPool +#define GPRC_CUSTOM_FIELDDESCRIPTOR ::google::protobuf::FieldDescriptor +#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor +#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto +#define GRPC_CUSTOM_METHODDESCRIPTOR ::google::protobuf::MethodDescriptor +#define GRPC_CUSTOM_SERVICEDESCRIPTOR ::google::protobuf::ServiceDescriptor +#define GRPC_CUSTOM_SOURCELOCATION ::google::protobuf::SourceLocation +#endif + #ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM #include #include @@ -60,6 +73,15 @@ namespace protobuf { typedef GRPC_CUSTOM_MESSAGE Message; typedef GRPC_CUSTOM_PROTOBUF_INT64 int64; +typedef GRPC_CUSTOM_DESCRIPTOR Descriptor; +typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool; +typedef GPRC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor; +typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor; +typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto; +typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor; +typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor; +typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation; + namespace io { typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream; diff --git a/src/compiler/config.h b/src/compiler/config.h index d8b95818dbb..631adbc5c1b 100644 --- a/src/compiler/config.h +++ b/src/compiler/config.h @@ -37,17 +37,6 @@ #include #include -#ifndef GRPC_CUSTOM_DESCRIPTOR -#include -#include -#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor -#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor -#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto -#define GRPC_CUSTOM_METHODDESCRIPTOR ::google::protobuf::MethodDescriptor -#define GRPC_CUSTOM_SERVICEDESCRIPTOR ::google::protobuf::ServiceDescriptor -#define GRPC_CUSTOM_SOURCELOCATION ::google::protobuf::SourceLocation -#endif - #ifndef GRPC_CUSTOM_CODEGENERATOR #include #define GRPC_CUSTOM_CODEGENERATOR ::google::protobuf::compiler::CodeGenerator @@ -77,12 +66,7 @@ namespace grpc { namespace protobuf { -typedef GRPC_CUSTOM_DESCRIPTOR Descriptor; -typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor; -typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto; -typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor; -typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor; -typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation; + namespace compiler { typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator; typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext; From c8074527b2c98e132061f79b48f06f0c5154b9fb Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 3 Jun 2016 14:36:11 -0700 Subject: [PATCH 075/175] Remove unnecessary headers --- .../impl/proto_server_reflection_plugin.h | 6 ++---- .../reflection/proto_server_reflection.cc | 3 --- .../reflection/proto_server_reflection.h | 3 --- .../proto_server_reflection_plugin.cc | 18 ++++++++++-------- .../proto_reflection_descriptor_database.h | 1 - 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h index df0abb2b16f..5bf1ff1bfcc 100644 --- a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h +++ b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h @@ -34,8 +34,6 @@ #ifndef GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H #define GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H -#include - #include #include @@ -58,7 +56,7 @@ class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { bool has_sync_methods() const GRPC_OVERRIDE; private: - std::shared_ptr<::grpc::ProtoServerReflection> reflection_service; + std::shared_ptr<::grpc::ProtoServerReflection> reflection_service_; }; std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection(); @@ -70,7 +68,7 @@ static struct StaticPluginInitializer_reflection { StaticPluginInitializer_reflection() { grpc_AddServerBuilderPlugin_reflection(); } -} static_plugin_initializer_reflection_; +} static_plugin_initializer_reflection; } // namespace reflection } // namespace grpc diff --git a/extensions/reflection/proto_server_reflection.cc b/extensions/reflection/proto_server_reflection.cc index e41c67cdbcf..f3cf7958e84 100644 --- a/extensions/reflection/proto_server_reflection.cc +++ b/extensions/reflection/proto_server_reflection.cc @@ -31,9 +31,6 @@ * */ -#include -#include -#include #include #include diff --git a/extensions/reflection/proto_server_reflection.h b/extensions/reflection/proto_server_reflection.h index f9b98c5fb3a..71b316816c2 100644 --- a/extensions/reflection/proto_server_reflection.h +++ b/extensions/reflection/proto_server_reflection.h @@ -34,9 +34,6 @@ #ifndef GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H #define GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H -#include -#include -#include #include #include diff --git a/extensions/reflection/proto_server_reflection_plugin.cc b/extensions/reflection/proto_server_reflection_plugin.cc index d038a7fff59..465a8b9442e 100644 --- a/extensions/reflection/proto_server_reflection_plugin.cc +++ b/extensions/reflection/proto_server_reflection_plugin.cc @@ -42,31 +42,33 @@ namespace grpc { namespace reflection { ProtoServerReflectionPlugin::ProtoServerReflectionPlugin() - : reflection_service(new grpc::ProtoServerReflection()) {} + : reflection_service_(new grpc::ProtoServerReflection()) {} -grpc::string ProtoServerReflectionPlugin::name() { return "p1"; } +grpc::string ProtoServerReflectionPlugin::name() { + return "proto_server_reflection"; +} void ProtoServerReflectionPlugin::InitServer(grpc::ServerInitializer* si) { - si->RegisterService(reflection_service); + si->RegisterService(reflection_service_); } void ProtoServerReflectionPlugin::Finish(grpc::ServerInitializer* si) { - reflection_service->SetServiceList(si->GetServiceList()); + reflection_service_->SetServiceList(si->GetServiceList()); } void ProtoServerReflectionPlugin::ChangeArguments(const grpc::string& name, void* value) {} bool ProtoServerReflectionPlugin::has_sync_methods() const { - if (reflection_service != nullptr) { - return reflection_service->has_synchronous_methods(); + if (reflection_service_ != nullptr) { + return reflection_service_->has_synchronous_methods(); } return false; } bool ProtoServerReflectionPlugin::has_async_methods() const { - if (reflection_service != nullptr) { - return reflection_service->has_async_methods(); + if (reflection_service_ != nullptr) { + return reflection_service_->has_async_methods(); } return false; } diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index bc25fb0f5c7..c6f7b5f0466 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -31,7 +31,6 @@ * */ -#include #include #include #include From 139098c1882b03bd4571af03a5a7a6694f87e0dd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 6 Jun 2016 08:10:08 -0700 Subject: [PATCH 076/175] Fix cast to avoid potential wraparound --- src/core/lib/transport/metadata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 751305e5d7c..79de54beb59 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -507,8 +507,8 @@ static void grow_mdtab(mdtab_shard *shard) { } static void rehash_mdtab(mdtab_shard *shard) { - if ((size_t)gpr_atm_no_barrier_load(&shard->free_estimate) > - shard->capacity / 4) { + if (gpr_atm_no_barrier_load(&shard->free_estimate) > + (gpr_atm)(shard->capacity / 4)) { gc_mdtab(shard); } else { grow_mdtab(shard); From 1495cb5b249e92ab20d1d7e63b0e627bd7cf2b4c Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 6 Jun 2016 10:58:06 -0700 Subject: [PATCH 077/175] Addressed reveiw comments about naming --- .../impl/proto_server_reflection_plugin.h | 11 ------ .../proto_server_reflection_plugin.cc | 10 ++++-- .../end2end/proto_server_reflection_test.cc | 1 + .../proto_reflection_descriptor_database.cc | 34 ++++++++----------- .../proto_reflection_descriptor_database.h | 4 +++ .../check_pb_files.sh | 3 -- 6 files changed, 27 insertions(+), 36 deletions(-) diff --git a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h index 5bf1ff1bfcc..774d3439e75 100644 --- a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h +++ b/extensions/include/grpc++/impl/proto_server_reflection_plugin.h @@ -59,17 +59,6 @@ class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { std::shared_ptr<::grpc::ProtoServerReflection> reflection_service_; }; -std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection(); - -void grpc_AddServerBuilderPlugin_reflection(); - -// Force AddServerBuilderPlugin() to be called at static initialization time. -static struct StaticPluginInitializer_reflection { - StaticPluginInitializer_reflection() { - grpc_AddServerBuilderPlugin_reflection(); - } -} static_plugin_initializer_reflection; - } // namespace reflection } // namespace grpc diff --git a/extensions/reflection/proto_server_reflection_plugin.cc b/extensions/reflection/proto_server_reflection_plugin.cc index 465a8b9442e..8489adc7e11 100644 --- a/extensions/reflection/proto_server_reflection_plugin.cc +++ b/extensions/reflection/proto_server_reflection_plugin.cc @@ -73,17 +73,23 @@ bool ProtoServerReflectionPlugin::has_async_methods() const { return false; } -std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { +static std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { return std::unique_ptr<::grpc::ServerBuilderPlugin>( new ProtoServerReflectionPlugin()); } -void grpc_AddServerBuilderPlugin_reflection() { +static void AddProtoReflectionServerBuilderPlugin() { static bool already_here = false; if (already_here) return; already_here = true; ::grpc::ServerBuilder::InternalAddPluginFactory(&CreateProtoReflection); } +struct StaticProtoReflectionPluginInitializer { + StaticProtoReflectionPluginInitializer() { + AddProtoReflectionServerBuilderPlugin(); + } +} static_proto_reflection_plugin_initializer; + } // namespace reflection } // namespace grpc diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc index ae770654ffe..300b2091139 100644 --- a/test/cpp/end2end/proto_server_reflection_test.cc +++ b/test/cpp/end2end/proto_server_reflection_test.cc @@ -140,6 +140,7 @@ class ProtoServerReflectionTest : public ::testing::Test { std::unordered_set known_types_; const google::protobuf::DescriptorPool* ref_desc_pool_; int port_; + reflection::ProtoServerReflectionPlugin plugin_; }; TEST_F(ProtoServerReflectionTest, CheckResponseWithLocalDescriptorPool) { diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc index 6513a149928..6907d97bd5e 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -69,10 +69,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileByName( request.set_file_by_filename(filename); ServerReflectionResponse response; - stream_mutex_.lock(); - GetStream()->Write(request); - GetStream()->Read(&response); - stream_mutex_.unlock(); + DoOneRequest(request, response); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { @@ -117,10 +114,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingSymbol( request.set_file_containing_symbol(symbol_name); ServerReflectionResponse response; - stream_mutex_.lock(); - GetStream()->Write(request); - GetStream()->Read(&response); - stream_mutex_.unlock(); + DoOneRequest(request, response); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { @@ -174,10 +168,7 @@ bool ProtoReflectionDescriptorDatabase::FindFileContainingExtension( field_number); ServerReflectionResponse response; - stream_mutex_.lock(); - GetStream()->Write(request); - GetStream()->Read(&response); - stream_mutex_.unlock(); + DoOneRequest(request, response); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kFileDescriptorResponse) { @@ -227,10 +218,7 @@ bool ProtoReflectionDescriptorDatabase::FindAllExtensionNumbers( request.set_all_extension_numbers_of_type(extendee_type); ServerReflectionResponse response; - stream_mutex_.lock(); - GetStream()->Write(request); - GetStream()->Read(&response); - stream_mutex_.unlock(); + DoOneRequest(request, response); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase:: @@ -262,10 +250,7 @@ bool ProtoReflectionDescriptorDatabase::GetServices( request.set_list_services(""); ServerReflectionResponse response; - stream_mutex_.lock(); - GetStream()->Write(request); - GetStream()->Read(&response); - stream_mutex_.unlock(); + DoOneRequest(request, response); if (response.message_response_case() == ServerReflectionResponse::MessageResponseCase::kListServicesResponse) { @@ -319,4 +304,13 @@ ProtoReflectionDescriptorDatabase::GetStream() { return stream_; } +void ProtoReflectionDescriptorDatabase::DoOneRequest( + const ServerReflectionRequest& request, + ServerReflectionResponse& response) { + stream_mutex_.lock(); + GetStream()->Write(request); + GetStream()->Read(&response); + stream_mutex_.unlock(); +} + } // namespace grpc diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index c6f7b5f0466..7656a496c25 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -91,6 +91,10 @@ class ProtoReflectionDescriptorDatabase const std::shared_ptr GetStream(); + void DoOneRequest( + const grpc::reflection::v1alpha::ServerReflectionRequest& request, + grpc::reflection::v1alpha::ServerReflectionResponse& response); + std::shared_ptr stream_; grpc::ClientContext ctx_; std::unique_ptr stub_; diff --git a/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh b/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh index b1af579a74b..62e41755ec1 100755 --- a/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh +++ b/tools/dockerfile/grpc_check_generated_pb_files/check_pb_files.sh @@ -33,9 +33,6 @@ set -e mkdir -p /var/local/git git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc -# copy service account keys if available -cp -r /var/local/jenkins/service_account $HOME || true - cd /var/local/git/grpc # build grpc cpp plugin for generating grpc pb files From 9d69e8082d3af7c79b7402a546f8bea255bc69e3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 6 Jun 2016 11:37:50 -0700 Subject: [PATCH 078/175] Advertise transport selected in user-agent string --- src/core/lib/channel/channel_stack.c | 2 ++ src/core/lib/channel/channel_stack.h | 3 +++ src/core/lib/channel/channel_stack_builder.c | 4 ++-- src/core/lib/channel/http_client_filter.c | 13 +++++++++---- src/core/lib/channel/http_client_filter.h | 2 +- test/core/channel/channel_stack_test.c | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/core/lib/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c index ad182d1f69f..224dd39d9b5 100644 --- a/src/core/lib/channel/channel_stack.c +++ b/src/core/lib/channel/channel_stack.c @@ -106,6 +106,7 @@ void grpc_channel_stack_init(grpc_exec_ctx *exec_ctx, int initial_refs, const grpc_channel_filter **filters, size_t filter_count, const grpc_channel_args *channel_args, + grpc_transport *optional_transport, const char *name, grpc_channel_stack *stack) { size_t call_size = ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack)) + @@ -127,6 +128,7 @@ void grpc_channel_stack_init(grpc_exec_ctx *exec_ctx, int initial_refs, for (i = 0; i < filter_count; i++) { args.channel_stack = stack; args.channel_args = channel_args; + args.optional_transport = optional_transport; args.is_first = i == 0; args.is_last = i == (filter_count - 1); elems[i].filter = filters[i]; diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index 36c17cb467f..88fbe7a968d 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -57,6 +57,8 @@ typedef struct grpc_call_stack grpc_call_stack; typedef struct { grpc_channel_stack *channel_stack; const grpc_channel_args *channel_args; + /** Transport, iff it is known */ + grpc_transport *optional_transport; int is_first; int is_last; } grpc_channel_element_args; @@ -187,6 +189,7 @@ void grpc_channel_stack_init(grpc_exec_ctx *exec_ctx, int initial_refs, grpc_iomgr_cb_func destroy, void *destroy_arg, const grpc_channel_filter **filters, size_t filter_count, const grpc_channel_args *args, + grpc_transport *optional_transport, const char *name, grpc_channel_stack *stack); /* Destroy a channel stack */ void grpc_channel_stack_destroy(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/channel/channel_stack_builder.c b/src/core/lib/channel/channel_stack_builder.c index a8646c95657..eda4968f486 100644 --- a/src/core/lib/channel/channel_stack_builder.c +++ b/src/core/lib/channel/channel_stack_builder.c @@ -257,8 +257,8 @@ void *grpc_channel_stack_builder_finish(grpc_exec_ctx *exec_ctx, // and initialize it grpc_channel_stack_init(exec_ctx, initial_refs, destroy, destroy_arg == NULL ? result : destroy_arg, filters, - num_filters, builder->args, builder->name, - channel_stack); + num_filters, builder->args, builder->transport, + builder->name, channel_stack); // run post-initialization functions i = 0; diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 516e708d1f0..55e87cd67c7 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -38,6 +38,7 @@ #include "src/core/lib/profiling/timers.h" #include "src/core/lib/support/string.h" #include "src/core/lib/transport/static_metadata.h" +#include "src/core/lib/transport/transport_impl.h" typedef struct call_data { grpc_linked_mdelem method; @@ -179,7 +180,8 @@ static grpc_mdelem *scheme_from_args(const grpc_channel_args *args) { return GRPC_MDELEM_SCHEME_HTTP; } -static grpc_mdstr *user_agent_from_args(const grpc_channel_args *args) { +static grpc_mdstr *user_agent_from_args(const grpc_channel_args *args, + const char *transport_name) { gpr_strvec v; size_t i; int is_first = 1; @@ -201,8 +203,8 @@ static grpc_mdstr *user_agent_from_args(const grpc_channel_args *args) { } } - gpr_asprintf(&tmp, "%sgrpc-c/%s (%s)", is_first ? "" : " ", - grpc_version_string(), GPR_PLATFORM_STRING); + gpr_asprintf(&tmp, "%sgrpc-c/%s (%s; %s)", is_first ? "" : " ", + grpc_version_string(), GPR_PLATFORM_STRING, transport_name); is_first = 0; gpr_strvec_add(&v, tmp); @@ -233,9 +235,12 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element_args *args) { channel_data *chand = elem->channel_data; GPR_ASSERT(!args->is_last); + GPR_ASSERT(args->optional_transport != NULL); chand->static_scheme = scheme_from_args(args->channel_args); chand->user_agent = grpc_mdelem_from_metadata_strings( - GRPC_MDSTR_USER_AGENT, user_agent_from_args(args->channel_args)); + GRPC_MDSTR_USER_AGENT, + user_agent_from_args(args->channel_args, + args->optional_transport->vtable->name)); } /* Destructor for channel data */ diff --git a/src/core/lib/channel/http_client_filter.h b/src/core/lib/channel/http_client_filter.h index a884b36318a..47081175ea9 100644 --- a/src/core/lib/channel/http_client_filter.h +++ b/src/core/lib/channel/http_client_filter.h @@ -1,5 +1,4 @@ /* - * * Copyright 2015, Google Inc. * All rights reserved. * @@ -39,6 +38,7 @@ /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_client_filter; +/* Channel arg to override the http2 :scheme header */ #define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme" #endif /* GRPC_CORE_LIB_CHANNEL_HTTP_CLIENT_FILTER_H */ diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index 1a5594bde86..2d7737a3b04 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -123,7 +123,7 @@ static void test_create_channel_stack(void) { channel_stack = gpr_malloc(grpc_channel_stack_size(&filters, 1)); grpc_channel_stack_init(&exec_ctx, 1, free_channel, channel_stack, &filters, - 1, &chan_args, "test", channel_stack); + 1, &chan_args, NULL, "test", channel_stack); GPR_ASSERT(channel_stack->count == 1); channel_elem = grpc_channel_stack_element(channel_stack, 0); channel_data = (int *)channel_elem->channel_data; From 0601df3a04a91e5e731e829989fd93290e301d97 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 6 Jun 2016 13:08:06 -0700 Subject: [PATCH 079/175] Move reflection src/hdr to src/cpp/ext include/grpc++/ext --- BUILD | 16 +++--- Makefile | 29 +++++----- build.yaml | 16 +++--- .../ext}/proto_server_reflection_plugin.h | 0 .../grpc++/ext}/reflection.grpc.pb.h | 2 +- .../grpc++/ext}/reflection.pb.h | 0 .../cpp/ext}/proto_server_reflection.cc | 2 +- .../cpp/ext}/proto_server_reflection.h | 2 +- .../ext}/proto_server_reflection_plugin.cc | 4 +- .../cpp/ext}/reflection.grpc.pb.cc | 4 +- .../cpp/ext}/reflection.pb.cc | 2 +- templates/Makefile.template | 7 +-- .../end2end/proto_server_reflection_test.cc | 2 +- .../proto_reflection_descriptor_database.h | 2 +- .../extensions/gen_reflection_proto.sh | 6 +- tools/run_tests/sources_and_headers.json | 24 ++++---- .../grpc++_reflection.vcxproj | 16 +++--- .../grpc++_reflection.vcxproj.filters | 55 ++++++++++--------- 18 files changed, 95 insertions(+), 94 deletions(-) rename {extensions/include/grpc++/impl => include/grpc++/ext}/proto_server_reflection_plugin.h (100%) rename {extensions/include/grpc++/impl => include/grpc++/ext}/reflection.grpc.pb.h (99%) rename {extensions/include/grpc++/impl => include/grpc++/ext}/reflection.pb.h (100%) rename {extensions/reflection => src/cpp/ext}/proto_server_reflection.cc (99%) rename {extensions/reflection => src/cpp/ext}/proto_server_reflection.h (98%) rename {extensions/reflection => src/cpp/ext}/proto_server_reflection_plugin.cc (96%) rename {extensions/reflection => src/cpp/ext}/reflection.grpc.pb.cc (98%) rename {extensions/reflection => src/cpp/ext}/reflection.pb.cc (99%) diff --git a/BUILD b/BUILD index b47100ad9c4..312ec7df9c9 100644 --- a/BUILD +++ b/BUILD @@ -1000,16 +1000,16 @@ cc_library( cc_library( name = "grpc++_reflection", srcs = [ - "extensions/reflection/proto_server_reflection.h", - "extensions/reflection/proto_server_reflection.cc", - "extensions/reflection/proto_server_reflection_plugin.cc", - "extensions/reflection/reflection.grpc.pb.cc", - "extensions/reflection/reflection.pb.cc", + "src/cpp/ext/proto_server_reflection.h", + "src/cpp/ext/proto_server_reflection.cc", + "src/cpp/ext/proto_server_reflection_plugin.cc", + "src/cpp/ext/reflection.grpc.pb.cc", + "src/cpp/ext/reflection.pb.cc", ], hdrs = [ - "extensions/include/grpc++/impl/proto_server_reflection_plugin.h", - "extensions/include/grpc++/impl/reflection.grpc.pb.h", - "extensions/include/grpc++/impl/reflection.pb.h", + "include/grpc++/ext/proto_server_reflection_plugin.h", + "include/grpc++/ext/reflection.grpc.pb.h", + "include/grpc++/ext/reflection.pb.h", ], includes = [ "include", diff --git a/Makefile b/Makefile index 97377dba034..c63b88fedf6 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,6 @@ BINDIR = $(BUILDDIR_ABSOLUTE)/bins OBJDIR = $(BUILDDIR_ABSOLUTE)/objs LIBDIR = $(BUILDDIR_ABSOLUTE)/libs GENDIR = $(BUILDDIR_ABSOLUTE)/gens -EXTDIR = $(BUILDDIR_ABSOLUTE)/extensions # Configurations @@ -370,7 +369,7 @@ CPPFLAGS += -fPIC LDFLAGS += -fPIC endif -INCLUDES = . include $(GENDIR) $(EXTDIR) $(EXTDIR)/include +INCLUDES = . include $(GENDIR) LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) @@ -2155,8 +2154,8 @@ install-headers_c: install-headers_cxx: $(E) "[INSTALL] Installing public C++ headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(patsubst extensions/%,%,$(dir $(h))) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(patsubst extensions/%,%,$(h)) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 install-static: install-static_c install-static_cxx @@ -3391,15 +3390,15 @@ endif LIBGRPC++_REFLECTION_SRC = \ - extensions/reflection/proto_server_reflection.cc \ - extensions/reflection/proto_server_reflection_plugin.cc \ - extensions/reflection/reflection.grpc.pb.cc \ - extensions/reflection/reflection.pb.cc \ + src/cpp/ext/proto_server_reflection.cc \ + src/cpp/ext/proto_server_reflection_plugin.cc \ + src/cpp/ext/reflection.grpc.pb.cc \ + src/cpp/ext/reflection.pb.cc \ PUBLIC_HEADERS_CXX += \ - extensions/include/grpc++/impl/proto_server_reflection_plugin.h \ - extensions/include/grpc++/impl/reflection.grpc.pb.h \ - extensions/include/grpc++/impl/reflection.pb.h \ + include/grpc++/ext/proto_server_reflection_plugin.h \ + include/grpc++/ext/reflection.grpc.pb.h \ + include/grpc++/ext/reflection.pb.h \ LIBGRPC++_REFLECTION_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_REFLECTION_SRC)))) @@ -14544,10 +14543,6 @@ ifneq ($(OPENSSL_DEP),) # This is to ensure the embedded OpenSSL is built beforehand, properly # installing headers to their final destination on the drive. We need this # otherwise parallel compilation will fail if a source is compiled first. -extensions/reflection/proto_server_reflection.cc: $(OPENSSL_DEP) -extensions/reflection/proto_server_reflection_plugin.cc: $(OPENSSL_DEP) -extensions/reflection/reflection.grpc.pb.cc: $(OPENSSL_DEP) -extensions/reflection/reflection.pb.cc: $(OPENSSL_DEP) src/core/ext/transport/chttp2/client/secure/secure_channel_create.c: $(OPENSSL_DEP) src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c: $(OPENSSL_DEP) src/core/ext/transport/cronet/client/secure/cronet_channel_create.c: $(OPENSSL_DEP) @@ -14578,6 +14573,10 @@ src/cpp/common/auth_property_iterator.cc: $(OPENSSL_DEP) src/cpp/common/secure_auth_context.cc: $(OPENSSL_DEP) src/cpp/common/secure_channel_arguments.cc: $(OPENSSL_DEP) src/cpp/common/secure_create_auth_context.cc: $(OPENSSL_DEP) +src/cpp/ext/proto_server_reflection.cc: $(OPENSSL_DEP) +src/cpp/ext/proto_server_reflection_plugin.cc: $(OPENSSL_DEP) +src/cpp/ext/reflection.grpc.pb.cc: $(OPENSSL_DEP) +src/cpp/ext/reflection.pb.cc: $(OPENSSL_DEP) src/cpp/server/secure_server_credentials.cc: $(OPENSSL_DEP) src/csharp/ext/grpc_csharp_ext.c: $(OPENSSL_DEP) test/core/bad_client/bad_client.c: $(OPENSSL_DEP) diff --git a/build.yaml b/build.yaml index 420a64bcf7f..a9c2f3b5529 100644 --- a/build.yaml +++ b/build.yaml @@ -904,16 +904,16 @@ libs: build: all language: c++ public_headers: - - extensions/include/grpc++/impl/proto_server_reflection_plugin.h - - extensions/include/grpc++/impl/reflection.grpc.pb.h - - extensions/include/grpc++/impl/reflection.pb.h + - include/grpc++/ext/proto_server_reflection_plugin.h + - include/grpc++/ext/reflection.grpc.pb.h + - include/grpc++/ext/reflection.pb.h headers: - - extensions/reflection/proto_server_reflection.h + - src/cpp/ext/proto_server_reflection.h src: - - extensions/reflection/proto_server_reflection.cc - - extensions/reflection/proto_server_reflection_plugin.cc - - extensions/reflection/reflection.grpc.pb.cc - - extensions/reflection/reflection.pb.cc + - src/cpp/ext/proto_server_reflection.cc + - src/cpp/ext/proto_server_reflection_plugin.cc + - src/cpp/ext/reflection.grpc.pb.cc + - src/cpp/ext/reflection.pb.cc uses: - grpc++_base - name: grpc++_test_config diff --git a/extensions/include/grpc++/impl/proto_server_reflection_plugin.h b/include/grpc++/ext/proto_server_reflection_plugin.h similarity index 100% rename from extensions/include/grpc++/impl/proto_server_reflection_plugin.h rename to include/grpc++/ext/proto_server_reflection_plugin.h diff --git a/extensions/include/grpc++/impl/reflection.grpc.pb.h b/include/grpc++/ext/reflection.grpc.pb.h similarity index 99% rename from extensions/include/grpc++/impl/reflection.grpc.pb.h rename to include/grpc++/ext/reflection.grpc.pb.h index e49a1b3f509..0b4ef861472 100644 --- a/extensions/include/grpc++/impl/reflection.grpc.pb.h +++ b/include/grpc++/ext/reflection.grpc.pb.h @@ -70,7 +70,7 @@ #ifndef GRPC_reflection_2eproto__INCLUDED #define GRPC_reflection_2eproto__INCLUDED -#include +#include #include #include diff --git a/extensions/include/grpc++/impl/reflection.pb.h b/include/grpc++/ext/reflection.pb.h similarity index 100% rename from extensions/include/grpc++/impl/reflection.pb.h rename to include/grpc++/ext/reflection.pb.h diff --git a/extensions/reflection/proto_server_reflection.cc b/src/cpp/ext/proto_server_reflection.cc similarity index 99% rename from extensions/reflection/proto_server_reflection.cc rename to src/cpp/ext/proto_server_reflection.cc index f3cf7958e84..6e54bc27207 100644 --- a/extensions/reflection/proto_server_reflection.cc +++ b/src/cpp/ext/proto_server_reflection.cc @@ -36,7 +36,7 @@ #include -#include "reflection/proto_server_reflection.h" +#include "src/cpp/ext/proto_server_reflection.h" using grpc::Status; using grpc::StatusCode; diff --git a/extensions/reflection/proto_server_reflection.h b/src/cpp/ext/proto_server_reflection.h similarity index 98% rename from extensions/reflection/proto_server_reflection.h rename to src/cpp/ext/proto_server_reflection.h index 71b316816c2..e7ab1fdf346 100644 --- a/extensions/reflection/proto_server_reflection.h +++ b/src/cpp/ext/proto_server_reflection.h @@ -39,7 +39,7 @@ #include -#include +#include namespace grpc { diff --git a/extensions/reflection/proto_server_reflection_plugin.cc b/src/cpp/ext/proto_server_reflection_plugin.cc similarity index 96% rename from extensions/reflection/proto_server_reflection_plugin.cc rename to src/cpp/ext/proto_server_reflection_plugin.cc index 8489adc7e11..becc9493595 100644 --- a/extensions/reflection/proto_server_reflection_plugin.cc +++ b/src/cpp/ext/proto_server_reflection_plugin.cc @@ -31,12 +31,12 @@ * */ -#include +#include #include #include #include -#include "reflection/proto_server_reflection.h" +#include "src/cpp/ext/proto_server_reflection.h" namespace grpc { namespace reflection { diff --git a/extensions/reflection/reflection.grpc.pb.cc b/src/cpp/ext/reflection.grpc.pb.cc similarity index 98% rename from extensions/reflection/reflection.grpc.pb.cc rename to src/cpp/ext/reflection.grpc.pb.cc index e8a376c3f29..b046dfc1b8b 100644 --- a/extensions/reflection/reflection.grpc.pb.cc +++ b/src/cpp/ext/reflection.grpc.pb.cc @@ -36,8 +36,8 @@ // If you make any local change, they will be lost. // source: reflection.proto -#include -#include +#include +#include #include #include diff --git a/extensions/reflection/reflection.pb.cc b/src/cpp/ext/reflection.pb.cc similarity index 99% rename from extensions/reflection/reflection.pb.cc rename to src/cpp/ext/reflection.pb.cc index a6184f048ff..b73a65d0a02 100644 --- a/extensions/reflection/reflection.pb.cc +++ b/src/cpp/ext/reflection.pb.cc @@ -36,7 +36,7 @@ // source: reflection.proto #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include +#include #include diff --git a/templates/Makefile.template b/templates/Makefile.template index aa7b8bb0e2d..0d5f0ec5b53 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -113,7 +113,6 @@ OBJDIR = $(BUILDDIR_ABSOLUTE)/objs LIBDIR = $(BUILDDIR_ABSOLUTE)/libs GENDIR = $(BUILDDIR_ABSOLUTE)/gens - EXTDIR = $(BUILDDIR_ABSOLUTE)/extensions # Configurations @@ -248,7 +247,7 @@ LDFLAGS += -fPIC endif - INCLUDES = . include $(GENDIR) $(EXTDIR) $(EXTDIR)/include + INCLUDES = . include $(GENDIR) LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) @@ -1289,8 +1288,8 @@ install-headers_cxx: $(E) "[INSTALL] Installing public C++ headers" - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(patsubst extensions/%,%,$(dir $(h))) && ) exit 0 || exit 1 - $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(patsubst extensions/%,%,$(h)) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 + $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 install-static: install-static_c install-static_cxx diff --git a/test/cpp/end2end/proto_server_reflection_test.cc b/test/cpp/end2end/proto_server_reflection_test.cc index 300b2091139..f8fc39b5535 100644 --- a/test/cpp/end2end/proto_server_reflection_test.cc +++ b/test/cpp/end2end/proto_server_reflection_test.cc @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index 7656a496c25..d7b2163ceaf 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -40,7 +40,7 @@ #include #include #include -#include +#include namespace grpc { diff --git a/tools/codegen/extensions/gen_reflection_proto.sh b/tools/codegen/extensions/gen_reflection_proto.sh index de970b9f7fe..45a1a9f4ec1 100755 --- a/tools/codegen/extensions/gen_reflection_proto.sh +++ b/tools/codegen/extensions/gen_reflection_proto.sh @@ -31,9 +31,9 @@ PROTO_DIR="src/proto/grpc/reflection/v1alpha" PROTO_FILE="reflection" -HEADER_DIR="extensions/include/grpc++/impl" -SRC_DIR="extensions/reflection" -INCLUDE_DIR="grpc++/impl" +HEADER_DIR="include/grpc++/ext" +SRC_DIR="src/cpp/ext" +INCLUDE_DIR="grpc++/ext" TMP_DIR="tmp" GRPC_PLUGIN="bins/opt/grpc_cpp_plugin" PROTOC=third_party/protobuf/src/protoc diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 7ad61845d5c..f41bb09adb1 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -4375,22 +4375,22 @@ "grpc++_base" ], "headers": [ - "extensions/include/grpc++/impl/proto_server_reflection_plugin.h", - "extensions/include/grpc++/impl/reflection.grpc.pb.h", - "extensions/include/grpc++/impl/reflection.pb.h", - "extensions/reflection/proto_server_reflection.h" + "include/grpc++/ext/proto_server_reflection_plugin.h", + "include/grpc++/ext/reflection.grpc.pb.h", + "include/grpc++/ext/reflection.pb.h", + "src/cpp/ext/proto_server_reflection.h" ], "language": "c++", "name": "grpc++_reflection", "src": [ - "extensions/include/grpc++/impl/proto_server_reflection_plugin.h", - "extensions/include/grpc++/impl/reflection.grpc.pb.h", - "extensions/include/grpc++/impl/reflection.pb.h", - "extensions/reflection/proto_server_reflection.cc", - "extensions/reflection/proto_server_reflection.h", - "extensions/reflection/proto_server_reflection_plugin.cc", - "extensions/reflection/reflection.grpc.pb.cc", - "extensions/reflection/reflection.pb.cc" + "include/grpc++/ext/proto_server_reflection_plugin.h", + "include/grpc++/ext/reflection.grpc.pb.h", + "include/grpc++/ext/reflection.pb.h", + "src/cpp/ext/proto_server_reflection.cc", + "src/cpp/ext/proto_server_reflection.h", + "src/cpp/ext/proto_server_reflection_plugin.cc", + "src/cpp/ext/reflection.grpc.pb.cc", + "src/cpp/ext/reflection.pb.cc" ], "third_party": false, "type": "lib" diff --git a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj index 82b2b85f9eb..75c9e8e5911 100644 --- a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj +++ b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj @@ -147,21 +147,21 @@ - - - + + + - + - + - + - + - + diff --git a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters index a5457bed008..70d3d45372a 100644 --- a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters @@ -1,51 +1,54 @@ - - extensions\reflection + + src\cpp\ext - - extensions\reflection + + src\cpp\ext - - extensions\reflection + + src\cpp\ext - - extensions\reflection + + src\cpp\ext - - extensions\include\grpc++\impl + + include\grpc++\ext - - extensions\include\grpc++\impl + + include\grpc++\ext - - extensions\include\grpc++\impl + + include\grpc++\ext - - extensions\reflection + + src\cpp\ext - - {8fd45ce8-8f02-367f-e3f7-4c0ae0e36566} + + {e9441021-f78a-ec84-7efd-1883975feddb} - - {1a18dfcc-bedf-226e-6929-377aba53249b} + + {c66e66b4-a64e-79bf-40e8-1a1bac124a3d} - - {83bf0cce-01da-a93c-0ff3-a1abca63ec5f} + + {8d96203b-d3ce-2164-74a6-06e0ff2b09af} - - {d34e8821-f67b-a793-3419-e2781ab9b3ee} + + {5ec5476e-3d72-e3f9-4f05-3f7c31c13651} - - {11feb184-a1d9-5485-26f0-538ddb50deff} + + {a642ac8e-cec2-35d3-9a8a-78313d03b440} + + + {d0204618-0f6a-dbc6-cf41-ffc04e76075a} From 7ae31a88980cba5e7e0173cad91e62dbfe1b0374 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 6 Jun 2016 14:21:11 -0700 Subject: [PATCH 080/175] Add more comments, fix format issues --- .../ext/proto_server_reflection_plugin.h | 10 +++-- src/cpp/ext/proto_server_reflection.cc | 14 ++++--- src/cpp/ext/proto_server_reflection.h | 22 +++++------ src/cpp/ext/proto_server_reflection_plugin.cc | 6 ++- .../proto_reflection_descriptor_database.h | 37 +++++++++++++++---- tools/distrib/check_include_guards.py | 2 + .../clang_format_all_the_things.sh | 2 +- .../sanity/check_sources_and_headers.py | 3 -- 8 files changed, 63 insertions(+), 33 deletions(-) diff --git a/include/grpc++/ext/proto_server_reflection_plugin.h b/include/grpc++/ext/proto_server_reflection_plugin.h index 774d3439e75..517c4737f59 100644 --- a/include/grpc++/ext/proto_server_reflection_plugin.h +++ b/include/grpc++/ext/proto_server_reflection_plugin.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H -#define GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H +#ifndef GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H +#define GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H #include #include @@ -59,7 +59,11 @@ class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { std::shared_ptr<::grpc::ProtoServerReflection> reflection_service_; }; +// Add proto reflection plugin to ServerBuilder. This function should be called +// at the static initialization time. +void InitProtoReflectionServerBuilderPlugin(); + } // namespace reflection } // namespace grpc -#endif // GRPCXX_PROTO_SERVER_REFLECTION_PLUGIN_H +#endif // GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H diff --git a/src/cpp/ext/proto_server_reflection.cc b/src/cpp/ext/proto_server_reflection.cc index 6e54bc27207..348a035f0f3 100644 --- a/src/cpp/ext/proto_server_reflection.cc +++ b/src/cpp/ext/proto_server_reflection.cc @@ -131,7 +131,8 @@ Status ProtoServerReflection::GetFileByName( return Status::CANCELLED; } - const protobuf::FileDescriptor* file_desc = descriptor_pool_->FindFileByName(filename); + const protobuf::FileDescriptor* file_desc = + descriptor_pool_->FindFileByName(filename); if (file_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "File not found."); } @@ -170,8 +171,9 @@ Status ProtoServerReflection::GetFileContainingExtension( return Status(StatusCode::NOT_FOUND, "Type not found."); } - const protobuf::FieldDescriptor* field_desc = descriptor_pool_->FindExtensionByNumber( - desc, request->extension_number()); + const protobuf::FieldDescriptor* field_desc = + descriptor_pool_->FindExtensionByNumber(desc, + request->extension_number()); if (field_desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Extension not found."); } @@ -187,7 +189,8 @@ Status ProtoServerReflection::GetAllExtensionNumbers( return Status::CANCELLED; } - const protobuf::Descriptor* desc = descriptor_pool_->FindMessageTypeByName(type); + const protobuf::Descriptor* desc = + descriptor_pool_->FindMessageTypeByName(type); if (desc == nullptr) { return Status(StatusCode::NOT_FOUND, "Type not found."); } @@ -202,7 +205,8 @@ Status ProtoServerReflection::GetAllExtensionNumbers( } void ProtoServerReflection::FillFileDescriptorResponse( - const protobuf::FileDescriptor* file_desc, ServerReflectionResponse* response, + const protobuf::FileDescriptor* file_desc, + ServerReflectionResponse* response, std::unordered_set* seen_files) { if (seen_files->find(file_desc->name()) != seen_files->end()) { return; diff --git a/src/cpp/ext/proto_server_reflection.h b/src/cpp/ext/proto_server_reflection.h index e7ab1fdf346..23c130513d1 100644 --- a/src/cpp/ext/proto_server_reflection.h +++ b/src/cpp/ext/proto_server_reflection.h @@ -30,16 +30,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -#ifndef GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H -#define GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H +#ifndef GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H +#define GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H #include #include -#include - #include +#include namespace grpc { @@ -48,21 +46,23 @@ class ProtoServerReflection GRPC_FINAL public: ProtoServerReflection(); + // Add the full names of registered services void SetServiceList(const std::vector* services); + // implementation of ServerReflectionInfo(stream ServerReflectionRequest) rpc + // in ServerReflection service Status ServerReflectionInfo( ServerContext* context, ServerReaderWriter* - stream) GRPC_OVERRIDE; + reflection::v1alpha::ServerReflectionRequest>* stream) + GRPC_OVERRIDE; private: Status ListService(ServerContext* context, reflection::v1alpha::ListServiceResponse* response); - Status GetFileByName( - ServerContext* context, const grpc::string& file_name, - reflection::v1alpha::ServerReflectionResponse* response); + Status GetFileByName(ServerContext* context, const grpc::string& file_name, + reflection::v1alpha::ServerReflectionResponse* response); Status GetFileContainingSymbol( ServerContext* context, const grpc::string& symbol, @@ -91,4 +91,4 @@ class ProtoServerReflection GRPC_FINAL } // namespace grpc -#endif // GRPC_EXTENSIONS_REFLECTION_PROTO_SERVER_REFLECTION_H +#endif // GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H diff --git a/src/cpp/ext/proto_server_reflection_plugin.cc b/src/cpp/ext/proto_server_reflection_plugin.cc index becc9493595..f31d102a9e6 100644 --- a/src/cpp/ext/proto_server_reflection_plugin.cc +++ b/src/cpp/ext/proto_server_reflection_plugin.cc @@ -78,16 +78,18 @@ static std::unique_ptr<::grpc::ServerBuilderPlugin> CreateProtoReflection() { new ProtoServerReflectionPlugin()); } -static void AddProtoReflectionServerBuilderPlugin() { +void InitProtoReflectionServerBuilderPlugin() { static bool already_here = false; if (already_here) return; already_here = true; ::grpc::ServerBuilder::InternalAddPluginFactory(&CreateProtoReflection); } +// Force InitProtoReflectionServerBuilderPlugin() to be called at static +// initialization time. struct StaticProtoReflectionPluginInitializer { StaticProtoReflectionPluginInitializer() { - AddProtoReflectionServerBuilderPlugin(); + InitProtoReflectionServerBuilderPlugin(); } } static_proto_reflection_plugin_initializer; diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h index d7b2163ceaf..99c00675bb3 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.h +++ b/test/cpp/util/proto_reflection_descriptor_database.h @@ -30,6 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#ifndef GRPC_TEST_CPP_PROTO_SERVER_REFLECTION_DATABSE_H +#define GRPC_TEST_CPP_PROTO_SERVER_REFLECTION_DATABSE_H #include #include @@ -39,11 +41,14 @@ #include #include #include -#include #include +#include namespace grpc { +// ProtoReflectionDescriptorDatabase takes a stub of ServerReflection and +// provides the methods defined by DescriptorDatabase interfaces. It can be used +// to feed a DescriptorPool instance. class ProtoReflectionDescriptorDatabase : public google::protobuf::DescriptorDatabase { public: @@ -55,28 +60,42 @@ class ProtoReflectionDescriptorDatabase virtual ~ProtoReflectionDescriptorDatabase(); - // DescriptorDatabase methods + // The following four methods implement DescriptorDatabase interfaces. + // + // Find a file by file name. Fills in in *output and returns true if found. + // Otherwise, returns false, leaving the contents of *output undefined. bool FindFileByName(const string& filename, google::protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; + // Find the file that declares the given fully-qualified symbol name. + // If found, fills in *output and returns true, otherwise returns false + // and leaves *output undefined. bool FindFileContainingSymbol(const string& symbol_name, google::protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; + // Find the file which defines an extension extending the given message type + // with the given field number. If found, fills in *output and returns true, + // otherwise returns false and leaves *output undefined. containing_type + // must be a fully-qualified type name. bool FindFileContainingExtension( const string& containing_type, int field_number, google::protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; + // Finds the tag numbers used by all known extensions of + // extendee_type, and appends them to output in an undefined + // order. This method is best-effort: it's not guaranteed that the + // database will find all extensions, and it's not guaranteed that + // FindFileContainingExtension will return true on all of the found + // numbers. Returns true if the search was successful, otherwise + // returns false and leaves output unchanged. bool FindAllExtensionNumbers(const string& extendee_type, std::vector* output) GRPC_OVERRIDE; + // Provide a list of full names of registered services bool GetServices(std::vector* output); - grpc::reflection::v1alpha::ServerReflection::Stub* stub() { - return stub_.get(); - } - private: typedef ClientReaderWriter< grpc::reflection::v1alpha::ServerReflectionRequest, @@ -92,8 +111,8 @@ class ProtoReflectionDescriptorDatabase const std::shared_ptr GetStream(); void DoOneRequest( - const grpc::reflection::v1alpha::ServerReflectionRequest& request, - grpc::reflection::v1alpha::ServerReflectionResponse& response); + const grpc::reflection::v1alpha::ServerReflectionRequest& request, + grpc::reflection::v1alpha::ServerReflectionResponse& response); std::shared_ptr stream_; grpc::ClientContext ctx_; @@ -108,3 +127,5 @@ class ProtoReflectionDescriptorDatabase }; } // namespace grpc + +#endif // GRPC_TEST_CPP_METRICS_SERVER_H diff --git a/tools/distrib/check_include_guards.py b/tools/distrib/check_include_guards.py index 9c23a70e001..874ddfe53a1 100755 --- a/tools/distrib/check_include_guards.py +++ b/tools/distrib/check_include_guards.py @@ -171,6 +171,8 @@ args = argp.parse_args() KNOWN_BAD = set([ 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h', + 'include/grpc++/ext/reflection.grpc.pb.h', + 'include/grpc++/ext/reflection.pb.h', ]) diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh index 6f4155944c3..eab7611b3f3 100755 --- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh +++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh @@ -44,7 +44,7 @@ for dir in $DIRS do for glob in $GLOB do - files="$files `find /local-code/$dir -name $glob -and -not -name *.generated.* -and -not -name *.pb.h -and -not -name *.pb.c`" + files="$files `find /local-code/$dir -name $glob -and -not -name *.generated.* -and -not -name *.pb.h -and -not -name *.pb.c -and -not -name *.pb.cc`" done done diff --git a/tools/run_tests/sanity/check_sources_and_headers.py b/tools/run_tests/sanity/check_sources_and_headers.py index 0eb804eb5b0..c028499ca63 100755 --- a/tools/run_tests/sanity/check_sources_and_headers.py +++ b/tools/run_tests/sanity/check_sources_and_headers.py @@ -57,9 +57,6 @@ def target_has_header(target, name): return True if name == 'src/core/lib/profiling/stap_probes.h': return True - if not name.startswith('extensions') \ - and target_has_header(target, 'extensions/' + name): - return True return False def produces_object(name): From a2bc0ccb500f0fffcdd263420133b4a0d0cbad2d Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 6 Jun 2016 16:21:59 -0700 Subject: [PATCH 081/175] Get transport from transport global Avoid introducing cancel_stream_cb_arg --- .../chttp2/transport/chttp2_transport.c | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index d0c94e6c463..43e9ca1ff56 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1529,26 +1529,20 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, 1); } -typedef struct { - grpc_exec_ctx *exec_ctx; - gpr_slice *optional_drop_message; -} cancel_stream_cb_arg; - static void cancel_stream_cb(grpc_chttp2_transport_global *transport_global, void *user_data, grpc_chttp2_stream_global *stream_global) { - cancel_stream_cb_arg *arg = user_data; - cancel_from_api(arg->exec_ctx, transport_global, stream_global, - GRPC_STATUS_UNAVAILABLE, arg->optional_drop_message); + grpc_chttp2_transport *transport = TRANSPORT_FROM_GLOBAL(transport_global); + cancel_from_api(user_data, transport_global, stream_global, + GRPC_STATUS_UNAVAILABLE, + GPR_SLICE_IS_EMPTY(transport->optional_drop_message) + ? NULL + : &transport->optional_drop_message); } static void end_all_the_calls(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { - cancel_stream_cb_arg arg = {exec_ctx, - GPR_SLICE_IS_EMPTY(t->optional_drop_message) - ? NULL - : &t->optional_drop_message}; - grpc_chttp2_for_all_streams(&t->global, &arg, cancel_stream_cb); + grpc_chttp2_for_all_streams(&t->global, exec_ctx, cancel_stream_cb); } static void drop_connection(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { From d4b4009c3773a31e5fe48fb6cc0a6f9d859781a4 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Mon, 6 Jun 2016 17:03:05 -0700 Subject: [PATCH 082/175] Use Python namespace packages Before, namespace packages would break in auditwheel due to a superfluous check (fixed in the commit referenced in the Dockerfiles). Now, the auditwheel used in the manylinux1-support Docker images can handle namespace packages, and we may thus use them. This should alleviate future user pain w.r.t. installation of grpcio-tools causing loss of grpcio files and vice versa (e.g. requiring a reinstall of grpcio following installation of grpcio-tools). --- setup.py | 3 +-- tools/distrib/python/grpcio_tools/setup.py | 3 +-- .../grpc_artifact_python_manylinux_x64/Dockerfile | 7 +++++++ .../grpc_artifact_python_manylinux_x86/Dockerfile | 7 +++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index f96824fa883..88f859246a8 100644 --- a/setup.py +++ b/setup.py @@ -234,8 +234,7 @@ setuptools.setup( ext_modules=CYTHON_EXTENSION_MODULES, packages=list(PACKAGES), package_dir=PACKAGE_DIRECTORIES, - # TODO(atash): Figure out why auditwheel doesn't like namespace packages. - #namespace_packages=['grpc'], + namespace_packages=['grpc'], package_data=PACKAGE_DATA, install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index 576f7ae32a5..bb08ceaadad 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -88,8 +88,7 @@ setuptools.setup( protoc_ext_module(), ]), packages=setuptools.find_packages('.'), - # TODO(atash): Figure out why auditwheel doesn't like namespace packages. - #namespace_packages=['grpc'], + namespace_packages=['grpc'], install_requires=[ 'protobuf>=3.0.0a3', ], diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile index 3e31a2b623d..1d4e8e1a4a4 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile @@ -41,3 +41,10 @@ RUN /opt/python/cp27-cp27mu/bin/pip install cython RUN /opt/python/cp34-cp34m/bin/pip install cython RUN /opt/python/cp35-cp35m/bin/pip install cython +#################################################### +# Install auditwheel with fix for namespace packages +RUN git clone https://github.com/pypa/auditwheel /usr/local/src/auditwheel +RUN cd /usr/local/src/auditwheel && git checkout bf071b38c9fe78b025ea05c78b1cb61d7cb09939 +RUN /opt/python/cp35-cp35m/bin/pip install /usr/local/src/auditwheel +RUN rm /usr/local/bin/auditwheel +RUN cd /usr/local/bin && ln -s /opt/python/cp35-cp35m/bin/auditwheel diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile index 5fe62c28b73..810499695ec 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile @@ -41,3 +41,10 @@ RUN /opt/python/cp27-cp27mu/bin/pip install cython RUN /opt/python/cp34-cp34m/bin/pip install cython RUN /opt/python/cp35-cp35m/bin/pip install cython +#################################################### +# Install auditwheel with fix for namespace packages +RUN git clone https://github.com/pypa/auditwheel /usr/local/src/auditwheel +RUN cd /usr/local/src/auditwheel && git checkout bf071b38c9fe78b025ea05c78b1cb61d7cb09939 +RUN /opt/python/cp35-cp35m/bin/pip install /usr/local/src/auditwheel +RUN rm /usr/local/bin/auditwheel +RUN cd /usr/local/bin && ln -s /opt/python/cp35-cp35m/bin/auditwheel From 571c12ef18ab9021bfaadac3434c5321d6297c38 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Mon, 6 Jun 2016 23:13:27 -0700 Subject: [PATCH 083/175] Remove AsyncStreaming client from python qps tests --- .../grpcio/tests/qps/benchmark_client.py | 45 ------------------- src/python/grpcio/tests/qps/qps_worker.py | 4 +- src/python/grpcio/tests/qps/worker_server.py | 5 +-- .../run_tests/performance/scenario_config.py | 8 ++-- 4 files changed, 7 insertions(+), 55 deletions(-) diff --git a/src/python/grpcio/tests/qps/benchmark_client.py b/src/python/grpcio/tests/qps/benchmark_client.py index b372ea01ade..aac218ed819 100644 --- a/src/python/grpcio/tests/qps/benchmark_client.py +++ b/src/python/grpcio/tests/qps/benchmark_client.py @@ -185,48 +185,3 @@ class StreamingSyncBenchmarkClient(BenchmarkClient): yield request except queue.Empty: pass - - -class AsyncReceiver(face.ResponseReceiver): - """Receiver for async stream responses.""" - - def __init__(self, send_time_queue, response_handler): - self._send_time_queue = send_time_queue - self._response_handler = response_handler - - def initial_metadata(self, initial_mdetadata): - pass - - def response(self, response): - end_time = time.time() - self._response_handler(end_time - self._send_time_queue.get_nowait()) - - def complete(self, terminal_metadata, code, details): - pass - - -class StreamingAsyncBenchmarkClient(BenchmarkClient): - - def __init__(self, server, config, hist): - super(StreamingAsyncBenchmarkClient, self).__init__(server, config, hist) - self._send_time_queue = queue.Queue() - self._receiver = AsyncReceiver(self._send_time_queue, self._handle_response) - self._rendezvous = None - - def send_request(self): - if self._rendezvous is not None: - self._send_time_queue.put(time.time()) - self._rendezvous.consume(self._request) - - def start(self): - if self._generic: - stream_callable = self._stub.stream_stream( - 'grpc.testing.BenchmarkService', 'StreamingCall') - else: - stream_callable = self._stub.StreamingCall - self._rendezvous = stream_callable.event( - self._receiver, lambda *args: None, _TIMEOUT) - - def stop(self): - self._rendezvous.terminate() - self._rendezvous = None diff --git a/src/python/grpcio/tests/qps/qps_worker.py b/src/python/grpcio/tests/qps/qps_worker.py index 3dda718638e..16926379a5b 100644 --- a/src/python/grpcio/tests/qps/qps_worker.py +++ b/src/python/grpcio/tests/qps/qps_worker.py @@ -43,9 +43,7 @@ def run_worker_server(port): server.add_insecure_port('[::]:{}'.format(port)) server.start() servicer.wait_for_quit() - # Drain outstanding requests for clean exit - time.sleep(2) - server.stop(0) + server.stop(2) if __name__ == '__main__': diff --git a/src/python/grpcio/tests/qps/worker_server.py b/src/python/grpcio/tests/qps/worker_server.py index 1f9af5482cc..d41f8377c2a 100644 --- a/src/python/grpcio/tests/qps/worker_server.py +++ b/src/python/grpcio/tests/qps/worker_server.py @@ -153,9 +153,8 @@ class WorkerServer(services_pb2.BetaWorkerServiceServicer): if config.rpc_type == control_pb2.UNARY: client = benchmark_client.UnaryAsyncBenchmarkClient( server, config, qps_data) - elif config.rpc_type == control_pb2.STREAMING: - client = benchmark_client.StreamingAsyncBenchmarkClient( - server, config, qps_data) + else: + raise Exception('Async streaming client not supported') else: raise Exception('Unsupported client type {}'.format(config.client_type)) diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index b55d728d840..81569e8b7a4 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -395,8 +395,8 @@ class PythonLanguage: # categories=[SMOKETEST]) yield _ping_pong_scenario( - 'python_protobuf_async_streaming_ping_pong', rpc_type='STREAMING', - client_type='ASYNC_CLIENT', server_type='SYNC_SERVER') + 'python_protobuf_sync_streaming_ping_pong', rpc_type='STREAMING', + client_type='SYNC_CLIENT', server_type='SYNC_SERVER') yield _ping_pong_scenario( 'python_protobuf_async_unary_ping_pong', rpc_type='UNARY', @@ -413,8 +413,8 @@ class PythonLanguage: unconstrained_client='sync') yield _ping_pong_scenario( - 'python_protobuf_async_streaming_qps_unconstrained', rpc_type='STREAMING', - client_type='ASYNC_CLIENT', server_type='SYNC_SERVER', + 'python_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING', + client_type='SYNC_CLIENT', server_type='SYNC_SERVER', unconstrained_client='async') yield _ping_pong_scenario( From 000aa457dccfb684136635647ff42b1fce58073f Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 7 Jun 2016 13:08:39 -0700 Subject: [PATCH 084/175] add a test with empty request --- test/cpp/end2end/end2end_test.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index f52aa52f39f..e3667cf26bd 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1014,6 +1014,16 @@ TEST_P(ProxyEnd2endTest, SimpleRpc) { SendRpc(stub_.get(), 1, false); } +TEST_P(ProxyEnd2endTest, SimpleRpcWithEmptyMessages) { + ResetStub(); + EchoRequest request; + EchoResponse response; + + ClientContext context; + Status s = stub_->Echo(&context, request, &response); + EXPECT_TRUE(s.ok()); +} + TEST_P(ProxyEnd2endTest, MultipleRpcs) { ResetStub(); std::vector threads; From 5cdc9b9181b990a29cffaf797e3396d25017cd1e Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 7 Jun 2016 13:24:35 -0700 Subject: [PATCH 085/175] added comment about host parameter format (issue 4147) --- src/objective-c/GRPCClient/GRPCCall.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 7a77ae60b6a..b9e741dfa8f 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -220,6 +220,8 @@ extern id const kGRPCTrailersKey; * messages to the response side of the call indefinitely (depending on the semantics of the * specific remote method called). * To finish a call right away, invoke cancel. + * host parameter should not contain the scheme (http:// or https://), only the name or IP addr + * and the port number, for example @"localhost:5050". */ - (instancetype)initWithHost:(NSString *)host path:(NSString *)path From b43bda43ec86607449e446de37c4d357a437589c Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 7 Jun 2016 13:40:36 -0700 Subject: [PATCH 086/175] added comment about host parameter format (issue 4147) --- src/objective-c/ProtoRPC/ProtoRPC.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index bd926b73287..642b8890ffb 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -38,6 +38,10 @@ @interface ProtoRPC : GRPCCall +/* + * host parameter should not contain the scheme (http:// or https://), only the name or IP addr + * and the port number, for example @"localhost:5050". + */ - (instancetype)initWithHost:(NSString *)host method:(ProtoMethod *)method requestsWriter:(GRXWriter *)requestsWriter From c6bf5f79b27be43e9fd3ab82273b62303d593708 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 7 Jun 2016 14:41:01 -0700 Subject: [PATCH 087/175] Use deps instead of uses in build.yaml --- BUILD | 1 + Makefile | 10 +++++----- build.yaml | 4 ++-- tools/run_tests/sources_and_headers.json | 2 +- vsprojects/grpc.sln | 3 +++ .../grpc++_reflection/grpc++_reflection.vcxproj | 5 +++++ 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/BUILD b/BUILD index 312ec7df9c9..bde9df99bc3 100644 --- a/BUILD +++ b/BUILD @@ -1016,6 +1016,7 @@ cc_library( ".", ], deps = [ + ":grpc++", ], ) diff --git a/Makefile b/Makefile index c63b88fedf6..2e5e667c7e1 100644 --- a/Makefile +++ b/Makefile @@ -3435,18 +3435,18 @@ endif ifeq ($(SYSTEM),MINGW32) -$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(OPENSSL_DEP) +$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc++.$(SHARED_EXT) $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++_reflection.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++_reflection.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++-imp else -$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(OPENSSL_DEP) +$(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++ else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_REFLECTION_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) -lgrpc++ $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).so.0 $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION).so endif diff --git a/build.yaml b/build.yaml index a9c2f3b5529..0376d2f86ca 100644 --- a/build.yaml +++ b/build.yaml @@ -914,8 +914,8 @@ libs: - src/cpp/ext/proto_server_reflection_plugin.cc - src/cpp/ext/reflection.grpc.pb.cc - src/cpp/ext/reflection.pb.cc - uses: - - grpc++_base + deps: + - grpc++ - name: grpc++_test_config build: private language: c++ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index f41bb09adb1..6110b024578 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -4372,7 +4372,7 @@ }, { "deps": [ - "grpc++_base" + "grpc++" ], "headers": [ "include/grpc++/ext/proto_server_reflection_plugin.h", diff --git a/vsprojects/grpc.sln b/vsprojects/grpc.sln index dcb5e212fa0..df6ffd8516e 100644 --- a/vsprojects/grpc.sln +++ b/vsprojects/grpc.sln @@ -97,6 +97,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_reflection", "vcxpro ProjectSection(myProperties) = preProject lib = "True" EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} = {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_unsecure", "vcxproj\.\grpc++_unsecure\grpc++_unsecure.vcxproj", "{6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}" ProjectSection(myProperties) = preProject diff --git a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj index 75c9e8e5911..cbb7c7c76ff 100644 --- a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj +++ b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj @@ -164,6 +164,11 @@ + + + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + + From 150e5025cb6535eb1387bdf7482f5f61243cdd71 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 7 Jun 2016 15:00:20 -0700 Subject: [PATCH 088/175] added ** for doc autogen. --- src/objective-c/ProtoRPC/ProtoRPC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index 642b8890ffb..170d8b9c689 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -38,7 +38,7 @@ @interface ProtoRPC : GRPCCall -/* +/** * host parameter should not contain the scheme (http:// or https://), only the name or IP addr * and the port number, for example @"localhost:5050". */ From 6e9fab5ed67106da998ec368e8882ba7a245a9b1 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Wed, 27 Apr 2016 16:52:51 -0700 Subject: [PATCH 089/175] Add support for establishing client channel using existing FD --- include/grpc/grpc.h | 6 + .../chttp2/client/insecure/channel_create.c | 141 +++++++++++++++--- 2 files changed, 129 insertions(+), 18 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 6f7a67b715e..163d5291d30 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -240,6 +240,12 @@ GRPCAPI char *grpc_channel_get_target(grpc_channel *channel); GRPCAPI grpc_channel *grpc_insecure_channel_create( const char *target, const grpc_channel_args *args, void *reserved); +/** Create a client channel to 'target' using file descriptor 'fd'. The 'target' + argument will be used to indicate the name for this channel. See the comment + for grpc_insecure_channel_create for description of 'args' argument. */ +GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd( + const char *target, int fd, const grpc_channel_args *args); + /** Create a lame client: this client fails every operation attempted on it. */ GRPCAPI grpc_channel *grpc_lame_client_channel_create( const char *target, grpc_status_code error_code, const char *error_message); diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.c b/src/core/ext/transport/chttp2/client/insecure/channel_create.c index c5d3d8d9cc8..8ed216db7b2 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c @@ -33,6 +33,7 @@ #include +#include #include #include @@ -47,6 +48,7 @@ #include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/iomgr/tcp_client.h" +#include "src/core/lib/iomgr/tcp_posix.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/channel.h" @@ -139,31 +141,31 @@ typedef struct { gpr_refcount refs; grpc_channel_args *merge_args; grpc_channel *master; -} client_channel_factory; +} client_tcp_channel_factory; -static void client_channel_factory_ref( +static void client_tcp_channel_factory_ref( grpc_client_channel_factory *cc_factory) { - client_channel_factory *f = (client_channel_factory *)cc_factory; + client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; gpr_ref(&f->refs); } -static void client_channel_factory_unref( +static void client_tcp_channel_factory_unref( grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) { - client_channel_factory *f = (client_channel_factory *)cc_factory; + client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; if (gpr_unref(&f->refs)) { if (f->master != NULL) { GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master, - "client_channel_factory"); + "client_tcp_channel_factory"); } grpc_channel_args_destroy(f->merge_args); gpr_free(f); } } -static grpc_subchannel *client_channel_factory_create_subchannel( +static grpc_subchannel *client_tcp_channel_factory_create_subchannel( grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, grpc_subchannel_args *args) { - client_channel_factory *f = (client_channel_factory *)cc_factory; + client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; connector *c = gpr_malloc(sizeof(*c)); grpc_channel_args *final_args = grpc_channel_args_merge(args->args, f->merge_args); @@ -178,11 +180,11 @@ static grpc_subchannel *client_channel_factory_create_subchannel( return s; } -static grpc_channel *client_channel_factory_create_channel( +static grpc_channel *client_tcp_channel_factory_create_channel( grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, const char *target, grpc_client_channel_type type, grpc_channel_args *args) { - client_channel_factory *f = (client_channel_factory *)cc_factory; + client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; grpc_channel_args *final_args = grpc_channel_args_merge(args, f->merge_args); grpc_channel *channel = grpc_channel_create(exec_ctx, target, final_args, GRPC_CLIENT_CHANNEL, NULL); @@ -190,7 +192,7 @@ static grpc_channel *client_channel_factory_create_channel( grpc_resolver *resolver = grpc_resolver_create(target, &f->base); if (!resolver) { GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel, - "client_channel_factory_create_channel"); + "client_tcp_channel_factory_create_channel"); return NULL; } @@ -201,10 +203,11 @@ static grpc_channel *client_channel_factory_create_channel( return channel; } -static const grpc_client_channel_factory_vtable client_channel_factory_vtable = - {client_channel_factory_ref, client_channel_factory_unref, - client_channel_factory_create_subchannel, - client_channel_factory_create_channel}; +static const grpc_client_channel_factory_vtable +client_tcp_channel_factory_vtable = + {client_tcp_channel_factory_ref, client_tcp_channel_factory_unref, + client_tcp_channel_factory_create_subchannel, + client_tcp_channel_factory_create_channel}; /* Create a client channel: Asynchronously: - resolve target @@ -219,13 +222,115 @@ grpc_channel *grpc_insecure_channel_create(const char *target, (target, args, reserved)); GPR_ASSERT(!reserved); - client_channel_factory *f = gpr_malloc(sizeof(*f)); + client_tcp_channel_factory *f = gpr_malloc(sizeof(*f)); memset(f, 0, sizeof(*f)); - f->base.vtable = &client_channel_factory_vtable; + f->base.vtable = &client_tcp_channel_factory_vtable; gpr_ref_init(&f->refs, 1); f->merge_args = grpc_channel_args_copy(args); - grpc_channel *channel = client_channel_factory_create_channel( + grpc_channel *channel = client_tcp_channel_factory_create_channel( + &exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, NULL); + if (channel != NULL) { + f->master = channel; + GRPC_CHANNEL_INTERNAL_REF(f->master, "grpc_insecure_channel_create"); + } + grpc_client_channel_factory_unref(&exec_ctx, &f->base); + + grpc_exec_ctx_finish(&exec_ctx); + + return channel; /* may be NULL */ +} + +typedef struct { + grpc_client_channel_factory base; + + int fd; + + gpr_refcount refs; + grpc_channel_args *merge_args; + grpc_channel *master; +} client_fd_channel_factory; + +static void client_fd_channel_factory_ref( + grpc_client_channel_factory *cc_factory) { + client_fd_channel_factory *f = (client_fd_channel_factory *)cc_factory; + gpr_ref(&f->refs); +} + +static void client_fd_channel_factory_unref( + grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) { + client_fd_channel_factory *f = (client_fd_channel_factory *)cc_factory; + if (gpr_unref(&f->refs)) { + if (f->master != NULL) { + GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master, + "client_fd_channel_factory"); + } + grpc_channel_args_destroy(f->merge_args); + gpr_free(f); + } +} + +static grpc_subchannel *client_fd_channel_factory_create_subchannel( + grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, + grpc_subchannel_args *args) { + return NULL; +} + +static grpc_channel *client_fd_channel_factory_create_channel( + grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, + const char *target, grpc_client_channel_type type, + grpc_channel_args *args) { + client_fd_channel_factory *f = (client_fd_channel_factory *)cc_factory; + + // FIXME(xyzzyz): hack to get the authority sent. + grpc_arg default_authority_arg; + default_authority_arg.type = GRPC_ARG_STRING; + default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; + default_authority_arg.value.string = "test.authority"; + grpc_channel_args *merged_args = grpc_channel_args_merge(args, f->merge_args); + grpc_channel_args *final_args = grpc_channel_args_copy_and_add( + merged_args, &default_authority_arg, 1); + grpc_channel_args_destroy(merged_args); + + int flags = fcntl(f->fd, F_GETFL, 0); + GPR_ASSERT(fcntl(f->fd, F_SETFL, flags | O_NONBLOCK) == 0); + + grpc_endpoint *client = grpc_tcp_create( + grpc_fd_create(f->fd, "client"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, + "fd-client"); + + grpc_transport *transport = + grpc_create_chttp2_transport(exec_ctx, final_args, client, 1); + GPR_ASSERT(transport); + grpc_channel *channel = grpc_channel_create( + exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); + grpc_channel_args_destroy(final_args); + grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL, 0); + + return channel; +} + +static const grpc_client_channel_factory_vtable +client_fd_channel_factory_vtable = + {client_fd_channel_factory_ref, client_fd_channel_factory_unref, + client_fd_channel_factory_create_subchannel, + client_fd_channel_factory_create_channel}; + +grpc_channel *grpc_insecure_channel_create_from_fd( + const char *target, int fd, const grpc_channel_args *args) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + GRPC_API_TRACE( + "grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, + (target, fd, args)); + + client_fd_channel_factory *f = gpr_malloc(sizeof(*f)); + memset(f, 0, sizeof(*f)); + f->base.vtable = &client_fd_channel_factory_vtable; + gpr_ref_init(&f->refs, 1); + f->merge_args = grpc_channel_args_copy(args); + f->fd = fd; + + grpc_channel *channel = client_fd_channel_factory_create_channel( &exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, NULL); if (channel != NULL) { f->master = channel; From d9b8db6c170006f6f457728a4a80698e27839081 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Thu, 28 Apr 2016 13:35:39 -0700 Subject: [PATCH 090/175] Create channel directly. --- .../chttp2/client/insecure/channel_create.c | 131 +++++------------- 1 file changed, 31 insertions(+), 100 deletions(-) diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.c b/src/core/ext/transport/chttp2/client/insecure/channel_create.c index 8ed216db7b2..ded0721e943 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c @@ -141,31 +141,31 @@ typedef struct { gpr_refcount refs; grpc_channel_args *merge_args; grpc_channel *master; -} client_tcp_channel_factory; +} client_channel_factory; -static void client_tcp_channel_factory_ref( +static void client_channel_factory_ref( grpc_client_channel_factory *cc_factory) { - client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; + client_channel_factory *f = (client_channel_factory *)cc_factory; gpr_ref(&f->refs); } -static void client_tcp_channel_factory_unref( +static void client_channel_factory_unref( grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) { - client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; + client_channel_factory *f = (client_channel_factory *)cc_factory; if (gpr_unref(&f->refs)) { if (f->master != NULL) { GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master, - "client_tcp_channel_factory"); + "client_channel_factory"); } grpc_channel_args_destroy(f->merge_args); gpr_free(f); } } -static grpc_subchannel *client_tcp_channel_factory_create_subchannel( +static grpc_subchannel *client_channel_factory_create_subchannel( grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, grpc_subchannel_args *args) { - client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; + client_channel_factory *f = (client_channel_factory *)cc_factory; connector *c = gpr_malloc(sizeof(*c)); grpc_channel_args *final_args = grpc_channel_args_merge(args->args, f->merge_args); @@ -180,11 +180,11 @@ static grpc_subchannel *client_tcp_channel_factory_create_subchannel( return s; } -static grpc_channel *client_tcp_channel_factory_create_channel( +static grpc_channel *client_channel_factory_create_channel( grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, const char *target, grpc_client_channel_type type, grpc_channel_args *args) { - client_tcp_channel_factory *f = (client_tcp_channel_factory *)cc_factory; + client_channel_factory *f = (client_channel_factory *)cc_factory; grpc_channel_args *final_args = grpc_channel_args_merge(args, f->merge_args); grpc_channel *channel = grpc_channel_create(exec_ctx, target, final_args, GRPC_CLIENT_CHANNEL, NULL); @@ -192,7 +192,7 @@ static grpc_channel *client_tcp_channel_factory_create_channel( grpc_resolver *resolver = grpc_resolver_create(target, &f->base); if (!resolver) { GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel, - "client_tcp_channel_factory_create_channel"); + "client_channel_factory_create_channel"); return NULL; } @@ -203,11 +203,10 @@ static grpc_channel *client_tcp_channel_factory_create_channel( return channel; } -static const grpc_client_channel_factory_vtable -client_tcp_channel_factory_vtable = - {client_tcp_channel_factory_ref, client_tcp_channel_factory_unref, - client_tcp_channel_factory_create_subchannel, - client_tcp_channel_factory_create_channel}; +static const grpc_client_channel_factory_vtable client_channel_factory_vtable = + {client_channel_factory_ref, client_channel_factory_unref, + client_channel_factory_create_subchannel, + client_channel_factory_create_channel}; /* Create a client channel: Asynchronously: - resolve target @@ -222,13 +221,13 @@ grpc_channel *grpc_insecure_channel_create(const char *target, (target, args, reserved)); GPR_ASSERT(!reserved); - client_tcp_channel_factory *f = gpr_malloc(sizeof(*f)); + client_channel_factory *f = gpr_malloc(sizeof(*f)); memset(f, 0, sizeof(*f)); - f->base.vtable = &client_tcp_channel_factory_vtable; + f->base.vtable = &client_channel_factory_vtable; gpr_ref_init(&f->refs, 1); f->merge_args = grpc_channel_args_copy(args); - grpc_channel *channel = client_tcp_channel_factory_create_channel( + grpc_channel *channel = client_channel_factory_create_channel( &exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, NULL); if (channel != NULL) { f->master = channel; @@ -241,102 +240,34 @@ grpc_channel *grpc_insecure_channel_create(const char *target, return channel; /* may be NULL */ } -typedef struct { - grpc_client_channel_factory base; - - int fd; - - gpr_refcount refs; - grpc_channel_args *merge_args; - grpc_channel *master; -} client_fd_channel_factory; - -static void client_fd_channel_factory_ref( - grpc_client_channel_factory *cc_factory) { - client_fd_channel_factory *f = (client_fd_channel_factory *)cc_factory; - gpr_ref(&f->refs); -} - -static void client_fd_channel_factory_unref( - grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) { - client_fd_channel_factory *f = (client_fd_channel_factory *)cc_factory; - if (gpr_unref(&f->refs)) { - if (f->master != NULL) { - GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master, - "client_fd_channel_factory"); - } - grpc_channel_args_destroy(f->merge_args); - gpr_free(f); - } -} - -static grpc_subchannel *client_fd_channel_factory_create_subchannel( - grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, - grpc_subchannel_args *args) { - return NULL; -} - -static grpc_channel *client_fd_channel_factory_create_channel( - grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory, - const char *target, grpc_client_channel_type type, - grpc_channel_args *args) { - client_fd_channel_factory *f = (client_fd_channel_factory *)cc_factory; +grpc_channel *grpc_insecure_channel_create_from_fd( + const char *target, int fd, const grpc_channel_args *args) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + GRPC_API_TRACE( + "grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, + (target, fd, args)); - // FIXME(xyzzyz): hack to get the authority sent. grpc_arg default_authority_arg; default_authority_arg.type = GRPC_ARG_STRING; default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; default_authority_arg.value.string = "test.authority"; - grpc_channel_args *merged_args = grpc_channel_args_merge(args, f->merge_args); grpc_channel_args *final_args = grpc_channel_args_copy_and_add( - merged_args, &default_authority_arg, 1); - grpc_channel_args_destroy(merged_args); + args, &default_authority_arg, 1); - int flags = fcntl(f->fd, F_GETFL, 0); - GPR_ASSERT(fcntl(f->fd, F_SETFL, flags | O_NONBLOCK) == 0); + int flags = fcntl(fd, F_GETFL, 0); + GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0); grpc_endpoint *client = grpc_tcp_create( - grpc_fd_create(f->fd, "client"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, + grpc_fd_create(fd, "client"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "fd-client"); grpc_transport *transport = - grpc_create_chttp2_transport(exec_ctx, final_args, client, 1); + grpc_create_chttp2_transport(&exec_ctx, final_args, client, 1); GPR_ASSERT(transport); grpc_channel *channel = grpc_channel_create( - exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); + &exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); grpc_channel_args_destroy(final_args); - grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL, 0); - - return channel; -} - -static const grpc_client_channel_factory_vtable -client_fd_channel_factory_vtable = - {client_fd_channel_factory_ref, client_fd_channel_factory_unref, - client_fd_channel_factory_create_subchannel, - client_fd_channel_factory_create_channel}; - -grpc_channel *grpc_insecure_channel_create_from_fd( - const char *target, int fd, const grpc_channel_args *args) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GRPC_API_TRACE( - "grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, - (target, fd, args)); - - client_fd_channel_factory *f = gpr_malloc(sizeof(*f)); - memset(f, 0, sizeof(*f)); - f->base.vtable = &client_fd_channel_factory_vtable; - gpr_ref_init(&f->refs, 1); - f->merge_args = grpc_channel_args_copy(args); - f->fd = fd; - - grpc_channel *channel = client_fd_channel_factory_create_channel( - &exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, NULL); - if (channel != NULL) { - f->master = channel; - GRPC_CHANNEL_INTERNAL_REF(f->master, "grpc_insecure_channel_create"); - } - grpc_client_channel_factory_unref(&exec_ctx, &f->base); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); grpc_exec_ctx_finish(&exec_ctx); From 46cc2acc3e0b33b469ad1461a33d92985082d52a Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Mon, 16 May 2016 11:12:04 -0700 Subject: [PATCH 091/175] add tests --- Makefile | 56 + grpc.def | 1 + .../grpcio/grpc/_cython/imports.generated.c | 2 + .../grpcio/grpc/_cython/imports.generated.h | 3 + src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 + src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 + test/core/end2end/fixtures/h2_fd.c | 160 + test/core/end2end/gen_build_yaml.py | 15 +- tools/run_tests/sources_and_headers.json | 34 + tools/run_tests/tests.json | 3900 +++++++++++------ 10 files changed, 2872 insertions(+), 1304 deletions(-) create mode 100644 test/core/end2end/fixtures/h2_fd.c diff --git a/Makefile b/Makefile index 5a5dd5e242c..62bcd31724f 100644 --- a/Makefile +++ b/Makefile @@ -1103,6 +1103,7 @@ bad_ssl_cert_test: $(BINDIR)/$(CONFIG)/bad_ssl_cert_test h2_census_test: $(BINDIR)/$(CONFIG)/h2_census_test h2_compress_test: $(BINDIR)/$(CONFIG)/h2_compress_test h2_fakesec_test: $(BINDIR)/$(CONFIG)/h2_fakesec_test +h2_fd_test: $(BINDIR)/$(CONFIG)/h2_fd_test h2_full_test: $(BINDIR)/$(CONFIG)/h2_full_test h2_full+pipe_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_test h2_full+trace_test: $(BINDIR)/$(CONFIG)/h2_full+trace_test @@ -1118,6 +1119,7 @@ h2_ssl_proxy_test: $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test h2_uds_test: $(BINDIR)/$(CONFIG)/h2_uds_test h2_census_nosec_test: $(BINDIR)/$(CONFIG)/h2_census_nosec_test h2_compress_nosec_test: $(BINDIR)/$(CONFIG)/h2_compress_nosec_test +h2_fd_nosec_test: $(BINDIR)/$(CONFIG)/h2_fd_nosec_test h2_full_nosec_test: $(BINDIR)/$(CONFIG)/h2_full_nosec_test h2_full+pipe_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test h2_full+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test @@ -1335,6 +1337,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/h2_census_test \ $(BINDIR)/$(CONFIG)/h2_compress_test \ $(BINDIR)/$(CONFIG)/h2_fakesec_test \ + $(BINDIR)/$(CONFIG)/h2_fd_test \ $(BINDIR)/$(CONFIG)/h2_full_test \ $(BINDIR)/$(CONFIG)/h2_full+pipe_test \ $(BINDIR)/$(CONFIG)/h2_full+trace_test \ @@ -1350,6 +1353,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/h2_uds_test \ $(BINDIR)/$(CONFIG)/h2_census_nosec_test \ $(BINDIR)/$(CONFIG)/h2_compress_nosec_test \ + $(BINDIR)/$(CONFIG)/h2_fd_nosec_test \ $(BINDIR)/$(CONFIG)/h2_full_nosec_test \ $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test \ $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test \ @@ -13554,6 +13558,38 @@ endif endif +H2_FD_TEST_SRC = \ + test/core/end2end/fixtures/h2_fd.c \ + +H2_FD_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_FD_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/h2_fd_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/h2_fd_test: $(H2_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(H2_FD_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_fd_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_fd.o: $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_h2_fd_test: $(H2_FD_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(H2_FD_TEST_OBJS:.o=.dep) +endif +endif + + H2_FULL_TEST_SRC = \ test/core/end2end/fixtures/h2_full.c \ @@ -14010,6 +14046,26 @@ ifneq ($(NO_DEPS),true) endif +H2_FD_NOSEC_TEST_SRC = \ + test/core/end2end/fixtures/h2_fd.c \ + +H2_FD_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_FD_NOSEC_TEST_SRC)))) + + +$(BINDIR)/$(CONFIG)/h2_fd_nosec_test: $(H2_FD_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(H2_FD_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_fd_nosec_test + +$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_fd.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_h2_fd_nosec_test: $(H2_FD_NOSEC_TEST_OBJS:.o=.dep) + +ifneq ($(NO_DEPS),true) +-include $(H2_FD_NOSEC_TEST_OBJS:.o=.dep) +endif + + H2_FULL_NOSEC_TEST_SRC = \ test/core/end2end/fixtures/h2_full.c \ diff --git a/grpc.def b/grpc.def index 3477bd91ae8..b042a696b3e 100644 --- a/grpc.def +++ b/grpc.def @@ -67,6 +67,7 @@ EXPORTS grpc_census_call_get_context grpc_channel_get_target grpc_insecure_channel_create + grpc_insecure_channel_create_from_fd grpc_lame_client_channel_create grpc_channel_destroy grpc_call_cancel diff --git a/src/python/grpcio/grpc/_cython/imports.generated.c b/src/python/grpcio/grpc/_cython/imports.generated.c index c80ee66c061..42b754429d0 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.c +++ b/src/python/grpcio/grpc/_cython/imports.generated.c @@ -105,6 +105,7 @@ grpc_census_call_set_context_type grpc_census_call_set_context_import; grpc_census_call_get_context_type grpc_census_call_get_context_import; grpc_channel_get_target_type grpc_channel_get_target_import; grpc_insecure_channel_create_type grpc_insecure_channel_create_import; +grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; grpc_channel_destroy_type grpc_channel_destroy_import; grpc_call_cancel_type grpc_call_cancel_import; @@ -376,6 +377,7 @@ void pygrpc_load_imports(HMODULE library) { grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context"); grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target"); grpc_insecure_channel_create_import = (grpc_insecure_channel_create_type) GetProcAddress(library, "grpc_insecure_channel_create"); + grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); grpc_lame_client_channel_create_import = (grpc_lame_client_channel_create_type) GetProcAddress(library, "grpc_lame_client_channel_create"); grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy"); grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel"); diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index 7b8e98d9bf7..556ebfb8485 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -265,6 +265,9 @@ extern grpc_channel_get_target_type grpc_channel_get_target_import; typedef grpc_channel *(*grpc_insecure_channel_create_type)(const char *target, const grpc_channel_args *args, void *reserved); extern grpc_insecure_channel_create_type grpc_insecure_channel_create_import; #define grpc_insecure_channel_create grpc_insecure_channel_create_import +typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); +extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; +#define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import typedef grpc_channel *(*grpc_lame_client_channel_create_type)(const char *target, grpc_status_code error_code, const char *error_message); extern grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; #define grpc_lame_client_channel_create grpc_lame_client_channel_create_import diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index f76462649d2..9563f18b7e3 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -105,6 +105,7 @@ grpc_census_call_set_context_type grpc_census_call_set_context_import; grpc_census_call_get_context_type grpc_census_call_get_context_import; grpc_channel_get_target_type grpc_channel_get_target_import; grpc_insecure_channel_create_type grpc_insecure_channel_create_import; +grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; grpc_channel_destroy_type grpc_channel_destroy_import; grpc_call_cancel_type grpc_call_cancel_import; @@ -372,6 +373,7 @@ void grpc_rb_load_imports(HMODULE library) { grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context"); grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target"); grpc_insecure_channel_create_import = (grpc_insecure_channel_create_type) GetProcAddress(library, "grpc_insecure_channel_create"); + grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); grpc_lame_client_channel_create_import = (grpc_lame_client_channel_create_type) GetProcAddress(library, "grpc_lame_client_channel_create"); grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy"); grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 5d690a915d8..87dead533da 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -265,6 +265,9 @@ extern grpc_channel_get_target_type grpc_channel_get_target_import; typedef grpc_channel *(*grpc_insecure_channel_create_type)(const char *target, const grpc_channel_args *args, void *reserved); extern grpc_insecure_channel_create_type grpc_insecure_channel_create_import; #define grpc_insecure_channel_create grpc_insecure_channel_create_import +typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); +extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; +#define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import typedef grpc_channel *(*grpc_lame_client_channel_create_type)(const char *target, grpc_status_code error_code, const char *error_message); extern grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; #define grpc_lame_client_channel_create grpc_lame_client_channel_create_import diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c new file mode 100644 index 00000000000..64ca75f7ff3 --- /dev/null +++ b/test/core/end2end/fixtures/h2_fd.c @@ -0,0 +1,160 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "src/core/ext/client_config/client_channel.h" +#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/lib/channel/compress_filter.h" +#include "src/core/lib/channel/connected_channel.h" +#include "src/core/lib/channel/http_client_filter.h" +#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/lib/iomgr/endpoint_pair.h" +#include "src/core/lib/iomgr/iomgr.h" +#include "src/core/lib/iomgr/socket_utils_posix.h" +#include "src/core/lib/iomgr/tcp_posix.h" +#include "src/core/lib/iomgr/unix_sockets_posix.h" +#include "src/core/lib/surface/channel.h" +#include "src/core/lib/surface/server.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" + +/* chttp2 transport that is immediately available (used for testing + connected_channel without a client_channel */ + +static void server_setup_transport(void *ts, grpc_transport *transport) { + grpc_end2end_test_fixture *f = ts; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_server_setup_transport(&exec_ctx, f->server, transport, + grpc_server_get_channel_args(f->server)); + grpc_exec_ctx_finish(&exec_ctx); +} + +typedef struct { + int fd_pair[2]; +} sp_fixture_data; + + +static void create_sockets(int sv[2]) { + int flags; + grpc_create_socketpair_if_unix(sv); + flags = fcntl(sv[0], F_GETFL, 0); + GPR_ASSERT(fcntl(sv[0], F_SETFL, flags | O_NONBLOCK) == 0); + flags = fcntl(sv[1], F_GETFL, 0); + GPR_ASSERT(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK) == 0); + GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[0])); + GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[1])); +} + +static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( + grpc_channel_args *client_args, grpc_channel_args *server_args) { + sp_fixture_data* fixture_data = gpr_malloc(sizeof(*fixture_data)); + + grpc_end2end_test_fixture f; + memset(&f, 0, sizeof(f)); + f.fixture_data = fixture_data; + f.cq = grpc_completion_queue_create(NULL); + + create_sockets(fixture_data->fd_pair); + + return f; +} + +static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, + grpc_channel_args *client_args) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + sp_fixture_data *sfd = f->fixture_data; + + f->client = grpc_insecure_channel_create_from_fd( + "fixture_client", sfd->fd_pair[0], client_args); + GPR_ASSERT(f->client); + + grpc_exec_ctx_finish(&exec_ctx); +} + +static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, + grpc_channel_args *server_args) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + sp_fixture_data *sfd = f->fixture_data; + grpc_transport *transport; + GPR_ASSERT(!f->server); + f->server = grpc_server_create(server_args, NULL); + grpc_server_register_completion_queue(f->server, f->cq, NULL); + grpc_server_start(f->server); + grpc_endpoint *server_endpoint = grpc_tcp_create( + grpc_fd_create(sfd->fd_pair[1], "fixture_server"), + 65536 /* read_slice_size */, "fixture_server"); + + transport = + grpc_create_chttp2_transport(&exec_ctx, server_args, server_endpoint, 0); + server_setup_transport(f, transport); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); + grpc_exec_ctx_finish(&exec_ctx); +} + +static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { + gpr_free(f->fixture_data); +} + +/* All test configurations */ +static grpc_end2end_test_config configs[] = { + {"chttp2/socketpair", 0, chttp2_create_fixture_socketpair, + chttp2_init_client_socketpair, chttp2_init_server_socketpair, + chttp2_tear_down_socketpair}, +}; + +int main(int argc, char **argv) { + size_t i; + + grpc_test_init(argc, argv); + grpc_end2end_tests_pre_init(); + grpc_init(); + + for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) { + grpc_end2end_tests(argc, argv, configs[i]); + } + + grpc_shutdown(); + + return 0; +} diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index cf1ba7c68ee..98b7cf5dcd7 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -45,6 +45,8 @@ default_unsecure_fixture_options = FixtureOptions( socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False) default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True) uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix']) +fd_fixture_options = default_unsecure_fixture_options._replace( + dns_resolver=False, fullstack=False, platforms=['linux', 'mac', 'posix']) # maps fixture name to whether it requires the security library @@ -52,6 +54,7 @@ END2END_FIXTURES = { 'h2_compress': default_unsecure_fixture_options, 'h2_census': default_unsecure_fixture_options, 'h2_fakesec': default_secure_fixture_options._replace(ci_mac=False), + 'h2_fd': fd_fixture_options, 'h2_full': default_unsecure_fixture_options, 'h2_full+pipe': default_unsecure_fixture_options._replace( platforms=['linux']), @@ -73,7 +76,8 @@ END2END_FIXTURES = { } TestOptions = collections.namedtuple( - 'TestOptions', 'needs_fullstack needs_dns proxyable secure traceable cpu_cost') + 'TestOptions', + 'needs_fullstack needs_dns proxyable secure traceable cpu_cost') default_test_options = TestOptions(False, False, True, False, True, 1.0) connectivity_test_options = default_test_options._replace(needs_fullstack=True) @@ -90,8 +94,10 @@ END2END_TESTS = { 'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_with_status': default_test_options._replace(cpu_cost=LOWCPU), - 'compressed_payload': default_test_options._replace(proxyable=False, cpu_cost=LOWCPU), - 'connectivity': connectivity_test_options._replace(proxyable=False, cpu_cost=LOWCPU), + 'compressed_payload': default_test_options._replace(proxyable=False, + cpu_cost=LOWCPU), + 'connectivity': connectivity_test_options._replace(proxyable=False, + cpu_cost=LOWCPU), 'default_host': default_test_options._replace(needs_fullstack=True, needs_dns=True), 'disappearing_server': connectivity_test_options, @@ -117,7 +123,8 @@ END2END_TESTS = { 'server_finishes_request': default_test_options, 'shutdown_finishes_calls': default_test_options, 'shutdown_finishes_tags': default_test_options, - 'simple_delayed_request': connectivity_test_options._replace(cpu_cost=LOWCPU), + 'simple_delayed_request': connectivity_test_options._replace( + cpu_cost=LOWCPU), 'simple_metadata': default_test_options, 'simple_request': default_test_options, 'trailing_metadata': default_test_options, diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index e23c1cb6002..839bac1c218 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -3491,6 +3491,23 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "end2end_tests", + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "language": "c", + "name": "h2_fd_test", + "src": [ + "test/core/end2end/fixtures/h2_fd.c" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "end2end_tests", @@ -3746,6 +3763,23 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "end2end_nosec_tests", + "gpr", + "gpr_test_util", + "grpc_test_util_unsecure", + "grpc_unsecure" + ], + "headers": [], + "language": "c", + "name": "h2_fd_nosec_test", + "src": [ + "test/core/end2end/fixtures/h2_fd.c" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "end2end_nosec_tests", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 1ac87e28a43..e887dc74c39 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -6784,7 +6784,6 @@ "bad_hostname" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6793,9 +6792,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6806,7 +6804,6 @@ "binary_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6815,9 +6812,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6828,7 +6824,6 @@ "call_creds" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6837,9 +6832,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6850,7 +6844,6 @@ "cancel_after_accept" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6859,9 +6852,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6872,7 +6864,6 @@ "cancel_after_client_done" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6881,9 +6872,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6894,7 +6884,6 @@ "cancel_after_invoke" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6903,9 +6892,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6916,7 +6904,6 @@ "cancel_before_invoke" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6925,9 +6912,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6938,7 +6924,6 @@ "cancel_in_a_vacuum" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6947,9 +6932,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6960,7 +6944,6 @@ "cancel_with_status" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6969,9 +6952,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -6982,7 +6964,6 @@ "compressed_payload" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -6991,9 +6972,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7001,21 +6981,19 @@ }, { "args": [ - "connectivity" + "empty_batch" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7023,10 +7001,9 @@ }, { "args": [ - "default_host" + "filter_causes_close" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7035,9 +7012,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7045,21 +7021,19 @@ }, { "args": [ - "disappearing_server" + "graceful_server_shutdown" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7067,10 +7041,9 @@ }, { "args": [ - "empty_batch" + "high_initial_seqno" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7079,9 +7052,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7089,10 +7061,9 @@ }, { "args": [ - "filter_causes_close" + "hpack_size" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7101,9 +7072,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7111,21 +7081,19 @@ }, { "args": [ - "graceful_server_shutdown" + "idempotent_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7133,10 +7101,9 @@ }, { "args": [ - "high_initial_seqno" + "invoke_large_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7145,9 +7112,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7155,10 +7121,9 @@ }, { "args": [ - "hpack_size" + "large_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7167,9 +7132,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7177,10 +7141,9 @@ }, { "args": [ - "idempotent_request" + "max_concurrent_streams" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7189,9 +7152,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7199,21 +7161,19 @@ }, { "args": [ - "invoke_large_request" + "max_message_length" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7221,10 +7181,9 @@ }, { "args": [ - "large_metadata" + "negative_deadline" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7233,9 +7192,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7243,10 +7201,9 @@ }, { "args": [ - "max_concurrent_streams" + "no_op" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7255,9 +7212,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7265,10 +7221,9 @@ }, { "args": [ - "max_message_length" + "payload" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7277,9 +7232,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7287,10 +7241,9 @@ }, { "args": [ - "negative_deadline" + "ping_pong_streaming" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7299,9 +7252,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7309,10 +7261,9 @@ }, { "args": [ - "no_op" + "registered_call" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7321,9 +7272,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7331,21 +7281,19 @@ }, { "args": [ - "payload" + "request_with_flags" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7353,10 +7301,9 @@ }, { "args": [ - "ping" + "request_with_payload" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7365,9 +7312,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7375,10 +7321,9 @@ }, { "args": [ - "ping_pong_streaming" + "server_finishes_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7387,9 +7332,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7397,10 +7341,9 @@ }, { "args": [ - "registered_call" + "shutdown_finishes_calls" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7409,9 +7352,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7419,10 +7361,9 @@ }, { "args": [ - "request_with_flags" + "shutdown_finishes_tags" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7431,9 +7372,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7441,10 +7381,9 @@ }, { "args": [ - "request_with_payload" + "simple_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7453,9 +7392,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7463,10 +7401,9 @@ }, { "args": [ - "server_finishes_request" + "simple_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7475,9 +7412,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7485,10 +7421,9 @@ }, { "args": [ - "shutdown_finishes_calls" + "trailing_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -7497,9 +7432,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full_test", + "name": "h2_fd_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -7507,7 +7441,7 @@ }, { "args": [ - "shutdown_finishes_tags" + "bad_hostname" ], "ci_platforms": [ "windows", @@ -7529,7 +7463,7 @@ }, { "args": [ - "simple_delayed_request" + "binary_metadata" ], "ci_platforms": [ "windows", @@ -7537,7 +7471,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", @@ -7551,7 +7485,7 @@ }, { "args": [ - "simple_metadata" + "call_creds" ], "ci_platforms": [ "windows", @@ -7573,7 +7507,7 @@ }, { "args": [ - "simple_request" + "cancel_after_accept" ], "ci_platforms": [ "windows", @@ -7581,7 +7515,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", @@ -7595,7 +7529,7 @@ }, { "args": [ - "trailing_metadata" + "cancel_after_client_done" ], "ci_platforms": [ "windows", @@ -7603,7 +7537,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", @@ -7617,114 +7551,1490 @@ }, { "args": [ - "bad_hostname" + "cancel_after_invoke" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { "args": [ - "binary_metadata" + "cancel_before_invoke" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { "args": [ - "call_creds" + "cancel_in_a_vacuum" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { "args": [ - "cancel_after_accept" + "cancel_with_status" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { "args": [ - "cancel_after_client_done" + "compressed_payload" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { "args": [ - "cancel_after_invoke" + "connectivity" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "default_host" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "disappearing_server" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "empty_batch" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "filter_causes_close" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "graceful_server_shutdown" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "high_initial_seqno" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "hpack_size" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "invoke_large_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "large_metadata" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "max_concurrent_streams" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "max_message_length" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "negative_deadline" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "no_op" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "payload" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "ping" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "ping_pong_streaming" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "registered_call" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "request_with_flags" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "request_with_payload" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "server_finishes_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "shutdown_finishes_calls" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "shutdown_finishes_tags" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "simple_delayed_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "simple_metadata" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "simple_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "trailing_metadata" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "bad_hostname" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "binary_metadata" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "call_creds" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "cancel_after_accept" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "cancel_after_client_done" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "cancel_after_invoke" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "cancel_before_invoke" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "cancel_in_a_vacuum" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "cancel_with_status" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "compressed_payload" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "connectivity" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "default_host" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "disappearing_server" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "empty_batch" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "filter_causes_close" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "graceful_server_shutdown" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "high_initial_seqno" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "hpack_size" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "invoke_large_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "large_metadata" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "max_concurrent_streams" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "max_message_length" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "negative_deadline" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "no_op" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "payload" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "ping" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "ping_pong_streaming" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "registered_call" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "request_with_flags" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "request_with_payload" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "server_finishes_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "shutdown_finishes_calls" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "shutdown_finishes_tags" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "simple_delayed_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "simple_metadata" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "simple_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "trailing_metadata" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", "platforms": [ "linux" ] }, + { + "args": [ + "bad_hostname" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "binary_metadata" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "call_creds" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "cancel_after_accept" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "cancel_after_client_done" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "cancel_after_invoke" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "cancel_before_invoke" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7732,15 +9042,21 @@ "cancel_in_a_vacuum" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7748,15 +9064,21 @@ "cancel_with_status" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7764,15 +9086,21 @@ "compressed_payload" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7780,15 +9108,21 @@ "connectivity" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7796,15 +9130,21 @@ "default_host" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7812,15 +9152,21 @@ "disappearing_server" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7828,15 +9174,21 @@ "empty_batch" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7844,15 +9196,21 @@ "filter_causes_close" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7860,15 +9218,21 @@ "graceful_server_shutdown" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7876,31 +9240,21 @@ "high_initial_seqno" ], "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+pipe_test", - "platforms": [ - "linux" - ] - }, - { - "args": [ - "hpack_size" - ], - "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7908,15 +9262,21 @@ "idempotent_request" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7924,15 +9284,21 @@ "invoke_large_request" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7940,15 +9306,21 @@ "large_metadata" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7956,15 +9328,21 @@ "max_concurrent_streams" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7972,15 +9350,21 @@ "max_message_length" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -7988,15 +9372,21 @@ "negative_deadline" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8004,15 +9394,21 @@ "no_op" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8020,15 +9416,21 @@ "payload" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8036,15 +9438,21 @@ "ping" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8052,15 +9460,21 @@ "ping_pong_streaming" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8068,15 +9482,21 @@ "registered_call" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8084,15 +9504,21 @@ "request_with_flags" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8100,15 +9526,21 @@ "request_with_payload" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8116,15 +9548,21 @@ "server_finishes_request" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8132,15 +9570,21 @@ "shutdown_finishes_calls" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8148,15 +9592,21 @@ "shutdown_finishes_tags" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8164,15 +9614,21 @@ "simple_delayed_request" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8180,15 +9636,21 @@ "simple_metadata" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8196,15 +9658,21 @@ "simple_request" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8212,15 +9680,21 @@ "trailing_metadata" ], "ci_platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+pipe_test", + "name": "h2_full+trace_test", "platforms": [ - "linux" + "windows", + "linux", + "mac", + "posix" ] }, { @@ -8230,14 +9704,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8252,14 +9725,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8274,14 +9746,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8296,14 +9767,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8318,14 +9788,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8340,14 +9809,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8362,14 +9830,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8384,14 +9851,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8406,14 +9872,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8428,14 +9893,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8450,14 +9914,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8472,14 +9935,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8494,14 +9956,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8516,14 +9977,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8538,14 +9998,34 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "graceful_server_shutdown" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8555,19 +10035,18 @@ }, { "args": [ - "graceful_server_shutdown" + "high_initial_seqno" ], "ci_platforms": [ "windows", "linux", - "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8577,19 +10056,18 @@ }, { "args": [ - "high_initial_seqno" + "hpack_size" ], "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8604,14 +10082,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8626,14 +10103,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8648,14 +10124,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8670,14 +10145,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8692,14 +10166,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8714,14 +10187,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8736,14 +10208,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8758,14 +10229,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8780,14 +10250,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8802,14 +10271,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8824,14 +10292,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8846,14 +10313,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8868,14 +10334,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8890,14 +10355,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8912,14 +10376,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8934,14 +10397,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8956,14 +10418,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -8978,14 +10439,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -9000,14 +10460,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -9022,14 +10481,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_full+trace_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -9886,7 +11344,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -9907,7 +11365,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -9928,7 +11386,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -9949,7 +11407,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -9970,7 +11428,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -9991,7 +11449,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10012,7 +11470,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10033,7 +11491,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10054,49 +11512,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "compressed_payload" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "connectivity" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10117,7 +11533,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10127,7 +11543,7 @@ }, { "args": [ - "disappearing_server" + "empty_batch" ], "ci_platforms": [ "windows", @@ -10138,7 +11554,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10148,7 +11564,7 @@ }, { "args": [ - "empty_batch" + "filter_causes_close" ], "ci_platforms": [ "windows", @@ -10159,7 +11575,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10180,7 +11596,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10201,28 +11617,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "high_initial_seqno" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10243,7 +11638,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10264,7 +11659,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10285,7 +11680,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10306,28 +11701,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "max_concurrent_streams" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10348,7 +11722,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10369,7 +11743,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10390,7 +11764,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10411,28 +11785,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "ping" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10453,7 +11806,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10474,7 +11827,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10495,28 +11848,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "request_with_payload" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10526,7 +11858,7 @@ }, { "args": [ - "server_finishes_request" + "request_with_payload" ], "ci_platforms": [ "windows", @@ -10537,7 +11869,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10547,7 +11879,7 @@ }, { "args": [ - "shutdown_finishes_calls" + "server_finishes_request" ], "ci_platforms": [ "windows", @@ -10558,7 +11890,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10568,7 +11900,7 @@ }, { "args": [ - "shutdown_finishes_tags" + "shutdown_finishes_calls" ], "ci_platforms": [ "windows", @@ -10579,7 +11911,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10600,7 +11932,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10621,7 +11953,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10642,7 +11974,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10663,7 +11995,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_proxy_test", "platforms": [ "windows", "linux", @@ -10684,7 +12016,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10705,7 +12037,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10726,7 +12058,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10747,7 +12079,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10768,7 +12100,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10789,7 +12121,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10810,7 +12142,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10831,7 +12163,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10852,7 +12184,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10862,18 +12194,18 @@ }, { "args": [ - "default_host" + "compressed_payload" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10894,7 +12226,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10915,7 +12247,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10925,18 +12257,18 @@ }, { "args": [ - "filter_causes_close" + "graceful_server_shutdown" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10946,18 +12278,18 @@ }, { "args": [ - "graceful_server_shutdown" + "high_initial_seqno" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10978,7 +12310,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -10999,7 +12331,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11020,7 +12352,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11041,7 +12373,28 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "max_concurrent_streams" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11062,7 +12415,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11083,7 +12436,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11104,7 +12457,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11125,7 +12478,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11146,7 +12499,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11167,7 +12520,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11188,7 +12541,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11209,7 +12562,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11230,7 +12583,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11251,7 +12604,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11261,18 +12614,18 @@ }, { "args": [ - "simple_delayed_request" + "shutdown_finishes_tags" ], "ci_platforms": [ "windows", "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11293,7 +12646,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11314,7 +12667,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11335,7 +12688,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_proxy_test", + "name": "h2_sockpair_test", "platforms": [ "windows", "linux", @@ -11356,7 +12709,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11377,7 +12730,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11398,7 +12751,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11419,7 +12772,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11440,7 +12793,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11461,7 +12814,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11482,7 +12835,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11503,7 +12856,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11524,7 +12877,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11545,7 +12898,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11566,7 +12919,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11587,7 +12940,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11608,7 +12961,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11629,28 +12982,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "hpack_size" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11671,7 +13003,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11692,7 +13024,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11713,7 +13045,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11734,7 +13066,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11755,7 +13087,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11776,7 +13108,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11797,7 +13129,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11818,7 +13150,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11839,7 +13171,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11860,7 +13192,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11881,7 +13213,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11902,7 +13234,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11923,7 +13255,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11944,7 +13276,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11965,7 +13297,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -11986,7 +13318,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -12007,7 +13339,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -12028,7 +13360,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_test", + "name": "h2_sockpair+trace_test", "platforms": [ "windows", "linux", @@ -12049,7 +13381,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12070,7 +13402,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12091,7 +13423,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12112,7 +13444,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12133,7 +13465,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12154,7 +13486,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12175,7 +13507,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12196,7 +13528,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12217,7 +13549,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12238,7 +13570,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12259,7 +13591,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12280,7 +13612,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12301,7 +13633,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12322,7 +13654,28 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "hpack_size" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12343,7 +13696,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12364,7 +13717,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12385,7 +13738,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12406,7 +13759,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12427,7 +13780,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12448,7 +13801,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12469,7 +13822,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12490,7 +13843,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12511,7 +13864,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12532,7 +13885,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12553,7 +13906,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12574,7 +13927,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12595,7 +13948,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12616,7 +13969,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12637,7 +13990,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12658,7 +14011,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12679,7 +14032,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12700,7 +14053,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair+trace_test", + "name": "h2_sockpair_1byte_test", "platforms": [ "windows", "linux", @@ -12715,13 +14068,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12736,13 +14090,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12757,13 +14112,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12778,13 +14134,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12799,13 +14156,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12820,13 +14178,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12841,13 +14200,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12862,13 +14222,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12883,13 +14244,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12904,13 +14266,80 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "connectivity" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "default_host" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "disappearing_server" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12925,13 +14354,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12946,13 +14376,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12967,13 +14398,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -12988,13 +14420,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13009,13 +14442,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13030,13 +14464,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13051,13 +14486,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13072,13 +14508,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13093,13 +14530,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13114,13 +14552,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13135,13 +14574,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13156,13 +14596,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13177,13 +14618,36 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "ping" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13198,13 +14662,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13219,13 +14684,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13240,13 +14706,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13261,13 +14728,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13282,13 +14750,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13303,13 +14772,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13324,13 +14794,36 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "simple_delayed_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13345,13 +14838,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13366,13 +14860,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13387,13 +14882,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_sockpair_1byte_test", + "name": "h2_ssl_test", "platforms": [ "windows", "linux", @@ -13415,7 +14911,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13437,7 +14933,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13459,7 +14955,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13481,7 +14977,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13503,7 +14999,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13525,7 +15021,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13547,7 +15043,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13569,7 +15065,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13591,7 +15087,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13613,7 +15109,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13635,7 +15131,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13657,7 +15153,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13679,7 +15175,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13701,7 +15197,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13723,7 +15219,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13745,7 +15241,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13767,7 +15263,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13789,7 +15285,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13811,7 +15307,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13833,7 +15329,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13855,7 +15351,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13877,7 +15373,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13899,7 +15395,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13921,7 +15417,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13943,7 +15439,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13965,7 +15461,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -13987,7 +15483,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14009,7 +15505,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14031,7 +15527,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14053,7 +15549,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14075,7 +15571,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14097,7 +15593,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14119,7 +15615,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14141,7 +15637,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14163,7 +15659,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14185,7 +15681,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14207,7 +15703,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14229,7 +15725,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_test", + "name": "h2_ssl_cert_test", "platforms": [ "windows", "linux", @@ -14244,14 +15740,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14266,14 +15761,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14288,14 +15782,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14310,14 +15803,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14332,14 +15824,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14354,14 +15845,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14376,14 +15866,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14398,14 +15887,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14420,58 +15908,13 @@ "ci_platforms": [ "windows", "linux", - "mac", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_cert_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "compressed_payload" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_cert_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "connectivity" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14486,14 +15929,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14508,14 +15950,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14530,14 +15971,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14552,14 +15992,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14574,14 +16013,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14596,36 +16034,13 @@ "ci_platforms": [ "windows", "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_cert_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "hpack_size" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14640,14 +16055,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14662,14 +16076,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14684,36 +16097,13 @@ "ci_platforms": [ "windows", "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_cert_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "max_concurrent_streams" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14728,14 +16118,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14750,58 +16139,13 @@ "ci_platforms": [ "windows", "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_cert_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "no_op" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "payload" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14811,19 +16155,18 @@ }, { "args": [ - "ping" + "no_op" ], "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14833,19 +16176,18 @@ }, { "args": [ - "ping_pong_streaming" + "payload" ], "ci_platforms": [ "windows", "linux", - "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14855,19 +16197,18 @@ }, { "args": [ - "registered_call" + "ping_pong_streaming" ], "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14877,19 +16218,18 @@ }, { "args": [ - "request_with_flags" + "registered_call" ], "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14904,14 +16244,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14926,14 +16265,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14948,14 +16286,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14970,14 +16307,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -14992,14 +16328,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -15014,14 +16349,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -15036,14 +16370,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -15058,14 +16391,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_cert_test", + "name": "h2_ssl_proxy_test", "platforms": [ "windows", "linux", @@ -15078,17 +16410,16 @@ "bad_hostname" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15099,17 +16430,16 @@ "binary_metadata" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15120,17 +16450,16 @@ "call_creds" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15141,17 +16470,16 @@ "cancel_after_accept" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15162,17 +16490,16 @@ "cancel_after_client_done" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15183,17 +16510,16 @@ "cancel_after_invoke" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15204,17 +16530,16 @@ "cancel_before_invoke" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15225,17 +16550,16 @@ "cancel_in_a_vacuum" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15246,17 +16570,16 @@ "cancel_with_status" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15264,20 +16587,39 @@ }, { "args": [ - "default_host" + "compressed_payload" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "connectivity" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15288,17 +16630,16 @@ "disappearing_server" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15309,17 +16650,16 @@ "empty_batch" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15330,17 +16670,16 @@ "filter_causes_close" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15351,17 +16690,16 @@ "graceful_server_shutdown" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15372,17 +16710,36 @@ "high_initial_seqno" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "hpack_size" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15393,17 +16750,16 @@ "idempotent_request" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15414,17 +16770,16 @@ "invoke_large_request" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15435,17 +16790,36 @@ "large_metadata" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "max_concurrent_streams" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15456,17 +16830,16 @@ "max_message_length" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15477,17 +16850,16 @@ "negative_deadline" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15498,17 +16870,16 @@ "no_op" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15519,17 +16890,56 @@ "payload" ], "ci_platforms": [ - "windows", "linux", + "mac", + "posix" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "ping" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "ping_pong_streaming" + ], + "ci_platforms": [ + "linux", + "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15537,20 +16947,19 @@ }, { "args": [ - "ping_pong_streaming" + "registered_call" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15558,20 +16967,19 @@ }, { "args": [ - "registered_call" + "request_with_flags" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15582,17 +16990,16 @@ "request_with_payload" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15603,17 +17010,16 @@ "server_finishes_request" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15624,17 +17030,16 @@ "shutdown_finishes_calls" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15645,17 +17050,16 @@ "shutdown_finishes_tags" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15666,17 +17070,16 @@ "simple_delayed_request" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15687,17 +17090,16 @@ "simple_metadata" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15708,17 +17110,16 @@ "simple_request" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15729,17 +17130,16 @@ "trailing_metadata" ], "ci_platforms": [ - "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_ssl_proxy_test", + "name": "h2_uds_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -15750,6 +17150,7 @@ "bad_hostname" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15758,8 +17159,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15770,6 +17172,7 @@ "binary_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15778,8 +17181,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15787,19 +17191,21 @@ }, { "args": [ - "call_creds" + "cancel_after_accept" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15807,9 +17213,10 @@ }, { "args": [ - "cancel_after_accept" + "cancel_after_client_done" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15818,8 +17225,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15827,9 +17235,10 @@ }, { "args": [ - "cancel_after_client_done" + "cancel_after_invoke" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15838,8 +17247,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15847,9 +17257,10 @@ }, { "args": [ - "cancel_after_invoke" + "cancel_before_invoke" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15858,8 +17269,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15867,9 +17279,10 @@ }, { "args": [ - "cancel_before_invoke" + "cancel_in_a_vacuum" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15878,8 +17291,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15887,9 +17301,10 @@ }, { "args": [ - "cancel_in_a_vacuum" + "cancel_with_status" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15898,8 +17313,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15907,9 +17323,10 @@ }, { "args": [ - "cancel_with_status" + "compressed_payload" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15918,8 +17335,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15927,9 +17345,10 @@ }, { "args": [ - "compressed_payload" + "connectivity" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15938,8 +17357,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15947,19 +17367,21 @@ }, { "args": [ - "connectivity" + "default_host" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15970,6 +17392,7 @@ "disappearing_server" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15978,8 +17401,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -15990,6 +17414,7 @@ "empty_batch" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -15998,8 +17423,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16010,6 +17436,7 @@ "filter_causes_close" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16018,8 +17445,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16030,6 +17458,7 @@ "graceful_server_shutdown" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16038,8 +17467,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16050,6 +17480,7 @@ "high_initial_seqno" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16058,8 +17489,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16070,6 +17502,7 @@ "hpack_size" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16078,8 +17511,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16090,6 +17524,7 @@ "idempotent_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16098,8 +17533,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16110,6 +17546,7 @@ "invoke_large_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16118,8 +17555,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16130,6 +17568,7 @@ "large_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16138,8 +17577,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16150,6 +17590,7 @@ "max_concurrent_streams" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16158,8 +17599,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16170,6 +17612,7 @@ "max_message_length" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16178,8 +17621,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16190,6 +17634,7 @@ "negative_deadline" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16198,8 +17643,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16210,6 +17656,7 @@ "no_op" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16218,8 +17665,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16230,6 +17678,7 @@ "payload" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16238,8 +17687,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16250,6 +17700,7 @@ "ping" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16258,8 +17709,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16270,6 +17722,7 @@ "ping_pong_streaming" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16278,8 +17731,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16290,6 +17744,7 @@ "registered_call" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16298,8 +17753,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16310,6 +17766,7 @@ "request_with_flags" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16318,8 +17775,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16330,6 +17788,7 @@ "request_with_payload" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16338,8 +17797,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16350,6 +17810,7 @@ "server_finishes_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16358,8 +17819,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16370,6 +17832,7 @@ "shutdown_finishes_calls" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16378,8 +17841,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16390,6 +17854,7 @@ "shutdown_finishes_tags" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16398,8 +17863,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16410,6 +17876,7 @@ "simple_delayed_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16418,8 +17885,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16430,6 +17898,7 @@ "simple_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16438,8 +17907,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16450,6 +17920,7 @@ "simple_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16458,8 +17929,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16470,6 +17942,7 @@ "trailing_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -16478,8 +17951,9 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_uds_test", + "name": "h2_census_nosec_test", "platforms": [ + "windows", "linux", "mac", "posix" @@ -16490,7 +17964,6 @@ "bad_hostname" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16499,7 +17972,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16512,7 +17985,6 @@ "binary_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16521,7 +17993,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16534,7 +18006,6 @@ "cancel_after_accept" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16543,7 +18014,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16556,7 +18027,6 @@ "cancel_after_client_done" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16565,7 +18035,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16578,7 +18048,6 @@ "cancel_after_invoke" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16587,7 +18056,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16600,7 +18069,6 @@ "cancel_before_invoke" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16609,7 +18077,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16622,7 +18090,6 @@ "cancel_in_a_vacuum" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16631,7 +18098,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16644,7 +18111,6 @@ "cancel_with_status" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16653,7 +18119,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16675,7 +18141,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16697,7 +18163,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16719,7 +18185,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16741,7 +18207,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16754,7 +18220,6 @@ "empty_batch" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16763,7 +18228,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16776,7 +18241,6 @@ "filter_causes_close" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16785,7 +18249,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16798,7 +18262,6 @@ "graceful_server_shutdown" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16807,7 +18270,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16820,7 +18283,6 @@ "high_initial_seqno" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16829,7 +18291,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16842,7 +18304,6 @@ "hpack_size" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16851,7 +18312,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16864,7 +18325,6 @@ "idempotent_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16873,7 +18333,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16886,7 +18346,6 @@ "invoke_large_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16895,7 +18354,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16908,7 +18367,6 @@ "large_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16917,7 +18375,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16930,7 +18388,6 @@ "max_concurrent_streams" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16939,7 +18396,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16952,7 +18409,6 @@ "max_message_length" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16961,7 +18417,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16974,7 +18430,6 @@ "negative_deadline" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -16983,7 +18438,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -16996,7 +18451,6 @@ "no_op" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17005,7 +18459,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17018,7 +18472,6 @@ "payload" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17027,7 +18480,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17049,7 +18502,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17062,7 +18515,6 @@ "ping_pong_streaming" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17071,7 +18523,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17084,7 +18536,6 @@ "registered_call" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17093,7 +18544,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17106,7 +18557,6 @@ "request_with_flags" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17115,7 +18565,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17128,7 +18578,6 @@ "request_with_payload" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17137,7 +18586,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17150,7 +18599,6 @@ "server_finishes_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17159,7 +18607,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17172,7 +18620,6 @@ "shutdown_finishes_calls" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17181,7 +18628,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17194,7 +18641,6 @@ "shutdown_finishes_tags" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17203,7 +18649,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17225,7 +18671,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17238,7 +18684,6 @@ "simple_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17247,7 +18692,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17260,7 +18705,6 @@ "simple_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17269,7 +18713,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17282,7 +18726,6 @@ "trailing_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17291,7 +18734,7 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_census_nosec_test", + "name": "h2_compress_nosec_test", "platforms": [ "windows", "linux", @@ -17313,9 +18756,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17335,9 +18777,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17357,9 +18798,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17379,9 +18819,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17401,9 +18840,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17423,9 +18861,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17445,9 +18882,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17467,9 +18903,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17480,29 +18915,6 @@ "compressed_payload" ], "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "connectivity" - ], - "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -17511,53 +18923,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "default_host" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "disappearing_server" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17577,9 +18944,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17599,9 +18965,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17621,9 +18986,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17643,9 +19007,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17665,9 +19028,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17687,9 +19049,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17709,9 +19070,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17731,9 +19091,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17753,9 +19112,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17775,9 +19133,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17797,9 +19154,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17819,9 +19175,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17841,31 +19196,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "ping" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17885,9 +19217,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17907,9 +19238,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17929,9 +19259,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17951,9 +19280,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17973,9 +19301,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -17995,9 +19322,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -18017,31 +19343,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, - { - "args": [ - "simple_delayed_request" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 0.1, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -18061,9 +19364,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -18083,9 +19385,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" @@ -18105,9 +19406,8 @@ "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_compress_nosec_test", + "name": "h2_fd_nosec_test", "platforms": [ - "windows", "linux", "mac", "posix" From 321b1fb1c2715a695f6c73f814c21f2418d5fd58 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Mon, 16 May 2016 15:42:36 -0700 Subject: [PATCH 092/175] separate posix functionality to grpc_posix.h --- BUILD | 7 + Makefile | 5 + binding.gyp | 1 + build.yaml | 2 + config.m4 | 1 + gRPC.podspec | 2 + grpc.def | 1 + grpc.gemspec | 2 + include/grpc/grpc_posix.h | 65 ++++ package.xml | 2 + .../client/insecure/channel_create_posix.c | 94 ++++++ .../grpcio/grpc/_cython/imports.generated.c | 2 + .../grpcio/grpc/_cython/imports.generated.h | 4 + src/python/grpcio/grpc_core_dependencies.py | 1 + src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 + src/ruby/ext/grpc/rb_grpc_imports.generated.h | 4 + test/core/end2end/fixtures/h2_fd.c | 2 +- test/core/end2end/gen_build_yaml.py | 4 +- third_party/protobuf | 2 +- tools/doxygen/Doxyfile.core | 1 + tools/doxygen/Doxyfile.core.internal | 2 + tools/run_tests/sources_and_headers.json | 5 +- tools/run_tests/tests.json | 318 +++++++++--------- vsprojects/vcxproj/grpc/grpc.vcxproj | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 6 + .../grpc_unsecure/grpc_unsecure.vcxproj | 3 + .../grpc_unsecure.vcxproj.filters | 6 + 27 files changed, 383 insertions(+), 164 deletions(-) create mode 100644 include/grpc/grpc_posix.h create mode 100644 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c diff --git a/BUILD b/BUILD index 3b1f04f6d14..1e0f112ac17 100644 --- a/BUILD +++ b/BUILD @@ -463,6 +463,7 @@ cc_library( "src/core/ext/client_config/uri_parser.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", + "src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c", "src/core/ext/lb_policy/pick_first/pick_first.c", @@ -488,6 +489,7 @@ cc_library( "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/grpc_posix.h", "include/grpc/status.h", "include/grpc/impl/codegen/byte_buffer.h", "include/grpc/impl/codegen/byte_buffer_reader.h", @@ -833,6 +835,7 @@ cc_library( "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/grpc_posix.h", "include/grpc/status.h", "include/grpc/impl/codegen/byte_buffer.h", "include/grpc/impl/codegen/byte_buffer_reader.h", @@ -1106,6 +1109,7 @@ cc_library( "src/core/ext/transport/chttp2/transport/writing.c", "src/core/ext/transport/chttp2/alpn/alpn.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", + "src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c", "src/core/ext/client_config/channel_connectivity.c", "src/core/ext/client_config/client_channel.c", "src/core/ext/client_config/client_channel_factory.c", @@ -1150,6 +1154,7 @@ cc_library( "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/grpc_posix.h", "include/grpc/status.h", "include/grpc/impl/codegen/byte_buffer.h", "include/grpc/impl/codegen/byte_buffer_reader.h", @@ -1840,6 +1845,7 @@ objc_library( "src/core/ext/client_config/uri_parser.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", + "src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c", "src/core/ext/lb_policy/pick_first/pick_first.c", @@ -1865,6 +1871,7 @@ objc_library( "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/grpc_posix.h", "include/grpc/status.h", "include/grpc/impl/codegen/byte_buffer.h", "include/grpc/impl/codegen/byte_buffer_reader.h", diff --git a/Makefile b/Makefile index 62bcd31724f..5eecfd74277 100644 --- a/Makefile +++ b/Makefile @@ -2635,6 +2635,7 @@ LIBGRPC_SRC = \ src/core/ext/client_config/uri_parser.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ + src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ third_party/nanopb/pb_common.c \ @@ -2663,6 +2664,7 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ + include/grpc/grpc_posix.h \ include/grpc/status.h \ include/grpc/impl/codegen/byte_buffer.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ @@ -2905,6 +2907,7 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ + include/grpc/grpc_posix.h \ include/grpc/status.h \ include/grpc/impl/codegen/byte_buffer.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ @@ -3184,6 +3187,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ + src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ src/core/ext/client_config/channel_connectivity.c \ src/core/ext/client_config/client_channel.c \ src/core/ext/client_config/client_channel_factory.c \ @@ -3231,6 +3235,7 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ + include/grpc/grpc_posix.h \ include/grpc/status.h \ include/grpc/impl/codegen/byte_buffer.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ diff --git a/binding.gyp b/binding.gyp index 4d9e9a49066..901ab45750d 100644 --- a/binding.gyp +++ b/binding.gyp @@ -719,6 +719,7 @@ 'src/core/ext/client_config/uri_parser.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', + 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'third_party/nanopb/pb_common.c', diff --git a/build.yaml b/build.yaml index 302e3f99e04..7ceaee9c6eb 100644 --- a/build.yaml +++ b/build.yaml @@ -154,6 +154,7 @@ filegroups: - include/grpc/byte_buffer_reader.h - include/grpc/compression.h - include/grpc/grpc.h + - include/grpc/grpc_posix.h - include/grpc/status.h headers: - src/core/lib/channel/channel_args.h @@ -561,6 +562,7 @@ filegroups: - name: grpc_transport_chttp2_client_insecure src: - src/core/ext/transport/chttp2/client/insecure/channel_create.c + - src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c uses: - grpc_transport_chttp2 - grpc_base diff --git a/config.m4 b/config.m4 index 54adac1bdc1..e3c5a81ae16 100644 --- a/config.m4 +++ b/config.m4 @@ -238,6 +238,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/client_config/uri_parser.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ + src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ third_party/nanopb/pb_common.c \ diff --git a/gRPC.podspec b/gRPC.podspec index 8e8f3f551ce..df1afc81535 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -318,6 +318,7 @@ Pod::Spec.new do |s| 'include/grpc/byte_buffer_reader.h', 'include/grpc/compression.h', 'include/grpc/grpc.h', + 'include/grpc/grpc_posix.h', 'include/grpc/status.h', 'include/grpc/impl/codegen/byte_buffer.h', 'include/grpc/impl/codegen/byte_buffer_reader.h', @@ -499,6 +500,7 @@ Pod::Spec.new do |s| 'src/core/ext/client_config/uri_parser.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', + 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'third_party/nanopb/pb_common.c', diff --git a/grpc.def b/grpc.def index b042a696b3e..562ca515af2 100644 --- a/grpc.def +++ b/grpc.def @@ -89,6 +89,7 @@ EXPORTS grpc_header_nonbin_value_is_legal grpc_is_binary_header grpc_call_error_to_string + grpc_insecure_channel_create_from_fd grpc_auth_property_iterator_next grpc_auth_context_property_iterator grpc_auth_context_peer_identity diff --git a/grpc.gemspec b/grpc.gemspec index 49ea3b0858c..daddc799260 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -147,6 +147,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/byte_buffer_reader.h ) s.files += %w( include/grpc/compression.h ) s.files += %w( include/grpc/grpc.h ) + s.files += %w( include/grpc/grpc_posix.h ) s.files += %w( include/grpc/status.h ) s.files += %w( include/grpc/impl/codegen/byte_buffer.h ) s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h ) @@ -478,6 +479,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/client_config/uri_parser.c ) s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2.c ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c ) + s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c ) s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c ) s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c ) s.files += %w( third_party/nanopb/pb_common.c ) diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h new file mode 100644 index 00000000000..4eedc10ef22 --- /dev/null +++ b/include/grpc/grpc_posix.h @@ -0,0 +1,65 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_GRPC_POSIX_H +#define GRPC_GRPC_POSIX_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*! \mainpage GRPC Core POSIX + * + * The GRPC Core POSIX library provides some POSIX-specific low-level + * functionality on top of GRPC Core. + */ + + +#ifdef GPR_POSIX_SOCKET + +/** Create a client channel to 'target' using file descriptor 'fd'. The 'target' + argument will be used to indicate the name for this channel. See the comment + for grpc_insecure_channel_create for description of 'args' argument. */ +GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd( + const char *target, int fd, const grpc_channel_args *args); + +#endif // GPR_POSIX_SOCKET + +#ifdef __cplusplus +} +#endif + +#endif /* GRPC_GRPC_POSIX_H */ diff --git a/package.xml b/package.xml index f780f8025b9..fb774c2e6a2 100644 --- a/package.xml +++ b/package.xml @@ -154,6 +154,7 @@ + @@ -485,6 +486,7 @@ + diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c new file mode 100644 index 00000000000..fdcf4c44306 --- /dev/null +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c @@ -0,0 +1,94 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifdef GPR_POSIX_SOCKET + +#include + +// #include +// #include +// #include + +// #include +// #include +// #include + +// #include "src/core/ext/client_config/client_channel.h" +// #include "src/core/ext/client_config/resolver_registry.h" +// #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +// #include "src/core/lib/channel/channel_args.h" +// #include "src/core/lib/channel/compress_filter.h" +// #include "src/core/lib/channel/http_client_filter.h" +// #include "src/core/lib/iomgr/tcp_client.h" +// #include "src/core/lib/iomgr/tcp_posix.h" +// #include "src/core/lib/surface/api_trace.h" +// #include "src/core/lib/surface/channel.h" + + +grpc_channel *grpc_insecure_channel_create_from_fd( + const char *target, int fd, const grpc_channel_args *args) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + GRPC_API_TRACE( + "grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, + (target, fd, args)); + + grpc_arg default_authority_arg; + default_authority_arg.type = GRPC_ARG_STRING; + default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; + default_authority_arg.value.string = "test.authority"; + grpc_channel_args *final_args = grpc_channel_args_copy_and_add( + args, &default_authority_arg, 1); + + int flags = fcntl(fd, F_GETFL, 0); + GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0); + + grpc_endpoint *client = grpc_tcp_create( + grpc_fd_create(fd, "client"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, + "fd-client"); + + grpc_transport *transport = + grpc_create_chttp2_transport(&exec_ctx, final_args, client, 1); + GPR_ASSERT(transport); + grpc_channel *channel = grpc_channel_create( + &exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); + grpc_channel_args_destroy(final_args); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); + + grpc_exec_ctx_finish(&exec_ctx); + + return channel != NULL ? channel : grpc_lame_client_channel_create( + target, GRPC_STATUS_INTERNAL, + "Failed to create client channel"); +} + +#endif // GPR_POSIX_SOCKET diff --git a/src/python/grpcio/grpc/_cython/imports.generated.c b/src/python/grpcio/grpc/_cython/imports.generated.c index 42b754429d0..8b8d8ba1ae3 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.c +++ b/src/python/grpcio/grpc/_cython/imports.generated.c @@ -127,6 +127,7 @@ grpc_header_key_is_legal_type grpc_header_key_is_legal_import; grpc_header_nonbin_value_is_legal_type grpc_header_nonbin_value_is_legal_import; grpc_is_binary_header_type grpc_is_binary_header_import; grpc_call_error_to_string_type grpc_call_error_to_string_import; +grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; grpc_auth_context_property_iterator_type grpc_auth_context_property_iterator_import; grpc_auth_context_peer_identity_type grpc_auth_context_peer_identity_import; @@ -399,6 +400,7 @@ void pygrpc_load_imports(HMODULE library) { grpc_header_nonbin_value_is_legal_import = (grpc_header_nonbin_value_is_legal_type) GetProcAddress(library, "grpc_header_nonbin_value_is_legal"); grpc_is_binary_header_import = (grpc_is_binary_header_type) GetProcAddress(library, "grpc_is_binary_header"); grpc_call_error_to_string_import = (grpc_call_error_to_string_type) GetProcAddress(library, "grpc_call_error_to_string"); + grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); grpc_auth_property_iterator_next_import = (grpc_auth_property_iterator_next_type) GetProcAddress(library, "grpc_auth_property_iterator_next"); grpc_auth_context_property_iterator_import = (grpc_auth_context_property_iterator_type) GetProcAddress(library, "grpc_auth_context_property_iterator"); grpc_auth_context_peer_identity_import = (grpc_auth_context_peer_identity_type) GetProcAddress(library, "grpc_auth_context_peer_identity"); diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index 556ebfb8485..42ebb91274d 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -331,6 +332,9 @@ extern grpc_is_binary_header_type grpc_is_binary_header_import; typedef const char *(*grpc_call_error_to_string_type)(grpc_call_error error); extern grpc_call_error_to_string_type grpc_call_error_to_string_import; #define grpc_call_error_to_string grpc_call_error_to_string_import +typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); +extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; +#define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import typedef const grpc_auth_property *(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator *it); extern grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; #define grpc_auth_property_iterator_next grpc_auth_property_iterator_next_import diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index b83c82cb926..0618b336d15 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -232,6 +232,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/client_config/uri_parser.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', + 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c', 'third_party/nanopb/pb_common.c', diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 9563f18b7e3..82761e95ca3 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -127,6 +127,7 @@ grpc_header_key_is_legal_type grpc_header_key_is_legal_import; grpc_header_nonbin_value_is_legal_type grpc_header_nonbin_value_is_legal_import; grpc_is_binary_header_type grpc_is_binary_header_import; grpc_call_error_to_string_type grpc_call_error_to_string_import; +grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; grpc_auth_context_property_iterator_type grpc_auth_context_property_iterator_import; grpc_auth_context_peer_identity_type grpc_auth_context_peer_identity_import; @@ -395,6 +396,7 @@ void grpc_rb_load_imports(HMODULE library) { grpc_header_nonbin_value_is_legal_import = (grpc_header_nonbin_value_is_legal_type) GetProcAddress(library, "grpc_header_nonbin_value_is_legal"); grpc_is_binary_header_import = (grpc_is_binary_header_type) GetProcAddress(library, "grpc_is_binary_header"); grpc_call_error_to_string_import = (grpc_call_error_to_string_type) GetProcAddress(library, "grpc_call_error_to_string"); + grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); grpc_auth_property_iterator_next_import = (grpc_auth_property_iterator_next_type) GetProcAddress(library, "grpc_auth_property_iterator_next"); grpc_auth_context_property_iterator_import = (grpc_auth_context_property_iterator_type) GetProcAddress(library, "grpc_auth_context_property_iterator"); grpc_auth_context_peer_identity_import = (grpc_auth_context_peer_identity_type) GetProcAddress(library, "grpc_auth_context_peer_identity"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 87dead533da..e83285828cd 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -331,6 +332,9 @@ extern grpc_is_binary_header_type grpc_is_binary_header_import; typedef const char *(*grpc_call_error_to_string_type)(grpc_call_error error); extern grpc_call_error_to_string_type grpc_call_error_to_string_import; #define grpc_call_error_to_string grpc_call_error_to_string_import +typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); +extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; +#define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import typedef const grpc_auth_property *(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator *it); extern grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; #define grpc_auth_property_iterator_next grpc_auth_property_iterator_next_import diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 64ca75f7ff3..1f4d2495e00 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -138,7 +138,7 @@ static void chttp2_tear_down_socketpair(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/socketpair", 0, chttp2_create_fixture_socketpair, + {"chttp2/fd", 0, chttp2_create_fixture_socketpair, chttp2_init_client_socketpair, chttp2_init_server_socketpair, chttp2_tear_down_socketpair}, }; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 98b7cf5dcd7..3d3bec1a69e 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -45,7 +45,7 @@ default_unsecure_fixture_options = FixtureOptions( socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False) default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True) uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix']) -fd_fixture_options = default_unsecure_fixture_options._replace( +fd_unsecure_fixture_options = default_unsecure_fixture_options._replace( dns_resolver=False, fullstack=False, platforms=['linux', 'mac', 'posix']) @@ -54,7 +54,7 @@ END2END_FIXTURES = { 'h2_compress': default_unsecure_fixture_options, 'h2_census': default_unsecure_fixture_options, 'h2_fakesec': default_secure_fixture_options._replace(ci_mac=False), - 'h2_fd': fd_fixture_options, + 'h2_fd': fd_unsecure_fixture_options, 'h2_full': default_unsecure_fixture_options, 'h2_full+pipe': default_unsecure_fixture_options._replace( platforms=['linux']), diff --git a/third_party/protobuf b/third_party/protobuf index 3470b6895aa..d5fb408ddc2 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 3470b6895aa659b7559ed678e029a5338e535f14 +Subproject commit d5fb408ddc281ffcadeb08699e65bb694656d0bd diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 7489401d74b..72102b2fc50 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -764,6 +764,7 @@ INPUT = include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ +include/grpc/grpc_posix.h \ include/grpc/status.h \ include/grpc/impl/codegen/byte_buffer.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 849a60eea98..648d42c1df8 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -764,6 +764,7 @@ INPUT = include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ +include/grpc/grpc_posix.h \ include/grpc/status.h \ include/grpc/impl/codegen/byte_buffer.h \ include/grpc/impl/codegen/byte_buffer_reader.h \ @@ -1095,6 +1096,7 @@ src/core/ext/client_config/subchannel_index.c \ src/core/ext/client_config/uri_parser.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ +src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \ third_party/nanopb/pb_common.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 839bac1c218..204ff4ce808 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -5631,6 +5631,7 @@ "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/grpc_posix.h", "include/grpc/status.h", "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", @@ -5715,6 +5716,7 @@ "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/grpc_posix.h", "include/grpc/status.h", "src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_args.h", @@ -6303,7 +6305,8 @@ "language": "c", "name": "grpc_transport_chttp2_client_insecure", "src": [ - "src/core/ext/transport/chttp2/client/insecure/channel_create.c" + "src/core/ext/transport/chttp2/client/insecure/channel_create.c", + "src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c" ], "third_party": false, "type": "filegroup" diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index e887dc74c39..59933e39626 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -9704,13 +9704,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9725,13 +9726,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9746,13 +9748,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9767,13 +9770,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9788,13 +9792,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9809,13 +9814,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9830,13 +9836,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9851,13 +9858,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9872,13 +9880,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9893,13 +9902,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9914,13 +9924,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9935,13 +9946,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9956,13 +9968,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9977,13 +9990,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -9998,13 +10012,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10019,13 +10034,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10040,13 +10056,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10061,13 +10078,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10082,13 +10100,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10103,13 +10122,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10124,13 +10144,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10145,13 +10166,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10166,13 +10188,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10187,13 +10210,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10208,13 +10232,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10229,13 +10254,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10250,13 +10276,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10271,13 +10298,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10292,13 +10320,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10313,13 +10342,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10334,13 +10364,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10355,13 +10386,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10376,13 +10408,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10397,13 +10430,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10418,13 +10452,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10439,13 +10474,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10460,13 +10496,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10481,13 +10518,14 @@ "ci_platforms": [ "windows", "linux", + "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_oauth2_test", + "name": "h2_loadreporting_test", "platforms": [ "windows", "linux", @@ -10502,14 +10540,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10524,14 +10561,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10546,14 +10582,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10568,14 +10603,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10590,14 +10624,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10612,14 +10645,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10634,14 +10666,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10656,14 +10687,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10678,14 +10708,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10700,14 +10729,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10722,14 +10750,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10744,14 +10771,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10766,14 +10792,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10788,14 +10813,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10810,14 +10834,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10832,14 +10855,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10854,14 +10876,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10876,14 +10897,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10898,14 +10918,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10920,14 +10939,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10942,14 +10960,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10964,14 +10981,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -10986,14 +11002,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11008,14 +11023,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11030,14 +11044,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11052,14 +11065,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11074,14 +11086,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11096,14 +11107,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11118,14 +11128,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11140,14 +11149,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11162,14 +11170,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11184,14 +11191,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11206,14 +11212,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11228,14 +11233,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11250,14 +11254,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11272,14 +11275,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11294,14 +11296,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11316,14 +11317,13 @@ "ci_platforms": [ "windows", "linux", - "mac", "posix" ], "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", - "name": "h2_loadreporting_test", + "name": "h2_oauth2_test", "platforms": [ "windows", "linux", @@ -11543,7 +11543,7 @@ }, { "args": [ - "empty_batch" + "disappearing_server" ], "ci_platforms": [ "windows", @@ -11564,7 +11564,7 @@ }, { "args": [ - "filter_causes_close" + "empty_batch" ], "ci_platforms": [ "windows", @@ -11627,7 +11627,7 @@ }, { "args": [ - "hpack_size" + "high_initial_seqno" ], "ci_platforms": [ "windows", @@ -11837,7 +11837,7 @@ }, { "args": [ - "request_with_flags" + "request_with_payload" ], "ci_platforms": [ "windows", @@ -11858,7 +11858,7 @@ }, { "args": [ - "request_with_payload" + "server_finishes_request" ], "ci_platforms": [ "windows", @@ -11879,7 +11879,7 @@ }, { "args": [ - "server_finishes_request" + "shutdown_finishes_calls" ], "ci_platforms": [ "windows", @@ -11900,7 +11900,7 @@ }, { "args": [ - "shutdown_finishes_calls" + "shutdown_finishes_tags" ], "ci_platforms": [ "windows", @@ -12215,7 +12215,7 @@ }, { "args": [ - "disappearing_server" + "empty_batch" ], "ci_platforms": [ "windows", @@ -12236,7 +12236,7 @@ }, { "args": [ - "empty_batch" + "filter_causes_close" ], "ci_platforms": [ "windows", @@ -12299,7 +12299,7 @@ }, { "args": [ - "high_initial_seqno" + "hpack_size" ], "ci_platforms": [ "windows", @@ -12530,7 +12530,7 @@ }, { "args": [ - "request_with_payload" + "request_with_flags" ], "ci_platforms": [ "windows", @@ -12551,7 +12551,7 @@ }, { "args": [ - "server_finishes_request" + "request_with_payload" ], "ci_platforms": [ "windows", @@ -12572,7 +12572,7 @@ }, { "args": [ - "shutdown_finishes_calls" + "server_finishes_request" ], "ci_platforms": [ "windows", @@ -12593,7 +12593,7 @@ }, { "args": [ - "shutdown_finishes_tags" + "shutdown_finishes_calls" ], "ci_platforms": [ "windows", @@ -17964,6 +17964,7 @@ "bad_hostname" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -17985,6 +17986,7 @@ "binary_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18006,6 +18008,7 @@ "cancel_after_accept" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18027,6 +18030,7 @@ "cancel_after_client_done" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18048,6 +18052,7 @@ "cancel_after_invoke" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18069,6 +18074,7 @@ "cancel_before_invoke" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18090,6 +18096,7 @@ "cancel_in_a_vacuum" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18111,6 +18118,7 @@ "cancel_with_status" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18220,6 +18228,7 @@ "empty_batch" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18241,6 +18250,7 @@ "filter_causes_close" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18262,6 +18272,7 @@ "graceful_server_shutdown" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18283,6 +18294,7 @@ "high_initial_seqno" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18304,6 +18316,7 @@ "hpack_size" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18325,6 +18338,7 @@ "idempotent_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18346,6 +18360,7 @@ "invoke_large_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18367,6 +18382,7 @@ "large_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18388,6 +18404,7 @@ "max_concurrent_streams" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18409,6 +18426,7 @@ "max_message_length" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18430,6 +18448,7 @@ "negative_deadline" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18451,6 +18470,7 @@ "no_op" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18472,6 +18492,7 @@ "payload" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18515,6 +18536,7 @@ "ping_pong_streaming" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18536,6 +18558,7 @@ "registered_call" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18557,6 +18580,7 @@ "request_with_flags" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18578,6 +18602,7 @@ "request_with_payload" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18599,6 +18624,7 @@ "server_finishes_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18620,6 +18646,7 @@ "shutdown_finishes_calls" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18641,6 +18668,7 @@ "shutdown_finishes_tags" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18684,6 +18712,7 @@ "simple_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18705,6 +18734,7 @@ "simple_request" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18726,6 +18756,7 @@ "trailing_metadata" ], "ci_platforms": [ + "windows", "linux", "mac", "posix" @@ -18747,7 +18778,6 @@ "bad_hostname" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18768,7 +18798,6 @@ "binary_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18789,7 +18818,6 @@ "cancel_after_accept" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18810,7 +18838,6 @@ "cancel_after_client_done" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18831,7 +18858,6 @@ "cancel_after_invoke" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18852,7 +18878,6 @@ "cancel_before_invoke" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18873,7 +18898,6 @@ "cancel_in_a_vacuum" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18894,7 +18918,6 @@ "cancel_with_status" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18935,7 +18958,6 @@ "empty_batch" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18956,7 +18978,6 @@ "filter_causes_close" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18977,7 +18998,6 @@ "graceful_server_shutdown" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -18998,7 +19018,6 @@ "high_initial_seqno" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19019,7 +19038,6 @@ "hpack_size" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19040,7 +19058,6 @@ "idempotent_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19061,7 +19078,6 @@ "invoke_large_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19082,7 +19098,6 @@ "large_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19103,7 +19118,6 @@ "max_concurrent_streams" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19124,7 +19138,6 @@ "max_message_length" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19145,7 +19158,6 @@ "negative_deadline" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19166,7 +19178,6 @@ "no_op" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19187,7 +19198,6 @@ "payload" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19208,7 +19218,6 @@ "ping_pong_streaming" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19229,7 +19238,6 @@ "registered_call" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19250,7 +19258,6 @@ "request_with_flags" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19271,7 +19278,6 @@ "request_with_payload" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19292,7 +19298,6 @@ "server_finishes_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19313,7 +19318,6 @@ "shutdown_finishes_calls" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19334,7 +19338,6 @@ "shutdown_finishes_tags" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19355,7 +19358,6 @@ "simple_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19376,7 +19378,6 @@ "simple_request" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" @@ -19397,7 +19398,6 @@ "trailing_metadata" ], "ci_platforms": [ - "windows", "linux", "mac", "posix" diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 2e8e7ca5dd6..4cc5f6011c8 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -271,6 +271,7 @@ + @@ -762,6 +763,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 4d58c8e9a5c..a8ac26514d9 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -469,6 +469,9 @@ src\core\ext\transport\chttp2\client\insecure + + src\core\ext\transport\chttp2\client\insecure + src\core\ext\lb_policy\grpclb @@ -549,6 +552,9 @@ include\grpc + + include\grpc + include\grpc diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 5f7bc887155..6edae2765dc 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -262,6 +262,7 @@ + @@ -634,6 +635,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 5006ac7e9b8..3279325eb1f 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -328,6 +328,9 @@ src\core\ext\transport\chttp2\client\insecure + + src\core\ext\transport\chttp2\client\insecure + src\core\ext\client_config @@ -465,6 +468,9 @@ include\grpc + + include\grpc + include\grpc From 3a3e14ca096e030bbbbeb7c52a4ef66f371d5166 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Mon, 16 May 2016 15:48:12 -0700 Subject: [PATCH 093/175] revert channel_create.c --- .../chttp2/client/insecure/channel_create.c | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.c b/src/core/ext/transport/chttp2/client/insecure/channel_create.c index ded0721e943..c5d3d8d9cc8 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c @@ -33,7 +33,6 @@ #include -#include #include #include @@ -48,7 +47,6 @@ #include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/iomgr/tcp_client.h" -#include "src/core/lib/iomgr/tcp_posix.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/channel.h" @@ -237,40 +235,6 @@ grpc_channel *grpc_insecure_channel_create(const char *target, grpc_exec_ctx_finish(&exec_ctx); - return channel; /* may be NULL */ -} - -grpc_channel *grpc_insecure_channel_create_from_fd( - const char *target, int fd, const grpc_channel_args *args) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GRPC_API_TRACE( - "grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, - (target, fd, args)); - - grpc_arg default_authority_arg; - default_authority_arg.type = GRPC_ARG_STRING; - default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; - default_authority_arg.value.string = "test.authority"; - grpc_channel_args *final_args = grpc_channel_args_copy_and_add( - args, &default_authority_arg, 1); - - int flags = fcntl(fd, F_GETFL, 0); - GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0); - - grpc_endpoint *client = grpc_tcp_create( - grpc_fd_create(fd, "client"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, - "fd-client"); - - grpc_transport *transport = - grpc_create_chttp2_transport(&exec_ctx, final_args, client, 1); - GPR_ASSERT(transport); - grpc_channel *channel = grpc_channel_create( - &exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); - grpc_channel_args_destroy(final_args); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); - - grpc_exec_ctx_finish(&exec_ctx); - return channel != NULL ? channel : grpc_lame_client_channel_create( target, GRPC_STATUS_INTERNAL, "Failed to create client channel"); From 8cf5303e8cc2e411420b0c69070dfdb838b182f3 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Mon, 16 May 2016 16:08:05 -0700 Subject: [PATCH 094/175] more separation --- include/grpc/grpc_posix.h | 4 ++- .../client/insecure/channel_create_posix.c | 28 ++++++++----------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index 4eedc10ef22..12bb287d1ac 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -34,7 +34,10 @@ #ifndef GRPC_GRPC_POSIX_H #define GRPC_GRPC_POSIX_H + #include +#include + #include #ifdef __cplusplus @@ -47,7 +50,6 @@ extern "C" { * functionality on top of GRPC Core. */ - #ifdef GPR_POSIX_SOCKET /** Create a client channel to 'target' using file descriptor 'fd'. The 'target' diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c index fdcf4c44306..7d28dbf8a9f 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c @@ -31,28 +31,22 @@ * */ +#include + #ifdef GPR_POSIX_SOCKET #include -// #include -// #include -// #include - -// #include -// #include -// #include +#include -// #include "src/core/ext/client_config/client_channel.h" -// #include "src/core/ext/client_config/resolver_registry.h" -// #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -// #include "src/core/lib/channel/channel_args.h" -// #include "src/core/lib/channel/compress_filter.h" -// #include "src/core/lib/channel/http_client_filter.h" -// #include "src/core/lib/iomgr/tcp_client.h" -// #include "src/core/lib/iomgr/tcp_posix.h" -// #include "src/core/lib/surface/api_trace.h" -// #include "src/core/lib/surface/channel.h" +#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/transport/transport.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/tcp_posix.h" +#include "src/core/lib/surface/api_trace.h" +#include "src/core/lib/surface/channel.h" grpc_channel *grpc_insecure_channel_create_from_fd( From a1f8b141f629fb30857da8f1dbc7f2d9ac09605f Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Mon, 16 May 2016 16:12:55 -0700 Subject: [PATCH 095/175] revert grpc.h --- include/grpc/grpc.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 163d5291d30..6f7a67b715e 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -240,12 +240,6 @@ GRPCAPI char *grpc_channel_get_target(grpc_channel *channel); GRPCAPI grpc_channel *grpc_insecure_channel_create( const char *target, const grpc_channel_args *args, void *reserved); -/** Create a client channel to 'target' using file descriptor 'fd'. The 'target' - argument will be used to indicate the name for this channel. See the comment - for grpc_insecure_channel_create for description of 'args' argument. */ -GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd( - const char *target, int fd, const grpc_channel_args *args); - /** Create a lame client: this client fails every operation attempted on it. */ GRPCAPI grpc_channel *grpc_lame_client_channel_create( const char *target, grpc_status_code error_code, const char *error_message); From f31a7ff597979986ac2dfea442be22c947a0c6c4 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Fri, 20 May 2016 15:27:30 -0700 Subject: [PATCH 096/175] added missing include --- test/core/end2end/fixtures/h2_fd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 1f4d2495e00..9e3df58a52a 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "src/core/ext/client_config/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/compress_filter.h" @@ -125,8 +126,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_fd_create(sfd->fd_pair[1], "fixture_server"), 65536 /* read_slice_size */, "fixture_server"); - transport = - grpc_create_chttp2_transport(&exec_ctx, server_args, server_endpoint, 0); + transport = grpc_create_chttp2_transport(&exec_ctx, server_args, server_endpoint, 0); server_setup_transport(f, transport); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); grpc_exec_ctx_finish(&exec_ctx); From 1f2386562267e37c9f9c28173965275d391aec9e Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Fri, 20 May 2016 15:55:57 -0700 Subject: [PATCH 097/175] code formatting --- test/core/end2end/fixtures/h2_fd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 9e3df58a52a..bdda5d95792 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -126,7 +126,8 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_fd_create(sfd->fd_pair[1], "fixture_server"), 65536 /* read_slice_size */, "fixture_server"); - transport = grpc_create_chttp2_transport(&exec_ctx, server_args, server_endpoint, 0); + transport = + grpc_create_chttp2_transport(&exec_ctx, server_args, server_endpoint, 0); server_setup_transport(f, transport); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); grpc_exec_ctx_finish(&exec_ctx); From 4023382294f732fe8fa1ff8e10a3eed68c154ff0 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Fri, 20 May 2016 15:53:01 -0700 Subject: [PATCH 098/175] Add support for establishing server channel using existing FD --- include/grpc/grpc_posix.h | 5 ++ .../server/insecure/server_chttp2_posix.c | 58 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index 12bb287d1ac..b72ea5208db 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -58,6 +58,11 @@ extern "C" { GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd( const char *target, int fd, const grpc_channel_args *args); +/** Add the connected communication channel based on file descriptor 'fd' to the + 'server'. The 'fd' must be an open file descriptor corresponding to a + connected socket. */ +GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd); + #endif // GPR_POSIX_SOCKET #ifdef __cplusplus diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c new file mode 100644 index 00000000000..012fbb432a7 --- /dev/null +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -0,0 +1,58 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef GPR_POSIX_SOCKET + +#include +#include + +void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + char *name; + gpr_asprintf(&name, "fd:%d", fd); + + grpc_endpoint *server_endpoint = grpc_tcp_create( + grpc_fd_create(fd, name), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name); + + grpc_channel_args *server_args = grpc_server_get_channel_args(server); + grpc_transport *transport = grpc_create_chttp2_transport( + &exec_ctx, server_args, server_endpoint, 0 /* is_client */); + grpc_server_setup_transport(&exec_ctx, server, transport, server_args); + + +} + + +#endif // GPR_POSIX_SOCKET From bf10c82bf805a6d9b87813650e581113c4c7b3ff Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Fri, 20 May 2016 16:13:32 -0700 Subject: [PATCH 099/175] implement support for adding external fd to server --- BUILD | 3 ++ Makefile | 2 + binding.gyp | 1 + build.yaml | 1 + config.m4 | 1 + gRPC.podspec | 1 + grpc.def | 2 +- grpc.gemspec | 1 + package.xml | 1 + .../server/insecure/server_chttp2_posix.c | 14 ++++-- .../grpcio/grpc/_cython/imports.generated.c | 4 +- .../grpcio/grpc/_cython/imports.generated.h | 6 +-- src/python/grpcio/grpc_core_dependencies.py | 1 + src/ruby/ext/grpc/rb_grpc_imports.generated.c | 4 +- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 6 +-- test/core/end2end/fixtures/h2_fd.c | 47 ++++--------------- tools/doxygen/Doxyfile.core.internal | 1 + tools/run_tests/sources_and_headers.json | 3 +- vsprojects/vcxproj/grpc/grpc.vcxproj | 2 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 3 ++ .../grpc_unsecure/grpc_unsecure.vcxproj | 2 + .../grpc_unsecure.vcxproj.filters | 3 ++ 22 files changed, 55 insertions(+), 54 deletions(-) diff --git a/BUILD b/BUILD index 1e0f112ac17..f1f3b8bff7b 100644 --- a/BUILD +++ b/BUILD @@ -462,6 +462,7 @@ cc_library( "src/core/ext/client_config/subchannel_index.c", "src/core/ext/client_config/uri_parser.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", + "src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", @@ -1086,6 +1087,7 @@ cc_library( "src/core/lib/transport/transport.c", "src/core/lib/transport/transport_op_string.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", + "src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c", "src/core/ext/transport/chttp2/transport/bin_encoder.c", "src/core/ext/transport/chttp2/transport/chttp2_plugin.c", "src/core/ext/transport/chttp2/transport/chttp2_transport.c", @@ -1844,6 +1846,7 @@ objc_library( "src/core/ext/client_config/subchannel_index.c", "src/core/ext/client_config/uri_parser.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", + "src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", diff --git a/Makefile b/Makefile index 5eecfd74277..78900aedd8d 100644 --- a/Makefile +++ b/Makefile @@ -2634,6 +2634,7 @@ LIBGRPC_SRC = \ src/core/ext/client_config/subchannel_index.c \ src/core/ext/client_config/uri_parser.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ + src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ @@ -3164,6 +3165,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/transport/transport.c \ src/core/lib/transport/transport_op_string.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ + src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \ src/core/ext/transport/chttp2/transport/bin_encoder.c \ src/core/ext/transport/chttp2/transport/chttp2_plugin.c \ src/core/ext/transport/chttp2/transport/chttp2_transport.c \ diff --git a/binding.gyp b/binding.gyp index 901ab45750d..80077a99bd8 100644 --- a/binding.gyp +++ b/binding.gyp @@ -718,6 +718,7 @@ 'src/core/ext/client_config/subchannel_index.c', 'src/core/ext/client_config/uri_parser.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', + 'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', diff --git a/build.yaml b/build.yaml index 7ceaee9c6eb..0a57965ab7b 100644 --- a/build.yaml +++ b/build.yaml @@ -578,6 +578,7 @@ filegroups: - name: grpc_transport_chttp2_server_insecure src: - src/core/ext/transport/chttp2/server/insecure/server_chttp2.c + - src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c uses: - grpc_transport_chttp2 - grpc_base diff --git a/config.m4 b/config.m4 index e3c5a81ae16..a760d982d13 100644 --- a/config.m4 +++ b/config.m4 @@ -237,6 +237,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/client_config/subchannel_index.c \ src/core/ext/client_config/uri_parser.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ + src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ diff --git a/gRPC.podspec b/gRPC.podspec index df1afc81535..2266e17205e 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -499,6 +499,7 @@ Pod::Spec.new do |s| 'src/core/ext/client_config/subchannel_index.c', 'src/core/ext/client_config/uri_parser.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', + 'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', diff --git a/grpc.def b/grpc.def index 562ca515af2..0046028949e 100644 --- a/grpc.def +++ b/grpc.def @@ -67,7 +67,6 @@ EXPORTS grpc_census_call_get_context grpc_channel_get_target grpc_insecure_channel_create - grpc_insecure_channel_create_from_fd grpc_lame_client_channel_create grpc_channel_destroy grpc_call_cancel @@ -90,6 +89,7 @@ EXPORTS grpc_is_binary_header grpc_call_error_to_string grpc_insecure_channel_create_from_fd + grpc_server_add_insecure_channel_from_fd grpc_auth_property_iterator_next grpc_auth_context_property_iterator grpc_auth_context_peer_identity diff --git a/grpc.gemspec b/grpc.gemspec index daddc799260..406e0477b92 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -478,6 +478,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/client_config/subchannel_index.c ) s.files += %w( src/core/ext/client_config/uri_parser.c ) s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2.c ) + s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c ) s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c ) diff --git a/package.xml b/package.xml index fb774c2e6a2..edd81623499 100644 --- a/package.xml +++ b/package.xml @@ -485,6 +485,7 @@ + diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index 012fbb432a7..1946f394d40 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -37,6 +37,14 @@ #include #include +#include + +#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/tcp_posix.h" +#include "src/core/lib/surface/server.h" void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -46,12 +54,12 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd) { grpc_endpoint *server_endpoint = grpc_tcp_create( grpc_fd_create(fd, name), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name); - grpc_channel_args *server_args = grpc_server_get_channel_args(server); + const grpc_channel_args *server_args = grpc_server_get_channel_args(server); grpc_transport *transport = grpc_create_chttp2_transport( &exec_ctx, server_args, server_endpoint, 0 /* is_client */); grpc_server_setup_transport(&exec_ctx, server, transport, server_args); - - + grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); + grpc_exec_ctx_finish(&exec_ctx); } diff --git a/src/python/grpcio/grpc/_cython/imports.generated.c b/src/python/grpcio/grpc/_cython/imports.generated.c index 8b8d8ba1ae3..5c49f6cf3e9 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.c +++ b/src/python/grpcio/grpc/_cython/imports.generated.c @@ -105,7 +105,6 @@ grpc_census_call_set_context_type grpc_census_call_set_context_import; grpc_census_call_get_context_type grpc_census_call_get_context_import; grpc_channel_get_target_type grpc_channel_get_target_import; grpc_insecure_channel_create_type grpc_insecure_channel_create_import; -grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; grpc_channel_destroy_type grpc_channel_destroy_import; grpc_call_cancel_type grpc_call_cancel_import; @@ -128,6 +127,7 @@ grpc_header_nonbin_value_is_legal_type grpc_header_nonbin_value_is_legal_import; grpc_is_binary_header_type grpc_is_binary_header_import; grpc_call_error_to_string_type grpc_call_error_to_string_import; grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; +grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import; grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; grpc_auth_context_property_iterator_type grpc_auth_context_property_iterator_import; grpc_auth_context_peer_identity_type grpc_auth_context_peer_identity_import; @@ -378,7 +378,6 @@ void pygrpc_load_imports(HMODULE library) { grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context"); grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target"); grpc_insecure_channel_create_import = (grpc_insecure_channel_create_type) GetProcAddress(library, "grpc_insecure_channel_create"); - grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); grpc_lame_client_channel_create_import = (grpc_lame_client_channel_create_type) GetProcAddress(library, "grpc_lame_client_channel_create"); grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy"); grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel"); @@ -401,6 +400,7 @@ void pygrpc_load_imports(HMODULE library) { grpc_is_binary_header_import = (grpc_is_binary_header_type) GetProcAddress(library, "grpc_is_binary_header"); grpc_call_error_to_string_import = (grpc_call_error_to_string_type) GetProcAddress(library, "grpc_call_error_to_string"); grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); + grpc_server_add_insecure_channel_from_fd_import = (grpc_server_add_insecure_channel_from_fd_type) GetProcAddress(library, "grpc_server_add_insecure_channel_from_fd"); grpc_auth_property_iterator_next_import = (grpc_auth_property_iterator_next_type) GetProcAddress(library, "grpc_auth_property_iterator_next"); grpc_auth_context_property_iterator_import = (grpc_auth_context_property_iterator_type) GetProcAddress(library, "grpc_auth_context_property_iterator"); grpc_auth_context_peer_identity_import = (grpc_auth_context_peer_identity_type) GetProcAddress(library, "grpc_auth_context_peer_identity"); diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index 42ebb91274d..701a3aec282 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -266,9 +266,6 @@ extern grpc_channel_get_target_type grpc_channel_get_target_import; typedef grpc_channel *(*grpc_insecure_channel_create_type)(const char *target, const grpc_channel_args *args, void *reserved); extern grpc_insecure_channel_create_type grpc_insecure_channel_create_import; #define grpc_insecure_channel_create grpc_insecure_channel_create_import -typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); -extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; -#define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import typedef grpc_channel *(*grpc_lame_client_channel_create_type)(const char *target, grpc_status_code error_code, const char *error_message); extern grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; #define grpc_lame_client_channel_create grpc_lame_client_channel_create_import @@ -335,6 +332,9 @@ extern grpc_call_error_to_string_type grpc_call_error_to_string_import; typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; #define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import +typedef void(*grpc_server_add_insecure_channel_from_fd_type)(grpc_server *server, int fd); +extern grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import; +#define grpc_server_add_insecure_channel_from_fd grpc_server_add_insecure_channel_from_fd_import typedef const grpc_auth_property *(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator *it); extern grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; #define grpc_auth_property_iterator_next grpc_auth_property_iterator_next_import diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 0618b336d15..0e4d962154f 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -231,6 +231,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/client_config/subchannel_index.c', 'src/core/ext/client_config/uri_parser.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', + 'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 82761e95ca3..c13d1a00d74 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -105,7 +105,6 @@ grpc_census_call_set_context_type grpc_census_call_set_context_import; grpc_census_call_get_context_type grpc_census_call_get_context_import; grpc_channel_get_target_type grpc_channel_get_target_import; grpc_insecure_channel_create_type grpc_insecure_channel_create_import; -grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; grpc_channel_destroy_type grpc_channel_destroy_import; grpc_call_cancel_type grpc_call_cancel_import; @@ -128,6 +127,7 @@ grpc_header_nonbin_value_is_legal_type grpc_header_nonbin_value_is_legal_import; grpc_is_binary_header_type grpc_is_binary_header_import; grpc_call_error_to_string_type grpc_call_error_to_string_import; grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; +grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import; grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; grpc_auth_context_property_iterator_type grpc_auth_context_property_iterator_import; grpc_auth_context_peer_identity_type grpc_auth_context_peer_identity_import; @@ -374,7 +374,6 @@ void grpc_rb_load_imports(HMODULE library) { grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context"); grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target"); grpc_insecure_channel_create_import = (grpc_insecure_channel_create_type) GetProcAddress(library, "grpc_insecure_channel_create"); - grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); grpc_lame_client_channel_create_import = (grpc_lame_client_channel_create_type) GetProcAddress(library, "grpc_lame_client_channel_create"); grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy"); grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel"); @@ -397,6 +396,7 @@ void grpc_rb_load_imports(HMODULE library) { grpc_is_binary_header_import = (grpc_is_binary_header_type) GetProcAddress(library, "grpc_is_binary_header"); grpc_call_error_to_string_import = (grpc_call_error_to_string_type) GetProcAddress(library, "grpc_call_error_to_string"); grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); + grpc_server_add_insecure_channel_from_fd_import = (grpc_server_add_insecure_channel_from_fd_type) GetProcAddress(library, "grpc_server_add_insecure_channel_from_fd"); grpc_auth_property_iterator_next_import = (grpc_auth_property_iterator_next_type) GetProcAddress(library, "grpc_auth_property_iterator_next"); grpc_auth_context_property_iterator_import = (grpc_auth_context_property_iterator_type) GetProcAddress(library, "grpc_auth_context_property_iterator"); grpc_auth_context_peer_identity_import = (grpc_auth_context_peer_identity_type) GetProcAddress(library, "grpc_auth_context_peer_identity"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index e83285828cd..4a7d4b272a3 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -266,9 +266,6 @@ extern grpc_channel_get_target_type grpc_channel_get_target_import; typedef grpc_channel *(*grpc_insecure_channel_create_type)(const char *target, const grpc_channel_args *args, void *reserved); extern grpc_insecure_channel_create_type grpc_insecure_channel_create_import; #define grpc_insecure_channel_create grpc_insecure_channel_create_import -typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); -extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; -#define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import typedef grpc_channel *(*grpc_lame_client_channel_create_type)(const char *target, grpc_status_code error_code, const char *error_message); extern grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; #define grpc_lame_client_channel_create grpc_lame_client_channel_create_import @@ -335,6 +332,9 @@ extern grpc_call_error_to_string_type grpc_call_error_to_string_import; typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; #define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import +typedef void(*grpc_server_add_insecure_channel_from_fd_type)(grpc_server *server, int fd); +extern grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import; +#define grpc_server_add_insecure_channel_from_fd grpc_server_add_insecure_channel_from_fd_import typedef const grpc_auth_property *(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator *it); extern grpc_auth_property_iterator_next_type grpc_auth_property_iterator_next_import; #define grpc_auth_property_iterator_next grpc_auth_property_iterator_next_import diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index bdda5d95792..b162cf82485 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -35,47 +35,20 @@ #include #include -#include -#include #include -#include -#include -#include -#include +#include #include -#include "src/core/ext/client_config/client_channel.h" -#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/lib/channel/compress_filter.h" -#include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_client_filter.h" -#include "src/core/lib/channel/http_server_filter.h" -#include "src/core/lib/iomgr/endpoint_pair.h" -#include "src/core/lib/iomgr/iomgr.h" +#include #include "src/core/lib/iomgr/socket_utils_posix.h" -#include "src/core/lib/iomgr/tcp_posix.h" +#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/unix_sockets_posix.h" -#include "src/core/lib/surface/channel.h" -#include "src/core/lib/surface/server.h" -#include "test/core/util/port.h" #include "test/core/util/test_config.h" -/* chttp2 transport that is immediately available (used for testing - connected_channel without a client_channel */ - -static void server_setup_transport(void *ts, grpc_transport *transport) { - grpc_end2end_test_fixture *f = ts; - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, f->server, transport, - grpc_server_get_channel_args(f->server)); - grpc_exec_ctx_finish(&exec_ctx); -} - typedef struct { int fd_pair[2]; } sp_fixture_data; - static void create_sockets(int sv[2]) { int flags; grpc_create_socketpair_if_unix(sv); @@ -106,6 +79,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; sp_fixture_data *sfd = f->fixture_data; + GPR_ASSERT(!f->client); f->client = grpc_insecure_channel_create_from_fd( "fixture_client", sfd->fd_pair[0], client_args); GPR_ASSERT(f->client); @@ -117,19 +91,14 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; sp_fixture_data *sfd = f->fixture_data; - grpc_transport *transport; GPR_ASSERT(!f->server); f->server = grpc_server_create(server_args, NULL); + GPR_ASSERT(f->server); grpc_server_register_completion_queue(f->server, f->cq, NULL); grpc_server_start(f->server); - grpc_endpoint *server_endpoint = grpc_tcp_create( - grpc_fd_create(sfd->fd_pair[1], "fixture_server"), - 65536 /* read_slice_size */, "fixture_server"); - - transport = - grpc_create_chttp2_transport(&exec_ctx, server_args, server_endpoint, 0); - server_setup_transport(f, transport); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); + + grpc_server_add_insecure_channel_from_fd(f->server, sfd->fd_pair[1]); + grpc_exec_ctx_finish(&exec_ctx); } diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 648d42c1df8..64ab164d570 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1095,6 +1095,7 @@ src/core/ext/client_config/subchannel_call_holder.c \ src/core/ext/client_config/subchannel_index.c \ src/core/ext/client_config/uri_parser.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ +src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 204ff4ce808..782aa373bf0 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6338,7 +6338,8 @@ "language": "c", "name": "grpc_transport_chttp2_server_insecure", "src": [ - "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c" + "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", + "src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c" ], "third_party": false, "type": "filegroup" diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 4cc5f6011c8..4327ab93173 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -761,6 +761,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index a8ac26514d9..860575cc09d 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -466,6 +466,9 @@ src\core\ext\transport\chttp2\server\insecure + + src\core\ext\transport\chttp2\server\insecure + src\core\ext\transport\chttp2\client\insecure diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 6edae2765dc..3695ad44a0c 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -589,6 +589,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 3279325eb1f..a22e199f593 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -259,6 +259,9 @@ src\core\ext\transport\chttp2\server\insecure + + src\core\ext\transport\chttp2\server\insecure + src\core\ext\transport\chttp2\transport From da5d85d660495f68f03756590606ca59513c8b54 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Wed, 25 May 2016 11:35:57 -0700 Subject: [PATCH 100/175] Add completion queue argument which is necessary after merge with master --- include/grpc/grpc_posix.h | 7 +++++-- .../chttp2/server/insecure/server_chttp2_posix.c | 8 ++++++-- test/core/end2end/fixtures/h2_fd.c | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index b72ea5208db..509e51e2c40 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -60,8 +60,11 @@ GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd( /** Add the connected communication channel based on file descriptor 'fd' to the 'server'. The 'fd' must be an open file descriptor corresponding to a - connected socket. */ -GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd); + connected socket. The 'cq' is a completion queue that will be getting events + from that descriptor. */ +GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server, + grpc_completion_queue *cq, + int fd); #endif // GPR_POSIX_SOCKET diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index 1946f394d40..1807efc85d3 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -44,9 +44,12 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/tcp_posix.h" +#include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" -void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd) { +void grpc_server_add_insecure_channel_from_fd(grpc_server *server, + grpc_completion_queue *cq, + int fd) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; char *name; gpr_asprintf(&name, "fd:%d", fd); @@ -57,7 +60,8 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, int fd) { const grpc_channel_args *server_args = grpc_server_get_channel_args(server); grpc_transport *transport = grpc_create_chttp2_transport( &exec_ctx, server_args, server_endpoint, 0 /* is_client */); - grpc_server_setup_transport(&exec_ctx, server, transport, server_args); + grpc_endpoint_add_to_pollset(&exec_ctx, server_endpoint, grpc_cq_pollset(cq)); + grpc_server_setup_transport(&exec_ctx, server, transport, NULL, server_args); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index b162cf82485..70790807223 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -97,7 +97,7 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_server_register_completion_queue(f->server, f->cq, NULL); grpc_server_start(f->server); - grpc_server_add_insecure_channel_from_fd(f->server, sfd->fd_pair[1]); + grpc_server_add_insecure_channel_from_fd(f->server, f->cq, sfd->fd_pair[1]); grpc_exec_ctx_finish(&exec_ctx); } From b97e2d145efb4d0b407d18b43d3b7bb38bccf61f Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Thu, 2 Jun 2016 12:12:55 -0700 Subject: [PATCH 101/175] Add C++ support for using external FD --- BUILD | 8 +++ Makefile | 8 +++ build.yaml | 4 ++ include/grpc++/create_channel_posix.h | 57 +++++++++++++++++++ include/grpc++/grpc++.h | 2 + include/grpc++/server.h | 6 ++ include/grpc++/server_posix.h | 56 ++++++++++++++++++ include/grpc/grpc_posix.h | 4 +- include/grpc/impl/codegen/port_platform.h | 5 ++ .../client/insecure/channel_create_posix.c | 4 +- .../server/insecure/server_chttp2_posix.c | 4 +- src/cpp/client/create_channel_posix.cc | 57 +++++++++++++++++++ src/cpp/server/server.cc | 8 +++ src/cpp/server/server_posix.cc | 51 +++++++++++++++++ .../grpcio/grpc/_cython/imports.generated.h | 2 +- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 2 +- tools/doxygen/Doxyfile.c++ | 2 + tools/doxygen/Doxyfile.c++.internal | 4 ++ tools/run_tests/sources_and_headers.json | 6 ++ vsprojects/vcxproj/grpc++/grpc++.vcxproj | 6 ++ .../vcxproj/grpc++/grpc++.vcxproj.filters | 12 ++++ .../grpc++_unsecure/grpc++_unsecure.vcxproj | 6 ++ .../grpc++_unsecure.vcxproj.filters | 12 ++++ 23 files changed, 318 insertions(+), 8 deletions(-) create mode 100644 include/grpc++/create_channel_posix.h create mode 100644 include/grpc++/server_posix.h create mode 100644 src/cpp/client/create_channel_posix.cc create mode 100644 src/cpp/server/server_posix.cc diff --git a/BUILD b/BUILD index f1f3b8bff7b..16bbdaa7cee 100644 --- a/BUILD +++ b/BUILD @@ -1236,6 +1236,7 @@ cc_library( "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", "src/cpp/client/create_channel_internal.cc", + "src/cpp/client/create_channel_posix.cc", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", @@ -1251,6 +1252,7 @@ cc_library( "src/cpp/server/server_builder.cc", "src/cpp/server/server_context.cc", "src/cpp/server/server_credentials.cc", + "src/cpp/server/server_posix.cc", "src/cpp/util/byte_buffer.cc", "src/cpp/util/slice.cc", "src/cpp/util/status.cc", @@ -1264,6 +1266,7 @@ cc_library( "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", + "include/grpc++/create_channel_posix.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", @@ -1291,6 +1294,7 @@ cc_library( "include/grpc++/server.h", "include/grpc++/server_builder.h", "include/grpc++/server_context.h", + "include/grpc++/server_posix.h", "include/grpc++/support/async_stream.h", "include/grpc++/support/async_unary_call.h", "include/grpc++/support/byte_buffer.h", @@ -1380,6 +1384,7 @@ cc_library( "src/cpp/client/client_context.cc", "src/cpp/client/create_channel.cc", "src/cpp/client/create_channel_internal.cc", + "src/cpp/client/create_channel_posix.cc", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", @@ -1395,6 +1400,7 @@ cc_library( "src/cpp/server/server_builder.cc", "src/cpp/server/server_context.cc", "src/cpp/server/server_credentials.cc", + "src/cpp/server/server_posix.cc", "src/cpp/util/byte_buffer.cc", "src/cpp/util/slice.cc", "src/cpp/util/status.cc", @@ -1408,6 +1414,7 @@ cc_library( "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", + "include/grpc++/create_channel_posix.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", @@ -1435,6 +1442,7 @@ cc_library( "include/grpc++/server.h", "include/grpc++/server_builder.h", "include/grpc++/server_context.h", + "include/grpc++/server_posix.h", "include/grpc++/support/async_stream.h", "include/grpc++/support/async_unary_call.h", "include/grpc++/support/byte_buffer.h", diff --git a/Makefile b/Makefile index 78900aedd8d..58358e23330 100644 --- a/Makefile +++ b/Makefile @@ -3431,6 +3431,7 @@ LIBGRPC++_SRC = \ src/cpp/client/client_context.cc \ src/cpp/client/create_channel.cc \ src/cpp/client/create_channel_internal.cc \ + src/cpp/client/create_channel_posix.cc \ src/cpp/client/credentials.cc \ src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ @@ -3446,6 +3447,7 @@ LIBGRPC++_SRC = \ src/cpp/server/server_builder.cc \ src/cpp/server/server_context.cc \ src/cpp/server/server_credentials.cc \ + src/cpp/server/server_posix.cc \ src/cpp/util/byte_buffer.cc \ src/cpp/util/slice.cc \ src/cpp/util/status.cc \ @@ -3459,6 +3461,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ + include/grpc++/create_channel_posix.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ @@ -3486,6 +3489,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ + include/grpc++/server_posix.h \ include/grpc++/support/async_stream.h \ include/grpc++/support/async_unary_call.h \ include/grpc++/support/byte_buffer.h \ @@ -3786,6 +3790,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/client/client_context.cc \ src/cpp/client/create_channel.cc \ src/cpp/client/create_channel_internal.cc \ + src/cpp/client/create_channel_posix.cc \ src/cpp/client/credentials.cc \ src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ @@ -3801,6 +3806,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/server/server_builder.cc \ src/cpp/server/server_context.cc \ src/cpp/server/server_credentials.cc \ + src/cpp/server/server_posix.cc \ src/cpp/util/byte_buffer.cc \ src/cpp/util/slice.cc \ src/cpp/util/status.cc \ @@ -3814,6 +3820,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ + include/grpc++/create_channel_posix.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ @@ -3841,6 +3848,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ + include/grpc++/server_posix.h \ include/grpc++/support/async_stream.h \ include/grpc++/support/async_unary_call.h \ include/grpc++/support/byte_buffer.h \ diff --git a/build.yaml b/build.yaml index 0a57965ab7b..a84309fe28d 100644 --- a/build.yaml +++ b/build.yaml @@ -635,6 +635,7 @@ filegroups: - include/grpc++/client_context.h - include/grpc++/completion_queue.h - include/grpc++/create_channel.h + - include/grpc++/create_channel_posix.h - include/grpc++/generic/async_generic_service.h - include/grpc++/generic/generic_stub.h - include/grpc++/grpc++.h @@ -662,6 +663,7 @@ filegroups: - include/grpc++/server.h - include/grpc++/server_builder.h - include/grpc++/server_context.h + - include/grpc++/server_posix.h - include/grpc++/support/async_stream.h - include/grpc++/support/async_unary_call.h - include/grpc++/support/byte_buffer.h @@ -684,6 +686,7 @@ filegroups: - src/cpp/client/client_context.cc - src/cpp/client/create_channel.cc - src/cpp/client/create_channel_internal.cc + - src/cpp/client/create_channel_posix.cc - src/cpp/client/credentials.cc - src/cpp/client/generic_stub.cc - src/cpp/client/insecure_credentials.cc @@ -699,6 +702,7 @@ filegroups: - src/cpp/server/server_builder.cc - src/cpp/server/server_context.cc - src/cpp/server/server_credentials.cc + - src/cpp/server/server_posix.cc - src/cpp/util/byte_buffer.cc - src/cpp/util/slice.cc - src/cpp/util/status.cc diff --git a/include/grpc++/create_channel_posix.h b/include/grpc++/create_channel_posix.h new file mode 100644 index 00000000000..0ca947d0447 --- /dev/null +++ b/include/grpc++/create_channel_posix.h @@ -0,0 +1,57 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_CREATE_CHANNEL_POSIX_H +#define GRPCXX_CREATE_CHANNEL_POSIX_H + +#include + +#include +#include + +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + +/// Create a new \a Channel communicating over given file descriptor +/// +/// \param target The name of the target. +/// \param fd The file descriptor representing a socket. +std::shared_ptr CreateInsecureChannelFromFd( + const grpc::string& target, int fd); + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} // namespace grpc + +#endif // GRPCXX_CREATE_CHANNEL_POSIX_H diff --git a/include/grpc++/grpc++.h b/include/grpc++/grpc++.h index b7d5fb0bbcd..ef07e199759 100644 --- a/include/grpc++/grpc++.h +++ b/include/grpc++/grpc++.h @@ -57,8 +57,10 @@ #include #include #include +#include #include #include #include +#include #endif // GRPCXX_GRPCXX_H diff --git a/include/grpc++/server.h b/include/grpc++/server.h index a0ee0e98e47..7a8858ef194 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -93,6 +93,12 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { /// until all server objects in the process have been destroyed. static void SetGlobalCallbacks(GlobalCallbacks* callbacks); + // Returns a \em raw pointer to the underlying grpc_server instance. + grpc_server* c_server(); + + // Returns a \em raw pointer to the underlying CompletionQueue. + CompletionQueue* completion_queue(); + private: friend class AsyncGenericService; friend class ServerBuilder; diff --git a/include/grpc++/server_posix.h b/include/grpc++/server_posix.h new file mode 100644 index 00000000000..1595ba6e00e --- /dev/null +++ b/include/grpc++/server_posix.h @@ -0,0 +1,56 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SERVER_POSIX_H +#define GRPCXX_SERVER_POSIX_H + +#include + +#include +#include + +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + +/// Adds new client to a \a Server communicating over given file descriptor +/// +/// \param server The server to add a client to. +/// \param fd The file descriptor representing a socket. +void AddInsecureChannelFromFd(Server* server, int fd); + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} // namespace grpc + +#endif // GRPCXX_CREATE_CHANNEL_POSIX_H diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index 509e51e2c40..06cc3aad8a2 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -50,7 +50,7 @@ extern "C" { * functionality on top of GRPC Core. */ -#ifdef GPR_POSIX_SOCKET +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD /** Create a client channel to 'target' using file descriptor 'fd'. The 'target' argument will be used to indicate the name for this channel. See the comment @@ -66,7 +66,7 @@ GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server, grpc_completion_queue *cq, int fd); -#endif // GPR_POSIX_SOCKET +#endif // GPR_SUPPORT_CHANNELS_FROM_FD #ifdef __cplusplus } diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index be4215a54bf..7fff36cb789 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -129,6 +129,7 @@ #define GPR_POSIX_SOCKETADDR 1 #define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 #define GPR_POSIX_SOCKETUTILS 1 +#define GPR_SUPPORT_CHANNELS_FROM_FD 1 #define GPR_HAVE_UNIX_SOCKET 1 #define GPR_HAVE_IP_PKTINFO 1 #define GPR_HAVE_IPV6_RECVPKTINFO 1 @@ -168,6 +169,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_SUPPORT_CHANNELS_FROM_FD 1 #define GPR_HAVE_MSG_NOSIGNAL 1 #define GPR_HAVE_UNIX_SOCKET 1 #define GPR_HAVE_IP_PKTINFO 1 @@ -194,6 +196,7 @@ #define GPR_POSIX_WAKEUP_FD 1 #define GPR_POSIX_SOCKET 1 #define GPR_POSIX_SOCKETADDR 1 +#define GPR_SUPPORT_CHANNELS_FROM_FD 1 #define GPR_HAVE_UNIX_SOCKET 1 #define GPR_HAVE_IP_PKTINFO 1 #define GPR_HAVE_IPV6_RECVPKTINFO 1 @@ -258,6 +261,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_SUPPORT_CHANNELS_FROM_FD 1 #define GPR_HAVE_SO_NOSIGPIPE 1 #define GPR_HAVE_UNIX_SOCKET 1 #define GPR_HAVE_IP_PKTINFO 1 @@ -289,6 +293,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_SUPPORT_CHANNELS_FROM_FD 1 #define GPR_HAVE_SO_NOSIGPIPE 1 #define GPR_HAVE_UNIX_SOCKET 1 #define GPR_HAVE_IP_PKTINFO 1 diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c index 7d28dbf8a9f..d3e27a59635 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c @@ -33,7 +33,7 @@ #include -#ifdef GPR_POSIX_SOCKET +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD #include @@ -85,4 +85,4 @@ grpc_channel *grpc_insecure_channel_create_from_fd( "Failed to create client channel"); } -#endif // GPR_POSIX_SOCKET +#endif // GPR_SUPPORT_CHANNELS_FROM_FD diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index 1807efc85d3..11e5c452893 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -33,7 +33,7 @@ #include -#ifdef GPR_POSIX_SOCKET +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD #include #include @@ -67,4 +67,4 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, } -#endif // GPR_POSIX_SOCKET +#endif // GPR_SUPPORT_CHANNELS_FROM_FD diff --git a/src/cpp/client/create_channel_posix.cc b/src/cpp/client/create_channel_posix.cc new file mode 100644 index 00000000000..99ffebd3923 --- /dev/null +++ b/src/cpp/client/create_channel_posix.cc @@ -0,0 +1,57 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include +#include +#include + +#include "src/cpp/client/create_channel_internal.h" + +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + +std::shared_ptr CreateInsecureChannelFromFd( + const grpc::string& target, int fd) { + internal::GrpcLibrary init_lib; + init_lib.init(); + return CreateChannelInternal( + "", grpc_insecure_channel_create_from_fd(target.c_str(), fd, nullptr)); +} + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} // namespace grpc diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index f6c3e5747c9..72a6150e960 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -329,6 +329,14 @@ void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) { g_callbacks.reset(callbacks); } +grpc_server* Server::c_server() { + return server_; +} + +CompletionQueue* Server::completion_queue() { + return &cq_; +} + static grpc_server_register_method_payload_handling PayloadHandlingForMethod( RpcServiceMethod* method) { switch (method->method_type()) { diff --git a/src/cpp/server/server_posix.cc b/src/cpp/server/server_posix.cc new file mode 100644 index 00000000000..7ed8cd069c7 --- /dev/null +++ b/src/cpp/server/server_posix.cc @@ -0,0 +1,51 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include + +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + +void AddInsecureChannelFromFd(Server* server, int fd) { + grpc_server_add_insecure_channel_from_fd(server->c_server(), + server->completion_queue()->cq(), + fd); + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} + +} // namespace grpc diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index 701a3aec282..16bb5cdfab6 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -332,7 +332,7 @@ extern grpc_call_error_to_string_type grpc_call_error_to_string_import; typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; #define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import -typedef void(*grpc_server_add_insecure_channel_from_fd_type)(grpc_server *server, int fd); +typedef void(*grpc_server_add_insecure_channel_from_fd_type)(grpc_server *server, grpc_completion_queue *cq, int fd); extern grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import; #define grpc_server_add_insecure_channel_from_fd grpc_server_add_insecure_channel_from_fd_import typedef const grpc_auth_property *(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator *it); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 4a7d4b272a3..9c86a3690c5 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -332,7 +332,7 @@ extern grpc_call_error_to_string_type grpc_call_error_to_string_import; typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; #define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import -typedef void(*grpc_server_add_insecure_channel_from_fd_type)(grpc_server *server, int fd); +typedef void(*grpc_server_add_insecure_channel_from_fd_type)(grpc_server *server, grpc_completion_queue *cq, int fd); extern grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import; #define grpc_server_add_insecure_channel_from_fd grpc_server_add_insecure_channel_from_fd_import typedef const grpc_auth_property *(*grpc_auth_property_iterator_next_type)(grpc_auth_property_iterator *it); diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 00177920209..49c0e1279ca 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -765,6 +765,7 @@ include/grpc++/channel.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ +include/grpc++/create_channel_posix.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ @@ -792,6 +793,7 @@ include/grpc++/security/server_credentials.h \ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ +include/grpc++/server_posix.h \ include/grpc++/support/async_stream.h \ include/grpc++/support/async_unary_call.h \ include/grpc++/support/byte_buffer.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 1c6884c0dfa..232951e16c2 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -765,6 +765,7 @@ include/grpc++/channel.h \ include/grpc++/client_context.h \ include/grpc++/completion_queue.h \ include/grpc++/create_channel.h \ +include/grpc++/create_channel_posix.h \ include/grpc++/generic/async_generic_service.h \ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ @@ -792,6 +793,7 @@ include/grpc++/security/server_credentials.h \ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ +include/grpc++/server_posix.h \ include/grpc++/support/async_stream.h \ include/grpc++/support/async_unary_call.h \ include/grpc++/support/byte_buffer.h \ @@ -872,6 +874,7 @@ src/cpp/client/channel.cc \ src/cpp/client/client_context.cc \ src/cpp/client/create_channel.cc \ src/cpp/client/create_channel_internal.cc \ +src/cpp/client/create_channel_posix.cc \ src/cpp/client/credentials.cc \ src/cpp/client/generic_stub.cc \ src/cpp/client/insecure_credentials.cc \ @@ -887,6 +890,7 @@ src/cpp/server/server.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_context.cc \ src/cpp/server/server_credentials.cc \ +src/cpp/server/server_posix.cc \ src/cpp/util/byte_buffer.cc \ src/cpp/util/slice.cc \ src/cpp/util/status.cc \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 782aa373bf0..fe6d3a23a0a 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6435,6 +6435,7 @@ "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", + "include/grpc++/create_channel_posix.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", @@ -6462,6 +6463,7 @@ "include/grpc++/server.h", "include/grpc++/server_builder.h", "include/grpc++/server_context.h", + "include/grpc++/server_posix.h", "include/grpc++/support/async_stream.h", "include/grpc++/support/async_unary_call.h", "include/grpc++/support/byte_buffer.h", @@ -6487,6 +6489,7 @@ "include/grpc++/client_context.h", "include/grpc++/completion_queue.h", "include/grpc++/create_channel.h", + "include/grpc++/create_channel_posix.h", "include/grpc++/generic/async_generic_service.h", "include/grpc++/generic/generic_stub.h", "include/grpc++/grpc++.h", @@ -6514,6 +6517,7 @@ "include/grpc++/server.h", "include/grpc++/server_builder.h", "include/grpc++/server_context.h", + "include/grpc++/server_posix.h", "include/grpc++/support/async_stream.h", "include/grpc++/support/async_unary_call.h", "include/grpc++/support/byte_buffer.h", @@ -6531,6 +6535,7 @@ "src/cpp/client/create_channel.cc", "src/cpp/client/create_channel_internal.cc", "src/cpp/client/create_channel_internal.h", + "src/cpp/client/create_channel_posix.cc", "src/cpp/client/credentials.cc", "src/cpp/client/generic_stub.cc", "src/cpp/client/insecure_credentials.cc", @@ -6548,6 +6553,7 @@ "src/cpp/server/server_builder.cc", "src/cpp/server/server_context.cc", "src/cpp/server/server_credentials.cc", + "src/cpp/server/server_posix.cc", "src/cpp/server/thread_pool_interface.h", "src/cpp/util/byte_buffer.cc", "src/cpp/util/slice.cc", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 660d14a07f6..558a33afbd9 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -263,6 +263,7 @@ + @@ -290,6 +291,7 @@ + @@ -384,6 +386,8 @@ + + @@ -414,6 +418,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 6cca360f9f6..6b80d97e8e2 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -31,6 +31,9 @@ src\cpp\client + + src\cpp\client + src\cpp\client @@ -76,6 +79,9 @@ src\cpp\server + + src\cpp\server + src\cpp\util @@ -111,6 +117,9 @@ include\grpc++ + + include\grpc++ + include\grpc++\generic @@ -192,6 +201,9 @@ include\grpc++ + + include\grpc++ + include\grpc++\support diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index abf6efbc03f..d2886e0eeec 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -263,6 +263,7 @@ + @@ -290,6 +291,7 @@ + @@ -371,6 +373,8 @@ + + @@ -401,6 +405,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 086fb5aa462..61b6f3e5487 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -16,6 +16,9 @@ src\cpp\client + + src\cpp\client + src\cpp\client @@ -61,6 +64,9 @@ src\cpp\server + + src\cpp\server + src\cpp\util @@ -96,6 +102,9 @@ include\grpc++ + + include\grpc++ + include\grpc++\generic @@ -177,6 +186,9 @@ include\grpc++ + + include\grpc++ + include\grpc++\support From 4ad746e4e0077ea95d3e937a046575701592dd3f Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Tue, 7 Jun 2016 15:02:59 -0700 Subject: [PATCH 102/175] clang-format, fix headers, windows fixes --- include/grpc++/create_channel_posix.h | 6 ++-- include/grpc++/server_posix.h | 4 +-- include/grpc/grpc_posix.h | 1 - .../client/insecure/channel_create_posix.c | 30 +++++++++++-------- .../server/insecure/server_chttp2_posix.c | 9 +++++- .../ext/transport/chttp2/transport/internal.h | 2 +- .../ext/transport/chttp2/transport/parsing.c | 4 +-- src/core/lib/support/avl.c | 5 ++-- src/cpp/client/create_channel_posix.cc | 5 ++-- src/cpp/server/server.cc | 8 ++--- src/cpp/server/server_posix.cc | 6 ++-- test/core/end2end/fixtures/h2_fd.c | 10 +++---- test/core/statistics/census_log_tests.c | 2 +- 13 files changed, 48 insertions(+), 44 deletions(-) diff --git a/include/grpc++/create_channel_posix.h b/include/grpc++/create_channel_posix.h index 0ca947d0447..0d961599420 100644 --- a/include/grpc++/create_channel_posix.h +++ b/include/grpc++/create_channel_posix.h @@ -36,8 +36,8 @@ #include -#include #include +#include namespace grpc { @@ -47,8 +47,8 @@ namespace grpc { /// /// \param target The name of the target. /// \param fd The file descriptor representing a socket. -std::shared_ptr CreateInsecureChannelFromFd( - const grpc::string& target, int fd); +std::shared_ptr CreateInsecureChannelFromFd(const grpc::string& target, + int fd); #endif // GPR_SUPPORT_CHANNELS_FROM_FD diff --git a/include/grpc++/server_posix.h b/include/grpc++/server_posix.h index 1595ba6e00e..e6066d4eaab 100644 --- a/include/grpc++/server_posix.h +++ b/include/grpc++/server_posix.h @@ -36,8 +36,8 @@ #include -#include #include +#include namespace grpc { @@ -53,4 +53,4 @@ void AddInsecureChannelFromFd(Server* server, int fd); } // namespace grpc -#endif // GRPCXX_CREATE_CHANNEL_POSIX_H +#endif // GRPCXX_SERVER_POSIX_H diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index 06cc3aad8a2..cff09006206 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -34,7 +34,6 @@ #ifndef GRPC_GRPC_POSIX_H #define GRPC_GRPC_POSIX_H - #include #include diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c index d3e27a59635..f1c24565001 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c @@ -41,34 +41,32 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/transport/transport.h" -#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/tcp_posix.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/channel.h" - +#include "src/core/lib/transport/transport.h" grpc_channel *grpc_insecure_channel_create_from_fd( const char *target, int fd, const grpc_channel_args *args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GRPC_API_TRACE( - "grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, - (target, fd, args)); + GRPC_API_TRACE("grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, + (target, fd, args)); grpc_arg default_authority_arg; default_authority_arg.type = GRPC_ARG_STRING; default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; default_authority_arg.value.string = "test.authority"; - grpc_channel_args *final_args = grpc_channel_args_copy_and_add( - args, &default_authority_arg, 1); + grpc_channel_args *final_args = + grpc_channel_args_copy_and_add(args, &default_authority_arg, 1); int flags = fcntl(fd, F_GETFL, 0); GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0); - grpc_endpoint *client = grpc_tcp_create( - grpc_fd_create(fd, "client"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, - "fd-client"); + grpc_endpoint *client = + grpc_tcp_create(grpc_fd_create(fd, "client"), + GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "fd-client"); grpc_transport *transport = grpc_create_chttp2_transport(&exec_ctx, final_args, client, 1); @@ -85,4 +83,12 @@ grpc_channel *grpc_insecure_channel_create_from_fd( "Failed to create client channel"); } -#endif // GPR_SUPPORT_CHANNELS_FROM_FD +#else // !GPR_SUPPORT_CHANNELS_FROM_FD + +grpc_channel *grpc_insecure_channel_create_from_fd( + const char *target, int fd, const grpc_channel_args *args) { + GPR_ASSERT(0); + return NULL; +} + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index 11e5c452893..313e9b9208c 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -66,5 +66,12 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, grpc_exec_ctx_finish(&exec_ctx); } +#else // !GPR_SUPPORT_CHANNELS_FROM_FD -#endif // GPR_SUPPORT_CHANNELS_FROM_FD +void grpc_server_add_insecure_channel_from_fd(grpc_server *server, + grpc_completion_queue *cq, + int fd) { + GPR_ASSERT(0); +} + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 5872fd8e0a4..86a31cc50be 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -691,7 +691,7 @@ extern int grpc_flowctl_trace; if (!(grpc_http_trace)) \ ; \ else \ - stmt + stmt typedef enum { GRPC_CHTTP2_FLOWCTL_MOVE, diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 4bd374b7fa7..8b6b0cebd0a 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -87,8 +87,8 @@ void grpc_chttp2_prepare_to_read( transport_global->settings[GRPC_SENT_SETTINGS], sizeof(transport_parsing->last_sent_settings)); transport_parsing->max_frame_size = - transport_global->settings[GRPC_ACKED_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]; + transport_global + ->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]; /* update the parsing view of incoming window */ while (grpc_chttp2_list_pop_unannounced_incoming_window_available( diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c index 8d3ce23e6c3..c04675e01fb 100644 --- a/src/core/lib/support/avl.c +++ b/src/core/lib/support/avl.c @@ -73,8 +73,9 @@ static long node_height(gpr_avl_node *node) { #ifndef NDEBUG static long calculate_height(gpr_avl_node *node) { - return node == NULL ? 0 : 1 + GPR_MAX(calculate_height(node->left), - calculate_height(node->right)); + return node == NULL ? 0 + : 1 + GPR_MAX(calculate_height(node->left), + calculate_height(node->right)); } static gpr_avl_node *assert_invariants(gpr_avl_node *n) { diff --git a/src/cpp/client/create_channel_posix.cc b/src/cpp/client/create_channel_posix.cc index 99ffebd3923..60cfed3d623 100644 --- a/src/cpp/client/create_channel_posix.cc +++ b/src/cpp/client/create_channel_posix.cc @@ -31,7 +31,6 @@ * */ - #include #include #include @@ -44,8 +43,8 @@ namespace grpc { #ifdef GPR_SUPPORT_CHANNELS_FROM_FD -std::shared_ptr CreateInsecureChannelFromFd( - const grpc::string& target, int fd) { +std::shared_ptr CreateInsecureChannelFromFd(const grpc::string& target, + int fd) { internal::GrpcLibrary init_lib; init_lib.init(); return CreateChannelInternal( diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 72a6150e960..50fc4733a16 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -329,13 +329,9 @@ void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) { g_callbacks.reset(callbacks); } -grpc_server* Server::c_server() { - return server_; -} +grpc_server* Server::c_server() { return server_; } -CompletionQueue* Server::completion_queue() { - return &cq_; -} +CompletionQueue* Server::completion_queue() { return &cq_; } static grpc_server_register_method_payload_handling PayloadHandlingForMethod( RpcServiceMethod* method) { diff --git a/src/cpp/server/server_posix.cc b/src/cpp/server/server_posix.cc index 7ed8cd069c7..8cb9753a125 100644 --- a/src/cpp/server/server_posix.cc +++ b/src/cpp/server/server_posix.cc @@ -40,12 +40,10 @@ namespace grpc { #ifdef GPR_SUPPORT_CHANNELS_FROM_FD void AddInsecureChannelFromFd(Server* server, int fd) { - grpc_server_add_insecure_channel_from_fd(server->c_server(), - server->completion_queue()->cq(), - fd); + grpc_server_add_insecure_channel_from_fd( + server->c_server(), server->completion_queue()->cq(), fd); #endif // GPR_SUPPORT_CHANNELS_FROM_FD - } } // namespace grpc diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 70790807223..e938fe77301 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -36,18 +36,16 @@ #include #include -#include #include #include +#include #include -#include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/socket_utils_posix.h" #include "src/core/lib/iomgr/unix_sockets_posix.h" #include "test/core/util/test_config.h" -typedef struct { - int fd_pair[2]; -} sp_fixture_data; +typedef struct { int fd_pair[2]; } sp_fixture_data; static void create_sockets(int sv[2]) { int flags; @@ -62,7 +60,7 @@ static void create_sockets(int sv[2]) { static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_channel_args *client_args, grpc_channel_args *server_args) { - sp_fixture_data* fixture_data = gpr_malloc(sizeof(*fixture_data)); + sp_fixture_data *fixture_data = gpr_malloc(sizeof(*fixture_data)); grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index 8646a2fdf1d..4baae6a73bb 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -31,7 +31,6 @@ * */ -#include "src/core/ext/census/census_log.h" #include #include #include @@ -42,6 +41,7 @@ #include #include #include +#include "src/core/ext/census/census_log.h" #include "test/core/util/test_config.h" /* Fills in 'record' of size 'size'. Each byte in record is filled in with the From 0872d0894cec06cf802d652fbf795b07f989e9a0 Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Tue, 7 Jun 2016 15:18:48 -0700 Subject: [PATCH 103/175] revert protobuf --- third_party/protobuf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/protobuf b/third_party/protobuf index d5fb408ddc2..3470b6895aa 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit d5fb408ddc281ffcadeb08699e65bb694656d0bd +Subproject commit 3470b6895aa659b7559ed678e029a5338e535f14 From 30fb536053c549aa2a8507a2a0bcd238bda607dd Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 7 Jun 2016 16:24:17 -0700 Subject: [PATCH 104/175] PR comments (offline). --- include/grpc++/impl/codegen/call.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index a9e5978b43b..770ef792904 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -202,8 +202,10 @@ class CallOpSendInitialMetadata { op->reserved = NULL; op->data.send_initial_metadata.count = initial_metadata_count_; op->data.send_initial_metadata.metadata = initial_metadata_; - memcpy(&op->data.send_initial_metadata.maybe_compression_level, - &maybe_compression_level_, sizeof(maybe_compression_level_)); + op->data.send_initial_metadata.maybe_compression_level.is_set = + maybe_compression_level_.is_set; + op->data.send_initial_metadata.maybe_compression_level.level = + maybe_compression_level_.level; } void FinishOp(bool* status, int max_message_size) { if (!send_) return; From 6f9501098ec0714f620b0913ffdc6f824f8aca14 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 7 Jun 2016 16:52:19 -0700 Subject: [PATCH 105/175] fix for issue 5548. Deprecated old classes and created subclasses. --- src/compiler/objective_c_generator.cc | 4 ++-- src/objective-c/ProtoRPC/ProtoMethod.h | 9 +++++++++ src/objective-c/ProtoRPC/ProtoMethod.m | 4 ++++ src/objective-c/ProtoRPC/ProtoRPC.h | 11 ++++++++++- src/objective-c/ProtoRPC/ProtoRPC.m | 6 +++++- src/objective-c/ProtoRPC/ProtoService.h | 15 +++++++++++++-- src/objective-c/ProtoRPC/ProtoService.m | 4 ++++ 7 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 465491e385f..75665cd5c0d 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -94,7 +94,7 @@ void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method, void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method, map< ::grpc::string, ::grpc::string> vars) { vars["method_name"] = "RPCTo" + vars["method_name"]; - vars["return_type"] = "ProtoRPC *"; + vars["return_type"] = "GRPCProtoRPC *"; PrintMethodSignature(printer, method, vars); } @@ -199,7 +199,7 @@ void PrintMethodImplementations(Printer *printer, " marshalling and parsing.\n"); printer.Print(vars, "@interface $service_class$ :" - " ProtoService<$service_class$>\n"); + " GRPCProtoService<$service_class$>\n"); printer.Print( "- (instancetype)initWithHost:(NSString *)host" " NS_DESIGNATED_INITIALIZER;\n"); diff --git a/src/objective-c/ProtoRPC/ProtoMethod.h b/src/objective-c/ProtoRPC/ProtoMethod.h index a0ed2cf98a5..bd1a848c19a 100644 --- a/src/objective-c/ProtoRPC/ProtoMethod.h +++ b/src/objective-c/ProtoRPC/ProtoMethod.h @@ -37,6 +37,7 @@ * A fully-qualified proto service method name. Full qualification is needed because a gRPC endpoint * can implement multiple services. */ +__attribute__((deprecated("Please use GRPCProtoMethod."))) @interface ProtoMethod : NSObject @property(nonatomic, readonly) NSString *package; @property(nonatomic, readonly) NSString *service; @@ -48,3 +49,11 @@ service:(NSString *)service method:(NSString *)method; @end + +/** + * This subclass is empty now. Eventually we'll remove ProtoService class + * to avoid potential naming conflict + */ +@interface GRPCProtoMethod : ProtoMethod + +@end diff --git a/src/objective-c/ProtoRPC/ProtoMethod.m b/src/objective-c/ProtoRPC/ProtoMethod.m index 4b7ed63123c..e9978f38afe 100644 --- a/src/objective-c/ProtoRPC/ProtoMethod.m +++ b/src/objective-c/ProtoRPC/ProtoMethod.m @@ -53,3 +53,7 @@ } } @end + +@implementation GRPCProtoMethod + +@end diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index bd926b73287..55fefb0aa88 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -36,13 +36,22 @@ #import "ProtoMethod.h" +__attribute__((deprecated("Please use GRPCProtoRPC."))) @interface ProtoRPC : GRPCCall - (instancetype)initWithHost:(NSString *)host - method:(ProtoMethod *)method + method:(GRPCProtoMethod *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable NS_DESIGNATED_INITIALIZER; - (void)start; @end + +/** + * This subclass is empty now. Eventually we'll remove ProtoService class + * to avoid potential naming conflict + */ +@interface GRPCProtoRPC : ProtoRPC + +@end diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 9bf66f347ac..27c8b0eff7e 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -70,7 +70,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing // Designated initializer - (instancetype)initWithHost:(NSString *)host - method:(ProtoMethod *)method + method:(GRPCProtoMethod *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable { @@ -117,3 +117,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing _responseWriteable = nil; } @end + +@implementation GRPCProtoRPC + +@end diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index 2e8cb33696b..edec8a4770f 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -33,17 +33,28 @@ #import -@class ProtoRPC; +@class GRPCProtoRPC; @protocol GRXWriteable; @class GRXWriter; + +__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService : NSObject - (instancetype)initWithHost:(NSString *)host packageName:(NSString *)packageName serviceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER; -- (ProtoRPC *)RPCToMethod:(NSString *)method +- (GRPCProtoRPC *)RPCToMethod:(NSString *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable; @end + + +/** + * This subclass is empty now. Eventually we'll remove ProtoService class + * to avoid potential naming conflict + */ +@interface GRPCProtoService : ProtoService + +@end diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m index fccc6aadc9c..597c3cf0fed 100644 --- a/src/objective-c/ProtoRPC/ProtoService.m +++ b/src/objective-c/ProtoRPC/ProtoService.m @@ -79,3 +79,7 @@ responsesWriteable:responsesWriteable]; } @end + +@implementation GRPCProtoService + +@end From a24d153619c82c0ef7a071fe81e78c5f0a4c268c Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Tue, 7 Jun 2016 16:55:47 -0700 Subject: [PATCH 106/175] fix windows build --- include/grpc/grpc_posix.h | 4 ---- .../transport/chttp2/server/insecure/server_chttp2_posix.c | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/grpc/grpc_posix.h b/include/grpc/grpc_posix.h index cff09006206..9742b83374a 100644 --- a/include/grpc/grpc_posix.h +++ b/include/grpc/grpc_posix.h @@ -49,8 +49,6 @@ extern "C" { * functionality on top of GRPC Core. */ -#ifdef GPR_SUPPORT_CHANNELS_FROM_FD - /** Create a client channel to 'target' using file descriptor 'fd'. The 'target' argument will be used to indicate the name for this channel. See the comment for grpc_insecure_channel_create for description of 'args' argument. */ @@ -65,8 +63,6 @@ GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server, grpc_completion_queue *cq, int fd); -#endif // GPR_SUPPORT_CHANNELS_FROM_FD - #ifdef __cplusplus } #endif diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index 313e9b9208c..b1c7a389dd8 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -31,12 +31,12 @@ * */ +#include +#include #include #ifdef GPR_SUPPORT_CHANNELS_FROM_FD -#include -#include #include #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" From 2dbc217e5e3f44e4b2037601a7c21b650edaa066 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Tue, 7 Jun 2016 15:03:57 -0700 Subject: [PATCH 107/175] Add common proto files to Python grpcio-tools --- tools/distrib/python/check_grpcio_tools.py | 2 +- .../python/grpcio_tools/grpc/tools/protoc.py | 5 ++- .../python/grpcio_tools/protoc_lib_deps.py | 4 +++ tools/distrib/python/grpcio_tools/setup.py | 33 +++++++++++++++-- tools/distrib/python/make_grpcio_tools.py | 35 ++++++++++++++----- 5 files changed, 65 insertions(+), 14 deletions(-) diff --git a/tools/distrib/python/check_grpcio_tools.py b/tools/distrib/python/check_grpcio_tools.py index baf2ff4effb..80c63278f42 100755 --- a/tools/distrib/python/check_grpcio_tools.py +++ b/tools/distrib/python/check_grpcio_tools.py @@ -37,7 +37,7 @@ OUT_OF_DATE_MESSAGE = """file {} is out of date Have you called tools/distrib/python/make_grpcio_tools.py since upgrading protobuf?""" -check_protoc_lib_deps_content = make.get_deps(make.BAZEL_DEPS_PROTOC_LIB_QUERY) +check_protoc_lib_deps_content = make.get_deps() with open(make.GRPC_PYTHON_PROTOC_LIB_DEPS, 'r') as protoc_lib_deps_file: if protoc_lib_deps_file.read() != check_protoc_lib_deps_content: diff --git a/tools/distrib/python/grpcio_tools/grpc/tools/protoc.py b/tools/distrib/python/grpcio_tools/grpc/tools/protoc.py index b4dd0ecae2e..1c69e78920c 100644 --- a/tools/distrib/python/grpcio_tools/grpc/tools/protoc.py +++ b/tools/distrib/python/grpcio_tools/grpc/tools/protoc.py @@ -29,10 +29,13 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import pkg_resources import sys from grpc.tools import protoc_compiler if __name__ == '__main__': - protoc_compiler.run_main(sys.argv) + proto_include = pkg_resources.resource_filename('grpc.tools', '_proto') + protoc_compiler.run_main( + sys.argv + ['-I{}'.format(proto_include)]) diff --git a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py index 135ac5cbb3b..cd4effa7ae8 100644 --- a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py +++ b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py @@ -30,3 +30,7 @@ # AUTO-GENERATED BY make_grpcio_tools.py! CC_FILES=['google/protobuf/compiler/zip_writer.cc', 'google/protobuf/compiler/subprocess.cc', 'google/protobuf/compiler/ruby/ruby_generator.cc', 'google/protobuf/compiler/python/python_generator.cc', 'google/protobuf/compiler/plugin.pb.cc', 'google/protobuf/compiler/plugin.cc', 'google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'google/protobuf/compiler/objectivec/objectivec_message.cc', 'google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'google/protobuf/compiler/objectivec/objectivec_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_file.cc', 'google/protobuf/compiler/objectivec/objectivec_field.cc', 'google/protobuf/compiler/objectivec/objectivec_extension.cc', 'google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'google/protobuf/compiler/objectivec/objectivec_enum.cc', 'google/protobuf/compiler/js/js_generator.cc', 'google/protobuf/compiler/javanano/javanano_primitive_field.cc', 'google/protobuf/compiler/javanano/javanano_message_field.cc', 'google/protobuf/compiler/javanano/javanano_message.cc', 'google/protobuf/compiler/javanano/javanano_map_field.cc', 'google/protobuf/compiler/javanano/javanano_helpers.cc', 'google/protobuf/compiler/javanano/javanano_generator.cc', 'google/protobuf/compiler/javanano/javanano_file.cc', 'google/protobuf/compiler/javanano/javanano_field.cc', 'google/protobuf/compiler/javanano/javanano_extension.cc', 'google/protobuf/compiler/javanano/javanano_enum_field.cc', 'google/protobuf/compiler/javanano/javanano_enum.cc', 'google/protobuf/compiler/java/java_string_field_lite.cc', 'google/protobuf/compiler/java/java_string_field.cc', 'google/protobuf/compiler/java/java_shared_code_generator.cc', 'google/protobuf/compiler/java/java_service.cc', 'google/protobuf/compiler/java/java_primitive_field_lite.cc', 'google/protobuf/compiler/java/java_primitive_field.cc', 'google/protobuf/compiler/java/java_name_resolver.cc', 'google/protobuf/compiler/java/java_message_lite.cc', 'google/protobuf/compiler/java/java_message_field_lite.cc', 'google/protobuf/compiler/java/java_message_field.cc', 'google/protobuf/compiler/java/java_message_builder_lite.cc', 'google/protobuf/compiler/java/java_message_builder.cc', 'google/protobuf/compiler/java/java_message.cc', 'google/protobuf/compiler/java/java_map_field_lite.cc', 'google/protobuf/compiler/java/java_map_field.cc', 'google/protobuf/compiler/java/java_lazy_message_field_lite.cc', 'google/protobuf/compiler/java/java_lazy_message_field.cc', 'google/protobuf/compiler/java/java_helpers.cc', 'google/protobuf/compiler/java/java_generator_factory.cc', 'google/protobuf/compiler/java/java_generator.cc', 'google/protobuf/compiler/java/java_file.cc', 'google/protobuf/compiler/java/java_field.cc', 'google/protobuf/compiler/java/java_extension_lite.cc', 'google/protobuf/compiler/java/java_extension.cc', 'google/protobuf/compiler/java/java_enum_lite.cc', 'google/protobuf/compiler/java/java_enum_field_lite.cc', 'google/protobuf/compiler/java/java_enum_field.cc', 'google/protobuf/compiler/java/java_enum.cc', 'google/protobuf/compiler/java/java_doc_comment.cc', 'google/protobuf/compiler/java/java_context.cc', 'google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_message_field.cc', 'google/protobuf/compiler/csharp/csharp_message.cc', 'google/protobuf/compiler/csharp/csharp_map_field.cc', 'google/protobuf/compiler/csharp/csharp_helpers.cc', 'google/protobuf/compiler/csharp/csharp_generator.cc', 'google/protobuf/compiler/csharp/csharp_field_base.cc', 'google/protobuf/compiler/csharp/csharp_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_enum.cc', 'google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'google/protobuf/compiler/cpp/cpp_string_field.cc', 'google/protobuf/compiler/cpp/cpp_service.cc', 'google/protobuf/compiler/cpp/cpp_primitive_field.cc', 'google/protobuf/compiler/cpp/cpp_message_field.cc', 'google/protobuf/compiler/cpp/cpp_message.cc', 'google/protobuf/compiler/cpp/cpp_map_field.cc', 'google/protobuf/compiler/cpp/cpp_helpers.cc', 'google/protobuf/compiler/cpp/cpp_generator.cc', 'google/protobuf/compiler/cpp/cpp_file.cc', 'google/protobuf/compiler/cpp/cpp_field.cc', 'google/protobuf/compiler/cpp/cpp_extension.cc', 'google/protobuf/compiler/cpp/cpp_enum_field.cc', 'google/protobuf/compiler/cpp/cpp_enum.cc', 'google/protobuf/compiler/command_line_interface.cc', 'google/protobuf/compiler/code_generator.cc', 'google/protobuf/wrappers.pb.cc', 'google/protobuf/wire_format.cc', 'google/protobuf/util/type_resolver_util.cc', 'google/protobuf/util/time_util.cc', 'google/protobuf/util/message_differencer.cc', 'google/protobuf/util/json_util.cc', 'google/protobuf/util/internal/utility.cc', 'google/protobuf/util/internal/type_info_test_helper.cc', 'google/protobuf/util/internal/type_info.cc', 'google/protobuf/util/internal/protostream_objectwriter.cc', 'google/protobuf/util/internal/protostream_objectsource.cc', 'google/protobuf/util/internal/proto_writer.cc', 'google/protobuf/util/internal/object_writer.cc', 'google/protobuf/util/internal/json_stream_parser.cc', 'google/protobuf/util/internal/json_objectwriter.cc', 'google/protobuf/util/internal/json_escaping.cc', 'google/protobuf/util/internal/field_mask_utility.cc', 'google/protobuf/util/internal/error_listener.cc', 'google/protobuf/util/internal/default_value_objectwriter.cc', 'google/protobuf/util/internal/datapiece.cc', 'google/protobuf/util/field_mask_util.cc', 'google/protobuf/util/field_comparator.cc', 'google/protobuf/unknown_field_set.cc', 'google/protobuf/type.pb.cc', 'google/protobuf/timestamp.pb.cc', 'google/protobuf/text_format.cc', 'google/protobuf/stubs/substitute.cc', 'google/protobuf/stubs/mathlimits.cc', 'google/protobuf/struct.pb.cc', 'google/protobuf/source_context.pb.cc', 'google/protobuf/service.cc', 'google/protobuf/reflection_ops.cc', 'google/protobuf/message.cc', 'google/protobuf/map_field.cc', 'google/protobuf/io/zero_copy_stream_impl.cc', 'google/protobuf/io/tokenizer.cc', 'google/protobuf/io/strtod.cc', 'google/protobuf/io/printer.cc', 'google/protobuf/io/gzip_stream.cc', 'google/protobuf/generated_message_reflection.cc', 'google/protobuf/field_mask.pb.cc', 'google/protobuf/extension_set_heavy.cc', 'google/protobuf/empty.pb.cc', 'google/protobuf/dynamic_message.cc', 'google/protobuf/duration.pb.cc', 'google/protobuf/descriptor_database.cc', 'google/protobuf/descriptor.pb.cc', 'google/protobuf/descriptor.cc', 'google/protobuf/compiler/parser.cc', 'google/protobuf/compiler/importer.cc', 'google/protobuf/api.pb.cc', 'google/protobuf/any.pb.cc', 'google/protobuf/any.cc', 'google/protobuf/wire_format_lite.cc', 'google/protobuf/stubs/time.cc', 'google/protobuf/stubs/strutil.cc', 'google/protobuf/stubs/structurally_valid.cc', 'google/protobuf/stubs/stringprintf.cc', 'google/protobuf/stubs/stringpiece.cc', 'google/protobuf/stubs/statusor.cc', 'google/protobuf/stubs/status.cc', 'google/protobuf/stubs/once.cc', 'google/protobuf/stubs/int128.cc', 'google/protobuf/stubs/common.cc', 'google/protobuf/stubs/bytestream.cc', 'google/protobuf/stubs/atomicops_internals_x86_msvc.cc', 'google/protobuf/stubs/atomicops_internals_x86_gcc.cc', 'google/protobuf/repeated_field.cc', 'google/protobuf/message_lite.cc', 'google/protobuf/io/zero_copy_stream_impl_lite.cc', 'google/protobuf/io/zero_copy_stream.cc', 'google/protobuf/io/coded_stream.cc', 'google/protobuf/generated_message_util.cc', 'google/protobuf/extension_set.cc', 'google/protobuf/arenastring.cc', 'google/protobuf/arena.cc'] +PROTO_FILES=['google/protobuf/wrappers.proto', 'google/protobuf/type.proto', 'google/protobuf/timestamp.proto', 'google/protobuf/struct.proto', 'google/protobuf/source_context.proto', 'google/protobuf/field_mask.proto', 'google/protobuf/empty.proto', 'google/protobuf/duration.proto', 'google/protobuf/descriptor.proto', 'google/protobuf/compiler/plugin.proto', 'google/protobuf/api.proto', 'google/protobuf/any.proto'] + +CC_INCLUDE='third_party/protobuf/src' +PROTO_INCLUDE='third_party/protobuf/src' diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index 576f7ae32a5..6537c266b32 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -28,9 +28,11 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from distutils import extension +import errno import os import os.path import shlex +import shutil import sys import setuptools @@ -47,18 +49,41 @@ sys.path.insert(0, os.path.abspath('.')) # ourselves in w.r.t. the multitude of operating systems this ought to build on. # By default we assume a GCC-like compiler. EXTRA_COMPILE_ARGS = shlex.split(os.environ.get('GRPC_PYTHON_CFLAGS', - '-frtti -std=c++11')) + '-fno-wrapv -frtti -std=c++11')) EXTRA_LINK_ARGS = shlex.split(os.environ.get('GRPC_PYTHON_LDFLAGS', '-lpthread')) +GRPC_PYTHON_TOOLS_PACKAGE = 'grpc.tools' +GRPC_PYTHON_PROTO_RESOURCES_NAME = '_proto' + import protoc_lib_deps import grpc_version +def package_data(): + tools_path = GRPC_PYTHON_TOOLS_PACKAGE.replace('.', os.path.sep) + proto_resources_path = os.path.join(tools_path, + GRPC_PYTHON_PROTO_RESOURCES_NAME) + proto_files = [] + for proto_file in protoc_lib_deps.PROTO_FILES: + source = os.path.join(protoc_lib_deps.PROTO_INCLUDE, proto_file) + target = os.path.join(proto_resources_path, proto_file) + relative_target = os.path.join(GRPC_PYTHON_PROTO_RESOURCES_NAME, proto_file) + try: + os.makedirs(os.path.dirname(target)) + except OSError as error: + if error.errno == errno.EEXIST: + pass + else: + raise + shutil.copy(source, target) + proto_files.append(relative_target) + return {GRPC_PYTHON_TOOLS_PACKAGE: proto_files} + def protoc_ext_module(): plugin_sources = [ 'grpc/tools/main.cc', 'grpc_root/src/compiler/python_generator.cc'] + [ - os.path.join('third_party/protobuf/src', cc_file) + os.path.join(protoc_lib_deps.CC_INCLUDE, cc_file) for cc_file in protoc_lib_deps.CC_FILES] plugin_ext = extension.Extension( name='grpc.tools.protoc_compiler', @@ -67,7 +92,7 @@ def protoc_ext_module(): '.', 'grpc_root', 'grpc_root/include', - 'third_party/protobuf/src', + protoc_lib_deps.CC_INCLUDE, ], language='c++', define_macros=[('HAVE_PTHREAD', 1)], @@ -92,5 +117,7 @@ setuptools.setup( #namespace_packages=['grpc'], install_requires=[ 'protobuf>=3.0.0a3', + 'grpcio>=0.14.0', ], + package_data=package_data(), ) diff --git a/tools/distrib/python/make_grpcio_tools.py b/tools/distrib/python/make_grpcio_tools.py index 50fbdbb14c0..fd9b38b084b 100755 --- a/tools/distrib/python/make_grpcio_tools.py +++ b/tools/distrib/python/make_grpcio_tools.py @@ -67,11 +67,16 @@ DEPS_FILE_CONTENT=""" # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # AUTO-GENERATED BY make_grpcio_tools.py! -CC_FILES={} +CC_FILES={cc_files} +PROTO_FILES={proto_files} + +CC_INCLUDE={cc_include} +PROTO_INCLUDE={proto_include} """ # Bazel query result prefix for expected source files in protobuf. PROTOBUF_CC_PREFIX = '//:src/' +PROTOBUF_PROTO_PREFIX = '//:src/' GRPC_ROOT = os.path.abspath( os.path.join(os.path.dirname(os.path.abspath(__file__)), @@ -79,7 +84,8 @@ GRPC_ROOT = os.path.abspath( GRPC_PYTHON_ROOT = os.path.join(GRPC_ROOT, 'tools/distrib/python/grpcio_tools') -GRPC_PROTOBUF = os.path.join(GRPC_ROOT, 'third_party/protobuf/src') +GRPC_PYTHON_PROTOBUF_RELATIVE_ROOT = 'third_party/protobuf/src' +GRPC_PROTOBUF = os.path.join(GRPC_ROOT, GRPC_PYTHON_PROTOBUF_RELATIVE_ROOT) GRPC_PROTOC_PLUGINS = os.path.join(GRPC_ROOT, 'src/compiler') GRPC_PYTHON_PROTOBUF = os.path.join(GRPC_PYTHON_ROOT, 'third_party/protobuf/src') @@ -93,18 +99,29 @@ GRPC_PYTHON_INCLUDE = os.path.join(GRPC_PYTHON_ROOT, 'grpc_root/include') BAZEL_DEPS = os.path.join(GRPC_ROOT, 'tools/distrib/python/bazel_deps.sh') BAZEL_DEPS_PROTOC_LIB_QUERY = '//:protoc_lib' +BAZEL_DEPS_COMMON_PROTOS_QUERY = '//:well_known_protos' + +def bazel_query(query): + output = subprocess.check_output([BAZEL_DEPS, query]) + return output.splitlines() -def get_deps(query): +def get_deps(): """Write the result of the bazel query `query` against protobuf to `out_file`.""" - output = subprocess.check_output([BAZEL_DEPS, query]) - output = output.splitlines() + cc_files_output = bazel_query(BAZEL_DEPS_PROTOC_LIB_QUERY) cc_files = [ - name for name in output + name[len(PROTOBUF_CC_PREFIX):] for name in cc_files_output if name.endswith('.cc') and name.startswith(PROTOBUF_CC_PREFIX)] - cc_files = [cc_file[len(PROTOBUF_CC_PREFIX):] for cc_file in cc_files] - deps_file_content = DEPS_FILE_CONTENT.format(cc_files) + proto_files_output = bazel_query(BAZEL_DEPS_COMMON_PROTOS_QUERY) + proto_files = [ + name[len(PROTOBUF_PROTO_PREFIX):] for name in proto_files_output + if name.endswith('.proto') and name.startswith(PROTOBUF_PROTO_PREFIX)] + deps_file_content = DEPS_FILE_CONTENT.format( + cc_files=cc_files, + proto_files=proto_files, + cc_include=repr(GRPC_PYTHON_PROTOBUF_RELATIVE_ROOT), + proto_include=repr(GRPC_PYTHON_PROTOBUF_RELATIVE_ROOT)) return deps_file_content @@ -123,7 +140,7 @@ def main(): shutil.copytree(GRPC_INCLUDE, GRPC_PYTHON_INCLUDE) try: - protoc_lib_deps_content = get_deps(BAZEL_DEPS_PROTOC_LIB_QUERY) + protoc_lib_deps_content = get_deps() except Exception as error: # We allow this script to succeed even if we couldn't get the dependencies, # as then we can assume that even without a successful bazel run the From c524ec0121ae70c354fa507e11880a62511d7e20 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 7 Jun 2016 16:52:53 -0700 Subject: [PATCH 108/175] make Metadata.Entry a class --- src/csharp/Grpc.Core/Metadata.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/Metadata.cs b/src/csharp/Grpc.Core/Metadata.cs index e982fa0c486..f73f720094a 100644 --- a/src/csharp/Grpc.Core/Metadata.cs +++ b/src/csharp/Grpc.Core/Metadata.cs @@ -95,6 +95,7 @@ namespace Grpc.Core public void Insert(int index, Metadata.Entry item) { + GrpcPreconditions.CheckNotNull(item); CheckWriteable(); entries.Insert(index, item); } @@ -114,6 +115,7 @@ namespace Grpc.Core set { + GrpcPreconditions.CheckNotNull(value); CheckWriteable(); entries[index] = value; } @@ -121,6 +123,7 @@ namespace Grpc.Core public void Add(Metadata.Entry item) { + GrpcPreconditions.CheckNotNull(item); CheckWriteable(); entries.Add(item); } @@ -187,7 +190,7 @@ namespace Grpc.Core /// /// Metadata entry /// - public struct Entry + public class Entry { private static readonly Encoding Encoding = Encoding.ASCII; private static readonly Regex ValidKeyRegex = new Regex("^[a-z0-9_-]+$"); From 95e547ef9ec96d7693c86d007555b5ce68be3510 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 7 Jun 2016 17:14:42 -0700 Subject: [PATCH 109/175] add unstarted server test --- src/csharp/Grpc.Core.Tests/ServerTest.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs index fa693162ada..5f7144611e5 100644 --- a/src/csharp/Grpc.Core.Tests/ServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs @@ -93,5 +93,12 @@ namespace Grpc.Core.Tests server.ShutdownAsync().Wait(); } + + [Test] + public void UnstartedServerDoesNotPreventShutdown() + { + // just create a server, don't start it, and make sure it doesn't prevent shutdown. + var server = new Server(); + } } } From 8ba42bec907e3e9cebd2621127caac22aed30a0d Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 7 Jun 2016 17:30:20 -0700 Subject: [PATCH 110/175] s/maybe_compression_level.compression_level/maybe_compression_level.level --- include/grpc/impl/codegen/grpc_types.h | 2 +- src/core/lib/surface/call.c | 3 +-- src/objective-c/GRPCClient/private/GRPCWrappedCall.m | 2 +- test/core/end2end/tests/compressed_payload.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index a2090853864..c51ffa44930 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -338,7 +338,7 @@ typedef struct grpc_op { * Otherwise, \a compression_level won't be considered */ struct { uint8_t is_set; - grpc_compression_level compression_level; + grpc_compression_level level; } maybe_compression_level; } send_initial_metadata; grpc_byte_buffer *send_message; diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 6fc91cb7ea9..54c93f88297 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1370,8 +1370,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, bool level_set = false; if (op->data.send_initial_metadata.maybe_compression_level.is_set) { effective_compression_level = - op->data.send_initial_metadata.maybe_compression_level - .compression_level; + op->data.send_initial_metadata.maybe_compression_level.level; level_set = true; } else { const grpc_compression_options copts = diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 27723afb0e9..a3fa5938cdd 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -73,7 +73,7 @@ _op.data.send_initial_metadata.count = metadata.count; _op.data.send_initial_metadata.metadata = metadata.grpc_metadataArray; _op.data.send_initial_metadata.maybe_compression_level.is_set = false; - _op.data.send_initial_metadata.maybe_compression_level.compression_level = 0; + _op.data.send_initial_metadata.maybe_compression_level.level = 0; _handler = handler; } return self; diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 34947fbe9d8..ec5c012238e 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -379,7 +379,7 @@ static void request_with_payload_template( op->data.send_initial_metadata.count = 0; if (set_server_level) { op->data.send_initial_metadata.maybe_compression_level.is_set = true; - op->data.send_initial_metadata.maybe_compression_level.compression_level = + op->data.send_initial_metadata.maybe_compression_level.level = server_compression_level; } op->flags = 0; From 978f4a59fce4dfd1018b59b20913ed2a500bfbee Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Tue, 7 Jun 2016 17:40:31 -0700 Subject: [PATCH 111/175] fix compilation on windows --- .../transport/chttp2/client/insecure/channel_create_posix.c | 5 +++-- .../transport/chttp2/server/insecure/server_chttp2_posix.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c index f1c24565001..ca435c25cec 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c @@ -31,12 +31,13 @@ * */ +#include +#include +#include #include #ifdef GPR_SUPPORT_CHANNELS_FROM_FD -#include - #include #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index b1c7a389dd8..d625ed1d9e5 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -33,6 +33,7 @@ #include #include +#include #include #ifdef GPR_SUPPORT_CHANNELS_FROM_FD From 9a36e6c7cd4daca929d5d3457edd0060a93030ca Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 7 Jun 2016 17:49:03 -0700 Subject: [PATCH 112/175] Changed Python Sync streaming qps to follow spec --- .../grpcio/tests/qps/benchmark_client.py | 63 +++++++++++++------ src/python/grpcio/tests/qps/client_runner.py | 5 +- .../run_tests/performance/scenario_config.py | 2 +- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/python/grpcio/tests/qps/benchmark_client.py b/src/python/grpcio/tests/qps/benchmark_client.py index aac218ed819..e2922347f98 100644 --- a/src/python/grpcio/tests/qps/benchmark_client.py +++ b/src/python/grpcio/tests/qps/benchmark_client.py @@ -82,6 +82,7 @@ class BenchmarkClient: self._response_callbacks = [] def add_response_callback(self, callback): + """callback will be invoked as callback(client, query_time)""" self._response_callbacks.append(callback) @abc.abstractmethod @@ -95,10 +96,10 @@ class BenchmarkClient: def stop(self): pass - def _handle_response(self, query_time): + def _handle_response(self, client, query_time): self._hist.add(query_time * 1e9) # Report times in nanoseconds for callback in self._response_callbacks: - callback(query_time) + callback(client, query_time) class UnarySyncBenchmarkClient(BenchmarkClient): @@ -121,7 +122,7 @@ class UnarySyncBenchmarkClient(BenchmarkClient): start_time = time.time() self._stub.UnaryCall(self._request, _TIMEOUT) end_time = time.time() - self._handle_response(end_time - start_time) + self._handle_response(self, end_time - start_time) class UnaryAsyncBenchmarkClient(BenchmarkClient): @@ -136,19 +137,20 @@ class UnaryAsyncBenchmarkClient(BenchmarkClient): def _response_received(self, start_time, resp): resp.result() end_time = time.time() - self._handle_response(end_time - start_time) + self._handle_response(self, end_time - start_time) def stop(self): self._stub = None -class StreamingSyncBenchmarkClient(BenchmarkClient): +class _SyncStream(object): - def __init__(self, server, config, hist): - super(StreamingSyncBenchmarkClient, self).__init__(server, config, hist) + def __init__(self, stub, generic, request, handle_response): + self._stub = stub + self._generic = generic + self._request = request + self._handle_response = handle_response self._is_streaming = False - self._pool = futures.ThreadPoolExecutor(max_workers=1) - # Use a thread-safe queue to put requests on the stream self._request_queue = queue.Queue() self._send_time_queue = queue.Queue() @@ -157,15 +159,6 @@ class StreamingSyncBenchmarkClient(BenchmarkClient): self._request_queue.put(self._request) def start(self): - self._is_streaming = True - self._pool.submit(self._request_stream) - - def stop(self): - self._is_streaming = False - self._pool.shutdown(wait=True) - self._stub = None - - def _request_stream(self): self._is_streaming = True if self._generic: stream_callable = self._stub.stream_stream( @@ -175,8 +168,11 @@ class StreamingSyncBenchmarkClient(BenchmarkClient): response_stream = stream_callable(self._request_generator(), _TIMEOUT) for _ in response_stream: - end_time = time.time() - self._handle_response(end_time - self._send_time_queue.get_nowait()) + self._handle_response( + self, time.time() - self._send_time_queue.get_nowait()) + + def stop(self): + self._is_streaming = False def _request_generator(self): while self._is_streaming: @@ -185,3 +181,30 @@ class StreamingSyncBenchmarkClient(BenchmarkClient): yield request except queue.Empty: pass + + +class StreamingSyncBenchmarkClient(BenchmarkClient): + + def __init__(self, server, config, hist): + super(StreamingSyncBenchmarkClient, self).__init__(server, config, hist) + self._pool = futures.ThreadPoolExecutor( + max_workers=config.outstanding_rpcs_per_channel) + self._streams = [_SyncStream(self._stub, self._generic, + self._request, self._handle_response) + for _ in xrange(config.outstanding_rpcs_per_channel)] + self._curr_stream = 0 + + def send_request(self): + # Use a round_robin scheduler to determine what stream to send on + self._streams[self._curr_stream].send_request() + self._curr_stream = (self._curr_stream + 1) % len(self._streams) + + def start(self): + for stream in self._streams: + self._pool.submit(stream.start) + + def stop(self): + for stream in self._streams: + stream.stop() + self._pool.shutdown(wait=True) + self._stub = None diff --git a/src/python/grpcio/tests/qps/client_runner.py b/src/python/grpcio/tests/qps/client_runner.py index 1ede7d2af1b..2d1d981733b 100644 --- a/src/python/grpcio/tests/qps/client_runner.py +++ b/src/python/grpcio/tests/qps/client_runner.py @@ -98,7 +98,6 @@ class ClosedLoopClientRunner(ClientRunner): self._client.stop() self._client = None - def _send_request(self, response_time): + def _send_request(self, client, response_time): if self._is_running: - self._client.send_request() - + client.send_request() diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index 81569e8b7a4..2d5130e1e86 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -415,7 +415,7 @@ class PythonLanguage: yield _ping_pong_scenario( 'python_protobuf_sync_streaming_qps_unconstrained', rpc_type='STREAMING', client_type='SYNC_CLIENT', server_type='SYNC_SERVER', - unconstrained_client='async') + unconstrained_client='sync') yield _ping_pong_scenario( 'python_to_cpp_protobuf_sync_unary_ping_pong', rpc_type='UNARY', From 22a65e1a2b7c1782bc288d9e8af1c0c9f0f90795 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 7 Jun 2016 19:06:05 -0700 Subject: [PATCH 113/175] Added python jwt_token_creds interop test --- setup.py | 2 +- src/python/grpcio/grpc/_auth.py | 15 ++++++++++++++- src/python/grpcio/tests/interop/client.py | 3 +++ src/python/grpcio/tests/interop/methods.py | 13 +++++++++++++ tools/run_tests/run_interop_tests.py | 2 +- 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index f96824fa883..0e2646d5d2f 100644 --- a/setup.py +++ b/setup.py @@ -202,7 +202,7 @@ TEST_PACKAGE_DATA = { } TESTS_REQUIRE = ( - 'oauth2client>=1.4.7', + 'oauth2client>=2.1.0', 'protobuf>=3.0.0a3', 'coverage>=4.0', ) + INSTALL_REQUIRES diff --git a/src/python/grpcio/grpc/_auth.py b/src/python/grpcio/grpc/_auth.py index 3ae00ca23a7..dea3221c9d8 100644 --- a/src/python/grpcio/grpc/_auth.py +++ b/src/python/grpcio/grpc/_auth.py @@ -29,6 +29,7 @@ """GRPCAuthMetadataPlugins for standard authentication.""" +import inspect from concurrent import futures import grpc @@ -46,9 +47,21 @@ class GoogleCallCredentials(grpc.AuthMetadataPlugin): self._credentials = credentials self._pool = futures.ThreadPoolExecutor(max_workers=1) + # Hack to determine if these are JWT creds and we need to pass + # additional_claims when getting a token + if 'additional_claims' in inspect.getargspec( + credentials.get_access_token).args: + self._is_jwt = True + else: + self._is_jwt = False + def __call__(self, context, callback): # MetadataPlugins cannot block (see grpc.beta.interfaces.py) - future = self._pool.submit(self._credentials.get_access_token) + if self._is_jwt: + future = self._pool.submit(self._credentials.get_access_token, + additional_claims={'aud': context.service_url}) + else: + future = self._pool.submit(self._credentials.get_access_token) future.add_done_callback(lambda x: self._get_token_callback(callback, x)) def _get_token_callback(self, callback, future): diff --git a/src/python/grpcio/tests/interop/client.py b/src/python/grpcio/tests/interop/client.py index e3d5545a020..8aa1ce30c1a 100644 --- a/src/python/grpcio/tests/interop/client.py +++ b/src/python/grpcio/tests/interop/client.py @@ -76,6 +76,9 @@ def _stub(args): creds = oauth2client_client.GoogleCredentials.get_application_default() scoped_creds = creds.create_scoped([args.oauth_scope]) call_creds = implementations.google_call_credentials(scoped_creds) + elif args.test_case == 'jwt_token_creds': + creds = oauth2client_client.GoogleCredentials.get_application_default() + call_creds = implementations.google_call_credentials(creds) else: call_creds = None if args.use_tls: diff --git a/src/python/grpcio/tests/interop/methods.py b/src/python/grpcio/tests/interop/methods.py index d5ef0c68bb9..7eac5115258 100644 --- a/src/python/grpcio/tests/interop/methods.py +++ b/src/python/grpcio/tests/interop/methods.py @@ -310,6 +310,16 @@ def _oauth2_auth_token(stub, args): (response.oauth_scope, args.oauth_scope)) +def _jwt_token_creds(stub, args): + json_key_filename = os.environ[ + oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS] + wanted_email = json.load(open(json_key_filename, 'rb'))['client_email'] + response = _large_unary_common_behavior(stub, True, False) + if wanted_email != response.username: + raise ValueError( + 'expected username %s, got %s' % (wanted_email, response.username)) + + def _per_rpc_creds(stub, args): json_key_filename = os.environ[ oauth2client_client.GOOGLE_APPLICATION_CREDENTIALS] @@ -338,6 +348,7 @@ class TestCase(enum.Enum): EMPTY_STREAM = 'empty_stream' COMPUTE_ENGINE_CREDS = 'compute_engine_creds' OAUTH2_AUTH_TOKEN = 'oauth2_auth_token' + JWT_TOKEN_CREDS = 'jwt_token_creds' PER_RPC_CREDS = 'per_rpc_creds' TIMEOUT_ON_SLEEPING_SERVER = 'timeout_on_sleeping_server' @@ -364,6 +375,8 @@ class TestCase(enum.Enum): _compute_engine_creds(stub, args) elif self is TestCase.OAUTH2_AUTH_TOKEN: _oauth2_auth_token(stub, args) + elif self is TestCase.JWT_TOKEN_CREDS: + _jwt_token_creds(stub, args) elif self is TestCase.PER_RPC_CREDS: _per_rpc_creds(stub, args) else: diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 053aabc9b5b..5aaefb1ae14 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -317,7 +317,7 @@ class PythonLanguage: 'PYTHONPATH': '{}/src/python/gens'.format(DOCKER_WORKDIR_ROOT)} def unimplemented_test_cases(self): - return _SKIP_ADVANCED + _SKIP_COMPRESSION + ['jwt_token_creds'] + return _SKIP_ADVANCED + _SKIP_COMPRESSION def unimplemented_test_cases_server(self): return _SKIP_ADVANCED + _SKIP_COMPRESSION From dfff4de040086d68bbdabf2d4a0c427b55987ebd Mon Sep 17 00:00:00 2001 From: "David G. Quintas" Date: Tue, 7 Jun 2016 19:57:33 -0700 Subject: [PATCH 114/175] Fix sed induced typo --- src/core/lib/iomgr/timer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/lib/iomgr/timer.c b/src/core/lib/iomgr/timer.c index 05a2fc104fc..69d3babfdb4 100644 --- a/src/core/lib/iomgr/timer.c +++ b/src/core/lib/iomgr/timer.c @@ -278,9 +278,8 @@ static int refill_queue(shard_type *shard, gpr_timespec now) { return !grpc_timer_heap_is_empty(&shard->heap); } -/* This pollent the next non-cancelled timer with deadline <= now from the - queue, - or returns NULL if there isn't one. +/* This pops the next non-cancelled timer with deadline <= now from the + queue, or returns NULL if there isn't one. REQUIRES: shard->mu locked */ static grpc_timer *pop_one(shard_type *shard, gpr_timespec now) { grpc_timer *timer; From cf41d19a9e1c7edf77fb0362824214dc9308a075 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 7 Jun 2016 21:05:43 -0700 Subject: [PATCH 115/175] clang-format --- include/grpc++/impl/grpc_library.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h index aaa9e4c8a54..1184d1bf093 100644 --- a/include/grpc++/impl/grpc_library.h +++ b/include/grpc++/impl/grpc_library.h @@ -37,8 +37,8 @@ #include #include -#include #include +#include #include namespace grpc { From 37e516e7c99ed08da6b8619701b542e2bd15a732 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 7 Jun 2016 21:23:41 -0700 Subject: [PATCH 116/175] regenerated projects --- BUILD | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD b/BUILD index 5a6562336b1..378f61eb66a 100644 --- a/BUILD +++ b/BUILD @@ -678,7 +678,7 @@ cc_library( "src/core/lib/channel/connected_channel.c", "src/core/lib/channel/http_client_filter.c", "src/core/lib/channel/http_server_filter.c", - "src/core/lib/compression/compression_algorithm.c", + "src/core/lib/compression/compression.c", "src/core/lib/compression/message_compress.c", "src/core/lib/debug/trace.c", "src/core/lib/http/format_request.c", diff --git a/Makefile b/Makefile index 2940ff6ed55..05cb78930d9 100644 --- a/Makefile +++ b/Makefile @@ -2746,7 +2746,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/compression/compression_algorithm.c \ + src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ src/core/lib/http/format_request.c \ From f6d09f2566561c9407c564a46901ff3a237ce115 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Tue, 7 Jun 2016 22:19:46 -0700 Subject: [PATCH 117/175] Fix command ordering for building Python artifacts Source packages were not getting the necessary C files due to `make_grpcio_tools.py` not being invoked before `sdist` through `setup.py`. --- tools/run_tests/build_artifact_python.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/build_artifact_python.sh b/tools/run_tests/build_artifact_python.sh index 4320f978e30..55f8eb634ba 100755 --- a/tools/run_tests/build_artifact_python.sh +++ b/tools/run_tests/build_artifact_python.sh @@ -59,12 +59,14 @@ ${SETARCH_CMD} ${PYTHON} setup.py \ ${SETARCH_CMD} ${PYTHON} setup.py \ bdist_wheel +# Build gRPC tools package distribution +${PYTHON} tools/distrib/python/make_grpcio_tools.py + # Build gRPC tools package source distribution ${SETARCH_CMD} ${PYTHON} tools/distrib/python/grpcio_tools/setup.py \ sdist # Build gRPC tools package binary distribution -${PYTHON} tools/distrib/python/make_grpcio_tools.py CFLAGS="$CFLAGS -fno-wrapv" ${SETARCH_CMD} \ ${PYTHON} tools/distrib/python/grpcio_tools/setup.py bdist_wheel From 3f30e634a6eb72baebe03a1e4757029918076cae Mon Sep 17 00:00:00 2001 From: Robbie Shade Date: Wed, 8 Jun 2016 08:40:56 -0400 Subject: [PATCH 118/175] Adds functions to set snd/rcv socket buffer sizes. Used for non-default 1 MB UDP socket buffers. --- src/core/lib/iomgr/socket_utils_common_posix.c | 10 ++++++++++ src/core/lib/iomgr/socket_utils_posix.h | 8 ++++++++ src/core/lib/iomgr/udp_server.c | 14 ++++++++++++++ test/core/iomgr/fd_posix_test.c | 8 +++----- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/core/lib/iomgr/socket_utils_common_posix.c b/src/core/lib/iomgr/socket_utils_common_posix.c index fa83ceef301..2147c86d4d1 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.c +++ b/src/core/lib/iomgr/socket_utils_common_posix.c @@ -111,6 +111,16 @@ int grpc_set_socket_ipv6_recvpktinfo_if_possible(int fd) { #endif } +int grpc_set_socket_sndbuf(int fd, int buffer_size_bytes) { + return 0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &buffer_size_bytes, + sizeof(buffer_size_bytes)); +} + +int grpc_set_socket_rcvbuf(int fd, int buffer_size_bytes) { + return 0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &buffer_size_bytes, + sizeof(buffer_size_bytes)); +} + /* set a socket to close on exec */ int grpc_set_socket_cloexec(int fd, int close_on_exec) { int oldflags = fcntl(fd, F_GETFD, 0); diff --git a/src/core/lib/iomgr/socket_utils_posix.h b/src/core/lib/iomgr/socket_utils_posix.h index a8f6e5e6586..7e41d1c8700 100644 --- a/src/core/lib/iomgr/socket_utils_posix.h +++ b/src/core/lib/iomgr/socket_utils_posix.h @@ -78,6 +78,14 @@ int grpc_set_socket_ip_pktinfo_if_possible(int fd); If IPV6_RECVPKTINFO is not available, returns 1. */ int grpc_set_socket_ipv6_recvpktinfo_if_possible(int fd); +/* Tries to set the socket's send buffer to given size. + Returns 1 on success, 0 on failure. */ +int grpc_set_socket_sndbuf(int fd, int buffer_size_bytes); + +/* Tries to set the socket's receive buffer to given size. + Returns 1 on success, 0 on failure. */ +int grpc_set_socket_rcvbuf(int fd, int buffer_size_bytes); + /* An enum to keep track of IPv4/IPv6 socket modes. Currently, this information is only used when a socket is first created, but diff --git a/src/core/lib/iomgr/udp_server.c b/src/core/lib/iomgr/udp_server.c index 98ffccd59b7..16150687d3d 100644 --- a/src/core/lib/iomgr/udp_server.c +++ b/src/core/lib/iomgr/udp_server.c @@ -210,6 +210,8 @@ static int prepare_socket(int fd, const struct sockaddr *addr, size_t addr_len) { struct sockaddr_storage sockname_temp; socklen_t sockname_len; + /* Set send/receive socket buffers to 1 MB */ + int buffer_size_bytes = 1024 * 1024; if (fd < 0) { goto error; @@ -239,6 +241,18 @@ static int prepare_socket(int fd, const struct sockaddr *addr, goto error; } + if (!grpc_set_socket_sndbuf(fd, buffer_size_bytes)) { + gpr_log(GPR_ERROR, "Failed to set send buffer size to %d bytes", + buf_size_bytes); + goto error; + } + + if (!grpc_set_socket_rcvbuf(fd, buffer_size_bytes)) { + gpr_log(GPR_ERROR, "Failed to set receive buffer size to %d bytes", + buf_size_bytes); + goto error; + } + return grpc_sockaddr_get_port((struct sockaddr *)&sockname_temp); error: diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index f97f33712eb..ad66542202c 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -68,17 +68,15 @@ static void create_test_socket(int port, int *socket_fd, struct sockaddr_in *sin) { int fd; int one = 1; - int buf_size = BUF_SIZE; + int buffer_size_bytes = BUF_SIZE; int flags; fd = socket(AF_INET, SOCK_STREAM, 0); setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); /* Reset the size of socket send buffer to the minimal value to facilitate buffer filling up and triggering notify_on_write */ - GPR_ASSERT( - setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &buf_size, sizeof(buf_size)) != -1); - GPR_ASSERT( - setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &buf_size, sizeof(buf_size)) != -1); + GPR_ASSERT(grpc_set_socket_sndbuf(fd, buffer_size_bytes)); + GPR_ASSERT(grpc_set_socket_rcvbuf(fd, buffer_size_bytes)); /* Make fd non-blocking */ flags = fcntl(fd, F_GETFL, 0); GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0); From e2b30ebbb321eecb396ecd2934c756aeedd51e98 Mon Sep 17 00:00:00 2001 From: Robbie Shade Date: Wed, 8 Jun 2016 08:45:05 -0400 Subject: [PATCH 119/175] Adds include for socket utils. --- test/core/iomgr/fd_posix_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index ad66542202c..0630f1d10e1 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -52,6 +52,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/iomgr.h" +#include "src/core/lib/iomgr/socket_utils_posix.h" #include "test/core/util/test_config.h" static gpr_mu *g_mu; From 080749e8ba5707d4c927baf92af4e82ce1718a7b Mon Sep 17 00:00:00 2001 From: "Matthew D. Steele" Date: Tue, 7 Jun 2016 13:55:04 -0400 Subject: [PATCH 120/175] Add interfaces for ServerAsyncReader/Writers --- include/grpc++/impl/codegen/async_stream.h | 43 ++++++++++++++----- .../grpc++/impl/codegen/impl/async_stream.h | 43 ++++++++++++++----- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/include/grpc++/impl/codegen/async_stream.h b/include/grpc++/impl/codegen/async_stream.h index a607a471060..70a8b393120 100644 --- a/include/grpc++/impl/codegen/async_stream.h +++ b/include/grpc++/impl/codegen/async_stream.h @@ -298,8 +298,16 @@ class ClientAsyncReaderWriter GRPC_FINAL }; template -class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncReaderInterface { +class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface, + public AsyncReaderInterface { + public: + virtual void Finish(const W& msg, const Status& status, void* tag) = 0; + + virtual void FinishWithError(const Status& status, void* tag) = 0; +}; + +template +class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface { public: explicit ServerAsyncReader(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -320,7 +328,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&read_ops_); } - void Finish(const W& msg, const Status& status, void* tag) { + void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, @@ -337,7 +345,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&finish_ops_); } - void FinishWithError(const Status& status, void* tag) { + void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE { GPR_CODEGEN_ASSERT(!status.ok()); finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { @@ -362,8 +370,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, }; template -class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface { +class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template +class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface { public: explicit ServerAsyncWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -390,7 +404,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, @@ -413,9 +427,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, /// Server-side interface for asynchronous bi-directional streaming. template -class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface, - public AsyncReaderInterface { +class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface, + public AsyncReaderInterface { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template +class ServerAsyncReaderWriter GRPC_FINAL + : public ServerAsyncReaderWriterInterface { public: explicit ServerAsyncReaderWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -448,7 +469,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, diff --git a/include/grpc++/impl/codegen/impl/async_stream.h b/include/grpc++/impl/codegen/impl/async_stream.h index 8f99e7eea43..7d7a9568077 100644 --- a/include/grpc++/impl/codegen/impl/async_stream.h +++ b/include/grpc++/impl/codegen/impl/async_stream.h @@ -295,8 +295,16 @@ class ClientAsyncReaderWriter GRPC_FINAL }; template -class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncReaderInterface { +class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface, + public AsyncReaderInterface { + public: + virtual void Finish(const W& msg, const Status& status, void* tag) = 0; + + virtual void FinishWithError(const Status& status, void* tag) = 0; +}; + +template +class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface { public: explicit ServerAsyncReader(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -316,7 +324,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&read_ops_); } - void Finish(const W& msg, const Status& status, void* tag) { + void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); @@ -332,7 +340,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&finish_ops_); } - void FinishWithError(const Status& status, void* tag) { + void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE { GPR_CODEGEN_ASSERT(!status.ok()); finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { @@ -356,8 +364,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, }; template -class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface { +class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template +class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface { public: explicit ServerAsyncWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -382,7 +396,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); @@ -404,9 +418,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, /// Server-side interface for asynchronous bi-directional streaming. template -class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, - public AsyncWriterInterface, - public AsyncReaderInterface { +class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface, + public AsyncWriterInterface, + public AsyncReaderInterface { + public: + virtual void Finish(const Status& status, void* tag) = 0; +}; + +template +class ServerAsyncReaderWriter GRPC_FINAL + : public ServerAsyncReaderWriterInterface { public: explicit ServerAsyncReaderWriter(ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} @@ -437,7 +458,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&write_ops_); } - void Finish(const Status& status, void* tag) { + void Finish(const Status& status, void* tag) GRPC_OVERRIDE { finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(ctx_->initial_metadata_); From 4f11ab1ffd20a3a0cf2c33a563fcd5437733c189 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 8 Jun 2016 10:40:00 -0700 Subject: [PATCH 121/175] addressed feedback. --- src/compiler/objective_c_generator.cc | 2 +- src/objective-c/ProtoRPC/ProtoMethod.h | 2 +- src/objective-c/ProtoRPC/ProtoRPC.h | 6 +++--- src/objective-c/ProtoRPC/ProtoRPC.m | 2 +- src/objective-c/ProtoRPC/ProtoService.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 75665cd5c0d..71a674174d7 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -94,7 +94,7 @@ void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method, void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method, map< ::grpc::string, ::grpc::string> vars) { vars["method_name"] = "RPCTo" + vars["method_name"]; - vars["return_type"] = "GRPCProtoRPC *"; + vars["return_type"] = "GRPCProtoCall *"; PrintMethodSignature(printer, method, vars); } diff --git a/src/objective-c/ProtoRPC/ProtoMethod.h b/src/objective-c/ProtoRPC/ProtoMethod.h index bd1a848c19a..f9fdbb35ffd 100644 --- a/src/objective-c/ProtoRPC/ProtoMethod.h +++ b/src/objective-c/ProtoRPC/ProtoMethod.h @@ -51,7 +51,7 @@ __attribute__((deprecated("Please use GRPCProtoMethod."))) @end /** - * This subclass is empty now. Eventually we'll remove ProtoService class + * This subclass is empty now. Eventually we'll remove ProtoMethod class * to avoid potential naming conflict */ @interface GRPCProtoMethod : ProtoMethod diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index 55fefb0aa88..f22d731f68b 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -36,7 +36,7 @@ #import "ProtoMethod.h" -__attribute__((deprecated("Please use GRPCProtoRPC."))) +__attribute__((deprecated("Please use GRPCProtoCall."))) @interface ProtoRPC : GRPCCall - (instancetype)initWithHost:(NSString *)host @@ -49,9 +49,9 @@ __attribute__((deprecated("Please use GRPCProtoRPC."))) @end /** - * This subclass is empty now. Eventually we'll remove ProtoService class + * This subclass is empty now. Eventually we'll remove ProtoRPC class * to avoid potential naming conflict */ -@interface GRPCProtoRPC : ProtoRPC +@interface GRPCProtoCall : ProtoRPC @end diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index 27c8b0eff7e..fb0b566f199 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -118,6 +118,6 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing } @end -@implementation GRPCProtoRPC +@implementation GRPCProtoCall @end diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index edec8a4770f..87d06e1ae59 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -33,7 +33,7 @@ #import -@class GRPCProtoRPC; +@class GRPCProtoCall; @protocol GRXWriteable; @class GRXWriter; @@ -44,7 +44,7 @@ __attribute__((deprecated("Please use GRPCProtoService."))) packageName:(NSString *)packageName serviceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER; -- (GRPCProtoRPC *)RPCToMethod:(NSString *)method +- (GRPCProtoCall *)RPCToMethod:(NSString *)method requestsWriter:(GRXWriter *)requestsWriter responseClass:(Class)responseClass responsesWriteable:(id)responsesWriteable; From cfd4102357187823f82d44e561aaa1d5b9a9e3fe Mon Sep 17 00:00:00 2001 From: Adam Michalik Date: Wed, 8 Jun 2016 10:59:48 -0700 Subject: [PATCH 122/175] fix memory leak --- .../transport/chttp2/server/insecure/server_chttp2_posix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index d625ed1d9e5..96bf4d6f308 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -38,6 +38,7 @@ #ifdef GPR_SUPPORT_CHANNELS_FROM_FD +#include #include #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" @@ -52,12 +53,15 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, grpc_completion_queue *cq, int fd) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + char *name; gpr_asprintf(&name, "fd:%d", fd); grpc_endpoint *server_endpoint = grpc_tcp_create( grpc_fd_create(fd, name), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name); + gpr_free(name); + const grpc_channel_args *server_args = grpc_server_get_channel_args(server); grpc_transport *transport = grpc_create_chttp2_transport( &exec_ctx, server_args, server_endpoint, 0 /* is_client */); From eb25a07a48d84f3426a9cc03f35faaa0b9a0c7c2 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 8 Jun 2016 10:59:48 -0700 Subject: [PATCH 123/175] Add filegroup grpc++_codegen_proto --- BUILD | 53 ++++++ Makefile | 53 ++++++ build.yaml | 2 + tools/run_tests/sources_and_headers.json | 3 +- .../grpc++_reflection.vcxproj | 53 ++++++ .../grpc++_reflection.vcxproj.filters | 177 ++++++++++++++++++ 6 files changed, 340 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index ba558b2cb98..d244a52bb3b 100644 --- a/BUILD +++ b/BUILD @@ -1374,6 +1374,59 @@ cc_library( "include/grpc++/ext/proto_server_reflection_plugin.h", "include/grpc++/ext/reflection.grpc.pb.h", "include/grpc++/ext/reflection.pb.h", + "include/grpc++/impl/codegen/proto_utils.h", + "include/grpc++/impl/codegen/async_stream.h", + "include/grpc++/impl/codegen/async_unary_call.h", + "include/grpc++/impl/codegen/call.h", + "include/grpc++/impl/codegen/call_hook.h", + "include/grpc++/impl/codegen/channel_interface.h", + "include/grpc++/impl/codegen/client_context.h", + "include/grpc++/impl/codegen/client_unary_call.h", + "include/grpc++/impl/codegen/completion_queue.h", + "include/grpc++/impl/codegen/completion_queue_tag.h", + "include/grpc++/impl/codegen/config.h", + "include/grpc++/impl/codegen/core_codegen_interface.h", + "include/grpc++/impl/codegen/create_auth_context.h", + "include/grpc++/impl/codegen/grpc_library.h", + "include/grpc++/impl/codegen/method_handler_impl.h", + "include/grpc++/impl/codegen/rpc_method.h", + "include/grpc++/impl/codegen/rpc_service_method.h", + "include/grpc++/impl/codegen/security/auth_context.h", + "include/grpc++/impl/codegen/serialization_traits.h", + "include/grpc++/impl/codegen/server_context.h", + "include/grpc++/impl/codegen/server_interface.h", + "include/grpc++/impl/codegen/service_type.h", + "include/grpc++/impl/codegen/status.h", + "include/grpc++/impl/codegen/status_code_enum.h", + "include/grpc++/impl/codegen/string_ref.h", + "include/grpc++/impl/codegen/stub_options.h", + "include/grpc++/impl/codegen/sync.h", + "include/grpc++/impl/codegen/sync_cxx11.h", + "include/grpc++/impl/codegen/sync_no_cxx11.h", + "include/grpc++/impl/codegen/sync_stream.h", + "include/grpc++/impl/codegen/time.h", + "include/grpc/impl/codegen/byte_buffer.h", + "include/grpc/impl/codegen/byte_buffer_reader.h", + "include/grpc/impl/codegen/compression_types.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/grpc_types.h", + "include/grpc/impl/codegen/propagation_bits.h", + "include/grpc/impl/codegen/status.h", + "include/grpc/impl/codegen/alloc.h", + "include/grpc/impl/codegen/atm.h", + "include/grpc/impl/codegen/atm_gcc_atomic.h", + "include/grpc/impl/codegen/atm_gcc_sync.h", + "include/grpc/impl/codegen/atm_windows.h", + "include/grpc/impl/codegen/log.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/slice.h", + "include/grpc/impl/codegen/slice_buffer.h", + "include/grpc/impl/codegen/sync.h", + "include/grpc/impl/codegen/sync_generic.h", + "include/grpc/impl/codegen/sync_posix.h", + "include/grpc/impl/codegen/sync_windows.h", + "include/grpc/impl/codegen/time.h", + "include/grpc++/impl/codegen/config_protobuf.h", ], includes = [ "include", diff --git a/Makefile b/Makefile index 44ea34d5101..01e6c404979 100644 --- a/Makefile +++ b/Makefile @@ -3632,6 +3632,59 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/ext/proto_server_reflection_plugin.h \ include/grpc++/ext/reflection.grpc.pb.h \ include/grpc++/ext/reflection.pb.h \ + include/grpc++/impl/codegen/proto_utils.h \ + include/grpc++/impl/codegen/async_stream.h \ + include/grpc++/impl/codegen/async_unary_call.h \ + include/grpc++/impl/codegen/call.h \ + include/grpc++/impl/codegen/call_hook.h \ + include/grpc++/impl/codegen/channel_interface.h \ + include/grpc++/impl/codegen/client_context.h \ + include/grpc++/impl/codegen/client_unary_call.h \ + include/grpc++/impl/codegen/completion_queue.h \ + include/grpc++/impl/codegen/completion_queue_tag.h \ + include/grpc++/impl/codegen/config.h \ + include/grpc++/impl/codegen/core_codegen_interface.h \ + include/grpc++/impl/codegen/create_auth_context.h \ + include/grpc++/impl/codegen/grpc_library.h \ + include/grpc++/impl/codegen/method_handler_impl.h \ + include/grpc++/impl/codegen/rpc_method.h \ + include/grpc++/impl/codegen/rpc_service_method.h \ + include/grpc++/impl/codegen/security/auth_context.h \ + include/grpc++/impl/codegen/serialization_traits.h \ + include/grpc++/impl/codegen/server_context.h \ + include/grpc++/impl/codegen/server_interface.h \ + include/grpc++/impl/codegen/service_type.h \ + include/grpc++/impl/codegen/status.h \ + include/grpc++/impl/codegen/status_code_enum.h \ + include/grpc++/impl/codegen/string_ref.h \ + include/grpc++/impl/codegen/stub_options.h \ + include/grpc++/impl/codegen/sync.h \ + include/grpc++/impl/codegen/sync_cxx11.h \ + include/grpc++/impl/codegen/sync_no_cxx11.h \ + include/grpc++/impl/codegen/sync_stream.h \ + include/grpc++/impl/codegen/time.h \ + include/grpc/impl/codegen/byte_buffer.h \ + include/grpc/impl/codegen/byte_buffer_reader.h \ + include/grpc/impl/codegen/compression_types.h \ + include/grpc/impl/codegen/connectivity_state.h \ + include/grpc/impl/codegen/grpc_types.h \ + include/grpc/impl/codegen/propagation_bits.h \ + include/grpc/impl/codegen/status.h \ + include/grpc/impl/codegen/alloc.h \ + include/grpc/impl/codegen/atm.h \ + include/grpc/impl/codegen/atm_gcc_atomic.h \ + include/grpc/impl/codegen/atm_gcc_sync.h \ + include/grpc/impl/codegen/atm_windows.h \ + include/grpc/impl/codegen/log.h \ + include/grpc/impl/codegen/port_platform.h \ + include/grpc/impl/codegen/slice.h \ + include/grpc/impl/codegen/slice_buffer.h \ + include/grpc/impl/codegen/sync.h \ + include/grpc/impl/codegen/sync_generic.h \ + include/grpc/impl/codegen/sync_posix.h \ + include/grpc/impl/codegen/sync_windows.h \ + include/grpc/impl/codegen/time.h \ + include/grpc++/impl/codegen/config_protobuf.h \ LIBGRPC++_REFLECTION_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_REFLECTION_SRC)))) diff --git a/build.yaml b/build.yaml index cd95e1d2d90..6328016d4cf 100644 --- a/build.yaml +++ b/build.yaml @@ -969,6 +969,8 @@ libs: - src/cpp/ext/reflection.pb.cc deps: - grpc++ + filegroups: + - grpc++_codegen_proto - name: grpc++_test_config build: private language: c++ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 163c313c4a2..2abd5084e9e 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -4308,7 +4308,8 @@ }, { "deps": [ - "grpc++" + "grpc++", + "grpc++_codegen_proto" ], "headers": [ "include/grpc++/ext/proto_server_reflection_plugin.h", diff --git a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj index cbb7c7c76ff..7c3e63b2084 100644 --- a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj +++ b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj @@ -150,6 +150,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters index 70d3d45372a..d9cd49cc306 100644 --- a/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_reflection/grpc++_reflection.vcxproj.filters @@ -24,6 +24,165 @@ include\grpc++\ext + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen\security + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc++\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc\impl\codegen + + + include\grpc++\impl\codegen + @@ -35,12 +194,30 @@ {e9441021-f78a-ec84-7efd-1883975feddb} + + {3b19b259-3bf4-c0fa-8e20-ed79acd63ac3} + {c66e66b4-a64e-79bf-40e8-1a1bac124a3d} {8d96203b-d3ce-2164-74a6-06e0ff2b09af} + + {4e57d72c-762f-20b1-bdb9-bc7088ca6fda} + + + {0f0f3943-7a9d-2b03-7eb1-2fbad4199428} + + + {e1b8bc6d-2cd2-1283-868a-dfd64c3dbab8} + + + {7bccc379-84fb-c1aa-19aa-a0cc09ac59ac} + + + {a1f1904b-e820-dd3c-b4b0-14a6e0ff9d19} + {5ec5476e-3d72-e3f9-4f05-3f7c31c13651} From 4b8550db49793fe756975e249b5e8323bf8d9969 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 8 Jun 2016 11:09:37 -0700 Subject: [PATCH 124/175] clang-format code --- src/core/ext/transport/chttp2/transport/internal.h | 2 +- src/core/ext/transport/chttp2/transport/parsing.c | 4 ++-- src/core/lib/support/avl.c | 5 ++--- test/core/statistics/census_log_tests.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 86a31cc50be..5872fd8e0a4 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -691,7 +691,7 @@ extern int grpc_flowctl_trace; if (!(grpc_http_trace)) \ ; \ else \ - stmt + stmt typedef enum { GRPC_CHTTP2_FLOWCTL_MOVE, diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 8b6b0cebd0a..4bd374b7fa7 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -87,8 +87,8 @@ void grpc_chttp2_prepare_to_read( transport_global->settings[GRPC_SENT_SETTINGS], sizeof(transport_parsing->last_sent_settings)); transport_parsing->max_frame_size = - transport_global - ->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]; + transport_global->settings[GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]; /* update the parsing view of incoming window */ while (grpc_chttp2_list_pop_unannounced_incoming_window_available( diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c index c04675e01fb..8d3ce23e6c3 100644 --- a/src/core/lib/support/avl.c +++ b/src/core/lib/support/avl.c @@ -73,9 +73,8 @@ static long node_height(gpr_avl_node *node) { #ifndef NDEBUG static long calculate_height(gpr_avl_node *node) { - return node == NULL ? 0 - : 1 + GPR_MAX(calculate_height(node->left), - calculate_height(node->right)); + return node == NULL ? 0 : 1 + GPR_MAX(calculate_height(node->left), + calculate_height(node->right)); } static gpr_avl_node *assert_invariants(gpr_avl_node *n) { diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index 4baae6a73bb..8646a2fdf1d 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -31,6 +31,7 @@ * */ +#include "src/core/ext/census/census_log.h" #include #include #include @@ -41,7 +42,6 @@ #include #include #include -#include "src/core/ext/census/census_log.h" #include "test/core/util/test_config.h" /* Fills in 'record' of size 'size'. Each byte in record is filled in with the From ac4b3a6e59802f9b84547126c8ac5a09683e5ae1 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 8 Jun 2016 15:00:25 -0700 Subject: [PATCH 125/175] Create command_line_tool.md --- doc/command_line_tool.md | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 doc/command_line_tool.md diff --git a/doc/command_line_tool.md b/doc/command_line_tool.md new file mode 100644 index 00000000000..eff101b2d4e --- /dev/null +++ b/doc/command_line_tool.md @@ -0,0 +1,77 @@ +# gRPC command line tool + +## Overview + +This document describes the command line tool that comes with gRPC repository. It is desireable to have command line +tools written in other languages to roughly follow the same syntax and flags. + +At this point, the tool needs to be built from source, and it should be moved out to grpc-tools repository as a stand +alone application once it is mature enough. + +## Core funcitonality + +The command line tool can do the following things: + +- Send unary rpc. +- Attach metadata and display received metadata. +- Handle common authentication to server. +- Find the request/response types from a given proto file. +- Read proto request in text form. +- Read request in wire form (for protobuf messages, this means serialized binary form). +- Display proto response in text form. +- Write response in wire form to a file. + +The command line tool should support the following things: + +- List server services and methods through server reflection. +- Infer request/response types from server reflection result. +- Fine-grained auth control (such as, use this oauth token to talk to the server). +- Send streaming rpc. + +## Code location + +To use the tool, you need to get the grpc repository and in the grpc directory call + +``` +make grpc_cli +``` + +The main file can be found at +https://github.com/grpc/grpc/blob/master/test/cpp/util/grpc_cli.cc + +## Usage + +### Basic usage + +Send a rpc to a helloworld server at `localhost:50051`: + +``` +bins/opt/grpc_cli call localhost:50051 SayHello examples/protos/helloworld.proto \ + "name: 'world'" --enable_ssl=false +``` + +On success, the tool will print out + +``` +Rpc succeeded with OK status +Response: + message: "Hello world" +``` + +The `localhost:50051` part indicates the server you are connecting to. `SayHello` is (part of) the +gRPC method string. Then there is the path to the proto file containing the service definition, +if it is not under current directory, you can use `--proto_path` to specify a new search root. +`"name: 'world'"` is the text format of the request proto message. +We are not using ssl here by `--enable_ssl=false`. For information on more +flags, look at the comments of `grpc_cli.cc`. + +### Send non-proto rpc + +For using gRPC with protocols other than probobuf, you will need the exact method name string +and a file containing the raw bytes to be sent on the wire + +``` +bins/opt/grpc_cli call localhost:50051 /helloworld.Greeter/SayHello --input_binary_file=input.bin \ + --output_binary_file=output.bin +``` +On success, you will need to read or decode the response from the `output.bin` file. From cb79b29ac589ba0f17da1588430db4407f73b5f6 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 8 Jun 2016 15:07:54 -0700 Subject: [PATCH 126/175] fix for issue 6344. added printing of .proto file comments in generated code. --- src/compiler/objective_c_generator.cc | 33 ++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 71a674174d7..db0b61ee6f0 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -60,9 +60,34 @@ void PrintProtoRpcDeclarationAsPragma(Printer *printer, " returns ($server_stream$$response_type$)\n\n"); } +template +static void PrintAllComments(const DescriptorType* desc, Printer* printer) { + std::vector comments; + grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED, + &comments); + grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING, + &comments); + grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING, + &comments); + if (comments.empty()) { + return; + } + printer->Print("/**\n"); + for (auto it = comments.begin(); it != comments.end(); ++it) { + printer->Print(" * "); + size_t start_pos = it->find_first_not_of(' '); + if (start_pos != grpc::string::npos) { + printer->Print(it->c_str() + start_pos); + } + printer->Print("\n"); + } + printer->Print(" */\n"); +} + void PrintMethodSignature(Printer *printer, const MethodDescriptor *method, const map< ::grpc::string, ::grpc::string> &vars) { - // TODO(jcanizales): Print method comments. + // Print comment + PrintAllComments(method, printer); printer->Print(vars, "- ($return_type$)$method_name$With"); if (method->client_streaming()) { @@ -195,8 +220,10 @@ void PrintMethodImplementations(Printer *printer, printer.Print("@end\n\n"); printer.Print( - "// Basic service implementation, over gRPC, that only does" - " marshalling and parsing.\n"); + "/**\n" + " * Basic service implementation, over gRPC, that only does\n" + " * marshalling and parsing.\n" + " */\n"); printer.Print(vars, "@interface $service_class$ :" " GRPCProtoService<$service_class$>\n"); From e27d189f2165e904dbb3d61616edf3c643df71f0 Mon Sep 17 00:00:00 2001 From: David Klempner Date: Thu, 19 May 2016 13:50:16 -0700 Subject: [PATCH 127/175] Factor out json seriailzation code and move it into parse_json. This is for the same reasons as ParseJson, that is so that we can limit the scope of the proto namespace differences between internal and external. --- Makefile | 6 +++--- build.yaml | 5 ++--- test/cpp/qps/parse_json.cc | 15 +++++++++++++++ test/cpp/qps/parse_json.h | 3 +++ test/cpp/qps/report.cc | 18 +++--------------- tools/run_tests/sources_and_headers.json | 9 ++++----- vsprojects/vcxproj/qps/qps.vcxproj | 3 +++ vsprojects/vcxproj/qps/qps.vcxproj.filters | 6 ++++++ .../qps_json_driver/qps_json_driver.vcxproj | 5 ----- .../qps_json_driver.vcxproj.filters | 8 -------- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index fdbedfd276e..a2815ff6635 100644 --- a/Makefile +++ b/Makefile @@ -4255,6 +4255,7 @@ LIBQPS_SRC = \ test/cpp/qps/client_sync.cc \ test/cpp/qps/driver.cc \ test/cpp/qps/limit_cores.cc \ + test/cpp/qps/parse_json.cc \ test/cpp/qps/qps_worker.cc \ test/cpp/qps/report.cc \ test/cpp/qps/server_async.cc \ @@ -4310,6 +4311,7 @@ $(OBJDIR)/$(CONFIG)/test/cpp/qps/client_async.o: $(GENDIR)/src/proto/grpc/testin $(OBJDIR)/$(CONFIG)/test/cpp/qps/client_sync.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/driver.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/limit_cores.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/qps/parse_json.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_worker.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/report.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/qps/server_async.o: $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.pb.cc $(GENDIR)/src/proto/grpc/testing/payloads.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/services.pb.cc $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc @@ -11331,7 +11333,6 @@ endif QPS_JSON_DRIVER_SRC = \ - test/cpp/qps/parse_json.cc \ test/cpp/qps/qps_json_driver.cc \ QPS_JSON_DRIVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_JSON_DRIVER_SRC)))) @@ -11363,8 +11364,6 @@ endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/qps/parse_json.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a - $(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_json_driver.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a deps_qps_json_driver: $(QPS_JSON_DRIVER_OBJS:.o=.dep) @@ -14577,6 +14576,7 @@ test/cpp/qps/client_async.cc: $(OPENSSL_DEP) test/cpp/qps/client_sync.cc: $(OPENSSL_DEP) test/cpp/qps/driver.cc: $(OPENSSL_DEP) test/cpp/qps/limit_cores.cc: $(OPENSSL_DEP) +test/cpp/qps/parse_json.cc: $(OPENSSL_DEP) test/cpp/qps/qps_worker.cc: $(OPENSSL_DEP) test/cpp/qps/report.cc: $(OPENSSL_DEP) test/cpp/qps/server_async.cc: $(OPENSSL_DEP) diff --git a/build.yaml b/build.yaml index 8c09c55335b..75d21b556d6 100644 --- a/build.yaml +++ b/build.yaml @@ -1120,6 +1120,7 @@ libs: - test/cpp/qps/histogram.h - test/cpp/qps/interarrival.h - test/cpp/qps/limit_cores.h + - test/cpp/qps/parse_json.h - test/cpp/qps/qps_worker.h - test/cpp/qps/report.h - test/cpp/qps/server.h @@ -1136,6 +1137,7 @@ libs: - test/cpp/qps/client_sync.cc - test/cpp/qps/driver.cc - test/cpp/qps/limit_cores.cc + - test/cpp/qps/parse_json.cc - test/cpp/qps/qps_worker.cc - test/cpp/qps/report.cc - test/cpp/qps/server_async.cc @@ -2811,10 +2813,7 @@ targets: build: test run: false language: c++ - headers: - - test/cpp/qps/parse_json.h src: - - test/cpp/qps/parse_json.cc - test/cpp/qps/qps_json_driver.cc deps: - qps diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc index a90bf6153c6..be804281f81 100644 --- a/test/cpp/qps/parse_json.cc +++ b/test/cpp/qps/parse_json.cc @@ -61,5 +61,20 @@ void ParseJson(const grpc::string& json, const grpc::string& type, GPR_ASSERT(msg->ParseFromString(binary)); } +grpc::string SerializeJson(const GRPC_CUSTOM_MESSAGE& msg, + const grpc::string& type) { + std::unique_ptr type_resolver( + google::protobuf::util::NewTypeResolverForDescriptorPool( + "type.googleapis.com", + google::protobuf::DescriptorPool::generated_pool())); + grpc::string binary; + grpc::string json_string; + msg.SerializeToString(&binary); + auto status = + BinaryToJsonString(type_resolver.get(), type, binary, &json_string); + GPR_ASSERT(status.ok()); + return json_string; +} + } // testing } // grpc diff --git a/test/cpp/qps/parse_json.h b/test/cpp/qps/parse_json.h index 42d7d22c53c..ce1821f961d 100644 --- a/test/cpp/qps/parse_json.h +++ b/test/cpp/qps/parse_json.h @@ -43,6 +43,9 @@ namespace testing { void ParseJson(const grpc::string& json, const grpc::string& type, GRPC_CUSTOM_MESSAGE* msg); +grpc::string SerializeJson(const GRPC_CUSTOM_MESSAGE& msg, + const grpc::string& type); + } // testing } // grpc diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index 3ae41399cfc..2ec7d8676c2 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -35,11 +35,9 @@ #include -#include -#include - #include #include "test/cpp/qps/driver.h" +#include "test/cpp/qps/parse_json.h" #include "test/cpp/qps/stats.h" namespace grpc { @@ -104,18 +102,8 @@ void GprLogReporter::ReportTimes(const ScenarioResult& result) { } void JsonReporter::ReportQPS(const ScenarioResult& result) { - std::unique_ptr type_resolver( - google::protobuf::util::NewTypeResolverForDescriptorPool( - "type.googleapis.com", - google::protobuf::DescriptorPool::generated_pool())); - grpc::string binary; - grpc::string json_string; - result.SerializeToString(&binary); - auto status = BinaryToJsonString( - type_resolver.get(), "type.googleapis.com/grpc.testing.ScenarioResult", - binary, &json_string); - GPR_ASSERT(status.ok()); - + grpc::string json_string = + SerializeJson(result, "type.googleapis.com/grpc.testing.ScenarioResult"); std::ofstream output_file(report_file_); output_file << json_string; output_file.close(); diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 325aca18a76..b1e0126542b 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -2361,14 +2361,10 @@ "grpc_test_util", "qps" ], - "headers": [ - "test/cpp/qps/parse_json.h" - ], + "headers": [], "language": "c++", "name": "qps_json_driver", "src": [ - "test/cpp/qps/parse_json.cc", - "test/cpp/qps/parse_json.h", "test/cpp/qps/qps_json_driver.cc" ], "third_party": false, @@ -4546,6 +4542,7 @@ "test/cpp/qps/histogram.h", "test/cpp/qps/interarrival.h", "test/cpp/qps/limit_cores.h", + "test/cpp/qps/parse_json.h", "test/cpp/qps/qps_worker.h", "test/cpp/qps/report.h", "test/cpp/qps/server.h", @@ -4565,6 +4562,8 @@ "test/cpp/qps/interarrival.h", "test/cpp/qps/limit_cores.cc", "test/cpp/qps/limit_cores.h", + "test/cpp/qps/parse_json.cc", + "test/cpp/qps/parse_json.h", "test/cpp/qps/qps_worker.cc", "test/cpp/qps/qps_worker.h", "test/cpp/qps/report.cc", diff --git a/vsprojects/vcxproj/qps/qps.vcxproj b/vsprojects/vcxproj/qps/qps.vcxproj index 32413625ed3..004cf7c9f0e 100644 --- a/vsprojects/vcxproj/qps/qps.vcxproj +++ b/vsprojects/vcxproj/qps/qps.vcxproj @@ -152,6 +152,7 @@ + @@ -208,6 +209,8 @@ + + diff --git a/vsprojects/vcxproj/qps/qps.vcxproj.filters b/vsprojects/vcxproj/qps/qps.vcxproj.filters index 54d438f5363..d3a440ba730 100644 --- a/vsprojects/vcxproj/qps/qps.vcxproj.filters +++ b/vsprojects/vcxproj/qps/qps.vcxproj.filters @@ -28,6 +28,9 @@ test\cpp\qps + + test\cpp\qps + test\cpp\qps @@ -63,6 +66,9 @@ test\cpp\qps + + test\cpp\qps + test\cpp\qps diff --git a/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj b/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj index 3884c102365..d1dea3ec4ae 100644 --- a/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj +++ b/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj @@ -160,11 +160,6 @@ - - - - - diff --git a/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj.filters b/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj.filters index cde967fc27c..62b9be85cc3 100644 --- a/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj.filters +++ b/vsprojects/vcxproj/test/qps_json_driver/qps_json_driver.vcxproj.filters @@ -1,18 +1,10 @@ - - test\cpp\qps - test\cpp\qps - - - test\cpp\qps - - From 2bdde23c25b2df3f5b94100226ca2957e4e2cba4 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 8 Jun 2016 17:45:19 -0700 Subject: [PATCH 128/175] Remove zu specifiers --- .../ext/transport/chttp2/transport/bin_decoder.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c index 38b5e46949b..2d90b01cd8b 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.c +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c @@ -151,9 +151,9 @@ gpr_slice grpc_chttp2_base64_decode(gpr_slice input) { if (input_length % 4 != 0) { gpr_log(GPR_ERROR, "Base64 decoding failed, input of " - "grpc_chttp2_base64_decode has a length of %zu, which is not a " + "grpc_chttp2_base64_decode has a length of %d, which is not a " "multiple of 4.\n", - input_length); + (int)input_length); return gpr_empty_slice(); } @@ -196,18 +196,19 @@ gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input, if (input_length % 4 == 1) { gpr_log(GPR_ERROR, "Base64 decoding failed, input of " - "grpc_chttp2_base64_decode_with_length has a length of %zu, which " + "grpc_chttp2_base64_decode_with_length has a length of %d, which " "has a tail of 1 byte.\n", - input_length); + (int)input_length); gpr_slice_unref(output); return gpr_empty_slice(); } if (output_length > input_length / 4 * 3 + tail_xtra[input_length % 4]) { gpr_log(GPR_ERROR, - "Base64 decoding failed, output_length %zu is longer " - "than the max possible output length %zu.\n", - output_length, input_length / 4 * 3 + tail_xtra[input_length % 4]); + "Base64 decoding failed, output_length %d is longer " + "than the max possible output length %d.\n", + (int)output_length, + (int)(input_length / 4 * 3 + tail_xtra[input_length % 4])); gpr_slice_unref(output); return gpr_empty_slice(); } From 82c3dd1f0a96944122d3a0e40242d592a2c7db64 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Wed, 8 Jun 2016 16:56:00 -0700 Subject: [PATCH 129/175] Add usage documentation to Python tools distribution --- tools/distrib/python/grpcio_tools/README.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/distrib/python/grpcio_tools/README.rst b/tools/distrib/python/grpcio_tools/README.rst index 10d2fe8c309..e9f137493ba 100644 --- a/tools/distrib/python/grpcio_tools/README.rst +++ b/tools/distrib/python/grpcio_tools/README.rst @@ -126,3 +126,13 @@ Help, I ... GCC 6.0), this is probably a bug where GCC chokes on constant expressions when the :code:`-fwrapv` flag is specified. You should consider setting your environment with :code:`CFLAGS=-fno-wrapv` or using clang (:code:`CC=clang`). + +Usage +----- + +Given protobuf include directories :code:`$INCLUDE`, an output directory +:code:`$OUTPUT`, and proto files :code:`$PROTO_FILES`, invoke as: + +:: + + $ python -m grpc.tools.protoc -I$INCLUDE --python_out=$OUTPUT --grpc_python_out=$OUTPUT $PROTO_FILES From 8e93533f65938a83760f522c9825cd903a307f03 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 8 Jun 2016 19:45:54 -0700 Subject: [PATCH 130/175] allow shutdown of unstarted server --- src/csharp/Grpc.Core.Tests/ServerTest.cs | 8 ++++++++ src/csharp/Grpc.Core/Server.cs | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs index 5f7144611e5..3b51aa63300 100644 --- a/src/csharp/Grpc.Core.Tests/ServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs @@ -94,6 +94,14 @@ namespace Grpc.Core.Tests server.ShutdownAsync().Wait(); } + [Test] + public void UnstartedServerCanBeShutdown() + { + var server = new Server(); + server.ShutdownAsync().Wait(); + Assert.Throws(typeof(InvalidOperationException), () => server.Start()); + } + [Test] public void UnstartedServerDoesNotPreventShutdown() { diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs index ae7a8c9a9a1..3b554e5e87e 100644 --- a/src/csharp/Grpc.Core/Server.cs +++ b/src/csharp/Grpc.Core/Server.cs @@ -140,6 +140,7 @@ namespace Grpc.Core lock (myLock) { GrpcPreconditions.CheckState(!startRequested); + GrpcPreconditions.CheckState(!shutdownRequested); startRequested = true; handle.Start(); @@ -203,7 +204,6 @@ namespace Grpc.Core { lock (myLock) { - GrpcPreconditions.CheckState(startRequested); GrpcPreconditions.CheckState(!shutdownRequested); shutdownRequested = true; } @@ -215,7 +215,6 @@ namespace Grpc.Core { handle.CancelAllCalls(); } - await ShutdownCompleteOrEnvironmentDeadAsync().ConfigureAwait(false); DisposeHandle(); From c9dc83400beb65ed30c9e239e17b0eeeb1858fc6 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 9 Jun 2016 18:57:14 +0000 Subject: [PATCH 131/175] Document cardinality violation status codes --- doc/statuscodes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/statuscodes.md b/doc/statuscodes.md index 84258c8d122..c918f9ed9ab 100644 --- a/doc/statuscodes.md +++ b/doc/statuscodes.md @@ -21,6 +21,8 @@ Only a subset of the pre-defined status codes are generated by the gRPC librarie | Flow-control protocol violation | INTERNAL | Both | | Error parsing returned status | UNKNOWN | Client | | Incorrect Auth metadata ( Credentials failed to get metadata, Incompatible credentials set on channel and call, Invalid host set in `:authority` metadata, etc.) | UNAUTHENTICATED | Both | +| Request cardinality violation (method requires exactly one request but client sent some other number of requests) | UNIMPLEMENTED | Server| +| Response cardinality violation (method requires exactly one response but server sent some other number of responses) | UNIMPLEMENTED | Client| | Error parsing response proto | INTERNAL | Client| | Error parsing request proto | INTERNAL | Server| From 5f8ad8954554369e262960449b204dc5b626b0f8 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 9 Jun 2016 19:22:41 +0000 Subject: [PATCH 132/175] Use == instead of is for cygrpc.OperationTypes --- src/python/grpcio/grpc/_channel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index d9eb5a4b770..7127110b09c 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -134,9 +134,9 @@ def _handle_event(event, state, response_deserializer): for batch_operation in event.batch_operations: operation_type = batch_operation.type state.due.remove(operation_type) - if operation_type is cygrpc.OperationType.receive_initial_metadata: + if operation_type == cygrpc.OperationType.receive_initial_metadata: state.initial_metadata = batch_operation.received_metadata - elif operation_type is cygrpc.OperationType.receive_message: + elif operation_type == cygrpc.OperationType.receive_message: serialized_response = batch_operation.received_message.bytes() if serialized_response is not None: response = _common.deserialize( @@ -146,7 +146,7 @@ def _handle_event(event, state, response_deserializer): _abort(state, grpc.StatusCode.INTERNAL, details) else: state.response = response - elif operation_type is cygrpc.OperationType.receive_status_on_client: + elif operation_type == cygrpc.OperationType.receive_status_on_client: state.trailing_metadata = batch_operation.received_metadata if state.code is None: code = _common.CYGRPC_STATUS_CODE_TO_STATUS_CODE.get( From 857495ae449a3c528978047e716341e9e316d64b Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Thu, 9 Jun 2016 14:25:31 -0700 Subject: [PATCH 133/175] fix for #6834 Removed constants kPackageName and kServiceName so multiple services can be defined in one proto. --- src/compiler/objective_c_generator.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 71a674174d7..6e14d2446f9 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -220,18 +220,13 @@ void PrintMethodImplementations(Printer *printer, {"service_class", ServiceClassName(service)}, {"package", service->file()->package()}}; - printer.Print(vars, - "static NSString *const kPackageName = @\"$package$\";\n"); - printer.Print( - vars, "static NSString *const kServiceName = @\"$service_name$\";\n\n"); - printer.Print(vars, "@implementation $service_class$\n\n"); printer.Print("// Designated initializer\n"); printer.Print("- (instancetype)initWithHost:(NSString *)host {\n"); - printer.Print( + printer.Print(vars, " return (self = [super initWithHost:host" - " packageName:kPackageName serviceName:kServiceName]);\n"); + " packageName:@\"$package$\" serviceName:@\"$service_name$\"]);\n"); printer.Print("}\n\n"); printer.Print( "// Override superclass initializer to disallow different" From 0aa822b20f1c99acdba62e1c3d570a67d6f783a9 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 9 Jun 2016 17:23:38 -0700 Subject: [PATCH 134/175] minor fixes --- doc/command_line_tool.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/command_line_tool.md b/doc/command_line_tool.md index eff101b2d4e..89a70548b8b 100644 --- a/doc/command_line_tool.md +++ b/doc/command_line_tool.md @@ -8,7 +8,7 @@ tools written in other languages to roughly follow the same syntax and flags. At this point, the tool needs to be built from source, and it should be moved out to grpc-tools repository as a stand alone application once it is mature enough. -## Core funcitonality +## Core functionality The command line tool can do the following things: @@ -30,10 +30,10 @@ The command line tool should support the following things: ## Code location -To use the tool, you need to get the grpc repository and in the grpc directory call +To use the tool, you need to get the grpc repository and in the grpc directory execute ``` -make grpc_cli +$ make grpc_cli ``` The main file can be found at @@ -46,7 +46,7 @@ https://github.com/grpc/grpc/blob/master/test/cpp/util/grpc_cli.cc Send a rpc to a helloworld server at `localhost:50051`: ``` -bins/opt/grpc_cli call localhost:50051 SayHello examples/protos/helloworld.proto \ +$ bins/opt/grpc_cli call localhost:50051 SayHello examples/protos/helloworld.proto \ "name: 'world'" --enable_ssl=false ``` @@ -71,7 +71,7 @@ For using gRPC with protocols other than probobuf, you will need the exact metho and a file containing the raw bytes to be sent on the wire ``` -bins/opt/grpc_cli call localhost:50051 /helloworld.Greeter/SayHello --input_binary_file=input.bin \ +$ bins/opt/grpc_cli call localhost:50051 /helloworld.Greeter/SayHello --input_binary_file=input.bin \ --output_binary_file=output.bin ``` On success, you will need to read or decode the response from the `output.bin` file. From 41c7d01feac733622a592f854ed8af59a28a9849 Mon Sep 17 00:00:00 2001 From: vjpai Date: Fri, 10 Jun 2016 00:24:42 -0700 Subject: [PATCH 135/175] First draft of C++ style guide, minor changes to C --- doc/c-style-guide.md | 2 +- doc/cpp-style-guide.md | 78 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 doc/cpp-style-guide.md diff --git a/doc/c-style-guide.md b/doc/c-style-guide.md index 87de8892ddd..d6f9bbd7d4a 100644 --- a/doc/c-style-guide.md +++ b/doc/c-style-guide.md @@ -11,7 +11,7 @@ General - Layout rules are defined by clang-format, and all code should be passed through clang-format. A (docker-based) script to do so is included in - tools/distrib/clang_format_code.sh. + [tools/distrib/clang\_format\_code.sh] (../tools/distrib/clang_format_code.sh). Header Files ------------ diff --git a/doc/cpp-style-guide.md b/doc/cpp-style-guide.md new file mode 100644 index 00000000000..c16f6ffc42d --- /dev/null +++ b/doc/cpp-style-guide.md @@ -0,0 +1,78 @@ +GRPC C++ STYLE GUIDE +===================== + +Background +---------- + +Here we document style rules for C++ usage in the gRPC C++ bindings +and tests. + +General +------- + +- The majority of gRPC's C++ requirements are drawn from the [Google C++ style +guide] (https://google.github.io/styleguide/cppguide.html) + - However, gRPC has some additional requirements to maintain + [portability] (#portability) +- As in C, layout rules are defined by clang-format, and all code +should be passed through clang-format. A (docker-based) script to do +so is included in [tools/distrib/clang\_format\_code.sh] +(../tools/distrib/clang_format_code.sh). + + +Portability Restrictions +------------------- + +gRPC supports a large number of compilers, ranging from those that are +missing many key C++11 features to those that have quite detailed +analysis. As a result, gRPC compiles with a high level of warnings and +treat all warnings as errors. gRPC also forbids the use of some common +C++11 constructs. Here are some guidelines, to be extended as needed: +- Do not use range-based for. Expressions of the form + ```c + for (auto& i: vec) { + // code + } + ``` + are not allowed and should be replaced with code such as + ```c + for (auto it = vec.begin; it != vec.end(); it++) { + auto& i = *it; + // code + } + ``` +- Do not use lambda of any kind (no capture, explicit capture, or +default capture). Other C++ functional features such as +`std::function` or `std::bind` are allowed +- Do not use brace-list initializers. +- Do not compare a pointer to `nullptr` . This is because gcc 4.4 + does not support `nullptr` directly and gRPC implements a subset of + its features in [include/grpc++/impl/codegen/config.h] + (../include/grpc++/impl/codegen/config.h). Instead, pointers should + be checked for validity using their implicit conversion to `bool`. + In other words, use `if (p)` rather than `if (p != nullptr)` +- Do not use `final` or `override` as these are not supported by some + compilers. Instead use `GRPC_FINAL` and `GRPC_OVERRIDE` . These + compile down to the traditional C++ forms for compilers that support + them but are just elided if the compiler does not support those features. +- In the [include] (../../../tree/master/include/grpc++) and [src] + (../../../tree/master/src/cpp) directory trees, you should also not + use certain STL objects like `std::mutex`, `std::lock_guard`, + `std::unique_lock`, `std::nullptr`, `std::thread` . Instead, use + `grpc::mutex`, `grpc::lock_guard`, etc., which are gRPC + implementations of the prominent features of these objects that are + not always available. You can use the `std` versions of those in +- Similarly, in the same directories, do not use `std::chrono` unless + it is guarded by `#ifndef GRPC_CXX0X_NO_CHRONO` . For platforms that + lack`std::chrono,` there is a C-language timer called gpr_timespec that can + be used instead. +- `std::unique_ptr` must be used with extreme care in any kind of + collection. For example `vector` does not work in + gcc 4.4 if the vector is constructed to its full size at + initialization but does work if elements are added to the vector + using functions like `push_back`. `map` and other pair-based + collections do not work with `unique_ptr` under gcc 4.4. The issue + is that many of these collection implementations assume a copy + constructor + to be available. + From 967e378f197604f67cd48ddba259c191992ea6b0 Mon Sep 17 00:00:00 2001 From: vjpai Date: Fri, 10 Jun 2016 00:29:03 -0700 Subject: [PATCH 136/175] More docs --- doc/cpp-style-guide.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/cpp-style-guide.md b/doc/cpp-style-guide.md index c16f6ffc42d..5feefae06a2 100644 --- a/doc/cpp-style-guide.md +++ b/doc/cpp-style-guide.md @@ -34,6 +34,7 @@ C++11 constructs. Here are some guidelines, to be extended as needed: // code } ``` + are not allowed and should be replaced with code such as ```c for (auto it = vec.begin; it != vec.end(); it++) { @@ -41,6 +42,7 @@ C++11 constructs. Here are some guidelines, to be extended as needed: // code } ``` + - Do not use lambda of any kind (no capture, explicit capture, or default capture). Other C++ functional features such as `std::function` or `std::bind` are allowed From e4e865f0c08485d26562f91071169880b0feab4f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 10 Jun 2016 00:29:59 -0700 Subject: [PATCH 137/175] Fix fuzzing detected bug --- src/core/ext/load_reporting/load_reporting.c | 3 +- .../0e79b68aa8b9c336f0bbf9029928c53079711423 | Bin 0 -> 523 bytes .../1560af88445d6c1e8b1300047f33056dce198e02 | Bin 0 -> 405 bytes .../48caf755ddcc6c45d3416ba6ab44709f360eb82b | Bin 0 -> 142 bytes .../7030cb2c62b289459e459bc54bd84c8d7e6f5a98 | Bin 0 -> 564 bytes .../81f8c545d77d93e6cb8239e9e4a4d7f8f8beeee9 | Bin 0 -> 853 bytes .../b7d02f4d12cd0b5442a04675e69f98fbdabc775a | Bin 0 -> 251 bytes .../ce6a90cb7d395fea7aa54ee9f7061cc45f5494d7 | Bin 0 -> 560 bytes ...h-482e9bdce0e13df2a77eef75a1c07d38ee28f4ab | Bin 0 -> 232 bytes .../e94428d78182060ff6309dd626cf6b3ebeed88d6 | Bin 0 -> 550 bytes tools/run_tests/tests.json | 153 ++++++++++++++++++ 11 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/0e79b68aa8b9c336f0bbf9029928c53079711423 create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/1560af88445d6c1e8b1300047f33056dce198e02 create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/48caf755ddcc6c45d3416ba6ab44709f360eb82b create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/7030cb2c62b289459e459bc54bd84c8d7e6f5a98 create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/81f8c545d77d93e6cb8239e9e4a4d7f8f8beeee9 create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/b7d02f4d12cd0b5442a04675e69f98fbdabc775a create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/ce6a90cb7d395fea7aa54ee9f7061cc45f5494d7 create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/crash-482e9bdce0e13df2a77eef75a1c07d38ee28f4ab create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/e94428d78182060ff6309dd626cf6b3ebeed88d6 diff --git a/src/core/ext/load_reporting/load_reporting.c b/src/core/ext/load_reporting/load_reporting.c index 60082dbaaae..9e4d32676fc 100644 --- a/src/core/ext/load_reporting/load_reporting.c +++ b/src/core/ext/load_reporting/load_reporting.c @@ -76,7 +76,8 @@ static bool is_load_reporting_enabled(const grpc_channel_args *a) { if (a == NULL) return false; for (size_t i = 0; i < a->num_args; i++) { if (0 == strcmp(a->args[i].key, GRPC_ARG_ENABLE_LOAD_REPORTING)) { - return a->args[i].value.pointer.p != NULL; + return a->args[i].type == GRPC_ARG_POINTER && + a->args[i].value.pointer.p != NULL; } } return false; diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/0e79b68aa8b9c336f0bbf9029928c53079711423 b/test/core/end2end/fuzzers/api_fuzzer_corpus/0e79b68aa8b9c336f0bbf9029928c53079711423 new file mode 100644 index 0000000000000000000000000000000000000000..5b16d9d759a7a585141dedf8a7a2e125df2be281 GIT binary patch literal 523 zcmZuuu}T9$5PiGEWiQH+QmmqZV1lL)w1~)ozaWTUah%DZ!5HJ*1O+*s$tU8qeDwU^FW(w76{C* z!+_iiry7c(jU>Wp(I+1-5@8>2ww;{syA(3tv@HD;0OD1s?QRtDR)6s_FM-md*^no#t zY7W(1(xM}C^ePKZpwhs}3QnS3Ei;Xxj%BQ91E~3+I3CIXKBpucMOPGF%Qx|$KLKje z)teT11)lZ((u_i=q^g7KNCmUvc3wPcdQOx>zv93+U1PAO-iwH`P zr8ArcZMXKss;EuHuDM&KS^8Zx!%<@)XcpwVN6mYgV{&*Us)=S`)l-*k=8K_w0%j=} OIXIun1~Y}O1-<~7>5*vw literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/1560af88445d6c1e8b1300047f33056dce198e02 b/test/core/end2end/fuzzers/api_fuzzer_corpus/1560af88445d6c1e8b1300047f33056dce198e02 new file mode 100644 index 0000000000000000000000000000000000000000..008dcac29ab7ef5256d670e4bd87d8f62a02fb39 GIT binary patch literal 405 zcmXX?u};H441IShr%Qo~nJE<#&$vtz7`liYkWK$hKkN{`TKV zRC|SX8;~s{_QKY-$sfi1OjI^}PkYO-JY^34$0<;i@H7U8wZ;X53Jml~m$(4*a6HYE I*%%&{|2JKGQvd(} literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/48caf755ddcc6c45d3416ba6ab44709f360eb82b b/test/core/end2end/fuzzers/api_fuzzer_corpus/48caf755ddcc6c45d3416ba6ab44709f360eb82b new file mode 100644 index 0000000000000000000000000000000000000000..f29e9a7983b7dfec60bd5f39faa2098a6df7e798 GIT binary patch literal 142 zcmW;E!3n}Z5Czaba~Q^mslk)cOTY>&!V<#ZO=K3c4J-(jU=L}+QWmUZ9r92A@c(1! zvR!=Ueh)!2jS6zG{CqY)o`pzqb cNM|j)GeAKxw!1^rvS355sD%)|#!f%LA9ZOXlmGw# literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/7030cb2c62b289459e459bc54bd84c8d7e6f5a98 b/test/core/end2end/fuzzers/api_fuzzer_corpus/7030cb2c62b289459e459bc54bd84c8d7e6f5a98 new file mode 100644 index 0000000000000000000000000000000000000000..035f23e8997040ba16d2c00fd695843087186f9f GIT binary patch literal 564 zcmZ`$u}T9$5PiGovKQsB6sxEZ%%Ld+n}{6v3xWt1$C(Uz7?U`6xqz)H#Luw5$|jwS zzhRR`tt|Y2buLj+&}EC+o%d$uz0oOgP7Ld`HbbAR<$NP}t7w?~_+Z~sSliR4G7JUg zS7AWziE|Cb&_)8`)ajiMC2(@&Ar%fc0w;Htl;>ygodAfJp|(!B-)fv?S%15cbdxNJ zJ5frP1M0RY>JBbWWUk#%n)qb_vRwB6!8z;4t@9|0PdXH($rZJ!)oTl%&;DI<-$Di*M)4WOot(q2az@F`_cH@={#Cth*V z9so;H)f-KUIe6Cl761JUCEz-&!kiTUB5I>oX}o^4W>zljA6vzK}YES2YqK=5Ep&}&_7y%NMijWasA)-QJu-xRSwMf(O>^KrDmWq)0 z8f>0evUTBWuy_H)$iTpGJlknS+e}y<-r4Wnz5D&1PKYyNSf{m_x5--0?(|(t!(^`p z&n*Srr`ojUfuyxJVLmj>cg^Z)P+ZQaG6%?cZilAP2OYwzxX`yyl^QIE{v{!!+6-Q<%hWX+*>0k=(=A zhLX=DMP#!N&lvU7Dxh}Pb=&mjj=sqiXHZ$-)+e=osEp8jE=SBW$tLQKxvmrUvvDr+sx#VajW z5&Pn%W?XcBZY$1#6F3X?@r6u7U*FG5?VKI_p8>$pR>N}<6gz`Y?*)@V0Z+QGrmzcj zy34j+JeKT#jjcD9S3q7eZBW@uOwW=2Ib&LnZN*ubI0@?gQijZ0s86;p98I!lzF9?2$uvPvbUHY_X zwn>psknl23GSl3Fd(WNg)wHZC-hg&2o&_$Dtux0?{4~Gl2`yYPuxVYen6+$Iv#mTm zm$F~JYGzrkxq5-8Yy=Aq;t57THqwSLo&AhJb_%@717PBza8e={YX1*@scgqT=Ds;l za3>G*{-~s!=1muZdzg{s-5ZZ>)3r5!_~V`6GHDCLzh}zqZGvyjAx}em0o@2!=u;AH O33{%l?Yc0ENbm=U!$aNx literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/ce6a90cb7d395fea7aa54ee9f7061cc45f5494d7 b/test/core/end2end/fuzzers/api_fuzzer_corpus/ce6a90cb7d395fea7aa54ee9f7061cc45f5494d7 new file mode 100644 index 0000000000000000000000000000000000000000..c5c9c27938380110a5f3cd2ea7b65081d71fe631 GIT binary patch literal 560 zcmZuuJ!>055PiEi%bsiwl_r&JgOG%+!eAE);UIs(U<@gavou&D`tscA4$|fdE#-tmVAZ``gek`PYjtmZJ7& zZ5l-+Wnl{jA%qw4IUeJ68Fg}_&}(T=Qo7_cou nG4x!DS<-a{u1eWpqt;qsU;!_=5t(Efd0jkRVa}4OO9lJ~aGIO* literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/crash-482e9bdce0e13df2a77eef75a1c07d38ee28f4ab b/test/core/end2end/fuzzers/api_fuzzer_corpus/crash-482e9bdce0e13df2a77eef75a1c07d38ee28f4ab new file mode 100644 index 0000000000000000000000000000000000000000..b83e382f18c755967e343e96db1cac2b99f4ba4a GIT binary patch literal 232 zcmXAjF-k*G5Jm3{pU2Bjd|;O{Hln|XosCG`frVrNAr4UpKVg!*w}B6WOA&sR9b^r* zHoviO4dFS)JIyWbxpU9wFSELqC3quxD+-_4rD^cuHC|Pj;Ziu0$>lw}GEGDyhY=hk zlUb00okr0isJr_#G>HEv0b1yKK3=Y7&noMcZeQ!giTpCMz4)QW<_+0@M9^VsO%>lX zUC#b#%uY6YVb^qR5+C0m6epD}NRF9kH$oo+F8-1QdcJ1^>_FC1 F;1_CjKkNVi literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/e94428d78182060ff6309dd626cf6b3ebeed88d6 b/test/core/end2end/fuzzers/api_fuzzer_corpus/e94428d78182060ff6309dd626cf6b3ebeed88d6 new file mode 100644 index 0000000000000000000000000000000000000000..570de0eef1aed67f31e64c06e9d740b9af4cd172 GIT binary patch literal 550 zcmZuuJ!>056r5eGWluJT%aBU4L0G~T*kBh5;eJFw1Y8_v=^+VAXZhV1aT^sT|K+MQ z>eS?Kq`4+><-$K;{d6*cfR`<1ci+4>v!fH@oEX+=Z3>^P<@}`g+|)4n^)yYF=lHBm zvk0WjZ^3}vZ_YIoLmL6Y>Cy`icR<*~lb)0Pc9w_2H(g8r9suGGP-hcfrlbD!BJD3{ z@hpwzVM6yA#Ul#iY;hx!D3JdCP8GMHArxV3HT9>r9@GS*b(uajvmEdwE=GF=W3%mjhC!7)h literal 0 HcmV?d00001 diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 6624e399d49..07ab7d6f90f 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -27495,6 +27495,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/0e79b68aa8b9c336f0bbf9029928c53079711423" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/0ea509d249ae28faba8980aacb972c7ea28d3fd5" @@ -27954,6 +27971,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/1560af88445d6c1e8b1300047f33056dce198e02" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/157586c7c0ba8fd0dc9bfc2426229a7da934cec2" @@ -31915,6 +31949,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/48caf755ddcc6c45d3416ba6ab44709f360eb82b" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/48f56289592da153b3c50bcc26ad6d4d3a7e443b" @@ -34737,6 +34788,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/7030cb2c62b289459e459bc54bd84c8d7e6f5a98" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/705c87b99197c87eb2ed148f8b3fdc60f8616f15" @@ -36063,6 +36131,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/81f8c545d77d93e6cb8239e9e4a4d7f8f8beeee9" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/820d5ba2e9d91563dae39a1b02833fbef1e6d8f1" @@ -39684,6 +39769,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/b7d02f4d12cd0b5442a04675e69f98fbdabc775a" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/b7f282fbd77193d822df9c8156370398e1fd099c" @@ -41554,6 +41656,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/ce6a90cb7d395fea7aa54ee9f7061cc45f5494d7" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/ceecce905981d8291a79fe32f89e8be688dfee7e" @@ -41724,6 +41843,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/crash-482e9bdce0e13df2a77eef75a1c07d38ee28f4ab" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/crash-4ae4941b4c3f857966a0e3c05f789a0a5ae15bbf" @@ -44121,6 +44257,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/api_fuzzer_corpus/e94428d78182060ff6309dd626cf6b3ebeed88d6" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "api_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/api_fuzzer_corpus/ea2cf809383d8725bec1b44ab774f04b3e6d5ae5" From 3a6385b53e4a5f9f123fc067dd136db8dc27951a Mon Sep 17 00:00:00 2001 From: vjpai Date: Fri, 10 Jun 2016 00:37:11 -0700 Subject: [PATCH 138/175] Add ref to test --- doc/cpp-style-guide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/cpp-style-guide.md b/doc/cpp-style-guide.md index 5feefae06a2..b89ba99e4d7 100644 --- a/doc/cpp-style-guide.md +++ b/doc/cpp-style-guide.md @@ -63,7 +63,8 @@ default capture). Other C++ functional features such as `std::unique_lock`, `std::nullptr`, `std::thread` . Instead, use `grpc::mutex`, `grpc::lock_guard`, etc., which are gRPC implementations of the prominent features of these objects that are - not always available. You can use the `std` versions of those in + not always available. You can use the `std` versions of those in [test] + (../../../tree/master/test/cpp) - Similarly, in the same directories, do not use `std::chrono` unless it is guarded by `#ifndef GRPC_CXX0X_NO_CHRONO` . For platforms that lack`std::chrono,` there is a C-language timer called gpr_timespec that can From bd67b559f50639a5ad8152c591fac945e8a843f1 Mon Sep 17 00:00:00 2001 From: vjpai Date: Fri, 10 Jun 2016 01:58:12 -0700 Subject: [PATCH 139/175] this_thread --- doc/cpp-style-guide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/cpp-style-guide.md b/doc/cpp-style-guide.md index b89ba99e4d7..271ff3984c3 100644 --- a/doc/cpp-style-guide.md +++ b/doc/cpp-style-guide.md @@ -78,4 +78,5 @@ default capture). Other C++ functional features such as is that many of these collection implementations assume a copy constructor to be available. - +- Don't use `std::this_thread` . Use `gpr_sleep_until` for sleeping a thread. + From 8da8511762f9b59d4715abf4861a4578e04530cd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 10 Jun 2016 09:13:10 -0700 Subject: [PATCH 140/175] Expand corpus, make one-shot runners not self-check leaks (to give ASAN a chance) --- test/core/client_config/uri_fuzzer_test.c | 4 + test/core/end2end/fuzzers/api_fuzzer.c | 3 +- test/core/end2end/fuzzers/client_fuzzer.c | 13 +- test/core/end2end/fuzzers/server_fuzzer.c | 13 +- .../05551028437699c8650f5d08eb5f95ee25adf436 | Bin 0 -> 49 bytes .../06285b50669cc16463db009ac821f99cf1ec2e24 | Bin 0 -> 650 bytes .../23c582f6e23c7bbc9ae7b039b3b4e2ccdea3d5d2 | Bin 0 -> 1106 bytes .../395aea4fcfea081fc0d2733fff2d14405439fa72 | Bin 0 -> 2047 bytes .../404e234751b01dd0b51f9e7610f787253b074528 | Bin 0 -> 650 bytes .../4123bd764c04385191342ea64918408140313714 | Bin 0 -> 47 bytes .../4f96a5fba4d11401eb22d4b1e365fbbb2d684f24 | Bin 0 -> 315 bytes .../609706c57e848ea58d7ca14fe6cc253322f3e8ce | Bin 0 -> 59 bytes .../89cd90fb47bb9eb289e8126b26021ee00d572d95 | Bin 0 -> 48 bytes .../99a1acc96512c1155f91afa378e2345726d307c3 | Bin 0 -> 660 bytes ...h-ccf36bef9318fe6d5e5e1560c5485cdc87d0a701 | Bin 0 -> 104 bytes .../ec4949487fa84f0cead39521b51f837af9dc784a | Bin 0 -> 46 bytes ...t-0292270056246b7a4ccd2e7d0356665cef307ef2 | Bin 0 -> 2046 bytes ...t-098ec93ded3a20e6043d11e9cc6066351e257f8e | Bin 0 -> 2047 bytes ...t-1dc659f500e7bee41a4fee4423ade8332c162cc0 | Bin 0 -> 2046 bytes ...t-350b5da741597222c98fe86768432507850317f5 | Bin 0 -> 2047 bytes ...t-395aea4fcfea081fc0d2733fff2d14405439fa72 | Bin 0 -> 2047 bytes ...t-45cf8ac5faa9c7b15baf9281e8d7e0b4e103f0e0 | Bin 0 -> 2046 bytes ...t-60a9f77951c5059616764894e1963d83d478edfe | Bin 0 -> 2047 bytes ...t-97a338fa892093ed5013a76b96b35dd112df3342 | Bin 0 -> 2047 bytes ...t-a1b2cfcf0997acb13a32fc5c004f57d9e9bc4275 | Bin 0 -> 2047 bytes ...t-a1ed26e6f82ca0e81e3f415bd8b0b8b520d3927b | Bin 0 -> 2046 bytes ...t-f412afea6b01aa53da919a41a65ffbf9885f2d65 | Bin 0 -> 2047 bytes test/core/http/fuzzer.c | 4 + test/core/json/fuzzer.c | 4 + test/core/nanopb/fuzzer_response.c | 3 + test/core/nanopb/fuzzer_serverlist.c | 3 + .../chttp2/hpack_parser_fuzzer_test.c | 5 +- test/core/util/one_corpus_entry_fuzzer.c | 7 + tools/run_tests/tests.json | 391 ++++++++++++++++++ 34 files changed, 438 insertions(+), 12 deletions(-) create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/05551028437699c8650f5d08eb5f95ee25adf436 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/06285b50669cc16463db009ac821f99cf1ec2e24 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/23c582f6e23c7bbc9ae7b039b3b4e2ccdea3d5d2 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/395aea4fcfea081fc0d2733fff2d14405439fa72 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/404e234751b01dd0b51f9e7610f787253b074528 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/4123bd764c04385191342ea64918408140313714 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/4f96a5fba4d11401eb22d4b1e365fbbb2d684f24 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/609706c57e848ea58d7ca14fe6cc253322f3e8ce create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/89cd90fb47bb9eb289e8126b26021ee00d572d95 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/99a1acc96512c1155f91afa378e2345726d307c3 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/crash-ccf36bef9318fe6d5e5e1560c5485cdc87d0a701 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/ec4949487fa84f0cead39521b51f837af9dc784a create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-0292270056246b7a4ccd2e7d0356665cef307ef2 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-098ec93ded3a20e6043d11e9cc6066351e257f8e create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-1dc659f500e7bee41a4fee4423ade8332c162cc0 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-350b5da741597222c98fe86768432507850317f5 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-395aea4fcfea081fc0d2733fff2d14405439fa72 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-45cf8ac5faa9c7b15baf9281e8d7e0b4e103f0e0 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-60a9f77951c5059616764894e1963d83d478edfe create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-97a338fa892093ed5013a76b96b35dd112df3342 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1b2cfcf0997acb13a32fc5c004f57d9e9bc4275 create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1ed26e6f82ca0e81e3f415bd8b0b8b520d3927b create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-f412afea6b01aa53da919a41a65ffbf9885f2d65 diff --git a/test/core/client_config/uri_fuzzer_test.c b/test/core/client_config/uri_fuzzer_test.c index eb976fc9f53..f297140559c 100644 --- a/test/core/client_config/uri_fuzzer_test.c +++ b/test/core/client_config/uri_fuzzer_test.c @@ -31,6 +31,7 @@ * */ +#include #include #include @@ -38,6 +39,9 @@ #include "src/core/ext/client_config/uri_parser.h" +bool squelch = true; +bool leak_check = true; + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char *s = gpr_malloc(size + 1); memcpy(s, data, size); diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 3cae0bd7782..dd93c4a817f 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -50,7 +50,8 @@ //////////////////////////////////////////////////////////////////////////////// // logging -static const bool squelch = true; +bool squelch = true; +bool leak_check = true; static void dont_log(gpr_log_func_args *args) {} diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c index 5612b6621a5..79b23d78569 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.c @@ -41,7 +41,8 @@ #include "test/core/util/memory_counters.h" #include "test/core/util/mock_endpoint.h" -static const bool squelch = true; +bool squelch = true; +bool leak_check = true; static void discard_write(gpr_slice slice) {} @@ -53,7 +54,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_metadata_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); - grpc_memory_counters_init(); + if (leak_check) grpc_memory_counters_init(); grpc_init(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -156,8 +157,10 @@ done: grpc_byte_buffer_destroy(response_payload_recv); } grpc_shutdown(); - counters = grpc_memory_counters_snapshot(); - grpc_memory_counters_destroy(); - GPR_ASSERT(counters.total_size_relative == 0); + if (leak_check) { + counters = grpc_memory_counters_snapshot(); + grpc_memory_counters_destroy(); + GPR_ASSERT(counters.total_size_relative == 0); + } return 0; } diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 0a7d6d92aac..80f568ac927 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -38,7 +38,8 @@ #include "test/core/util/memory_counters.h" #include "test/core/util/mock_endpoint.h" -static const bool squelch = true; +bool squelch = true; +bool leak_check = true; static void discard_write(gpr_slice slice) {} @@ -51,7 +52,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_metadata_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); - grpc_memory_counters_init(); + if (leak_check) grpc_memory_counters_init(); grpc_init(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -120,8 +121,10 @@ done: grpc_server_destroy(server); grpc_completion_queue_destroy(cq); grpc_shutdown(); - counters = grpc_memory_counters_snapshot(); - grpc_memory_counters_destroy(); - GPR_ASSERT(counters.total_size_relative == 0); + if (leak_check) { + counters = grpc_memory_counters_snapshot(); + grpc_memory_counters_destroy(); + GPR_ASSERT(counters.total_size_relative == 0); + } return 0; } diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/05551028437699c8650f5d08eb5f95ee25adf436 b/test/core/end2end/fuzzers/server_fuzzer_corpus/05551028437699c8650f5d08eb5f95ee25adf436 new file mode 100644 index 0000000000000000000000000000000000000000..c61aff87e99b3377985e44b628e217e4a10f6a43 GIT binary patch literal 49 vcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6d=<5ybl600ImE%)bbc literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/06285b50669cc16463db009ac821f99cf1ec2e24 b/test/core/end2end/fuzzers/server_fuzzer_corpus/06285b50669cc16463db009ac821f99cf1ec2e24 new file mode 100644 index 0000000000000000000000000000000000000000..d480552344b12045ec680b47c6644de0bd97e653 GIT binary patch literal 650 zcmbtSO-sZu5KWhgwYrdl-isGM*lt&kz35R7VsZNivT3#nWRuX&f))Rq|H9ic1uc^>p0*wF&C zo#%8xs+3A$*^{1!X0z#)6=OO}&ZSW6=L>YRaY_Wv`Ih_8qK_~8cJYtIVgIfc2&~(H s`b1|Q^p%JP&0agNW&nR$W5{(2!vc3H@NUAxzpHTD*Ym9Z7H?XiPtP}lVgLXD literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/23c582f6e23c7bbc9ae7b039b3b4e2ccdea3d5d2 b/test/core/end2end/fuzzers/server_fuzzer_corpus/23c582f6e23c7bbc9ae7b039b3b4e2ccdea3d5d2 new file mode 100644 index 0000000000000000000000000000000000000000..20b4cf800c7c378771c760e6973b5e80811efc6e GIT binary patch literal 1106 zcmbVLO;3X`7%m&?hA!ctcj8HxF__+V*;Nll;`Rr+(m|7sHt>>c{ycw-zhFlXwk%G@ zzEBe0w9VTG-sdBDdv?0c(_|8O4}HI5b*%A=t_UGhz54ku^vbZ$h7v>E@@7JKQ=Hlt z!;HjqPR$rVs@u{aaN~#GG3DVI% Jd$m>=6@1%?FHGSYfD$NdCapxh9re+j1@v<+n57oR*w^L4b2s@;f;vCyZF4GYF9;5UT@>Q>pom~0P@-xj^-@Q7hY zWPNu;>P!=sUscVc0tVkXNvAty1gOsR#P5aCgqjjMS>#}?k^)E?owd#i{xD(!LZGDt zwJ?p;?PG%n1%zAK_({KS+x|++uLxJ?mbt22tS1&Ei u<7XxH@Uvm>f0M9aLa%R$GaR@+gS${K=0J6^%gf>UI8e;zmF1H;I`9v!s!HJi literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/404e234751b01dd0b51f9e7610f787253b074528 b/test/core/end2end/fuzzers/server_fuzzer_corpus/404e234751b01dd0b51f9e7610f787253b074528 new file mode 100644 index 0000000000000000000000000000000000000000..56a2f93726c5ca957aba30586b4b2ca9d9ccf849 GIT binary patch literal 650 zcmbtSO-lnY5KYR8Yjq(9y)Rz;pu1Z=?nRG!5Et7&kY>|OAWgz%3Re7c{wI$G&2H@> z6;W^?!@SANBl9NJ(|vlG-c6@fah;EoVKSUNbRHoT`QvSXa2H{+S6T`pF6PD*Guo2< z(lNmoJQ4ubqXh?H>Zp30Ov$jMOOIL!s{>^iRibe~j+oKFHDs`|oKS0(WE7;)MblbF zjys=G#<+!yYi4Sxo0FQ)6$L($weR$Nqo$OW41mYbQmJ_BP|`PUJEG=A+Mnk^@7Rxq z(RQBG8Lcy>q-Rfi9#)L=D=$VqPS2Ip%jXMpv+k6@oeQlDp+_HI_U+;yiNpR~4k#=g tW+Bm807E6>jb^W_pk@R9w8lsn2b%@%Qjpz5fPYuvwyzgO|1I8(MxR-?gCYO` literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/4123bd764c04385191342ea64918408140313714 b/test/core/end2end/fuzzers/server_fuzzer_corpus/4123bd764c04385191342ea64918408140313714 new file mode 100644 index 0000000000000000000000000000000000000000..18d908f6ab36746b4f3e637d6a5ca9832de32fd9 GIT binary patch literal 47 xcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6dOF z^~jpKym{GtP1DrMTvOmvOA2g4a;C^JI<9#1cnRKHqniJ}0~>Pn`{30zYZI#IA7D)< z&(o{|b+%Y2bYT~&H{)O!A7dGBI^0_L^ZZ4UBQiPL@3ZOmVt?c!?YOveOA6SPDhP3) MAN|q~j0aJE0}U2X1ONa4 literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/609706c57e848ea58d7ca14fe6cc253322f3e8ce b/test/core/end2end/fuzzers/server_fuzzer_corpus/609706c57e848ea58d7ca14fe6cc253322f3e8ce new file mode 100644 index 0000000000000000000000000000000000000000..1ac7cc9036dda75c98f351ef894bc4cea0682f36 GIT binary patch literal 59 wcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k`KnwI}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6dq47EfW%~qfza^Cam;??BqP;J@BIiq?_kv z{Zb@c3NMb^26#H1-1}urrtwG$RlnYnhmUp@L5u$jy&uY7w0${bSUc~;tfTZTY%I8{ t%a8A{RdhQXbh|qe4$(I}L@CXSB&^OXE;N{}w3ibt&3=9k%Dpo*}fkA?uk%i&80^|Px6tyDhMFq*a hj6ekij7F(>$@wXndFdQLr3@f32FCvlaKO;O001Bt7aRZp literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/ec4949487fa84f0cead39521b51f837af9dc784a b/test/core/end2end/fuzzers/server_fuzzer_corpus/ec4949487fa84f0cead39521b51f837af9dc784a new file mode 100644 index 0000000000000000000000000000000000000000..e6ea5327d88cb2bb310d7d65efb5fe37d6a874d6 GIT binary patch literal 46 vcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=9k%EI@*RL6d* z6g4-k)ZJZ+I|YOr+4@a?Z_|BA%gzWFSNb*^ZVyqfa{Tto$g8UD^HU3O#06p_yL8iP$U2V literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-098ec93ded3a20e6043d11e9cc6066351e257f8e b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-098ec93ded3a20e6043d11e9cc6066351e257f8e new file mode 100644 index 0000000000000000000000000000000000000000..b8fa2c077eda26ab17ee584145d8954ab121ea05 GIT binary patch literal 2047 zcmeHDu};G<5KSP65>d$m>=6@1O&l1ru)=_dNPghzToX&KZ8;Z-^6d;bSvz&19deSN z?oQ8l_g?w+o;)RQbzSn8EMLaUxcV3|2!hBzAFCi7vyfdC7N}eBtucH9j$IeM=x~Qo zM`V4qL+VTum7i73;sOR=IZ68)Wdx|s^u%t3(S({(+FN8`t&##r8qHg01-lzD1tHK< zidvXP>h`|DtpdWeZ2V6@Z{7Y#%Pt5P-|oRe;uq|VFv+}m zlgyjsz3S^DeNNw-rsA)8k;F+{?v9l19x>{P ztly4Ey=kNBvu;>i!ss_A>2#xv0M(m;*sU;{P*X-Hiwvw)QUFP#dFQNPcN1nH1X{{a z3)4#7-M4s9K)98ySNeb3?nhd7LAW6YQlT4IJPznG=={OM9@1jH@6THY@ytTYY pAC=VO_fzopI~xmU^pO0Mb*>34B!PM%K2{s&Bv76sUbTx);16T+N}K=y literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-350b5da741597222c98fe86768432507850317f5 b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-350b5da741597222c98fe86768432507850317f5 new file mode 100644 index 0000000000000000000000000000000000000000..4364289907f9c10ac026c3f04adb59691762ef54 GIT binary patch literal 2047 zcmeHDO;3YB5Cz3piB0yPcjC#K@}WmAUiHvOgg-D{rm)GnyIF?B`rD1T@DF+_2PT=9 zndHsKd&TE_^c1~SRgu0V**aW@^kpwi(eSD zM8WGYt)U!EIp6&8-cs>r~^Lb_YWR4E}17&ATE&u=k literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-395aea4fcfea081fc0d2733fff2d14405439fa72 b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-395aea4fcfea081fc0d2733fff2d14405439fa72 new file mode 100644 index 0000000000000000000000000000000000000000..c83226294aae3a3a076196a863137794946a94bb GIT binary patch literal 2047 zcmeHDJx{|h5OpAk5>d$m>=6@1%?FHGSYfD$NdCapxh9re+j1@v<+n57oR*w^L4b2s@;f;vCyZF4GYF9;5UT@>Q>pom~0P@-xj^-@Q7hY zWPNu;>P!=sUscVc0tVkXNvAty1gOsR#P5aCgqjjMS>#}?k^)E?owd#i{xD(!LZGDt zwJ?p;?PG%n1%zAK_({KS+x|++uLxJ?mbt22tS1&Ei u<7XxH@Uvm>f0M9aLa%R$GaR@+gS${K=0J6^%gf>UI8e;zmF1H;I`9v!s!HJi literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-45cf8ac5faa9c7b15baf9281e8d7e0b4e103f0e0 b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-45cf8ac5faa9c7b15baf9281e8d7e0b4e103f0e0 new file mode 100644 index 0000000000000000000000000000000000000000..70b2eecbd632a92d2e4a5200f08884b26370687e GIT binary patch literal 2046 zcmeHDJx{|h5Ort}C8ClC*dr#2nhzMWu)X`Ke5aqcX@8{USAdy8r+H literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-60a9f77951c5059616764894e1963d83d478edfe b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-60a9f77951c5059616764894e1963d83d478edfe new file mode 100644 index 0000000000000000000000000000000000000000..0063c63f73370676ad2b47ed594e89b4cc1c1103 GIT binary patch literal 2047 zcmeHHu};G<5KSP65>d$m>=6@1O&l1ru)=_dNPghzToX&KZ8;Z-^6d;b5kJs{swgMj z)1CBuckc}@KVFlEj*co|o3BL+bb`Sh_0!m$e3MPY%u1>YLOH{jT1(Tfgu z7P%1US{O~JDW$zd2G%MmfTYp9byl#O5mOKX zEv2Z1X{2s%8{8@&T+7D4^z+v3m$dARa6t~FLf5l+=+ULndcxfXnp7z1%VZiSc%D6a zX<44!E2)RiRq*^h2@5Cm`sO&mf%5~nGxcZ=R7czV?-u|56Q`)FIK`vqoBz&%AF+l? A;s5{u literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-97a338fa892093ed5013a76b96b35dd112df3342 b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-97a338fa892093ed5013a76b96b35dd112df3342 new file mode 100644 index 0000000000000000000000000000000000000000..3a231db3e4ba5d21499a8865a4045bb868a66ffa GIT binary patch literal 2047 zcmeHDO-sW-5KS~<8!YTW@4-_m&4(Uy@v4VnF!=-1%`{oq?k<}NSbv*8&4Zi#gdR%3 z49sH&=FQA|#piqU6unhdk-j9^DqMx-Za~lT0+%i}ocYn5N<{7m~P*;`4)y<5iZDrkZ3y=_8r<78aME`hdSm`xH1~o@ia@G zowOv2)>5ecYvaBCj>7yAoxXn>KWFK_K8rPzF6=;g;d}GBDLRl(@u~Tz={WEQ8Rbiz literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1b2cfcf0997acb13a32fc5c004f57d9e9bc4275 b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1b2cfcf0997acb13a32fc5c004f57d9e9bc4275 new file mode 100644 index 0000000000000000000000000000000000000000..1a213469ddaccc32277e6d2fae71aa31cf2fb699 GIT binary patch literal 2047 zcmeHDO-sW-5KU~vHdxq$-h-!Bnh!nZ;#Ch~F!=-1%`{oq?k<}NSbw_*H~9-CJ(LX0 zV+Q8Utu12?BF;Z|Kp;g*g!`Z`tF>sEC zVpLq$LN$*y9wZR%MD3XF->&%;hTRY@$%2q*I~MjG+87#l@U(|I=2EyZ8sG6WOJ1C{ yB#SmusQzc`z5R{G{1KhM>1#8+#HAD#mlB$F&Pkv=hdgtyB!T=&e9Sf`O5h*1p-Tw> literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1ed26e6f82ca0e81e3f415bd8b0b8b520d3927b b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1ed26e6f82ca0e81e3f415bd8b0b8b520d3927b new file mode 100644 index 0000000000000000000000000000000000000000..c00d51de994a53935432593d2bdda4cf96ad8ea7 GIT binary patch literal 2046 zcmeHDJx{|h5OpAk5>d$m>=6@1%?FHGSYfD$NdCapxh9re+j1@v<+n57oR*w^L4b2s@;f;vCyZF4GYF9;5UT@>Q>pom~0P@-xj^-@Q7hY zWPNu;>P!=sUscVc0tVkXNvAty1gOsR#P5aCgqjjMS>#}?k^)E?owd#i{xD(!LZGDt zwJ?p;?PG%n1%zAK_({KS+x|++uLxJ?mbt22tS1&Ei u<7XxH@Uvm>f0M9aLa%R$GaR@+gS${K=0J6^%gf>UI8e;zmF1HeI`9u;$x7h> literal 0 HcmV?d00001 diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-f412afea6b01aa53da919a41a65ffbf9885f2d65 b/test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-f412afea6b01aa53da919a41a65ffbf9885f2d65 new file mode 100644 index 0000000000000000000000000000000000000000..171446cb1e08db5709645e225a836fbe98335556 GIT binary patch literal 2047 zcmeHIu};G<5KSP65>d$m>=6@1O&l1ru)=_dNPfU|u8D;1|X$RQZCMw^nn#F|}Xz~j8SK3OUJKH0>mewE`OmXjk3Fowu0+ltq^-i*zv8F;w zaF~LTwo#_NZD6Yf!df--lK9r`w{q+ZVS!#K4Zdgb(1TA!OMttLXi}*awaG*$d7eFz zv@B2VwKBukDtP{xgoRTjeRCY(!1)2#8G1Aas-tb57oUy;#p#?fU-It`MD(A1{*Cn) D92-oN literal 0 HcmV?d00001 diff --git a/test/core/http/fuzzer.c b/test/core/http/fuzzer.c index 7e4f4eb993d..c3c634f2813 100644 --- a/test/core/http/fuzzer.c +++ b/test/core/http/fuzzer.c @@ -31,6 +31,7 @@ * */ +#include #include #include @@ -38,6 +39,9 @@ #include "src/core/lib/http/parser.h" +bool squelch = true; +bool leak_check = true; + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_http_parser parser; grpc_http_parser_init(&parser); diff --git a/test/core/json/fuzzer.c b/test/core/json/fuzzer.c index e94b41ca999..26c5c25caf1 100644 --- a/test/core/json/fuzzer.c +++ b/test/core/json/fuzzer.c @@ -31,6 +31,7 @@ * */ +#include #include #include @@ -40,6 +41,9 @@ #include "src/core/lib/json/json.h" #include "test/core/util/memory_counters.h" +bool squelch = true; +bool leak_check = true; + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char *s; struct grpc_memory_counters counters; diff --git a/test/core/nanopb/fuzzer_response.c b/test/core/nanopb/fuzzer_response.c index b4e386020a7..21a5d7b9685 100644 --- a/test/core/nanopb/fuzzer_response.c +++ b/test/core/nanopb/fuzzer_response.c @@ -38,6 +38,9 @@ #include "src/core/ext/lb_policy/grpclb/load_balancer_api.h" +bool squelch = true; +bool leak_check = true; + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size); grpc_grpclb_response *response; diff --git a/test/core/nanopb/fuzzer_serverlist.c b/test/core/nanopb/fuzzer_serverlist.c index d4ec74f0e79..df2044d9077 100644 --- a/test/core/nanopb/fuzzer_serverlist.c +++ b/test/core/nanopb/fuzzer_serverlist.c @@ -38,6 +38,9 @@ #include "src/core/ext/lb_policy/grpclb/load_balancer_api.h" +bool squelch = true; +bool leak_check = true; + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size); grpc_grpclb_serverlist *serverlist; diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c b/test/core/transport/chttp2/hpack_parser_fuzzer_test.c index e41eda8653e..1e3d2d39d88 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.c @@ -40,12 +40,15 @@ #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" +bool squelch = true; +bool leak_check = true; + static void onhdr(void *ud, grpc_mdelem *md) { GRPC_MDELEM_UNREF(md); } static void dont_log(gpr_log_func_args *args) {} int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_metadata_hash_seed(0); - gpr_set_log_function(dont_log); + if (squelch) gpr_set_log_function(dont_log); grpc_init(); grpc_chttp2_hpack_parser parser; grpc_chttp2_hpack_parser_init(&parser); diff --git a/test/core/util/one_corpus_entry_fuzzer.c b/test/core/util/one_corpus_entry_fuzzer.c index 41f9558211a..be32a8a2cf4 100644 --- a/test/core/util/one_corpus_entry_fuzzer.c +++ b/test/core/util/one_corpus_entry_fuzzer.c @@ -31,13 +31,20 @@ * */ +#include + #include #include "src/core/lib/support/load_file.h" extern int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); +extern bool squelch; +extern bool leak_check; + int main(int argc, char **argv) { int ok = 0; + squelch = false; + leak_check = false; gpr_slice buffer = gpr_load_file(argv[1], 0, &ok); GPR_ASSERT(ok); LLVMFuzzerTestOneInput(GPR_SLICE_START_PTR(buffer), GPR_SLICE_LENGTH(buffer)); diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 6624e399d49..1faf6be0388 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -72630,6 +72630,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/05551028437699c8650f5d08eb5f95ee25adf436" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/05c3a0390d0f52d241728926fa901599a47e4606" @@ -72664,6 +72681,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/06285b50669cc16463db009ac821f99cf1ec2e24" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/06bd2f82fefb9943787d63ea359f9b77072380c2" @@ -73463,6 +73497,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/23c582f6e23c7bbc9ae7b039b3b4e2ccdea3d5d2" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/23f261e44d54a2736f6e288128d98db9e5015206" @@ -74092,6 +74143,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/395aea4fcfea081fc0d2733fff2d14405439fa72" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/39ea47bb.bin" @@ -74279,6 +74347,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/404e234751b01dd0b51f9e7610f787253b074528" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/407607d2.bin" @@ -74313,6 +74398,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/4123bd764c04385191342ea64918408140313714" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/418f392319c44d06a018ce4c62569d527829177a" @@ -74670,6 +74772,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/4f96a5fba4d11401eb22d4b1e365fbbb2d684f24" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/4f97bd97ab5dc6b4c0f62f8459be8a9593dc83b3" @@ -75214,6 +75333,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/609706c57e848ea58d7ca14fe6cc253322f3e8ce" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/61e798bdd49b339983fea4ccfe18efe44afbd69b" @@ -76013,6 +76149,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/89cd90fb47bb9eb289e8126b26021ee00d572d95" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/8b186384.bin" @@ -76387,6 +76540,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/99a1acc96512c1155f91afa378e2345726d307c3" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/9a176b6f7e0dc5f681a1788d8954f76fabd08cad" @@ -77662,6 +77832,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/crash-ccf36bef9318fe6d5e5e1560c5485cdc87d0a701" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/crash-dae0f07934a527989f23f06e630710ff6ca8c809" @@ -78155,6 +78342,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/ec4949487fa84f0cead39521b51f837af9dc784a" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/ed8da77f.bin" @@ -78648,6 +78852,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-0292270056246b7a4ccd2e7d0356665cef307ef2" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-082763e16153cb6b8f3f5308cd060e822f475e5a" @@ -78665,6 +78886,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-098ec93ded3a20e6043d11e9cc6066351e257f8e" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-0aa52e00ddd54f8e129430852c2da95650c354b0" @@ -78767,6 +79005,57 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-1dc659f500e7bee41a4fee4423ade8332c162cc0" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-350b5da741597222c98fe86768432507850317f5" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-395aea4fcfea081fc0d2733fff2d14405439fa72" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-3991c873ba814d0cd03a67d25fff0c8fe8713aca" @@ -78801,6 +79090,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-45cf8ac5faa9c7b15baf9281e8d7e0b4e103f0e0" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-4c6da955e4c101b81a62b2f8e934d94a62ae534b" @@ -78852,6 +79158,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-60a9f77951c5059616764894e1963d83d478edfe" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-63ebf780ee6c2003eba622686a4bf94c503ad96e" @@ -79005,6 +79328,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-97a338fa892093ed5013a76b96b35dd112df3342" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-9a176b6f7e0dc5f681a1788d8954f76fabd08cad" @@ -79039,6 +79379,40 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1b2cfcf0997acb13a32fc5c004f57d9e9bc4275" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a1ed26e6f82ca0e81e3f415bd8b0b8b520d3927b" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-a61a28cf78149518466b87e5463ec5c771dc504e" @@ -79311,6 +79685,23 @@ ], "uses_polling": false }, + { + "args": [ + "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-f412afea6b01aa53da919a41a65ffbf9885f2d65" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "server_fuzzer_one_entry", + "platforms": [ + "linux" + ], + "uses_polling": false + }, { "args": [ "test/core/end2end/fuzzers/server_fuzzer_corpus/slow-unit-f67be653815f6c2c10eea55c8009e1167ac9c20b" From 64c0e8d4bcf5f6822cdef368ee84074c3ea234c7 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 10 Jun 2016 11:19:51 -0700 Subject: [PATCH 141/175] Add format check for gpr_log and gpr_asprintf --- include/grpc/impl/codegen/log.h | 4 ++- include/grpc/support/string_util.h | 3 +- .../ext/lb_policy/round_robin/round_robin.c | 2 +- .../ext/resolver/dns/native/dns_resolver.c | 3 +- .../chttp2/server/insecure/server_chttp2.c | 7 ++-- .../server/secure/server_secure_chttp2.c | 7 ++-- .../chttp2/transport/chttp2_transport.c | 23 ++++++++---- .../ext/transport/chttp2/transport/parsing.c | 4 +-- src/core/lib/channel/compress_filter.c | 12 +++---- src/core/lib/iomgr/iomgr.c | 9 ++--- src/core/lib/support/string.c | 10 ++++++ src/core/lib/support/string.h | 4 +++ src/core/lib/surface/call.c | 4 +-- src/core/lib/surface/call_log_batch.c | 2 +- src/core/lib/transport/metadata.c | 4 +-- test/core/client_config/lb_policies_test.c | 13 +++---- .../set_initial_connect_string_test.c | 6 ++-- test/core/compression/message_compress_test.c | 15 ++++---- test/core/end2end/tests/cancel_with_status.c | 2 +- test/core/end2end/tests/negative_deadline.c | 2 +- test/core/iomgr/endpoint_tests.c | 6 ++-- test/core/iomgr/fd_posix_test.c | 2 +- test/core/iomgr/tcp_posix_test.c | 24 +++++++------ test/core/support/slice_test.c | 4 +-- test/core/support/string_test.c | 35 ++++++++++++++++++- test/core/surface/completion_queue_test.c | 4 +-- test/core/transport/chttp2/bin_encoder_test.c | 3 +- test/core/transport/metadata_test.c | 5 +-- 28 files changed, 146 insertions(+), 73 deletions(-) diff --git a/include/grpc/impl/codegen/log.h b/include/grpc/impl/codegen/log.h index aa86fc4c179..9090a34cd55 100644 --- a/include/grpc/impl/codegen/log.h +++ b/include/grpc/impl/codegen/log.h @@ -34,6 +34,7 @@ #ifndef GRPC_IMPL_CODEGEN_LOG_H #define GRPC_IMPL_CODEGEN_LOG_H +#include #include #include /* for abort() */ @@ -74,7 +75,8 @@ const char *gpr_log_severity_string(gpr_log_severity severity); /* Log a message. It's advised to use GPR_xxx above to generate the context * for each message */ GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, - const char *format, ...); + const char *format, ...) + __attribute__((format(printf, 4, 5))); GPRAPI void gpr_log_message(const char *file, int line, gpr_log_severity severity, const char *message); diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index f981bc0db0b..c68577b6269 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -54,7 +54,8 @@ GPRAPI char *gpr_strdup(const char *src); On error, returns -1 and sets *strp to NULL. If the format string is bad, the result is undefined. */ -GPRAPI int gpr_asprintf(char **strp, const char *format, ...); +GPRAPI int gpr_asprintf(char **strp, const char *format, ...) + __attribute__((format(printf, 2, 3))); #ifdef __cplusplus } diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index da2cdfe8e90..40dd7c59400 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -333,7 +333,7 @@ static void start_picking(grpc_exec_ctx *exec_ctx, round_robin_lb_policy *p) { p->started_picking = 1; if (grpc_lb_round_robin_trace) { - gpr_log(GPR_DEBUG, "LB_POLICY: p=%p num_subchannels=%d", p, + gpr_log(GPR_DEBUG, "LB_POLICY: p=%p num_subchannels=%" PRIuPTR, p, p->num_subchannels); } diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c index 620ba4e2aa0..5efc95e0fa6 100644 --- a/src/core/ext/resolver/dns/native/dns_resolver.c +++ b/src/core/ext/resolver/dns/native/dns_resolver.c @@ -183,7 +183,8 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg, gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now); gpr_timespec timeout = gpr_time_sub(next_try, now); - gpr_log(GPR_DEBUG, "dns resolution failed: retrying in %d.%09d seconds", + gpr_log(GPR_DEBUG, + "dns resolution failed: retrying in %" PRId64 ".%09d seconds", timeout.tv_sec, timeout.tv_nsec); GPR_ASSERT(!r->have_retry_timer); r->have_retry_timer = true; diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c index 0428bb1e3dc..c95dd20d1d8 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c @@ -111,13 +111,14 @@ int grpc_server_add_insecure_http2_port(grpc_server *server, const char *addr) { } } if (count == 0) { - gpr_log(GPR_ERROR, "No address added out of total %d resolved", + gpr_log(GPR_ERROR, "No address added out of total %" PRIuPTR " resolved", resolved->naddrs); goto error; } if (count != resolved->naddrs) { - gpr_log(GPR_ERROR, "Only %d addresses added out of total %d resolved", - count, resolved->naddrs); + gpr_log(GPR_ERROR, + "Only %d addresses added out of total %" PRIuPTR " resolved", count, + resolved->naddrs); } grpc_resolved_addresses_destroy(resolved); diff --git a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c index ebbefbcd893..e3437e5ed3d 100644 --- a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +++ b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c @@ -229,13 +229,14 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr, } } if (count == 0) { - gpr_log(GPR_ERROR, "No address added out of total %d resolved", + gpr_log(GPR_ERROR, "No address added out of total %" PRIuPTR " resolved", resolved->naddrs); goto error; } if (count != resolved->naddrs) { - gpr_log(GPR_ERROR, "Only %d addresses added out of total %d resolved", - count, resolved->naddrs); + gpr_log(GPR_ERROR, + "Only %d addresses added out of total %" PRIuPTR " resolved", count, + resolved->naddrs); /* if it's an error, don't we want to goto error; here ? */ } grpc_resolved_addresses_destroy(resolved); diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 046b3950012..047f164eca8 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1972,10 +1972,13 @@ static char *format_flowctl_context_var(const char *context, const char *var, int64_t val, uint32_t id, char **scope) { char *underscore_pos; + char *buf; char *result; if (context == NULL) { *scope = NULL; - gpr_asprintf(&result, "%s(%lld)", var, val); + gpr_asprintf(&buf, "%s(%" PRId64 ")", var, val); + result = gpr_strpad(buf, ' ', 40); + gpr_free(buf); return result; } underscore_pos = strchr(context, '_'); @@ -1986,7 +1989,9 @@ static char *format_flowctl_context_var(const char *context, const char *var, gpr_asprintf(scope, "%s[%d]", tmp, id); gpr_free(tmp); } - gpr_asprintf(&result, "%s.%s(%lld)", underscore_pos + 1, var, val); + gpr_asprintf(&buf, "%s.%s(%" PRId64 ")", underscore_pos + 1, var, val); + result = gpr_strpad(buf, ' ', 40); + gpr_free(buf); return result; } @@ -2007,6 +2012,8 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *phase, uint32_t stream_id, int64_t val1, int64_t val2) { char *scope1; char *scope2; + char *tmp_phase; + char *tmp_scope1; char *label1 = format_flowctl_context_var(context1, var1, val1, stream_id, &scope1); char *label2 = @@ -2014,14 +2021,18 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *phase, char *clisvr = is_client ? "client" : "server"; char *prefix; - gpr_asprintf(&prefix, "FLOW % 8s: %s % 11s ", phase, clisvr, scope1); + tmp_phase = gpr_strpad(phase, ' ', 8); + tmp_scope1 = gpr_strpad(scope1, ' ', 11); + gpr_asprintf(&prefix, "FLOW %s: %s %s ", phase, clisvr, scope1); + gpr_free(tmp_phase); + gpr_free(tmp_scope1); switch (op) { case GRPC_CHTTP2_FLOWCTL_MOVE: GPR_ASSERT(samestr(scope1, scope2)); if (val2 != 0) { gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "%sMOVE % 40s <- % 40s giving %d", prefix, label1, label2, + "%sMOVE %s <- %s giving %" PRId64, prefix, label1, label2, val1 + val2); } break; @@ -2029,7 +2040,7 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *phase, GPR_ASSERT(val2 >= 0); if (val2 != 0) { gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "%sCREDIT % 40s by % 40s giving %d", prefix, label1, label2, + "%sCREDIT %s by %s giving %" PRId64, prefix, label1, label2, val1 + val2); } break; @@ -2037,7 +2048,7 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *phase, GPR_ASSERT(val2 >= 0); if (val2 != 0) { gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "%sDEBIT % 40s by % 40s giving %d", prefix, label1, label2, + "%sDEBIT %s by %s giving %" PRId64, prefix, label1, label2, val1 - val2); } break; diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 4bd374b7fa7..8f72a4ff992 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -534,14 +534,14 @@ static grpc_chttp2_parse_error update_incoming_window( grpc_chttp2_stream_parsing *stream_parsing) { uint32_t incoming_frame_size = transport_parsing->incoming_frame_size; if (incoming_frame_size > transport_parsing->incoming_window) { - gpr_log(GPR_ERROR, "frame of size %d overflows incoming window of %d", + gpr_log(GPR_ERROR, "frame of size %d overflows incoming window of %" PRId64, transport_parsing->incoming_frame_size, transport_parsing->incoming_window); return GRPC_CHTTP2_CONNECTION_ERROR; } if (incoming_frame_size > stream_parsing->incoming_window) { - gpr_log(GPR_ERROR, "frame of size %d overflows incoming window of %d", + gpr_log(GPR_ERROR, "frame of size %d overflows incoming window of %" PRId64, transport_parsing->incoming_frame_size, stream_parsing->incoming_window); return GRPC_CHTTP2_CONNECTION_ERROR; diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index 4fe9a7f045a..32f4f8d37e5 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -177,8 +177,8 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx, const float savings_ratio = 1.0f - (float)after_size / (float)before_size; GPR_ASSERT(grpc_compression_algorithm_name(calld->compression_algorithm, &algo_name)); - gpr_log(GPR_DEBUG, - "Compressed[%s] %d bytes vs. %d bytes (%.2f%% savings)", + gpr_log(GPR_DEBUG, "Compressed[%s] %" PRIuPTR " bytes vs. %" PRIuPTR + " bytes (%.2f%% savings)", algo_name, before_size, after_size, 100 * savings_ratio); } gpr_slice_buffer_swap(&calld->slices, &tmp); @@ -188,10 +188,10 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx, char *algo_name; GPR_ASSERT(grpc_compression_algorithm_name(calld->compression_algorithm, &algo_name)); - gpr_log( - GPR_DEBUG, - "Algorithm '%s' enabled but decided not to compress. Input size: %d", - algo_name, calld->slices.length); + gpr_log(GPR_DEBUG, + "Algorithm '%s' enabled but decided not to compress. Input size: " + "%" PRIuPTR, + algo_name, calld->slices.length); } } diff --git a/src/core/lib/iomgr/iomgr.c b/src/core/lib/iomgr/iomgr.c index 60cef8ba777..89292a153ed 100644 --- a/src/core/lib/iomgr/iomgr.c +++ b/src/core/lib/iomgr/iomgr.c @@ -96,7 +96,8 @@ void grpc_iomgr_shutdown(void) { gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), last_warning_time), gpr_time_from_seconds(1, GPR_TIMESPAN)) >= 0) { if (g_root_object.next != &g_root_object) { - gpr_log(GPR_DEBUG, "Waiting for %d iomgr objects to be destroyed", + gpr_log(GPR_DEBUG, + "Waiting for %" PRIuPTR " iomgr objects to be destroyed", count_objects()); } last_warning_time = gpr_now(GPR_CLOCK_REALTIME); @@ -114,9 +115,9 @@ void grpc_iomgr_shutdown(void) { if (gpr_cv_wait(&g_rcv, &g_mu, short_deadline)) { if (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), shutdown_deadline) > 0) { if (g_root_object.next != &g_root_object) { - gpr_log(GPR_DEBUG, - "Failed to free %d iomgr objects before shutdown deadline: " - "memory leaks are likely", + gpr_log(GPR_DEBUG, "Failed to free %" PRIuPTR + " iomgr objects before shutdown deadline: " + "memory leaks are likely", count_objects()); dump_objects("LEAKED"); if (grpc_iomgr_abort_on_leaks()) { diff --git a/src/core/lib/support/string.c b/src/core/lib/support/string.c index a2ab6c5f1fc..789bd6408be 100644 --- a/src/core/lib/support/string.c +++ b/src/core/lib/support/string.c @@ -194,6 +194,16 @@ int int64_ttoa(int64_t value, char *string) { return i; } +char *gpr_strpad(const char *str, char flag, size_t length) { + const size_t str_length = strlen(str); + const size_t out_length = str_length > length ? str_length : length; + char *out = gpr_malloc(out_length + 1); + memset(out, flag, out_length - str_length); + memcpy(out + out_length - str_length, str, str_length); + out[out_length] = 0; + return out; +} + char *gpr_strjoin(const char **strs, size_t nstrs, size_t *final_length) { return gpr_strjoin_sep(strs, nstrs, "", final_length); } diff --git a/src/core/lib/support/string.h b/src/core/lib/support/string.h index ea58610914e..30f5aef7665 100644 --- a/src/core/lib/support/string.h +++ b/src/core/lib/support/string.h @@ -83,6 +83,10 @@ int int64_ttoa(int64_t value, char *output); /* Reverse a run of bytes */ void gpr_reverse_bytes(char *str, int len); +/* Pad a string with flag characters. The given length specifies the minimum + field width. The input string is never truncated. */ +char *gpr_strpad(const char *str, char flag, size_t length); + /* Join a set of strings, returning the resulting string. Total combined length (excluding null terminator) is returned in total_length if it is non-null. */ diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index a9b1e25a771..c613f325dc1 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1182,7 +1182,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx, if (algo >= GRPC_COMPRESS_ALGORITHMS_COUNT) { gpr_asprintf(&error_msg, "Invalid compression algorithm value '%d'.", algo); - gpr_log(GPR_ERROR, error_msg); + gpr_log(GPR_ERROR, "%s", error_msg); close_with_status(exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg); } else if (grpc_compression_options_is_algorithm_enabled( &compression_options, algo) == 0) { @@ -1191,7 +1191,7 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx, grpc_compression_algorithm_name(algo, &algo_name); gpr_asprintf(&error_msg, "Compression algorithm '%s' is disabled.", algo_name); - gpr_log(GPR_ERROR, error_msg); + gpr_log(GPR_ERROR, "%s", error_msg); close_with_status(exec_ctx, call, GRPC_STATUS_UNIMPLEMENTED, error_msg); } else { call->incoming_compression_algorithm = algo; diff --git a/src/core/lib/surface/call_log_batch.c b/src/core/lib/surface/call_log_batch.c index a6d1d5149f1..31c074f15dc 100644 --- a/src/core/lib/surface/call_log_batch.c +++ b/src/core/lib/surface/call_log_batch.c @@ -112,7 +112,7 @@ void grpc_call_log_batch(char *file, int line, gpr_log_severity severity, size_t i; for (i = 0; i < nops; i++) { tmp = grpc_op_string(&ops[i]); - gpr_log(file, line, severity, "ops[%d]: %s", i, tmp); + gpr_log(file, line, severity, "ops[%" PRIuPTR "]: %s", i, tmp); gpr_free(tmp); } } diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 79de54beb59..0677f297660 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -235,7 +235,7 @@ void grpc_mdctx_global_shutdown(void) { gc_mdtab(shard); /* TODO(ctiller): GPR_ASSERT(shard->count == 0); */ if (shard->count != 0) { - gpr_log(GPR_DEBUG, "WARNING: %d metadata elements were leaked", + gpr_log(GPR_DEBUG, "WARNING: %" PRIuPTR " metadata elements were leaked", shard->count); if (grpc_iomgr_abort_on_leaks()) { abort(); @@ -248,7 +248,7 @@ void grpc_mdctx_global_shutdown(void) { gpr_mu_destroy(&shard->mu); /* TODO(ctiller): GPR_ASSERT(shard->count == 0); */ if (shard->count != 0) { - gpr_log(GPR_DEBUG, "WARNING: %d metadata strings were leaked", + gpr_log(GPR_DEBUG, "WARNING: %" PRIuPTR " metadata strings were leaked", shard->count); for (size_t j = 0; j < shard->capacity; j++) { for (internal_string *s = shard->strs[j]; s; s = s->bucket_next) { diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index 1534360dea0..3160312db6f 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -135,7 +135,7 @@ static void drain_cq(grpc_completion_queue *cq) { } static void kill_server(const servers_fixture *f, size_t i) { - gpr_log(GPR_INFO, "KILLING SERVER %d", i); + gpr_log(GPR_INFO, "KILLING SERVER %" PRIuPTR, i); GPR_ASSERT(f->servers[i] != NULL); grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); GPR_ASSERT( @@ -157,7 +157,7 @@ typedef struct request_data { static void revive_server(const servers_fixture *f, request_data *rdata, size_t i) { int got_port; - gpr_log(GPR_INFO, "RAISE AGAIN SERVER %d", i); + gpr_log(GPR_INFO, "RAISE AGAIN SERVER %" PRIuPTR, i); GPR_ASSERT(f->servers[i] == NULL); gpr_log(GPR_DEBUG, "revive: %s", f->servers_hostports[i]); @@ -311,7 +311,7 @@ static int *perform_request(servers_fixture *f, grpc_channel *client, .type != GRPC_QUEUE_TIMEOUT) { GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); read_tag = ((int)(intptr_t)ev.tag); - gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d", + gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%" PRIuPTR, ev.success, ev.type, read_tag, iter_num); if (ev.success && read_tag >= 1000) { GPR_ASSERT(s_idx == -1); /* only one server must reply */ @@ -643,7 +643,8 @@ static void print_failed_expectations(const int *expected_connection_sequence, const size_t num_iters) { size_t i; for (i = 0; i < num_iters; i++) { - gpr_log(GPR_ERROR, "FAILURE: Iter (expected, actual): %d (%d, %d)", i, + gpr_log(GPR_ERROR, + "FAILURE: Iter (expected, actual): %" PRIuPTR " (%d, %d)", i, expected_connection_sequence[i % expected_seq_length], actual_connection_sequence[i]); } @@ -726,8 +727,8 @@ static void verify_total_carnage_round_robin( const int actual = actual_connection_sequence[i]; const int expected = -1; if (actual != expected) { - gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %d", expected, - actual, i); + gpr_log(GPR_ERROR, "FAILURE: expected %d, actual %d at iter %" PRIuPTR, + expected, actual, i); abort(); } } diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c index 438b9492369..9f47671f4df 100644 --- a/test/core/client_config/set_initial_connect_string_test.c +++ b/test/core/client_config/set_initial_connect_string_test.c @@ -69,7 +69,7 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) { GPR_ASSERT(success); gpr_slice_buffer_move_into(&state.temp_incoming_buffer, &state.incoming_buffer); - gpr_log(GPR_DEBUG, "got %d bytes, magic is %d bytes", + gpr_log(GPR_DEBUG, "got %" PRIuPTR " bytes, magic is %" PRIuPTR " bytes", state.incoming_buffer.length, strlen(magic_connect_string)); if (state.incoming_buffer.length > strlen(magic_connect_string)) { gpr_atm_rel_store(&state.done_atm, 1); @@ -173,8 +173,8 @@ static void actually_poll_server(void *arg) { bool done = gpr_atm_acq_load(&state.done_atm) != 0; gpr_timespec time_left = gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME)); - gpr_log(GPR_DEBUG, "done=%d, time_left=%d.%09d", done, time_left.tv_sec, - time_left.tv_nsec); + gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIuPTR ".%09d", done, + time_left.tv_sec, time_left.tv_nsec); if (done || gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) < 0) { break; } diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c index 1a93903346f..47ecf72e08e 100644 --- a/test/core/compression/message_compress_test.c +++ b/test/core/compression/message_compress_test.c @@ -66,13 +66,14 @@ static void assert_passthrough(gpr_slice value, char *algorithm_name; GPR_ASSERT(grpc_compression_algorithm_name(algorithm, &algorithm_name) != 0); - gpr_log(GPR_INFO, - "assert_passthrough: value_length=%d value_hash=0x%08x " - "algorithm='%s' uncompressed_split='%s' compressed_split='%s'", - GPR_SLICE_LENGTH(value), gpr_murmur_hash3(GPR_SLICE_START_PTR(value), - GPR_SLICE_LENGTH(value), 0), - algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode), - grpc_slice_split_mode_name(compressed_split_mode)); + gpr_log( + GPR_INFO, "assert_passthrough: value_length=%" PRIuPTR + " value_hash=0x%08x " + "algorithm='%s' uncompressed_split='%s' compressed_split='%s'", + GPR_SLICE_LENGTH(value), + gpr_murmur_hash3(GPR_SLICE_START_PTR(value), GPR_SLICE_LENGTH(value), 0), + algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode), + grpc_slice_split_mode_name(compressed_split_mode)); gpr_slice_buffer_init(&input); gpr_slice_buffer_init(&compressed_raw); diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index 83629a9a028..673c7051ad1 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -112,7 +112,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { char *details = NULL; size_t details_capacity = 0; - gpr_log(GPR_DEBUG, "test with %d ops", num_ops); + gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", "foo.test.google.fr:1234", deadline, diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index fd56c8b4ff1..dff7992f63b 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -112,7 +112,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { char *details = NULL; size_t details_capacity = 0; - gpr_log(GPR_DEBUG, "test with %d ops", num_ops); + gpr_log(GPR_DEBUG, "test with %" PRIuPTR " ops", num_ops); c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", "foo.test.google.fr:1234", deadline, diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c index 52082c3c6b7..6d15ecf141d 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -188,13 +188,15 @@ static void read_and_write_test(grpc_endpoint_test_config config, grpc_endpoint_test_fixture f = begin_test(config, "read_and_write_test", slice_size); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - gpr_log(GPR_DEBUG, "num_bytes=%d write_size=%d slice_size=%d shutdown=%d", + gpr_log(GPR_DEBUG, "num_bytes=%" PRIuPTR " write_size=%" PRIuPTR + " slice_size=%" PRIuPTR " shutdown=%d", num_bytes, write_size, slice_size, shutdown); if (shutdown) { gpr_log(GPR_INFO, "Start read and write shutdown test"); } else { - gpr_log(GPR_INFO, "Start read and write test with %d bytes, slice size %d", + gpr_log(GPR_INFO, "Start read and write test with %" PRIuPTR + " bytes, slice size %" PRIuPTR, num_bytes, slice_size); } diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index 0630f1d10e1..24ba474680f 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -398,7 +398,7 @@ static void test_grpc_fd(void) { client_wait_and_shutdown(&cl); server_wait_and_shutdown(&sv); GPR_ASSERT(sv.read_bytes_total == cl.write_bytes_total); - gpr_log(GPR_INFO, "Total read bytes %d", sv.read_bytes_total); + gpr_log(GPR_INFO, "Total read bytes %" PRIdPTR, sv.read_bytes_total); } typedef struct fd_change_data { diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 7a98fa0e506..19ba258303e 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -151,7 +151,7 @@ static void read_cb(grpc_exec_ctx *exec_ctx, void *user_data, bool success) { read_bytes = count_slices(state->incoming.slices, state->incoming.count, ¤t_data); state->read_bytes += read_bytes; - gpr_log(GPR_INFO, "Read %d bytes of %d", read_bytes, + gpr_log(GPR_INFO, "Read %" PRIuPTR " bytes of %" PRIuPTR, read_bytes, state->target_read_bytes); if (state->read_bytes >= state->target_read_bytes) { gpr_mu_unlock(g_mu); @@ -170,8 +170,8 @@ static void read_test(size_t num_bytes, size_t slice_size) { gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - gpr_log(GPR_INFO, "Read test of size %d, slice size %d", num_bytes, - slice_size); + gpr_log(GPR_INFO, "Read test of size %" PRIuPTR ", slice size %" PRIuPTR, + num_bytes, slice_size); create_sockets(sv); @@ -179,7 +179,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); - gpr_log(GPR_INFO, "Wrote %d bytes", written_bytes); + gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes); state.ep = ep; state.read_bytes = 0; @@ -216,7 +216,7 @@ static void large_read_test(size_t slice_size) { gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - gpr_log(GPR_INFO, "Start large read test, slice size %d", slice_size); + gpr_log(GPR_INFO, "Start large read test, slice size %" PRIuPTR, slice_size); create_sockets(sv); @@ -225,7 +225,7 @@ static void large_read_test(size_t slice_size) { grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket(sv[0]); - gpr_log(GPR_INFO, "Wrote %d bytes", written_bytes); + gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes); state.ep = ep; state.read_bytes = 0; @@ -344,8 +344,9 @@ static void write_test(size_t num_bytes, size_t slice_size) { gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - gpr_log(GPR_INFO, "Start write test with %d bytes, slice size %d", num_bytes, - slice_size); + gpr_log(GPR_INFO, + "Start write test with %" PRIuPTR " bytes, slice size %" PRIuPTR, + num_bytes, slice_size); create_sockets(sv); @@ -404,8 +405,9 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { int fd_released_done = 0; grpc_closure_init(&fd_released_cb, &on_fd_released, &fd_released_done); - gpr_log(GPR_INFO, "Release fd read_test of size %d, slice size %d", num_bytes, - slice_size); + gpr_log(GPR_INFO, + "Release fd read_test of size %" PRIuPTR ", slice size %" PRIuPTR, + num_bytes, slice_size); create_sockets(sv); @@ -414,7 +416,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); - gpr_log(GPR_INFO, "Wrote %d bytes", written_bytes); + gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes); state.ep = ep; state.read_bytes = 0; diff --git a/test/core/support/slice_test.c b/test/core/support/slice_test.c index 2df38376a9f..0da483a3216 100644 --- a/test/core/support/slice_test.c +++ b/test/core/support/slice_test.c @@ -164,7 +164,7 @@ static void test_slice_split_head_works(size_t length) { size_t i; LOG_TEST_NAME("test_slice_split_head_works"); - gpr_log(GPR_INFO, "length=%d", length); + gpr_log(GPR_INFO, "length=%" PRIuPTR, length); /* Create a slice in which each byte is equal to the distance from it to the beginning of the slice. */ @@ -192,7 +192,7 @@ static void test_slice_split_tail_works(size_t length) { size_t i; LOG_TEST_NAME("test_slice_split_tail_works"); - gpr_log(GPR_INFO, "length=%d", length); + gpr_log(GPR_INFO, "length=%" PRIuPTR, length); /* Create a slice in which each byte is equal to the distance from it to the beginning of the slice. */ diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c index d5f8107f211..3380482787e 100644 --- a/test/core/support/string_test.c +++ b/test/core/support/string_test.c @@ -156,7 +156,7 @@ static void test_asprintf(void) { LOG_TEST_NAME("test_asprintf"); /* Print an empty string. */ - GPR_ASSERT(gpr_asprintf(&buf, "") == 0); + GPR_ASSERT(gpr_asprintf(&buf, "%s", "") == 0); GPR_ASSERT(buf[0] == '\0'); gpr_free(buf); @@ -334,6 +334,38 @@ static void test_int64toa() { GPR_ASSERT(0 == strcmp("-9223372036854775808", buf)); } +static void test_strpad() { + char *padded; + + padded = gpr_strpad("foo", ' ', 5); + GPR_ASSERT(0 == strcmp(" foo", padded)); + gpr_free(padded); + + padded = gpr_strpad("foo", ' ', 4); + GPR_ASSERT(0 == strcmp(" foo", padded)); + gpr_free(padded); + + padded = gpr_strpad("foo", ' ', 3); + GPR_ASSERT(0 == strcmp("foo", padded)); + gpr_free(padded); + + padded = gpr_strpad("foo", ' ', 2); + GPR_ASSERT(0 == strcmp("foo", padded)); + gpr_free(padded); + + padded = gpr_strpad("foo", ' ', 1); + GPR_ASSERT(0 == strcmp("foo", padded)); + gpr_free(padded); + + padded = gpr_strpad("foo", ' ', 0); + GPR_ASSERT(0 == strcmp("foo", padded)); + gpr_free(padded); + + padded = gpr_strpad("foo", '0', 5); + GPR_ASSERT(0 == strcmp("00foo", padded)); + gpr_free(padded); +} + int main(int argc, char **argv) { grpc_test_init(argc, argv); test_strdup(); @@ -346,5 +378,6 @@ int main(int argc, char **argv) { test_strsplit(); test_ltoa(); test_int64toa(); + test_strpad(); return 0; } diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 49a1fc441f0..2fcd7f5a938 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -348,8 +348,8 @@ static void test_threading(size_t producers, size_t consumers) { size_t total_consumed = 0; static int optid = 101; - gpr_log(GPR_INFO, "%s: %d producers, %d consumers", "test_threading", - producers, consumers); + gpr_log(GPR_INFO, "%s: %" PRIuPTR " producers, %" PRIuPTR " consumers", + "test_threading", producers, consumers); /* start all threads: they will wait for phase1 */ for (i = 0; i < producers + consumers; i++) { diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c index 095861e9741..08d10735a5a 100644 --- a/test/core/transport/chttp2/bin_encoder_test.c +++ b/test/core/transport/chttp2/bin_encoder_test.c @@ -88,7 +88,8 @@ static void expect_combined_equiv(const char *s, size_t len, int line) { char *t = gpr_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII); char *e = gpr_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII); char *g = gpr_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot: %s\nwant: %s", t, g, e); + gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot: %s\nwant: %s", line, t, g, + e); gpr_free(t); gpr_free(e); gpr_free(g); diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c index a4e9694a93e..007892930cf 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.c @@ -166,7 +166,7 @@ static void test_things_stick_around(void) { grpc_init(); for (i = 0; i < nstrs; i++) { - gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%dx", i); + gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%" PRIuPTR "x", i); strs[i] = grpc_mdstr_from_string(buffer); shuf[i] = i; gpr_free(buffer); @@ -188,7 +188,8 @@ static void test_things_stick_around(void) { for (i = 0; i < nstrs; i++) { GRPC_MDSTR_UNREF(strs[shuf[i]]); for (j = i + 1; j < nstrs; j++) { - gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%dx", shuf[j]); + gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%" PRIuPTR "x", + shuf[j]); test = grpc_mdstr_from_string(buffer); GPR_ASSERT(test == strs[shuf[j]]); GRPC_MDSTR_UNREF(test); From 1efb6017ec1edb26706895dfe71f4d72ea387cf4 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Wed, 8 Jun 2016 13:06:44 -0700 Subject: [PATCH 142/175] Initial Python3 support Notable Changes: -Convert all str types to byte types at cython layer (ascii encoding) -Use six for packages that have different names in Python2/Python3 -By default, unit tests are compiled/run in Python2.7 and Python3.4 -Ensure MACOSX_BUILD_TARGET is at least 10.7 --- setup.py | 12 ++++ src/python/grpcio/commands.py | 2 +- src/python/grpcio/grpc/_channel.py | 10 +-- src/python/grpcio/grpc/_common.py | 13 ++++ .../grpcio/grpc/_cython/_cygrpc/call.pyx.pxi | 7 +- .../grpc/_cython/_cygrpc/channel.pyx.pxi | 24 ++----- .../grpc/_cython/_cygrpc/credentials.pxd.pxi | 2 +- .../grpc/_cython/_cygrpc/credentials.pyx.pxi | 53 +++------------ .../grpc/_cython/_cygrpc/grpc_string.pyx.pxi | 39 +++++++++++ .../grpc/_cython/_cygrpc/records.pyx.pxi | 68 ++++--------------- .../grpc/_cython/_cygrpc/server.pyx.pxi | 7 +- src/python/grpcio/grpc/_cython/cygrpc.pyx | 1 + src/python/grpcio/grpc/_links/service.py | 6 +- src/python/grpcio/grpc/_server.py | 14 ++-- .../grpcio/grpc/beta/_client_adaptations.py | 17 ++--- .../grpcio/grpc/beta/_server_adaptations.py | 46 +++++++------ .../grpcio/tests/qps/benchmark_client.py | 5 +- src/python/grpcio/tests/qps/client_runner.py | 9 ++- src/python/grpcio/tests/stress/client.py | 6 +- .../unit/_adapter/_intermediary_low_test.py | 43 ++++++------ .../grpcio/tests/unit/_adapter/_low_test.py | 16 ++--- .../grpcio/tests/unit/_cython/cygrpc_test.py | 2 +- .../tests/unit/_links/_transmission_test.py | 2 +- src/python/grpcio/tests/unit/_rpc_test.py | 8 ++- .../tests/unit/beta/_beta_features_test.py | 4 +- .../grpcio/tests/unit/beta/_not_found_test.py | 2 +- .../framework/interfaces/base/test_cases.py | 6 +- src/python/grpcio/tests/unit/test_common.py | 4 ++ tools/gce/linux_performance_worker_init.sh | 4 ++ tools/run_tests/build_python.sh | 15 ++++ tools/run_tests/run_python.sh | 1 + tools/run_tests/run_tests.py | 29 ++++---- 32 files changed, 243 insertions(+), 234 deletions(-) create mode 100644 src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi diff --git a/setup.py b/setup.py index 018d0470f43..e2de96de358 100644 --- a/setup.py +++ b/setup.py @@ -33,9 +33,11 @@ import os import os.path import shutil import sys +import sysconfig from distutils import core as _core from distutils import extension as _extension +import pkg_resources import setuptools from setuptools.command import egg_info @@ -110,6 +112,16 @@ if "linux" in sys.platform or "darwin" in sys.platform: DEFINE_MACROS += (('PyMODINIT_FUNC', pymodinit),) +# By default, Python3 distutils enforces compatibility of +# c plugins (.so files) with the OSX version Python3 was built with. +# For Python3.4, this is OSX 10.6, but we need Thread Local Support (__thread) +if 'darwin' in sys.platform and PY3: + mac_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') + if mac_target and (pkg_resources.parse_version(mac_target) < + pkg_resources.parse_version('10.7.0')): + os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7' + + def cython_extensions(module_names, extra_sources, include_dirs, libraries, define_macros, build_with_cython=False): # Set compiler directives linetrace argument only if we care about tracing; diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py index 295dab2d274..3e974eba0a3 100644 --- a/src/python/grpcio/commands.py +++ b/src/python/grpcio/commands.py @@ -191,7 +191,7 @@ class BuildProtoModules(setuptools.Command): except subprocess.CalledProcessError as e: sys.stderr.write( 'warning: Command:\n{}\nMessage:\n{}\nOutput:\n{}'.format( - command, e.message, e.output)) + command, str(e), e.output)) # Generated proto directories dont include __init__.py, but # these are needed for python package resolution diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index d9eb5a4b770..555a92a3634 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -85,7 +85,7 @@ def _deadline(timeout): def _unknown_code_details(unknown_cygrpc_code, details): - return b'Server sent unknown code {} and details "{}"'.format( + return 'Server sent unknown code {} and details "{}"'.format( unknown_cygrpc_code, details) @@ -142,7 +142,7 @@ def _handle_event(event, state, response_deserializer): response = _common.deserialize( serialized_response, response_deserializer) if response is None: - details = b'Exception deserializing response!' + details = 'Exception deserializing response!' _abort(state, grpc.StatusCode.INTERNAL, details) else: state.response = response @@ -186,7 +186,7 @@ def _consume_request_iterator( if state.code is None and not state.cancelled: if serialized_request is None: call.cancel() - details = b'Exception serializing request!' + details = 'Exception serializing request!' _abort(state, grpc.StatusCode.INTERNAL, details) return else: @@ -230,7 +230,7 @@ class _Rendezvous(grpc.RpcError, grpc.Future, grpc.Call): if self._state.code is None: self._call.cancel() self._state.cancelled = True - _abort(self._state, grpc.StatusCode.CANCELLED, b'Cancelled!') + _abort(self._state, grpc.StatusCode.CANCELLED, 'Cancelled!') self._state.condition.notify_all() return False @@ -402,7 +402,7 @@ def _start_unary_request(request, timeout, request_serializer): if serialized_request is None: state = _RPCState( (), _EMPTY_METADATA, _EMPTY_METADATA, grpc.StatusCode.INTERNAL, - b'Exception serializing request!') + 'Exception serializing request!') rendezvous = _Rendezvous(state, None, None, deadline) return deadline, deadline_timespec, None, rendezvous else: diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index a3fb66cd077..b8688a0149a 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -97,3 +97,16 @@ def serialize(message, serializer): def deserialize(serialized_message, deserializer): return _transform(serialized_message, deserializer, 'Exception deserializing message!') + + +def _encode(s): + if isinstance(s, bytes): + return s + else: + return s.encode('ascii') + + +def fully_qualified_method(group, method): + group = _encode(group) + method = _encode(method) + return b'/' + group + b'/' + method diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi index 1bfe6344e07..a09bbc75fe6 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi @@ -55,6 +55,7 @@ cdef class Call: def cancel( self, grpc_status_code error_code=GRPC_STATUS__DO_NOT_USE, details=None): + details = str_to_bytes(details) if not self.is_valid: raise ValueError("invalid call object cannot be used from Python") if (details is None) != (error_code == GRPC_STATUS__DO_NOT_USE): @@ -63,12 +64,6 @@ cdef class Call: cdef grpc_call_error result cdef char *c_details = NULL if error_code != GRPC_STATUS__DO_NOT_USE: - if isinstance(details, bytes): - pass - elif isinstance(details, basestring): - details = details.encode() - else: - raise TypeError("expected details to be str or bytes") self.references.append(details) c_details = details with nogil: diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi index c26bc083cf3..866cff0d019 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi @@ -34,18 +34,13 @@ cdef class Channel: def __cinit__(self, target, ChannelArgs arguments=None, ChannelCredentials channel_credentials=None): + target = str_to_bytes(target) cdef grpc_channel_args *c_arguments = NULL cdef char *c_target = NULL self.c_channel = NULL self.references = [] if arguments is not None: c_arguments = &arguments.c_args - if isinstance(target, bytes): - pass - elif isinstance(target, basestring): - target = target.encode() - else: - raise TypeError("expected target to be str or bytes") c_target = target if channel_credentials is None: with nogil: @@ -62,25 +57,14 @@ cdef class Channel: def create_call(self, Call parent, int flags, CompletionQueue queue not None, method, host, Timespec deadline not None): + method = str_to_bytes(method) + host = str_to_bytes(host) if queue.is_shutting_down: raise ValueError("queue must not be shutting down or shutdown") - if isinstance(method, bytes): - pass - elif isinstance(method, basestring): - method = method.encode() - else: - raise TypeError("expected method to be str or bytes") cdef char *method_c_string = method cdef char *host_c_string = NULL - if host is None: - pass - elif isinstance(host, bytes): + if host is not None: host_c_string = host - elif isinstance(host, basestring): - host = host.encode() - host_c_string = host - else: - raise TypeError("expected host to be str, bytes, or None") cdef Call operation_call = Call() operation_call.references = [self, method, host, queue] cdef grpc_call *parent_call = NULL diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi index 19a59e08f3f..d377a675200 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi @@ -54,7 +54,7 @@ cdef class ServerCredentials: cdef class CredentialsMetadataPlugin: cdef object plugin_callback - cdef str plugin_name + cdef bytes plugin_name cdef grpc_metadata_credentials_plugin make_c_plugin(self) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index 1ba86457af5..470382d6091 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -82,7 +82,7 @@ cdef class ServerCredentials: cdef class CredentialsMetadataPlugin: - def __cinit__(self, object plugin_callback, str name): + def __cinit__(self, object plugin_callback, name): """ Args: plugin_callback (callable): Callback accepting a service URL (str/bytes) @@ -93,6 +93,7 @@ cdef class CredentialsMetadataPlugin: successful). name (str): Plugin name. """ + name = str_to_bytes(name) if not callable(plugin_callback): raise ValueError('expected callable plugin_callback') self.plugin_callback = plugin_callback @@ -129,7 +130,8 @@ cdef void plugin_get_metadata( grpc_credentials_plugin_metadata_cb cb, void *user_data) with gil: def python_callback( Metadata metadata, grpc_status_code status, - const char *error_details): + error_details): + error_details = str_to_bytes(error_details) cb(user_data, metadata.c_metadata_array.metadata, metadata.c_metadata_array.count, status, error_details) cdef CredentialsMetadataPlugin self = state @@ -148,14 +150,7 @@ def channel_credentials_google_default(): def channel_credentials_ssl(pem_root_certificates, SslPemKeyCertPair ssl_pem_key_cert_pair): - if pem_root_certificates is None: - pass - elif isinstance(pem_root_certificates, bytes): - pass - elif isinstance(pem_root_certificates, basestring): - pem_root_certificates = pem_root_certificates.encode() - else: - raise TypeError("expected str or bytes for pem_root_certificates") + pem_root_certificates = str_to_bytes(pem_root_certificates) cdef ChannelCredentials credentials = ChannelCredentials() cdef const char *c_pem_root_certificates = NULL if pem_root_certificates is not None: @@ -207,12 +202,7 @@ def call_credentials_google_compute_engine(): def call_credentials_service_account_jwt_access( json_key, Timespec token_lifetime not None): - if isinstance(json_key, bytes): - pass - elif isinstance(json_key, basestring): - json_key = json_key.encode() - else: - raise TypeError("expected json_key to be str or bytes") + json_key = str_to_bytes(json_key) cdef CallCredentials credentials = CallCredentials() cdef char *json_key_c_string = json_key with nogil: @@ -223,12 +213,7 @@ def call_credentials_service_account_jwt_access( return credentials def call_credentials_google_refresh_token(json_refresh_token): - if isinstance(json_refresh_token, bytes): - pass - elif isinstance(json_refresh_token, basestring): - json_refresh_token = json_refresh_token.encode() - else: - raise TypeError("expected json_refresh_token to be str or bytes") + json_refresh_token = str_to_bytes(json_refresh_token) cdef CallCredentials credentials = CallCredentials() cdef char *json_refresh_token_c_string = json_refresh_token with nogil: @@ -238,18 +223,8 @@ def call_credentials_google_refresh_token(json_refresh_token): return credentials def call_credentials_google_iam(authorization_token, authority_selector): - if isinstance(authorization_token, bytes): - pass - elif isinstance(authorization_token, basestring): - authorization_token = authorization_token.encode() - else: - raise TypeError("expected authorization_token to be str or bytes") - if isinstance(authority_selector, bytes): - pass - elif isinstance(authority_selector, basestring): - authority_selector = authority_selector.encode() - else: - raise TypeError("expected authority_selector to be str or bytes") + authorization_token = str_to_bytes(authorization_token) + authority_selector = str_to_bytes(authority_selector) cdef CallCredentials credentials = CallCredentials() cdef char *authorization_token_c_string = authorization_token cdef char *authority_selector_c_string = authority_selector @@ -272,16 +247,10 @@ def call_credentials_metadata_plugin(CredentialsMetadataPlugin plugin): def server_credentials_ssl(pem_root_certs, pem_key_cert_pairs, bint force_client_auth): + pem_root_certs = str_to_bytes(pem_root_certs) cdef char *c_pem_root_certs = NULL - if pem_root_certs is None: - pass - elif isinstance(pem_root_certs, bytes): - c_pem_root_certs = pem_root_certs - elif isinstance(pem_root_certs, basestring): - pem_root_certs = pem_root_certs.encode() + if pem_root_certs is not None: c_pem_root_certs = pem_root_certs - else: - raise TypeError("expected pem_root_certs to be str or bytes") pem_key_cert_pairs = list(pem_key_cert_pairs) for pair in pem_key_cert_pairs: if not isinstance(pair, SslPemKeyCertPair): diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi new file mode 100644 index 00000000000..274f038e0ac --- /dev/null +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_string.pyx.pxi @@ -0,0 +1,39 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# This function will ascii encode unicode string inputs if neccesary. +# In Python3, unicode strings are the default str type. +cdef bytes str_to_bytes(object s): + if s is None or isinstance(s, bytes): + return s + elif isinstance(s, unicode): + return s.encode('ascii') + else: + raise TypeError('Expected bytes, str, or unicode, not {}'.format(type(s))) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index e0219b00865..2e52953c0a3 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -235,18 +235,13 @@ cdef class ByteBuffer: if data is None: self.c_byte_buffer = NULL return - if isinstance(data, bytes): - pass - elif isinstance(data, basestring): - data = data.encode() - elif isinstance(data, ByteBuffer): + if isinstance(data, ByteBuffer): data = (data).bytes() if data is None: self.c_byte_buffer = NULL return else: - raise TypeError("expected value to be of type str, bytes, or " - "ByteBuffer, not {}".format(type(data))) + data = str_to_bytes(data) cdef char *c_data = data cdef gpr_slice data_slice @@ -302,19 +297,8 @@ cdef class ByteBuffer: cdef class SslPemKeyCertPair: def __cinit__(self, private_key, certificate_chain): - if isinstance(private_key, bytes): - self.private_key = private_key - elif isinstance(private_key, basestring): - self.private_key = private_key.encode() - else: - raise TypeError("expected private_key to be of type str or bytes") - if isinstance(certificate_chain, bytes): - self.certificate_chain = certificate_chain - elif isinstance(certificate_chain, basestring): - self.certificate_chain = certificate_chain.encode() - else: - raise TypeError("expected certificate_chain to be of type str or bytes " - "or int") + self.private_key = str_to_bytes(private_key) + self.certificate_chain = str_to_bytes(certificate_chain) self.c_pair.private_key = self.private_key self.c_pair.certificate_chain = self.certificate_chain @@ -322,27 +306,16 @@ cdef class SslPemKeyCertPair: cdef class ChannelArg: def __cinit__(self, key, value): - if isinstance(key, bytes): - self.key = key - elif isinstance(key, basestring): - self.key = key.encode() - else: - raise TypeError("expected key to be of type str or bytes") - if isinstance(value, bytes): - self.value = value - self.c_arg.type = GRPC_ARG_STRING - self.c_arg.value.string = self.value - elif isinstance(value, basestring): - self.value = value.encode() - self.c_arg.type = GRPC_ARG_STRING - self.c_arg.value.string = self.value - elif isinstance(value, int): + self.key = str_to_bytes(key) + self.c_arg.key = self.key + if isinstance(value, int): self.value = int(value) self.c_arg.type = GRPC_ARG_INTEGER self.c_arg.value.integer = self.value else: - raise TypeError("expected value to be of type str or bytes or int") - self.c_arg.key = self.key + self.value = str_to_bytes(value) + self.c_arg.type = GRPC_ARG_STRING + self.c_arg.value.string = self.value cdef class ChannelArgs: @@ -375,18 +348,8 @@ cdef class ChannelArgs: cdef class Metadatum: def __cinit__(self, key, value): - if isinstance(key, bytes): - self._key = key - elif isinstance(key, basestring): - self._key = key.encode() - else: - raise TypeError("expected key to be of type str or bytes") - if isinstance(value, bytes): - self._value = value - elif isinstance(value, basestring): - self._value = value.encode() - else: - raise TypeError("expected value to be of type str or bytes") + self._key = str_to_bytes(key) + self._value = str_to_bytes(value) self.c_metadata.key = self._key self.c_metadata.value = self._value self.c_metadata.value_length = len(self._value) @@ -601,12 +564,7 @@ def operation_send_close_from_client(int flags): def operation_send_status_from_server( Metadata metadata, grpc_status_code code, details, int flags): - if isinstance(details, bytes): - pass - elif isinstance(details, basestring): - details = details.encode() - else: - raise TypeError("expected a str or bytes object for details") + details = str_to_bytes(details) cdef Operation op = Operation() op.c_op.type = GRPC_OP_SEND_STATUS_FROM_SERVER op.c_op.flags = flags diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 55948755b2f..c8a73e65d6f 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -103,12 +103,7 @@ cdef class Server: def add_http2_port(self, address, ServerCredentials server_credentials=None): - if isinstance(address, bytes): - pass - elif isinstance(address, basestring): - address = address.encode() - else: - raise TypeError("expected address to be a str or bytes") + address = str_to_bytes(address) self.references.append(address) cdef int result cdef char *address_c_string = address diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx index 8823ea5ef5e..cf146f5a048 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pyx +++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx @@ -35,6 +35,7 @@ import sys # TODO(atash): figure out why the coverage tool gets confused about the Cython # coverage plugin when the following files don't have a '.pxi' suffix. +include "grpc/_cython/_cygrpc/grpc_string.pyx.pxi" include "grpc/_cython/_cygrpc/call.pyx.pxi" include "grpc/_cython/_cygrpc/channel.pyx.pxi" include "grpc/_cython/_cygrpc/credentials.pyx.pxi" diff --git a/src/python/grpcio/grpc/_links/service.py b/src/python/grpcio/grpc/_links/service.py index 11310e22409..5fc4994ca0e 100644 --- a/src/python/grpcio/grpc/_links/service.py +++ b/src/python/grpcio/grpc/_links/service.py @@ -33,6 +33,7 @@ import abc import enum import logging import threading +import six import time from grpc._adapter import _intermediary_low @@ -177,7 +178,10 @@ class _Kernel(object): call = service_acceptance.call call.accept(self._completion_queue, call) try: - group, method = service_acceptance.method.split(b'/')[1:3] + service_method = service_acceptance.method + if six.PY3: + service_method = service_method.decode('latin1') + group, method = service_method.split('/')[1:3] except ValueError: logging.info('Illegal path "%s"!', service_acceptance.method) return diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index aae9f48ae6c..f4f67204977 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -85,7 +85,7 @@ def _abortion_code(state, code): def _details(state): - return b'' if state.details is None else state.details + return '' if state.details is None else state.details class _HandlerCallDetails( @@ -189,7 +189,7 @@ def _receive_message(state, call, request_deserializer): if request is None: _abort( state, call, cygrpc.StatusCode.internal, - b'Exception deserializing request!') + 'Exception deserializing request!') else: state.request = request state.condition.notify_all() @@ -340,7 +340,7 @@ def _unary_request(rpc_event, state, request_deserializer): state.condition.wait() if state.request is None: if state.client is _CLOSED: - details = b'"{}" requires exactly one request message.'.format( + details = '"{}" requires exactly one request message.'.format( rpc_event.request_call_details.method) # TODO(5992#issuecomment-220761992): really, what status code? _abort( @@ -363,7 +363,7 @@ def _call_behavior(rpc_event, state, behavior, argument, request_deserializer): except Exception as e: # pylint: disable=broad-except with state.condition: if e not in state.rpc_errors: - details = b'Exception calling application: {}'.format(e) + details = 'Exception calling application: {}'.format(e) logging.exception(details) _abort( state, rpc_event.operation_call, cygrpc.StatusCode.unknown, details) @@ -378,7 +378,7 @@ def _take_response_from_response_iterator(rpc_event, state, response_iterator): except Exception as e: # pylint: disable=broad-except with state.condition: if e not in state.rpc_errors: - details = b'Exception iterating responses: {}'.format(e) + details = 'Exception iterating responses: {}'.format(e) logging.exception(details) _abort( state, rpc_event.operation_call, cygrpc.StatusCode.unknown, details) @@ -391,7 +391,7 @@ def _serialize_response(rpc_event, state, response, response_serializer): with state.condition: _abort( state, rpc_event.operation_call, cygrpc.StatusCode.internal, - b'Failed to serialize response!') + 'Failed to serialize response!') return None else: return serialized_response @@ -544,7 +544,7 @@ def _handle_unrecognized_method(rpc_event): cygrpc.operation_receive_close_on_server(_EMPTY_FLAGS), cygrpc.operation_send_status_from_server( _EMPTY_METADATA, cygrpc.StatusCode.unimplemented, - b'Method not found!', _EMPTY_FLAGS), + 'Method not found!', _EMPTY_FLAGS), ) rpc_state = _RPCState() rpc_event.operation_call.start_batch( diff --git a/src/python/grpcio/grpc/beta/_client_adaptations.py b/src/python/grpcio/grpc/beta/_client_adaptations.py index 621fcf2174f..024808c5404 100644 --- a/src/python/grpcio/grpc/beta/_client_adaptations.py +++ b/src/python/grpcio/grpc/beta/_client_adaptations.py @@ -30,6 +30,7 @@ """Translates gRPC's client-side API into gRPC's client-side Beta API.""" import grpc +from grpc import _common from grpc._cython import cygrpc from grpc.beta import interfaces from grpc.framework.common import cardinality @@ -48,10 +49,6 @@ _STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS = { } -def _fully_qualified_method(group, method): - return b'/{}/{}'.format(group, method) - - def _effective_metadata(metadata, metadata_transformer): non_none_metadata = () if metadata is None else metadata if metadata_transformer is None: @@ -184,7 +181,7 @@ def _blocking_unary_unary( metadata_transformer, request, request_serializer, response_deserializer): try: multi_callable = channel.unary_unary( - _fully_qualified_method(group, method), + _common.fully_qualified_method(group, method), request_serializer=request_serializer, response_deserializer=response_deserializer) effective_metadata = _effective_metadata(metadata, metadata_transformer) @@ -205,7 +202,7 @@ def _future_unary_unary( channel, group, method, timeout, protocol_options, metadata, metadata_transformer, request, request_serializer, response_deserializer): multi_callable = channel.unary_unary( - _fully_qualified_method(group, method), + _common.fully_qualified_method(group, method), request_serializer=request_serializer, response_deserializer=response_deserializer) effective_metadata = _effective_metadata(metadata, metadata_transformer) @@ -219,7 +216,7 @@ def _unary_stream( channel, group, method, timeout, protocol_options, metadata, metadata_transformer, request, request_serializer, response_deserializer): multi_callable = channel.unary_stream( - _fully_qualified_method(group, method), + _common.fully_qualified_method(group, method), request_serializer=request_serializer, response_deserializer=response_deserializer) effective_metadata = _effective_metadata(metadata, metadata_transformer) @@ -235,7 +232,7 @@ def _blocking_stream_unary( response_deserializer): try: multi_callable = channel.stream_unary( - _fully_qualified_method(group, method), + _common.fully_qualified_method(group, method), request_serializer=request_serializer, response_deserializer=response_deserializer) effective_metadata = _effective_metadata(metadata, metadata_transformer) @@ -257,7 +254,7 @@ def _future_stream_unary( metadata_transformer, request_iterator, request_serializer, response_deserializer): multi_callable = channel.stream_unary( - _fully_qualified_method(group, method), + _common.fully_qualified_method(group, method), request_serializer=request_serializer, response_deserializer=response_deserializer) effective_metadata = _effective_metadata(metadata, metadata_transformer) @@ -272,7 +269,7 @@ def _stream_stream( metadata_transformer, request_iterator, request_serializer, response_deserializer): multi_callable = channel.stream_stream( - _fully_qualified_method(group, method), + _common.fully_qualified_method(group, method), request_serializer=request_serializer, response_deserializer=response_deserializer) effective_metadata = _effective_metadata(metadata, metadata_transformer) diff --git a/src/python/grpcio/grpc/beta/_server_adaptations.py b/src/python/grpcio/grpc/beta/_server_adaptations.py index 52eadf23158..79e6ca87eb5 100644 --- a/src/python/grpcio/grpc/beta/_server_adaptations.py +++ b/src/python/grpcio/grpc/beta/_server_adaptations.py @@ -33,6 +33,7 @@ import collections import threading import grpc +from grpc import _common from grpc.beta import interfaces from grpc.framework.common import cardinality from grpc.framework.common import style @@ -287,36 +288,43 @@ def _simple_method_handler( None, _adapt_stream_stream_event(implementation.stream_stream_event)) +def _flatten_method_pair_map(method_pair_map): + method_pair_map = method_pair_map or {} + flat_map = {} + for method_pair in method_pair_map: + method = _common.fully_qualified_method(method_pair[0], method_pair[1]) + flat_map[method] = method_pair_map[method_pair] + return flat_map + + class _GenericRpcHandler(grpc.GenericRpcHandler): def __init__( self, method_implementations, multi_method_implementation, request_deserializers, response_serializers): - self._method_implementations = method_implementations + self._method_implementations = _flatten_method_pair_map( + method_implementations) + self._request_deserializers = _flatten_method_pair_map( + request_deserializers) + self._response_serializers = _flatten_method_pair_map( + response_serializers) self._multi_method_implementation = multi_method_implementation - self._request_deserializers = request_deserializers or {} - self._response_serializers = response_serializers or {} def service(self, handler_call_details): - try: - group_name, method_name = handler_call_details.method.split(b'/')[1:3] - except ValueError: + method_implementation = self._method_implementations.get( + handler_call_details.method) + if method_implementation is not None: + return _simple_method_handler( + method_implementation, + self._request_deserializers.get(handler_call_details.method), + self._response_serializers.get(handler_call_details.method)) + elif self._multi_method_implementation is None: return None else: - method_implementation = self._method_implementations.get( - (group_name, method_name,)) - if method_implementation is not None: - return _simple_method_handler( - method_implementation, - self._request_deserializers.get((group_name, method_name,)), - self._response_serializers.get((group_name, method_name,))) - elif self._multi_method_implementation is None: + try: + return None #TODO(nathaniel): call the multimethod. + except face.NoSuchMethodError: return None - else: - try: - return None #TODO(nathaniel): call the multimethod. - except face.NoSuchMethodError: - return None class _Server(interfaces.Server): diff --git a/src/python/grpcio/tests/qps/benchmark_client.py b/src/python/grpcio/tests/qps/benchmark_client.py index e2922347f98..1b100bb168d 100644 --- a/src/python/grpcio/tests/qps/benchmark_client.py +++ b/src/python/grpcio/tests/qps/benchmark_client.py @@ -31,12 +31,9 @@ import abc import time -try: - import Queue as queue # Python 2.x -except ImportError: - import queue # Python 3 from concurrent import futures +from six.moves import queue from grpc.beta import implementations from grpc.framework.interfaces.face import face diff --git a/src/python/grpcio/tests/qps/client_runner.py b/src/python/grpcio/tests/qps/client_runner.py index 2d1d981733b..1fd58687ad4 100644 --- a/src/python/grpcio/tests/qps/client_runner.py +++ b/src/python/grpcio/tests/qps/client_runner.py @@ -34,7 +34,7 @@ ClientRunner invokes either periodically or in response to some event. """ import abc -import thread +import threading import time @@ -61,15 +61,18 @@ class OpenLoopClientRunner(ClientRunner): super(OpenLoopClientRunner, self).__init__(client) self._is_running = False self._interval_generator = interval_generator + self._dispatch_thread = threading.Thread( + target=self._dispatch_requests, args=()) def start(self): self._is_running = True self._client.start() - thread.start_new_thread(self._dispatch_requests, ()) - + self._dispatch_thread.start() + def stop(self): self._is_running = False self._client.stop() + self._dispatch_thread.join() self._client = None def _dispatch_requests(self): diff --git a/src/python/grpcio/tests/stress/client.py b/src/python/grpcio/tests/stress/client.py index e2e016760c8..0de2532cd88 100644 --- a/src/python/grpcio/tests/stress/client.py +++ b/src/python/grpcio/tests/stress/client.py @@ -30,10 +30,10 @@ """Entry point for running stress tests.""" import argparse -import Queue import threading from grpc.beta import implementations +from six.moves import queue from src.proto.grpc.testing import metrics_pb2 from src.proto.grpc.testing import test_pb2 @@ -94,7 +94,7 @@ def run_test(args): test_cases = _parse_weighted_test_cases(args.test_cases) test_servers = args.server_addresses.split(',') # Propagate any client exceptions with a queue - exception_queue = Queue.Queue() + exception_queue = queue.Queue() stop_event = threading.Event() hist = histogram.Histogram(1, 1) runners = [] @@ -121,7 +121,7 @@ def run_test(args): if timeout_secs < 0: timeout_secs = None raise exception_queue.get(block=True, timeout=timeout_secs) - except Queue.Empty: + except queue.Empty: # No exceptions thrown, success pass finally: diff --git a/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py b/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py index 22d4b019c7f..09ebdeff335 100644 --- a/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py +++ b/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py @@ -164,15 +164,15 @@ class EchoTest(unittest.TestCase): self.assertIsNotNone(service_accepted) self.assertIs(service_accepted.kind, _low.Event.Kind.SERVICE_ACCEPTED) self.assertIs(service_accepted.tag, service_tag) - self.assertEqual(method, service_accepted.service_acceptance.method) - self.assertEqual(self.host, service_accepted.service_acceptance.host) + self.assertEqual(method.encode(), service_accepted.service_acceptance.method) + self.assertEqual(self.host.encode(), service_accepted.service_acceptance.host) self.assertIsNotNone(service_accepted.service_acceptance.call) metadata = dict(service_accepted.metadata) - self.assertIn(client_metadata_key, metadata) - self.assertEqual(client_metadata_value, metadata[client_metadata_key]) - self.assertIn(client_binary_metadata_key, metadata) + self.assertIn(client_metadata_key.encode(), metadata) + self.assertEqual(client_metadata_value.encode(), metadata[client_metadata_key.encode()]) + self.assertIn(client_binary_metadata_key.encode(), metadata) self.assertEqual(client_binary_metadata_value, - metadata[client_binary_metadata_key]) + metadata[client_binary_metadata_key.encode()]) server_call = service_accepted.service_acceptance.call server_call.accept(self.server_completion_queue, finish_tag) server_call.add_metadata(server_leading_metadata_key, @@ -186,12 +186,12 @@ class EchoTest(unittest.TestCase): self.assertEqual(_low.Event.Kind.METADATA_ACCEPTED, metadata_accepted.kind) self.assertEqual(metadata_tag, metadata_accepted.tag) metadata = dict(metadata_accepted.metadata) - self.assertIn(server_leading_metadata_key, metadata) - self.assertEqual(server_leading_metadata_value, - metadata[server_leading_metadata_key]) - self.assertIn(server_leading_binary_metadata_key, metadata) + self.assertIn(server_leading_metadata_key.encode(), metadata) + self.assertEqual(server_leading_metadata_value.encode(), + metadata[server_leading_metadata_key.encode()]) + self.assertIn(server_leading_binary_metadata_key.encode(), metadata) self.assertEqual(server_leading_binary_metadata_value, - metadata[server_leading_binary_metadata_key]) + metadata[server_leading_binary_metadata_key.encode()]) for datum in test_data: client_call.write(datum, write_tag, _low.WriteFlags.WRITE_NO_COMPRESS) @@ -277,17 +277,17 @@ class EchoTest(unittest.TestCase): self.assertIsNone(read_accepted.bytes) self.assertEqual(_low.Event.Kind.FINISH, finish_accepted.kind) self.assertEqual(finish_tag, finish_accepted.tag) - self.assertEqual(_low.Status(_low.Code.OK, details), finish_accepted.status) + self.assertEqual(_low.Status(_low.Code.OK, details.encode()), finish_accepted.status) metadata = dict(finish_accepted.metadata) - self.assertIn(server_trailing_metadata_key, metadata) - self.assertEqual(server_trailing_metadata_value, - metadata[server_trailing_metadata_key]) - self.assertIn(server_trailing_binary_metadata_key, metadata) + self.assertIn(server_trailing_metadata_key.encode(), metadata) + self.assertEqual(server_trailing_metadata_value.encode(), + metadata[server_trailing_metadata_key.encode()]) + self.assertIn(server_trailing_binary_metadata_key.encode(), metadata) self.assertEqual(server_trailing_binary_metadata_value, - metadata[server_trailing_binary_metadata_key]) + metadata[server_trailing_binary_metadata_key.encode()]) self.assertSetEqual(set(key for key, _ in finish_accepted.metadata), - set((server_trailing_metadata_key, - server_trailing_binary_metadata_key,))) + set((server_trailing_metadata_key.encode(), + server_trailing_binary_metadata_key.encode(),))) self.assertSequenceEqual(test_data, server_data) self.assertSequenceEqual(test_data, client_data) @@ -302,7 +302,8 @@ class EchoTest(unittest.TestCase): self._perform_echo_test([_BYTE_SEQUENCE]) def testManyOneByteEchoes(self): - self._perform_echo_test(_BYTE_SEQUENCE) + self._perform_echo_test( + [_BYTE_SEQUENCE[i:i+1] for i in range(len(_BYTE_SEQUENCE))]) def testManyManyByteEchoes(self): self._perform_echo_test(_BYTE_SEQUENCE_SEQUENCE) @@ -409,7 +410,7 @@ class CancellationTest(unittest.TestCase): finish_event = self.client_events.get() self.assertEqual(_low.Event.Kind.FINISH, finish_event.kind) - self.assertEqual(_low.Status(_low.Code.CANCELLED, 'Cancelled'), + self.assertEqual(_low.Status(_low.Code.CANCELLED, b'Cancelled'), finish_event.status) self.assertSequenceEqual(test_data, server_data) diff --git a/src/python/grpcio/tests/unit/_adapter/_low_test.py b/src/python/grpcio/tests/unit/_adapter/_low_test.py index ec46617996b..e09a1f2564f 100644 --- a/src/python/grpcio/tests/unit/_adapter/_low_test.py +++ b/src/python/grpcio/tests/unit/_adapter/_low_test.py @@ -148,11 +148,11 @@ class InsecureServerInsecureClient(unittest.TestCase): # Check that Python's user agent string is a part of the full user agent # string received_initial_metadata_dict = dict(received_initial_metadata) - self.assertIn('user-agent', received_initial_metadata_dict) - self.assertIn('Python-gRPC-{}'.format(_grpcio_metadata.__version__), - received_initial_metadata_dict['user-agent']) - self.assertEqual(method, request_event.call_details.method) - self.assertEqual(host, request_event.call_details.host) + self.assertIn(b'user-agent', received_initial_metadata_dict) + self.assertIn('Python-gRPC-{}'.format(_grpcio_metadata.__version__).encode(), + received_initial_metadata_dict[b'user-agent']) + self.assertEqual(method.encode(), request_event.call_details.method) + self.assertEqual(host.encode(), request_event.call_details.host) self.assertLess(abs(deadline - request_event.call_details.deadline), deadline_tolerance) @@ -198,12 +198,12 @@ class InsecureServerInsecureClient(unittest.TestCase): test_common.metadata_transmitted(server_initial_metadata, client_result.initial_metadata)) elif client_result.type == _types.OpType.RECV_MESSAGE: - self.assertEqual(response, client_result.message) + self.assertEqual(response.encode(), client_result.message) elif client_result.type == _types.OpType.RECV_STATUS_ON_CLIENT: self.assertTrue( test_common.metadata_transmitted(server_trailing_metadata, client_result.trailing_metadata)) - self.assertEqual(server_status_details, client_result.status.details) + self.assertEqual(server_status_details.encode(), client_result.status.details) self.assertEqual(server_status_code, client_result.status.code) self.assertEqual(set([ _types.OpType.SEND_INITIAL_METADATA, @@ -220,7 +220,7 @@ class InsecureServerInsecureClient(unittest.TestCase): self.assertNotIn(client_result.type, found_server_op_types) found_server_op_types.add(server_result.type) if server_result.type == _types.OpType.RECV_MESSAGE: - self.assertEqual(request, server_result.message) + self.assertEqual(request.encode(), server_result.message) elif server_result.type == _types.OpType.RECV_CLOSE_ON_SERVER: self.assertFalse(server_result.cancelled) self.assertEqual(set([ diff --git a/src/python/grpcio/tests/unit/_cython/cygrpc_test.py b/src/python/grpcio/tests/unit/_cython/cygrpc_test.py index 4039c1b99bd..a006a20ce3f 100644 --- a/src/python/grpcio/tests/unit/_cython/cygrpc_test.py +++ b/src/python/grpcio/tests/unit/_cython/cygrpc_test.py @@ -37,7 +37,7 @@ from tests.unit import test_common from tests.unit import resources -_SSL_HOST_OVERRIDE = 'foo.test.google.fr' +_SSL_HOST_OVERRIDE = b'foo.test.google.fr' _CALL_CREDENTIALS_METADATA_KEY = 'call-creds-key' _CALL_CREDENTIALS_METADATA_VALUE = 'call-creds-value' _EMPTY_FLAGS = 0 diff --git a/src/python/grpcio/tests/unit/_links/_transmission_test.py b/src/python/grpcio/tests/unit/_links/_transmission_test.py index 888684d197d..1f6edd18ca7 100644 --- a/src/python/grpcio/tests/unit/_links/_transmission_test.py +++ b/src/python/grpcio/tests/unit/_links/_transmission_test.py @@ -153,7 +153,7 @@ class RoundTripTest(unittest.TestCase): invocation_mate.tickets()[-1].termination, links.Ticket.Termination.COMPLETION) self.assertIs(invocation_mate.tickets()[-1].code, test_code) - self.assertEqual(invocation_mate.tickets()[-1].message, test_message) + self.assertEqual(invocation_mate.tickets()[-1].message, test_message.encode()) def _perform_scenario_test(self, scenario): test_operation_id = object() diff --git a/src/python/grpcio/tests/unit/_rpc_test.py b/src/python/grpcio/tests/unit/_rpc_test.py index 1c7a14c5d01..b33bff490c7 100644 --- a/src/python/grpcio/tests/unit/_rpc_test.py +++ b/src/python/grpcio/tests/unit/_rpc_test.py @@ -29,6 +29,8 @@ """Test of gRPC Python's application-layer API.""" +from __future__ import division + import itertools import threading import unittest @@ -41,9 +43,9 @@ from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_control _SERIALIZE_REQUEST = lambda bytestring: bytestring * 2 -_DESERIALIZE_REQUEST = lambda bytestring: bytestring[len(bytestring) / 2:] +_DESERIALIZE_REQUEST = lambda bytestring: bytestring[len(bytestring) // 2:] _SERIALIZE_RESPONSE = lambda bytestring: bytestring * 3 -_DESERIALIZE_RESPONSE = lambda bytestring: bytestring[:len(bytestring) / 3] +_DESERIALIZE_RESPONSE = lambda bytestring: bytestring[:len(bytestring) // 3] _UNARY_UNARY = b'/test/UnaryUnary' _UNARY_STREAM = b'/test/UnaryStream' @@ -189,7 +191,7 @@ class RPCTest(unittest.TestCase): self._server.add_generic_rpc_handlers((_GenericHandler(self._handler),)) self._server.start() - self._channel = grpc.insecure_channel(b'localhost:%d' % port) + self._channel = grpc.insecure_channel('localhost:%d' % port) # TODO(nathaniel): Why is this necessary, and only in some development # environments? diff --git a/src/python/grpcio/tests/unit/beta/_beta_features_test.py b/src/python/grpcio/tests/unit/beta/_beta_features_test.py index bb2893a21b9..3a9701b8ebe 100644 --- a/src/python/grpcio/tests/unit/beta/_beta_features_test.py +++ b/src/python/grpcio/tests/unit/beta/_beta_features_test.py @@ -42,8 +42,8 @@ from tests.unit.framework.common import test_constants _SERVER_HOST_OVERRIDE = 'foo.test.google.fr' -_PER_RPC_CREDENTIALS_METADATA_KEY = 'my-call-credentials-metadata-key' -_PER_RPC_CREDENTIALS_METADATA_VALUE = 'my-call-credentials-metadata-value' +_PER_RPC_CREDENTIALS_METADATA_KEY = b'my-call-credentials-metadata-key' +_PER_RPC_CREDENTIALS_METADATA_VALUE = b'my-call-credentials-metadata-value' _GROUP = 'group' _UNARY_UNARY = 'unary-unary' diff --git a/src/python/grpcio/tests/unit/beta/_not_found_test.py b/src/python/grpcio/tests/unit/beta/_not_found_test.py index 44fcd1e13c2..37b8c49120f 100644 --- a/src/python/grpcio/tests/unit/beta/_not_found_test.py +++ b/src/python/grpcio/tests/unit/beta/_not_found_test.py @@ -61,7 +61,7 @@ class NotFoundTest(unittest.TestCase): def test_future_stream_unary_not_found(self): rpc_future = self._generic_stub.future_stream_unary( - 'grupe', 'mevvod', b'def', test_constants.LONG_TIMEOUT) + 'grupe', 'mevvod', [b'def'], test_constants.LONG_TIMEOUT) with self.assertRaises(face.LocalError) as exception_assertion_context: rpc_future.result() self.assertIs( diff --git a/src/python/grpcio/tests/unit/framework/interfaces/base/test_cases.py b/src/python/grpcio/tests/unit/framework/interfaces/base/test_cases.py index 4f8e26c9a26..5d16bf98be3 100644 --- a/src/python/grpcio/tests/unit/framework/interfaces/base/test_cases.py +++ b/src/python/grpcio/tests/unit/framework/interfaces/base/test_cases.py @@ -29,6 +29,8 @@ """Tests of the base interface of RPC Framework.""" +from __future__ import division + import logging import random import threading @@ -54,13 +56,13 @@ class _Serialization(test_interfaces.Serialization): return request + request def deserialize_request(self, serialized_request): - return serialized_request[:len(serialized_request) / 2] + return serialized_request[:len(serialized_request) // 2] def serialize_response(self, response): return response * 3 def deserialize_response(self, serialized_response): - return serialized_response[2 * len(serialized_response) / 3:] + return serialized_response[2 * len(serialized_response) // 3:] def _advance(quadruples, operator, controller): diff --git a/src/python/grpcio/tests/unit/test_common.py b/src/python/grpcio/tests/unit/test_common.py index 7b4d20dccbe..b779f65e7e9 100644 --- a/src/python/grpcio/tests/unit/test_common.py +++ b/src/python/grpcio/tests/unit/test_common.py @@ -61,6 +61,10 @@ def metadata_transmitted(original_metadata, transmitted_metadata): original = collections.defaultdict(list) for key_value_pair in original_metadata: key, value = tuple(key_value_pair) + if not isinstance(key, bytes): + key = key.encode() + if not isinstance(value, bytes): + value = value.encode() original[key].append(value) transmitted = collections.defaultdict(list) for key_value_pair in transmitted_metadata: diff --git a/tools/gce/linux_performance_worker_init.sh b/tools/gce/linux_performance_worker_init.sh index dc4784262e7..9b8d1d1eb74 100755 --- a/tools/gce/linux_performance_worker_init.sh +++ b/tools/gce/linux_performance_worker_init.sh @@ -69,6 +69,10 @@ sudo apt-get install -y \ python-pip \ python-setuptools \ python-yaml \ + python3-dev \ + python3-pip \ + python3-setuptools \ + python3-yaml \ telnet \ unzip \ wget \ diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh index 4cc6881ef5a..b1c90df824c 100755 --- a/tools/run_tests/build_python.sh +++ b/tools/run_tests/build_python.sh @@ -34,6 +34,7 @@ set -ex cd $(dirname $0)/../.. TOX_PYTHON_ENV="$1" +PY_VERSION="${TOX_PYTHON_ENV: -2}" ROOT=`pwd` export LD_LIBRARY_PATH=$ROOT/libs/$CONFIG @@ -51,11 +52,25 @@ fi tox -e ${TOX_PYTHON_ENV} --notest +# We force the .so naming convention in PEP 3149 for side by side installation support +# Note this is the default in Python3, but explicitly disabled for Darwin, so we only +# use this hack for our testing environment. +if [ "$PY_VERSION" -gt "27" ] +then + mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so.backup || true +fi + $ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build $ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build_py $ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py build_ext --inplace $ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/setup.py gather --test +if [ "$PY_VERSION" -gt "27" ] +then + mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so $ROOT/src/python/grpcio/grpc/_cython/cygrpc.cpython-${PY_VERSION}m.so || true + mv $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so.backup $ROOT/src/python/grpcio/grpc/_cython/cygrpc.so || true +fi + # Build the health checker $ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/src/python/grpcio_health_checking/setup.py build $ROOT/.tox/${TOX_PYTHON_ENV}/bin/python $ROOT/src/python/grpcio_health_checking/setup.py build_py diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh index 7a3ce6b821a..8059059d41b 100755 --- a/tools/run_tests/run_python.sh +++ b/tools/run_tests/run_python.sh @@ -55,3 +55,4 @@ fi mkdir -p $ROOT/reports rm -rf $ROOT/reports/python-coverage (mv -T $ROOT/htmlcov $ROOT/reports/python-coverage) || true + diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index f7282dddb85..f4582ad3a74 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -374,7 +374,7 @@ class PythonLanguage(object): def configure(self, config, args): self.config = config self.args = args - self._tox_env = self._get_tox_env(self.args.compiler) + self._tox_envs = self._get_tox_envs(self.args.compiler) def test_specs(self): # load list of known test suites @@ -386,19 +386,21 @@ class PythonLanguage(object): os.path.abspath('src/python/grpcio_health_checking')) if self.config.build_config != 'gcov': return [self.config.job_spec( - ['tools/run_tests/run_python.sh', self._tox_env], + ['tools/run_tests/run_python.sh', tox_env], None, environ=dict(environment.items() + [('GRPC_PYTHON_TESTRUNNER_FILTER', suite_name)]), - shortname='py.test.%s' % suite_name, + shortname='%s.test.%s' % (tox_env, suite_name), timeout_seconds=5*60) - for suite_name in tests_json] + for suite_name in tests_json + for tox_env in self._tox_envs] else: - return [self.config.job_spec(['tools/run_tests/run_python.sh'], + return [self.config.job_spec(['tools/run_tests/run_python.sh', tox_env], None, environ=environment, - shortname='py.test.coverage', - timeout_seconds=15*60)] + shortname='%s.test.coverage' % tox_env, + timeout_seconds=15*60) + for tox_env in self._tox_envs] def pre_build_steps(self): @@ -411,7 +413,8 @@ class PythonLanguage(object): return [] def build_steps(self): - return [['tools/run_tests/build_python.sh', self._tox_env]] + return [['tools/run_tests/build_python.sh', tox_env] + for tox_env in self._tox_envs] def post_tests_steps(self): return [] @@ -422,12 +425,14 @@ class PythonLanguage(object): def dockerfile_dir(self): return 'tools/dockerfile/test/python_jessie_%s' % _docker_arch_suffix(self.args.arch) - def _get_tox_env(self, compiler): + def _get_tox_envs(self, compiler): """Returns name of tox environment based on selected compiler.""" - if compiler == 'python2.7' or compiler == 'default': - return 'py27' + if compiler == 'default': + return ('py27', 'py34') + elif compiler == 'python2.7': + return ('py27',) elif compiler == 'python3.4': - return 'py34' + return ('py34',) else: raise Exception('Compiler %s not supported.' % compiler) From 1f24af879c507927203f11301e6ff2439bdbeff8 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 10 Jun 2016 13:15:07 -0700 Subject: [PATCH 143/175] Restricted the check to GUNC --- include/grpc/impl/codegen/log.h | 3 +-- include/grpc/impl/codegen/port_platform.h | 9 +++++++++ include/grpc/support/string_util.h | 4 ++-- src/core/lib/support/log_linux.c | 4 ++-- .../core/client_config/set_initial_connect_string_test.c | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/grpc/impl/codegen/log.h b/include/grpc/impl/codegen/log.h index 9090a34cd55..e5010c29da8 100644 --- a/include/grpc/impl/codegen/log.h +++ b/include/grpc/impl/codegen/log.h @@ -75,8 +75,7 @@ const char *gpr_log_severity_string(gpr_log_severity severity); /* Log a message. It's advised to use GPR_xxx above to generate the context * for each message */ GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, - const char *format, ...) - __attribute__((format(printf, 4, 5))); + const char *format, ...) GPRC_PRINT_FORMAT_CHECK(4, 5); GPRAPI void gpr_log_message(const char *file, int line, gpr_log_severity severity, const char *message); diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index 7fff36cb789..9640ab60089 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -434,6 +434,15 @@ typedef unsigned __int64 uint64_t; #endif #endif +#ifndef GPRC_PRINT_FORMAT_CHECK +#ifdef __GNUC__ +#define GPRC_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) \ + __attribute__((format(printf, FORMAT_STR, ARGS))) +#else +#define GPRC_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) +#endif +#endif /* GPRC_PRINT_FORMAT_CHECK */ + #if GPR_FORBID_UNREACHABLE_CODE #define GPR_UNREACHABLE_CODE(STATEMENT) #else diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index c68577b6269..05cbd3b8c92 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -54,8 +54,8 @@ GPRAPI char *gpr_strdup(const char *src); On error, returns -1 and sets *strp to NULL. If the format string is bad, the result is undefined. */ -GPRAPI int gpr_asprintf(char **strp, const char *format, ...) - __attribute__((format(printf, 2, 3))); +GPRAPI int gpr_asprintf(char **strp, const char *format, + ...) GPRC_PRINT_FORMAT_CHECK(2, 3); #ifdef __cplusplus } diff --git a/src/core/lib/support/log_linux.c b/src/core/lib/support/log_linux.c index ca04c022e3f..508fae4eec3 100644 --- a/src/core/lib/support/log_linux.c +++ b/src/core/lib/support/log_linux.c @@ -95,9 +95,9 @@ void gpr_default_log(gpr_log_func_args *args) { strcpy(time_buffer, "error:strftime"); } - gpr_asprintf(&prefix, "%s%s.%09d %7tu %s:%d]", + gpr_asprintf(&prefix, "%s%s.%09" PRId32 " %7ld %s:%d]", gpr_log_severity_string(args->severity), time_buffer, - (int)(now.tv_nsec), gettid(), display_file, args->line); + now.tv_nsec, gettid(), display_file, args->line); fprintf(stderr, "%-60s %s\n", prefix, args->message); gpr_free(prefix); diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c index 9f47671f4df..63371a6b341 100644 --- a/test/core/client_config/set_initial_connect_string_test.c +++ b/test/core/client_config/set_initial_connect_string_test.c @@ -173,7 +173,7 @@ static void actually_poll_server(void *arg) { bool done = gpr_atm_acq_load(&state.done_atm) != 0; gpr_timespec time_left = gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME)); - gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIuPTR ".%09d", done, + gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09" PRId32, done, time_left.tv_sec, time_left.tv_nsec); if (done || gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) < 0) { break; From 0ba114408ebb153b29c85dd8be9847095a6a6954 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 10 Jun 2016 15:15:44 -0700 Subject: [PATCH 144/175] Fix gpr_log format mismatches in c++ tests --- include/grpc/support/string_util.h | 4 ++-- .../ext/transport/chttp2/transport/chttp2_transport.c | 4 ++-- test/cpp/end2end/async_end2end_test.cc | 3 ++- test/cpp/interop/client.cc | 5 +++-- test/cpp/interop/interop_client.cc | 10 ++++++---- test/cpp/interop/metrics_client.cc | 2 +- test/cpp/qps/driver.cc | 8 ++++---- test/cpp/qps/parse_json.cc | 2 +- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index 05cbd3b8c92..952cbfc26b9 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -54,8 +54,8 @@ GPRAPI char *gpr_strdup(const char *src); On error, returns -1 and sets *strp to NULL. If the format string is bad, the result is undefined. */ -GPRAPI int gpr_asprintf(char **strp, const char *format, - ...) GPRC_PRINT_FORMAT_CHECK(2, 3); +GPRAPI int gpr_asprintf(char **strp, const char *format, ...) + GPRC_PRINT_FORMAT_CHECK(2, 3); #ifdef __cplusplus } diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 047f164eca8..c37867a6aa0 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -957,7 +957,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, if (metadata_size > metadata_peer_limit) { gpr_log(GPR_DEBUG, "to-be-sent initial metadata size exceeds peer limit " - "(%lu vs. %lu)", + "(%" PRIuPTR " vs. %" PRIuPTR ")", metadata_size, metadata_peer_limit); cancel_from_api(exec_ctx, transport_global, stream_global, GRPC_STATUS_RESOURCE_EXHAUSTED); @@ -1012,7 +1012,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, if (metadata_size > metadata_peer_limit) { gpr_log(GPR_DEBUG, "to-be-sent trailing metadata size exceeds peer limit " - "(%lu vs. %lu)", + "(%" PRIuPTR " vs. %" PRIuPTR ")", metadata_size, metadata_peer_limit); cancel_from_api(exec_ctx, transport_global, stream_global, GRPC_STATUS_RESOURCE_EXHAUSTED); diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index b8398015006..5915187d438 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -231,7 +231,8 @@ class TestScenario { void Log() const { gpr_log(GPR_INFO, "Scenario: disable_blocking %d, credentials %s, message size %d", - disable_blocking, credentials_type.c_str(), message_content.size()); + disable_blocking, credentials_type.c_str(), + (int)(message_content.size())); } bool disable_blocking; const grpc::string credentials_type; diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 77278249794..addaf174f2b 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -171,8 +171,9 @@ int main(int argc, char** argv) { "large_unary|large_compressed_unary|client_streaming|server_streaming|" "server_compressed_streaming|half_duplex|ping_pong|cancel_after_begin|" "cancel_after_first_response|timeout_on_sleeping_server|empty_stream|" - "compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds", - "status_code_and_message|custom_metadata", FLAGS_test_case.c_str()); + "compute_engine_creds|jwt_token_creds|oauth2_auth_token|per_rpc_creds|" + "status_code_and_message|custom_metadata", + FLAGS_test_case.c_str()); ret = 1; } diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index a0479e8f689..f9813f38c17 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -433,7 +433,7 @@ bool InteropClient::DoResponseStreaming() { // most likely due to connection failure. gpr_log(GPR_ERROR, "DoResponseStreaming(): Read fewer streams (%d) than " - "response_stream_sizes.size() (%d)", + "response_stream_sizes.size() (%" PRIu64 ")", i, response_stream_sizes.size()); return TransientFailureOrAbort(); } @@ -517,9 +517,11 @@ bool InteropClient::DoResponseCompressedStreaming() { // stream->Read() failed before reading all the expected messages. This // is most likely due to a connection failure. gpr_log(GPR_ERROR, - "DoResponseCompressedStreaming(): Responses read (k=%d) is " + "DoResponseCompressedStreaming(): Responses read (k=%" PRIuPTR + ") is " "less than the expected messages (i.e " - "response_stream_sizes.size() (%d)). (i=%d, j=%d)", + "response_stream_sizes.size() (%" PRIu64 ")). (i=%" PRIuPTR + ", j=%" PRIuPTR ")", k, response_stream_sizes.size(), i, j); return TransientFailureOrAbort(); } @@ -608,7 +610,7 @@ bool InteropClient::DoHalfDuplex() { // most likely due to a connection failure gpr_log(GPR_ERROR, "DoHalfDuplex(): Responses read (i=%d) are less than the expected " - "number of messages response_stream_sizes.size() (%d)", + "number of messages response_stream_sizes.size() (%" PRIu64 ")", i, response_stream_sizes.size()); return TransientFailureOrAbort(); } diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index c8c2215fab1..7a0cb994df5 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -76,7 +76,7 @@ bool PrintMetrics(std::unique_ptr stub, bool total_only, while (reader->Read(&gauge_response)) { if (gauge_response.value_case() == GaugeResponse::kLongValue) { if (!total_only) { - gpr_log(GPR_INFO, "%s: %ld", gauge_response.name().c_str(), + gpr_log(GPR_INFO, "%s: %lld", gauge_response.name().c_str(), gauge_response.long_value()); } overall_qps += gauge_response.long_value(); diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 57d8c22a954..83dbdc3e59e 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -244,8 +244,8 @@ std::unique_ptr RunScenario( // where class contained in std::vector must have a copy constructor auto* servers = new ServerData[num_servers]; for (size_t i = 0; i < num_servers; i++) { - gpr_log(GPR_INFO, "Starting server on %s (worker #%d)", workers[i].c_str(), - i); + gpr_log(GPR_INFO, "Starting server on %s (worker #%" PRIuPTR ")", + workers[i].c_str(), i); servers[i].stub = WorkerService::NewStub( CreateChannel(workers[i], InsecureChannelCredentials())); @@ -307,8 +307,8 @@ std::unique_ptr RunScenario( auto* clients = new ClientData[num_clients]; for (size_t i = 0; i < num_clients; i++) { const auto& worker = workers[i + num_servers]; - gpr_log(GPR_INFO, "Starting client on %s (worker #%d)", worker.c_str(), - i + num_servers); + gpr_log(GPR_INFO, "Starting client on %s (worker #%" PRIuPTR ")", + worker.c_str(), i + num_servers); clients[i].stub = WorkerService::NewStub( CreateChannel(worker, InsecureChannelCredentials())); ClientConfig per_client_config = client_config; diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc index be804281f81..e4fc35fa414 100644 --- a/test/cpp/qps/parse_json.cc +++ b/test/cpp/qps/parse_json.cc @@ -55,7 +55,7 @@ void ParseJson(const grpc::string& json, const grpc::string& type, grpc::string errmsg(status.error_message()); gpr_log(GPR_ERROR, "Failed to convert json to binary: errcode=%d msg=%s", status.error_code(), errmsg.c_str()); - gpr_log(GPR_ERROR, "JSON: ", json.c_str()); + gpr_log(GPR_ERROR, "JSON: %s", json.c_str()); abort(); } GPR_ASSERT(msg->ParseFromString(binary)); From beaa35724c4eb67eb5f890d6f66e0fd3b2f50aaa Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 10 Jun 2016 15:46:14 -0700 Subject: [PATCH 145/175] Fix type mismatch for type_size --- src/core/ext/transport/chttp2/transport/parsing.c | 6 ++++-- test/cpp/end2end/async_end2end_test.cc | 8 ++++---- test/cpp/end2end/zookeeper_test.cc | 2 +- test/cpp/interop/interop_client.cc | 6 +++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 8f72a4ff992..3c74258352e 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -649,7 +649,8 @@ static void on_initial_header(void *tp, grpc_mdelem *md) { if (new_size > metadata_size_limit) { if (!stream_parsing->exceeded_metadata_size) { gpr_log(GPR_DEBUG, - "received initial metadata size exceeds limit (%lu vs. %lu)", + "received initial metadata size exceeds limit (%" PRIuPTR + " vs. %" PRIuPTR ")", new_size, metadata_size_limit); stream_parsing->seen_error = true; stream_parsing->exceeded_metadata_size = true; @@ -695,7 +696,8 @@ static void on_trailing_header(void *tp, grpc_mdelem *md) { if (new_size > metadata_size_limit) { if (!stream_parsing->exceeded_metadata_size) { gpr_log(GPR_DEBUG, - "received trailing metadata size exceeds limit (%lu vs. %lu)", + "received trailing metadata size exceeds limit (%" PRIuPTR + " vs. %" PRIuPTR ")", new_size, metadata_size_limit); stream_parsing->seen_error = true; stream_parsing->exceeded_metadata_size = true; diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 5915187d438..8229bda6bf2 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -229,10 +229,10 @@ class TestScenario { credentials_type(creds_type), message_content(content) {} void Log() const { - gpr_log(GPR_INFO, - "Scenario: disable_blocking %d, credentials %s, message size %d", - disable_blocking, credentials_type.c_str(), - (int)(message_content.size())); + gpr_log( + GPR_INFO, + "Scenario: disable_blocking %d, credentials %s, message size %" PRIuPTR, + disable_blocking, credentials_type.c_str(), message_content.size()); } bool disable_blocking; const grpc::string credentials_type; diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index 12853a1b985..b44668fe84f 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -101,7 +101,7 @@ class ZookeeperTest : public ::testing::Test { zookeeper_address_ = addr_str; gpr_free(addr); } - gpr_log(GPR_DEBUG, zookeeper_address_.c_str()); + gpr_log(GPR_DEBUG, "%s, " zookeeper_address_.c_str()); // Connects to zookeeper server zoo_set_debug_level(ZOO_LOG_LEVEL_WARN); diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index f9813f38c17..0bf1fd6f737 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -433,7 +433,7 @@ bool InteropClient::DoResponseStreaming() { // most likely due to connection failure. gpr_log(GPR_ERROR, "DoResponseStreaming(): Read fewer streams (%d) than " - "response_stream_sizes.size() (%" PRIu64 ")", + "response_stream_sizes.size() (%" PRIuPTR ")", i, response_stream_sizes.size()); return TransientFailureOrAbort(); } @@ -520,7 +520,7 @@ bool InteropClient::DoResponseCompressedStreaming() { "DoResponseCompressedStreaming(): Responses read (k=%" PRIuPTR ") is " "less than the expected messages (i.e " - "response_stream_sizes.size() (%" PRIu64 ")). (i=%" PRIuPTR + "response_stream_sizes.size() (%" PRIuPTR ")). (i=%" PRIuPTR ", j=%" PRIuPTR ")", k, response_stream_sizes.size(), i, j); return TransientFailureOrAbort(); @@ -610,7 +610,7 @@ bool InteropClient::DoHalfDuplex() { // most likely due to a connection failure gpr_log(GPR_ERROR, "DoHalfDuplex(): Responses read (i=%d) are less than the expected " - "number of messages response_stream_sizes.size() (%" PRIu64 ")", + "number of messages response_stream_sizes.size() (%" PRIuPTR ")", i, response_stream_sizes.size()); return TransientFailureOrAbort(); } From 654db3d33e8e972ce5a3b20e642870acc20ec96c Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 10 Jun 2016 15:48:11 -0700 Subject: [PATCH 146/175] Regenerate build files --- src/python/grpcio/grpc/_cython/imports.generated.h | 4 ++-- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index 16bb5cdfab6..62865f8a0e9 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -482,7 +482,7 @@ extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_impo typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_from_reader_type)(grpc_byte_buffer_reader *reader); extern grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import; #define grpc_raw_byte_buffer_from_reader grpc_raw_byte_buffer_from_reader_import -typedef void(*gpr_log_type)(const char *file, int line, gpr_log_severity severity, const char *format, ...); +typedef void(*gpr_log_type)(const char *file, int line, gpr_log_severity severity, const char *format, ...) GPRC_PRINT_FORMAT_CHECK(4, 5); extern gpr_log_type gpr_log_import; #define gpr_log gpr_log_import typedef void(*gpr_log_message_type)(const char *file, int line, gpr_log_severity severity, const char *message); @@ -821,7 +821,7 @@ extern gpr_format_message_type gpr_format_message_import; typedef char *(*gpr_strdup_type)(const char *src); extern gpr_strdup_type gpr_strdup_import; #define gpr_strdup gpr_strdup_import -typedef int(*gpr_asprintf_type)(char **strp, const char *format, ...); +typedef int(*gpr_asprintf_type)(char **strp, const char *format, ...) GPRC_PRINT_FORMAT_CHECK(2, 3); extern gpr_asprintf_type gpr_asprintf_import; #define gpr_asprintf gpr_asprintf_import typedef const char *(*gpr_subprocess_binary_extension_type)(); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 9c86a3690c5..e9845cd7e25 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -482,7 +482,7 @@ extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_impo typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_from_reader_type)(grpc_byte_buffer_reader *reader); extern grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import; #define grpc_raw_byte_buffer_from_reader grpc_raw_byte_buffer_from_reader_import -typedef void(*gpr_log_type)(const char *file, int line, gpr_log_severity severity, const char *format, ...); +typedef void(*gpr_log_type)(const char *file, int line, gpr_log_severity severity, const char *format, ...) GPRC_PRINT_FORMAT_CHECK(4, 5); extern gpr_log_type gpr_log_import; #define gpr_log gpr_log_import typedef void(*gpr_log_message_type)(const char *file, int line, gpr_log_severity severity, const char *message); @@ -821,7 +821,7 @@ extern gpr_format_message_type gpr_format_message_import; typedef char *(*gpr_strdup_type)(const char *src); extern gpr_strdup_type gpr_strdup_import; #define gpr_strdup gpr_strdup_import -typedef int(*gpr_asprintf_type)(char **strp, const char *format, ...); +typedef int(*gpr_asprintf_type)(char **strp, const char *format, ...) GPRC_PRINT_FORMAT_CHECK(2, 3); extern gpr_asprintf_type gpr_asprintf_import; #define gpr_asprintf gpr_asprintf_import typedef const char *(*gpr_subprocess_binary_extension_type)(); From bcf5023bb6ad3ddeef99b9a703b2fa245450a77a Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 10 Jun 2016 16:22:57 -0700 Subject: [PATCH 147/175] Fix zookeeper_test --- test/cpp/end2end/zookeeper_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc index b44668fe84f..fdc500e5352 100644 --- a/test/cpp/end2end/zookeeper_test.cc +++ b/test/cpp/end2end/zookeeper_test.cc @@ -101,7 +101,7 @@ class ZookeeperTest : public ::testing::Test { zookeeper_address_ = addr_str; gpr_free(addr); } - gpr_log(GPR_DEBUG, "%s, " zookeeper_address_.c_str()); + gpr_log(GPR_DEBUG, "%s", zookeeper_address_.c_str()); // Connects to zookeeper server zoo_set_debug_level(ZOO_LOG_LEVEL_WARN); From 0de6cea2077925926e68e38f7f2a9f355f7df6b5 Mon Sep 17 00:00:00 2001 From: Martin Dyring-Andersen Date: Fri, 10 Jun 2016 20:59:44 -0400 Subject: [PATCH 148/175] Fix scope problem when GPR_SUPPORT_CHANNELS_FROM_FD is not defined --- src/cpp/server/server_posix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/server/server_posix.cc b/src/cpp/server/server_posix.cc index 8cb9753a125..c3aa2adc60e 100644 --- a/src/cpp/server/server_posix.cc +++ b/src/cpp/server/server_posix.cc @@ -42,8 +42,8 @@ namespace grpc { void AddInsecureChannelFromFd(Server* server, int fd) { grpc_server_add_insecure_channel_from_fd( server->c_server(), server->completion_queue()->cq(), fd); +} #endif // GPR_SUPPORT_CHANNELS_FROM_FD -} } // namespace grpc From 77a927be5af179eba8f9c272950800dd03b349a7 Mon Sep 17 00:00:00 2001 From: vjpai Date: Sat, 11 Jun 2016 08:10:45 -0700 Subject: [PATCH 149/175] Digraph --- doc/cpp-style-guide.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/cpp-style-guide.md b/doc/cpp-style-guide.md index 271ff3984c3..9408c4abd68 100644 --- a/doc/cpp-style-guide.md +++ b/doc/cpp-style-guide.md @@ -79,4 +79,7 @@ default capture). Other C++ functional features such as constructor to be available. - Don't use `std::this_thread` . Use `gpr_sleep_until` for sleeping a thread. - +- [Some adjacent character combinations cause problems] + (https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C). If declaring a + template against some class relative to the global namespace, + `<::name` will be non-portable. Separate the `<` from the `:` and use `< ::name`. From 6d258c59d3137f29426ed7f6cc5afa376c2a50c6 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 10 Jun 2016 09:36:51 -0700 Subject: [PATCH 150/175] add support for clang3.5, clang3.7 and gcc4.6 --- .../cxx_ubuntu1604_x64/Dockerfile.template | 6 ++++ .../test/cxx_ubuntu1604_x64/Dockerfile | 6 ++++ tools/run_tests/run_tests.py | 31 +++++++++++++------ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template b/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template index c11cefd283b..e39537975bf 100644 --- a/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile.template @@ -34,6 +34,12 @@ <%include file="../../apt_get_basic.include"/> <%include file="../../cxx_deps.include"/> <%include file="../../run_tests_addons.include"/> + + # The clang-3.6 symlink for the default clang version was added + # to Ubuntu 16.04 recently, so make sure it's installed. + # Also install clang3.7. + RUN apt-get update && apt-get -y install clang-3.6 clang-3.7 && apt-get clean + # Define the default command. CMD ["bash"] \ No newline at end of file diff --git a/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile b/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile index 02d3c0d9ad6..d356433163e 100644 --- a/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile +++ b/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile @@ -82,5 +82,11 @@ RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins + +# The clang-3.6 symlink for the default clang version was added +# to Ubuntu 16.04 recently, so make sure it's installed. +# Also install clang3.7. +RUN apt-get update && apt-get -y install clang-3.6 clang-3.7 && apt-get clean + # Define the default command. CMD ["bash"] diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index f7282dddb85..4490bac898d 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -246,11 +246,17 @@ class CLanguage(object): def makefile_name(self): return 'Makefile' - def _clang_make_options(self): - return ['CC=clang', 'CXX=clang++', 'LD=clang', 'LDXX=clang++'] - - def _gcc44_make_options(self): - return ['CC=gcc-4.4', 'CXX=g++-4.4', 'LD=gcc-4.4', 'LDXX=g++-4.4'] + def _clang_make_options(self, version_suffix=''): + return ['CC=clang%s' % version_suffix, + 'CXX=clang++%s' % version_suffix, + 'LD=clang%s' % version_suffix, + 'LDXX=clang++%s' % version_suffix] + + def _gcc_make_options(self, version_suffix): + return ['CC=gcc%s' % version_suffix, + 'CXX=g++%s' % version_suffix, + 'LD=gcc%s' % version_suffix, + 'LDXX=g++%s' % version_suffix] def _compiler_options(self, use_docker, compiler): """Returns docker distro and make options to use for given compiler.""" @@ -260,13 +266,20 @@ class CLanguage(object): if compiler == 'gcc4.9' or compiler == 'default': return ('jessie', []) elif compiler == 'gcc4.4': - return ('wheezy', self._gcc44_make_options()) + return ('wheezy', self._gcc_make_options(version_suffix='-4.4')) + elif compiler == 'gcc4.6': + return ('wheezy', self._gcc_make_options(version_suffix='-4.6')) elif compiler == 'gcc5.3': return ('ubuntu1604', []) elif compiler == 'clang3.4': + # on ubuntu1404, clang-3.4 alias doesn't exist, just use 'clang' return ('ubuntu1404', self._clang_make_options()) + elif compiler == 'clang3.5': + return ('jessie', self._clang_make_options(version_suffix='-3.5')) elif compiler == 'clang3.6': - return ('ubuntu1604', self._clang_make_options()) + return ('ubuntu1604', self._clang_make_options(version_suffix='-3.6')) + elif compiler == 'clang3.7': + return ('ubuntu1604', self._clang_make_options(version_suffix='-3.7')) else: raise Exception('Compiler %s not supported.' % compiler) @@ -816,8 +829,8 @@ argp.add_argument('--arch', help='Selects architecture to target. For some platforms "default" is the only supported choice.') argp.add_argument('--compiler', choices=['default', - 'gcc4.4', 'gcc4.9', 'gcc5.3', - 'clang3.4', 'clang3.6', + 'gcc4.4', 'gcc4.6', 'gcc4.9', 'gcc5.3', + 'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7', 'vs2010', 'vs2013', 'vs2015', 'python2.7', 'python3.4', 'node0.12', 'node4', 'node5'], From 7aabab711176d425ba16b15ed8c0def84bfcee23 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Wed, 11 May 2016 13:51:13 -0700 Subject: [PATCH 151/175] Added unit test for empty request/responses --- src/python/grpcio/tests/tests.json | 1 + .../grpcio/tests/unit/_empty_message_test.py | 137 ++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 src/python/grpcio/tests/unit/_empty_message_test.py diff --git a/src/python/grpcio/tests/tests.json b/src/python/grpcio/tests/tests.json index 8dc47bf69dd..53b2998b786 100644 --- a/src/python/grpcio/tests/tests.json +++ b/src/python/grpcio/tests/tests.json @@ -28,6 +28,7 @@ "_crust_over_core_over_links_face_interface_test.GenericInvokerFutureInvocationAsynchronousEventServiceTest", "_crust_over_core_over_links_face_interface_test.MultiCallableInvokerBlockingInvocationInlineServiceTest", "_crust_over_core_over_links_face_interface_test.MultiCallableInvokerFutureInvocationAsynchronousEventServiceTest", + "_empty_message_test.EmptyMessageTest", "_face_interface_test.DynamicInvokerBlockingInvocationInlineServiceTest", "_face_interface_test.DynamicInvokerFutureInvocationAsynchronousEventServiceTest", "_face_interface_test.GenericInvokerBlockingInvocationInlineServiceTest", diff --git a/src/python/grpcio/tests/unit/_empty_message_test.py b/src/python/grpcio/tests/unit/_empty_message_test.py new file mode 100644 index 00000000000..f324f6216b7 --- /dev/null +++ b/src/python/grpcio/tests/unit/_empty_message_test.py @@ -0,0 +1,137 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import unittest + +import grpc +from grpc.framework.foundation import logging_pool + +from tests.unit.framework.common import test_constants + +_REQUEST = b'' +_RESPONSE = b'' + +_UNARY_UNARY = b'/test/UnaryUnary' +_UNARY_STREAM = b'/test/UnaryStream' +_STREAM_UNARY = b'/test/StreamUnary' +_STREAM_STREAM = b'/test/StreamStream' + + +def handle_unary_unary(request, servicer_context): + return _RESPONSE + + +def handle_unary_stream(request, servicer_context): + for _ in range(test_constants.STREAM_LENGTH): + yield _RESPONSE + + +def handle_stream_unary(request_iterator, servicer_context): + for request in request_iterator: + pass + return _RESPONSE + + +def handle_stream_stream(request_iterator, servicer_context): + for request in request_iterator: + yield _RESPONSE + + +class _MethodHandler(grpc.RpcMethodHandler): + + def __init__(self, request_streaming, response_streaming): + self.request_streaming = request_streaming + self.response_streaming = response_streaming + self.request_deserializer = None + self.response_serializer = None + self.unary_unary = None + self.unary_stream = None + self.stream_unary = None + self.stream_stream = None + if self.request_streaming and self.response_streaming: + self.stream_stream = handle_stream_stream + elif self.request_streaming: + self.stream_unary = handle_stream_unary + elif self.response_streaming: + self.unary_stream = handle_unary_stream + else: + self.unary_unary = handle_unary_unary + + +class _GenericHandler(grpc.GenericRpcHandler): + + def service(self, handler_call_details): + if handler_call_details.method == _UNARY_UNARY: + return _MethodHandler(False, False) + elif handler_call_details.method == _UNARY_STREAM: + return _MethodHandler(False, True) + elif handler_call_details.method == _STREAM_UNARY: + return _MethodHandler(True, False) + elif handler_call_details.method == _STREAM_STREAM: + return _MethodHandler(True, True) + else: + return None + + +class EmptyMessageTest(unittest.TestCase): + + def setUp(self): + self._server_pool = logging_pool.pool(test_constants.THREAD_CONCURRENCY) + self._server = grpc.server((_GenericHandler(),), self._server_pool) + port = self._server.add_insecure_port('[::]:0') + self._server.start() + self._channel = grpc.insecure_channel('localhost:%d' % port) + + def tearDown(self): + self._server.stop(0) + + def testUnaryUnary(self): + response = self._channel.unary_unary(_UNARY_UNARY)(_REQUEST) + self.assertEqual(_RESPONSE, response) + + def testUnaryStream(self): + response_iterator = self._channel.unary_stream(_UNARY_STREAM)(_REQUEST) + self.assertSequenceEqual( + [_RESPONSE] * test_constants.STREAM_LENGTH, list(response_iterator)) + + def testStreamUnary(self): + response = self._channel.stream_unary(_STREAM_UNARY)( + [_REQUEST] * test_constants.STREAM_LENGTH) + self.assertEqual(_RESPONSE, response) + + def testStreamStream(self): + response_iterator = self._channel.stream_stream(_STREAM_STREAM)( + [_REQUEST] * test_constants.STREAM_LENGTH) + self.assertSequenceEqual( + [_RESPONSE] * test_constants.STREAM_LENGTH, list(response_iterator)) + + +if __name__ == '__main__': + unittest.main(verbosity=2) + From 6b943e55fa4dc383f731bc8d30eb2c6116265771 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Mon, 13 Jun 2016 09:19:46 -0700 Subject: [PATCH 152/175] Fixed bug with server initial metadata type translation --- src/python/grpcio/grpc/_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index f4f67204977..2f99e5b4125 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -254,7 +254,7 @@ class _Context(grpc.ServicerContext): else: if self._state.initial_metadata_allowed: operation = cygrpc.operation_send_initial_metadata( - cygrpc.Metadata(initial_metadata), _EMPTY_FLAGS) + _common.metadata(initial_metadata), _EMPTY_FLAGS) self._rpc_event.operation_call.start_batch( cygrpc.Operations((operation,)), _send_initial_metadata(self._state)) From e05d31962dec34466417e17370dc3a169b6e5eb6 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 18 May 2016 15:06:39 -0700 Subject: [PATCH 153/175] php: add channel argument to BaseStub constructor --- src/php/lib/Grpc/BaseStub.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index 2de1b337e53..70644fac872 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -52,8 +52,9 @@ class BaseStub * - 'update_metadata': (optional) a callback function which takes in a * metadata array, and returns an updated metadata array * - 'grpc.primary_user_agent': (optional) a user-agent string + * @param $channel Channel An already created Channel object */ - public function __construct($hostname, $opts) + public function __construct($hostname, $opts, $channel = null) { $this->hostname = $hostname; $this->update_metadata = null; @@ -77,7 +78,15 @@ class BaseStub 'required. Please see one of the '. 'ChannelCredentials::create methods'); } - $this->channel = new Channel($hostname, $opts); + if ($channel) { + if (!is_a($channel, 'Channel')) { + throw new \Exception("The channel argument is not a". + "Channel object"); + } + $this->channel = $channel; + } else { + $this->channel = new Channel($hostname, $opts); + } } /** From a011572c8171cad96c3d630987afc8782883068c Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 13 Jun 2016 09:49:58 -0700 Subject: [PATCH 154/175] cloning from the local repo --- test/distrib/cpp/run_distrib_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/distrib/cpp/run_distrib_test.sh b/test/distrib/cpp/run_distrib_test.sh index 5c21a1e19ec..dfe9867a602 100755 --- a/test/distrib/cpp/run_distrib_test.sh +++ b/test/distrib/cpp/run_distrib_test.sh @@ -30,7 +30,7 @@ set -ex -git clone https://github.com/grpc/grpc.git +git clone $EXTERNAL_GIT_ROOT cd grpc && git submodule update --init cd third_party/protobuf && ./autogen.sh && \ From 5fa6b5db394d62d13a161c94780e12ed2ce79bae Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 13 Jun 2016 10:03:35 -0700 Subject: [PATCH 155/175] regenerate PHP's package.xml --- package.xml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/package.xml b/package.xml index 9fa63e30909..1c658df79c4 100644 --- a/package.xml +++ b/package.xml @@ -1072,20 +1072,5 @@ Update to wrap gRPC C Core version 0.10.0 - Updated functions with TSRM macros for ZTS support #6607 - - - 0.15.0 - 0.15.0 - - - beta - beta - - 2016-05-19 - BSD - -- TBD - - From e4fd5b9fe2f95209606571b0761928369ee507ec Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 13 Jun 2016 10:10:21 -0700 Subject: [PATCH 156/175] C# merge fixups --- src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs | 1 + src/csharp/Grpc.Core/Channel.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs index 74b104e5a4b..98e27a17a1d 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/AsyncCallTest.cs @@ -210,6 +210,7 @@ namespace Grpc.Core.Internal.Tests new Metadata()); AssertUnaryResponseSuccess(asyncCall, fakeCall, resultTask); + var writeTask = requestStream.WriteAsync("request1"); var ex = Assert.ThrowsAsync(async () => await writeTask); Assert.AreEqual(Status.DefaultSuccess, ex.Status); diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs index e485f0807cb..4f29c35b321 100644 --- a/src/csharp/Grpc.Core/Channel.cs +++ b/src/csharp/Grpc.Core/Channel.cs @@ -31,7 +31,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; From f38f2bb4319e51bd4af43f057d1cc20956af21fb Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 13 Jun 2016 10:55:02 -0700 Subject: [PATCH 157/175] php: remove explicit version in composer.json --- composer.json | 1 - templates/composer.json.template | 1 - 2 files changed, 2 deletions(-) diff --git a/composer.json b/composer.json index b77a59e351c..05ac0037146 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,6 @@ "name": "grpc/grpc", "type": "library", "description": "gRPC library for PHP", - "version": "0.15.0", "keywords": ["rpc"], "homepage": "http://grpc.io", "license": "BSD-3-Clause", diff --git a/templates/composer.json.template b/templates/composer.json.template index 275b4655ced..7d2029c218f 100644 --- a/templates/composer.json.template +++ b/templates/composer.json.template @@ -4,7 +4,6 @@ "name": "grpc/grpc", "type": "library", "description": "gRPC library for PHP", - "version": "${settings.php_version.php()}", "keywords": ["rpc"], "homepage": "http://grpc.io", "license": "BSD-3-Clause", From aee9d1aa7dcae6371cf28ac2efde8dd513a89c9e Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Fri, 10 Jun 2016 13:11:23 -0700 Subject: [PATCH 158/175] Added check for signals in poll() Also removed the unused pluck() function --- .../_cython/_cygrpc/completion_queue.pxd.pxi | 3 - .../_cython/_cygrpc/completion_queue.pyx.pxi | 59 +++++++------------ .../grpcio/grpc/_cython/_cygrpc/grpc.pxi | 6 ++ .../grpc/_cython/_cygrpc/server.pyx.pxi | 2 +- 4 files changed, 27 insertions(+), 43 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi index a67c9636843..01089c3dc0b 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pxd.pxi @@ -31,9 +31,6 @@ cdef class CompletionQueue: cdef grpc_completion_queue *c_completion_queue - cdef object pluck_condition - cdef int num_plucking - cdef int num_polling cdef bint is_shutting_down cdef bint is_shutdown diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi index cdae39d5194..90266516fed 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi @@ -32,6 +32,8 @@ cimport cpython import threading import time +cdef int _INTERRUPT_CHECK_PERIOD_MS = 200 + cdef class CompletionQueue: @@ -40,9 +42,6 @@ cdef class CompletionQueue: self.c_completion_queue = grpc_completion_queue_create(NULL) self.is_shutting_down = False self.is_shutdown = False - self.pluck_condition = threading.Condition() - self.num_plucking = 0 - self.num_polling = 0 cdef _interpret_event(self, grpc_event event): cdef OperationTag tag = None @@ -83,45 +82,27 @@ cdef class CompletionQueue: def poll(self, Timespec deadline=None): # We name this 'poll' to avoid problems with CPython's expectations for # 'special' methods (like next and __next__). + cdef gpr_timespec c_increment + cdef gpr_timespec c_timeout cdef gpr_timespec c_deadline with nogil: + c_increment = gpr_time_from_millis(_INTERRUPT_CHECK_PERIOD_MS, GPR_TIMESPAN) c_deadline = gpr_inf_future(GPR_CLOCK_REALTIME) - if deadline is not None: - c_deadline = deadline.c_time - cdef grpc_event event - - # Poll within a critical section to detect contention - with self.pluck_condition: - assert self.num_plucking == 0, 'cannot simultaneously pluck and poll' - self.num_polling += 1 - with nogil: - event = grpc_completion_queue_next( - self.c_completion_queue, c_deadline, NULL) - with self.pluck_condition: - self.num_polling -= 1 - return self._interpret_event(event) - - def pluck(self, OperationTag tag, Timespec deadline=None): - # Plucking a 'None' tag is equivalent to passing control to GRPC core until - # the deadline. - cdef gpr_timespec c_deadline = gpr_inf_future( - GPR_CLOCK_REALTIME) - if deadline is not None: - c_deadline = deadline.c_time - cdef grpc_event event - - # Pluck within a critical section to detect contention - with self.pluck_condition: - assert self.num_polling == 0, 'cannot simultaneously pluck and poll' - assert self.num_plucking < GRPC_MAX_COMPLETION_QUEUE_PLUCKERS, ( - 'cannot pluck more than {} times simultaneously'.format( - GRPC_MAX_COMPLETION_QUEUE_PLUCKERS)) - self.num_plucking += 1 - with nogil: - event = grpc_completion_queue_pluck( - self.c_completion_queue, tag, c_deadline, NULL) - with self.pluck_condition: - self.num_plucking -= 1 + if deadline is not None: + c_deadline = deadline.c_time + + while True: + c_timeout = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), c_increment) + if gpr_time_cmp(c_timeout, c_deadline) > 0: + c_timeout = c_deadline + event = grpc_completion_queue_next( + self.c_completion_queue, c_timeout, NULL) + if event.type != GRPC_QUEUE_TIMEOUT or gpr_time_cmp(c_timeout, c_deadline) == 0: + break; + + # Handle any signals + with gil: + cpython.PyErr_CheckSignals() return self._interpret_event(event) def shutdown(self): diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 05b8886df73..168b9751aa2 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -80,6 +80,12 @@ cdef extern from "grpc/_cython/loader.h": gpr_timespec gpr_convert_clock_type(gpr_timespec t, gpr_clock_type target_clock) nogil + gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) nogil + + gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) nogil + + int gpr_time_cmp(gpr_timespec a, gpr_timespec b) nogil + ctypedef enum grpc_status_code: GRPC_STATUS_OK GRPC_STATUS_CANCELLED diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 55948755b2f..6ce589dbdc2 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -99,7 +99,7 @@ cdef class Server: with nogil: grpc_server_start(self.c_server) # Ensure the core has gotten a chance to do the start-up work - self.backup_shutdown_queue.pluck(None, Timespec(None)) + self.backup_shutdown_queue.poll(Timespec(None)) def add_http2_port(self, address, ServerCredentials server_credentials=None): From 2bab9a833933ca5c055e558f689545c546b5e89b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 13 Jun 2016 11:46:47 -0700 Subject: [PATCH 159/175] add LogLevel enum --- src/csharp/Grpc.Core/Grpc.Core.csproj | 1 + src/csharp/Grpc.Core/Logging/LogLevel.cs | 59 ++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/csharp/Grpc.Core/Logging/LogLevel.cs diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index a8b7b5f00d9..db04a8a68b1 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -136,6 +136,7 @@ + diff --git a/src/csharp/Grpc.Core/Logging/LogLevel.cs b/src/csharp/Grpc.Core/Logging/LogLevel.cs new file mode 100644 index 00000000000..d64e1f5fd0f --- /dev/null +++ b/src/csharp/Grpc.Core/Logging/LogLevel.cs @@ -0,0 +1,59 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; + +namespace Grpc.Core.Logging +{ + /// Standard logging levels. + public enum LogLevel + { + /// + /// Debug severity. + /// + Debug = 0, + /// + /// Info severity. + /// + Info, + /// + /// Warning severity. + /// + Warning, + /// + /// Error severity. + /// + Error + } +} From 504b3b9cc45cb9dc57618c92a396a681a42ac37d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 13 Jun 2016 12:47:09 -0700 Subject: [PATCH 160/175] set default gRPC C# logging level to Info --- src/csharp/Grpc.Core/Grpc.Core.csproj | 1 + src/csharp/Grpc.Core/GrpcEnvironment.cs | 3 +- .../Grpc.Core/Logging/LogLevelFilterLogger.cs | 160 ++++++++++++++++++ 3 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 src/csharp/Grpc.Core/Logging/LogLevelFilterLogger.cs diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index db04a8a68b1..a796911b99f 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -137,6 +137,7 @@ + diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs index 0359d9092a7..e9e4cb4cbb3 100644 --- a/src/csharp/Grpc.Core/GrpcEnvironment.cs +++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs @@ -47,6 +47,7 @@ namespace Grpc.Core /// public class GrpcEnvironment { + const LogLevel DefaultLogLevel = LogLevel.Info; const int MinDefaultThreadPoolSize = 4; static object staticLock = new object(); @@ -57,7 +58,7 @@ namespace Grpc.Core static readonly HashSet registeredChannels = new HashSet(); static readonly HashSet registeredServers = new HashSet(); - static ILogger logger = new ConsoleLogger(); + static ILogger logger = new LogLevelFilterLogger(new ConsoleLogger(), DefaultLogLevel); readonly object myLock = new object(); readonly GrpcThreadPool threadPool; diff --git a/src/csharp/Grpc.Core/Logging/LogLevelFilterLogger.cs b/src/csharp/Grpc.Core/Logging/LogLevelFilterLogger.cs new file mode 100644 index 00000000000..4eeb79c783d --- /dev/null +++ b/src/csharp/Grpc.Core/Logging/LogLevelFilterLogger.cs @@ -0,0 +1,160 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using Grpc.Core.Utils; + +namespace Grpc.Core.Logging +{ + /// Logger that filters out messages below certain log level. + public class LogLevelFilterLogger : ILogger + { + readonly ILogger innerLogger; + readonly LogLevel logLevel; + + /// + /// Creates and instance of LogLevelFilter. + /// + public LogLevelFilterLogger(ILogger logger, LogLevel logLevel) + { + this.innerLogger = GrpcPreconditions.CheckNotNull(logger); + this.logLevel = logLevel; + } + + /// + /// Returns a logger associated with the specified type. + /// + public virtual ILogger ForType() + { + var newInnerLogger = innerLogger.ForType(); + if (object.ReferenceEquals(this.innerLogger, newInnerLogger)) + { + return this; + } + return new LogLevelFilterLogger(newInnerLogger, logLevel); + } + + /// Logs a message with severity Debug. + public void Debug(string message) + { + if (logLevel <= LogLevel.Debug) + { + innerLogger.Debug(message); + } + } + + /// Logs a formatted message with severity Debug. + public void Debug(string format, params object[] formatArgs) + { + if (logLevel <= LogLevel.Debug) + { + innerLogger.Debug(format, formatArgs); + } + } + + /// Logs a message with severity Info. + public void Info(string message) + { + if (logLevel <= LogLevel.Info) + { + innerLogger.Info(message); + } + } + + /// Logs a formatted message with severity Info. + public void Info(string format, params object[] formatArgs) + { + if (logLevel <= LogLevel.Info) + { + innerLogger.Info(format, formatArgs); + } + } + + /// Logs a message with severity Warning. + public void Warning(string message) + { + if (logLevel <= LogLevel.Warning) + { + innerLogger.Warning(message); + } + } + + /// Logs a formatted message with severity Warning. + public void Warning(string format, params object[] formatArgs) + { + if (logLevel <= LogLevel.Warning) + { + innerLogger.Warning(format, formatArgs); + } + } + + /// Logs a message and an associated exception with severity Warning. + public void Warning(Exception exception, string message) + { + if (logLevel <= LogLevel.Warning) + { + innerLogger.Warning(exception, message); + } + } + + /// Logs a message with severity Error. + public void Error(string message) + { + if (logLevel <= LogLevel.Error) + { + innerLogger.Error(message); + } + } + + /// Logs a formatted message with severity Error. + public void Error(string format, params object[] formatArgs) + { + if (logLevel <= LogLevel.Error) + { + innerLogger.Error(format, formatArgs); + } + } + + /// Logs a message and an associated exception with severity Error. + public void Error(Exception exception, string message) + { + if (logLevel <= LogLevel.Error) + { + innerLogger.Error(exception, message); + } + } + } +} From 4547940d0671b528f2ace782466af94150cb7902 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Mon, 13 Jun 2016 20:14:18 +0000 Subject: [PATCH 161/175] Python GA code generation --- src/compiler/python_generator.cc | 148 ++++- src/compiler/python_generator.h | 1 + src/compiler/python_plugin.cc | 1 + src/python/grpcio/grpc/__init__.py | 96 +++ src/python/grpcio/grpc/_utilities.py | 26 +- .../protoc_plugin/_python_plugin_test.py | 583 ++++++++++++++++++ src/python/grpcio/tests/tests.json | 1 + 7 files changed, 853 insertions(+), 3 deletions(-) create mode 100644 src/python/grpcio/tests/protoc_plugin/_python_plugin_test.py diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index cd5ddd88326..15cda474ccd 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -342,7 +342,7 @@ bool PrintBetaServerFactory(const grpc::string& package_qualified_service_name, out->Print("}\n"); out->Print("method_implementations = {\n"); for (auto name_and_implementation_constructor = - method_implementation_constructors.begin(); + method_implementation_constructors.begin(); name_and_implementation_constructor != method_implementation_constructors.end(); name_and_implementation_constructor++) { @@ -457,8 +457,149 @@ bool PrintBetaStubFactory(const grpc::string& package_qualified_service_name, return true; } +bool PrintStub(const grpc::string& package_qualified_service_name, + const ServiceDescriptor* service, Printer* out) { + out->Print("\n\n"); + out->Print("class $Service$Stub(object):\n", "Service", service->name()); + { + IndentScope raii_class_indent(out); + PrintAllComments(service, out); + out->Print("\n"); + out->Print("def __init__(self, channel):\n"); + { + IndentScope raii_init_indent(out); + out->Print("\"\"\"Constructor.\n"); + out->Print("\n"); + out->Print("Args:\n"); + { + IndentScope raii_args_indent(out); + out->Print("channel: A grpc.Channel.\n"); + } + out->Print("\"\"\"\n"); + for (int i = 0; i < service->method_count(); ++i) { + auto method = service->method(i); + auto multi_callable_constructor = + grpc::string(method->client_streaming() ? "stream" : "unary") + + "_" + + grpc::string(method->server_streaming() ? "stream" : "unary"); + grpc::string request_module_and_class; + if (!GetModuleAndMessagePath(method->input_type(), service, + &request_module_and_class)) { + return false; + } + grpc::string response_module_and_class; + if (!GetModuleAndMessagePath(method->output_type(), service, + &response_module_and_class)) { + return false; + } + out->Print("self.$Method$ = channel.$MultiCallableConstructor$(\n", + "Method", method->name(), + "MultiCallableConstructor", multi_callable_constructor); + { + IndentScope raii_first_attribute_indent(out); + IndentScope raii_second_attribute_indent(out); + out->Print( + "'/$PackageQualifiedService$/$Method$',\n", + "PackageQualifiedService", package_qualified_service_name, + "Method", method->name()); + out->Print( + "request_serializer=$RequestModuleAndClass$.SerializeToString,\n", + "RequestModuleAndClass", request_module_and_class); + out->Print( + "response_deserializer=$ResponseModuleAndClass$.FromString,\n", + "ResponseModuleAndClass", response_module_and_class); + out->Print(")\n"); + } + } + } + } + return true; +} + +bool PrintServicer(const ServiceDescriptor* service, Printer* out) { + out->Print("\n\n"); + out->Print("class $Service$Servicer(object):\n", "Service", service->name()); + { + IndentScope raii_class_indent(out); + PrintAllComments(service, out); + for (int i = 0; i < service->method_count(); ++i) { + auto method = service->method(i); + grpc::string arg_name = method->client_streaming() ? + "request_iterator" : "request"; + out->Print("\n"); + out->Print("def $Method$(self, $ArgName$, context):\n", + "Method", method->name(), "ArgName", arg_name); + { + IndentScope raii_method_indent(out); + PrintAllComments(method, out); + out->Print("context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n"); + out->Print("context.set_details('Method not implemented!')\n"); + out->Print("raise NotImplementedError('Method not implemented!')\n"); + } + } + } + return true; +} + +bool PrintAddServicerToServer(const grpc::string& package_qualified_service_name, + const ServiceDescriptor* service, Printer* out) { + out->Print("\n\n"); + out->Print("def add_$Service$Servicer_to_server(servicer, server):\n", + "Service", service->name()); + { + IndentScope raii_class_indent(out); + out->Print("rpc_method_handlers = {\n"); + { + IndentScope raii_dict_first_indent(out); + IndentScope raii_dict_second_indent(out); + for (int i = 0; i < service->method_count(); ++i) { + auto method = service->method(i); + auto method_handler_constructor = + grpc::string(method->client_streaming() ? "stream" : "unary") + + "_" + + grpc::string(method->server_streaming() ? "stream" : "unary") + + "_rpc_method_handler"; + grpc::string request_module_and_class; + if (!GetModuleAndMessagePath(method->input_type(), service, + &request_module_and_class)) { + return false; + } + grpc::string response_module_and_class; + if (!GetModuleAndMessagePath(method->output_type(), service, + &response_module_and_class)) { + return false; + } + out->Print("'$Method$': grpc.$MethodHandlerConstructor$(\n", + "Method", method->name(), + "MethodHandlerConstructor", method_handler_constructor); + { + IndentScope raii_call_first_indent(out); + IndentScope raii_call_second_indent(out); + out->Print("servicer.$Method$,\n", "Method", method->name()); + out->Print("request_deserializer=$RequestModuleAndClass$.FromString,\n", + "RequestModuleAndClass", request_module_and_class); + out->Print("response_serializer=$ResponseModuleAndClass$.SerializeToString,\n", + "ResponseModuleAndClass", response_module_and_class); + } + out->Print("),\n"); + } + } + out->Print("}\n"); + out->Print("generic_handler = grpc.method_handlers_generic_handler(\n"); + { + IndentScope raii_call_first_indent(out); + IndentScope raii_call_second_indent(out); + out->Print("'$PackageQualifiedServiceName$', rpc_method_handlers)\n", + "PackageQualifiedServiceName", package_qualified_service_name); + } + out->Print("server.add_generic_rpc_handlers((generic_handler,))\n"); + } + return true; +} + bool PrintPreamble(const FileDescriptor* file, const GeneratorConfiguration& config, Printer* out) { + out->Print("import $Package$\n", "Package", config.grpc_package_root); out->Print("from $Package$ import implementations as beta_implementations\n", "Package", config.beta_package_root); out->Print("from $Package$ import interfaces as beta_interfaces\n", @@ -487,7 +628,10 @@ pair GetServices(const FileDescriptor* file, for (int i = 0; i < file->service_count(); ++i) { auto service = file->service(i); auto package_qualified_service_name = package + service->name(); - if (!(PrintBetaServicer(service, &out) && + if (!(PrintStub(package_qualified_service_name, service, &out) && + PrintServicer(service, &out) && + PrintAddServicerToServer(package_qualified_service_name, service, &out) && + PrintBetaServicer(service, &out) && PrintBetaStub(service, &out) && PrintBetaServerFactory(package_qualified_service_name, service, &out) && PrintBetaStubFactory(package_qualified_service_name, service, &out))) { diff --git a/src/compiler/python_generator.h b/src/compiler/python_generator.h index e56b6790ef9..fc51b48daec 100644 --- a/src/compiler/python_generator.h +++ b/src/compiler/python_generator.h @@ -43,6 +43,7 @@ namespace grpc_python_generator { // Data pertaining to configuration of the generator with respect to anything // that may be used internally at Google. struct GeneratorConfiguration { + grpc::string grpc_package_root; grpc::string beta_package_root; }; diff --git a/src/compiler/python_plugin.cc b/src/compiler/python_plugin.cc index 92a07b2f80a..fc76ee5ec6d 100644 --- a/src/compiler/python_plugin.cc +++ b/src/compiler/python_plugin.cc @@ -38,6 +38,7 @@ int main(int argc, char* argv[]) { grpc_python_generator::GeneratorConfiguration config; + config.grpc_package_root = "grpc"; config.beta_package_root = "grpc.beta"; grpc_python_generator::PythonGrpcGenerator generator(config); return grpc::protobuf::compiler::PluginMain(argc, argv, &generator); diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 5ba5a4e1fdd..a8897501d1c 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -900,6 +900,102 @@ class Server(six.with_metaclass(abc.ABCMeta)): ################################# Functions ################################ +def unary_unary_rpc_method_handler( + behavior, request_deserializer=None, response_serializer=None): + """Creates an RpcMethodHandler for a unary-unary RPC method. + + Args: + behavior: The implementation of an RPC method as a callable behavior taking + a single request value and returning a single response value. + request_deserializer: An optional request deserialization behavior. + response_serializer: An optional response serialization behavior. + + Returns: + An RpcMethodHandler for a unary-unary RPC method constructed from the given + parameters. + """ + from grpc import _utilities + return _utilities.RpcMethodHandler( + False, False, request_deserializer, response_serializer, behavior, None, + None, None) + + +def unary_stream_rpc_method_handler( + behavior, request_deserializer=None, response_serializer=None): + """Creates an RpcMethodHandler for a unary-stream RPC method. + + Args: + behavior: The implementation of an RPC method as a callable behavior taking + a single request value and returning an iterator of response values. + request_deserializer: An optional request deserialization behavior. + response_serializer: An optional response serialization behavior. + + Returns: + An RpcMethodHandler for a unary-stream RPC method constructed from the + given parameters. + """ + from grpc import _utilities + return _utilities.RpcMethodHandler( + False, True, request_deserializer, response_serializer, None, behavior, + None, None) + + +def stream_unary_rpc_method_handler( + behavior, request_deserializer=None, response_serializer=None): + """Creates an RpcMethodHandler for a stream-unary RPC method. + + Args: + behavior: The implementation of an RPC method as a callable behavior taking + an iterator of request values and returning a single response value. + request_deserializer: An optional request deserialization behavior. + response_serializer: An optional response serialization behavior. + + Returns: + An RpcMethodHandler for a stream-unary RPC method constructed from the + given parameters. + """ + from grpc import _utilities + return _utilities.RpcMethodHandler( + True, False, request_deserializer, response_serializer, None, None, + behavior, None) + + +def stream_stream_rpc_method_handler( + behavior, request_deserializer=None, response_serializer=None): + """Creates an RpcMethodHandler for a stream-stream RPC method. + + Args: + behavior: The implementation of an RPC method as a callable behavior taking + an iterator of request values and returning an iterator of response + values. + request_deserializer: An optional request deserialization behavior. + response_serializer: An optional response serialization behavior. + + Returns: + An RpcMethodHandler for a stream-stream RPC method constructed from the + given parameters. + """ + from grpc import _utilities + return _utilities.RpcMethodHandler( + True, True, request_deserializer, response_serializer, None, None, None, + behavior) + + +def method_handlers_generic_handler(service, method_handlers): + """Creates a grpc.GenericRpcHandler from RpcMethodHandlers. + + Args: + service: A service name to be used for the given method handlers. + method_handlers: A dictionary from method name to RpcMethodHandler + implementing the named method. + + Returns: + A GenericRpcHandler constructed from the given parameters. + """ + from grpc import _utilities + return _utilities.DictionaryGenericHandler(service, method_handlers) + + def ssl_channel_credentials( root_certificates=None, private_key=None, certificate_chain=None): """Creates a ChannelCredentials for use with an SSL-enabled Channel. diff --git a/src/python/grpcio/grpc/_utilities.py b/src/python/grpcio/grpc/_utilities.py index a4ca9b7282c..4850967fbc7 100644 --- a/src/python/grpcio/grpc/_utilities.py +++ b/src/python/grpcio/grpc/_utilities.py @@ -29,16 +29,41 @@ """Internal utilities for gRPC Python.""" +import collections import threading import time +import six + import grpc +from grpc import _common from grpc.framework.foundation import callable_util _DONE_CALLBACK_EXCEPTION_LOG_MESSAGE = ( 'Exception calling connectivity future "done" callback!') +class RpcMethodHandler( + collections.namedtuple( + '_RpcMethodHandler', + ('request_streaming', 'response_streaming', 'request_deserializer', + 'response_serializer', 'unary_unary', 'unary_stream', 'stream_unary', + 'stream_stream',)), + grpc.RpcMethodHandler): + pass + + +class DictionaryGenericHandler(grpc.GenericRpcHandler): + + def __init__(self, service, method_handlers): + self._method_handlers = { + _common.fully_qualified_method(service, method): method_handler + for method, method_handler in six.iteritems(method_handlers)} + + def service(self, handler_call_details): + return self._method_handlers.get(handler_call_details.method) + + class _ChannelReadyFuture(grpc.Future): def __init__(self, channel): @@ -144,4 +169,3 @@ def channel_ready_future(channel): ready_future = _ChannelReadyFuture(channel) ready_future.start() return ready_future - diff --git a/src/python/grpcio/tests/protoc_plugin/_python_plugin_test.py b/src/python/grpcio/tests/protoc_plugin/_python_plugin_test.py new file mode 100644 index 00000000000..1c9cbb0d0c3 --- /dev/null +++ b/src/python/grpcio/tests/protoc_plugin/_python_plugin_test.py @@ -0,0 +1,583 @@ +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import collections +from concurrent import futures +import contextlib +import distutils.spawn +import errno +import os +import shutil +import subprocess +import sys +import tempfile +import threading +import unittest + +from six import moves + +import grpc +from tests.unit.framework.common import test_constants + +# Identifiers of entities we expect to find in the generated module. +STUB_IDENTIFIER = 'TestServiceStub' +SERVICER_IDENTIFIER = 'TestServiceServicer' +ADD_SERVICER_TO_SERVER_IDENTIFIER = 'add_TestServiceServicer_to_server' + + +class _ServicerMethods(object): + + def __init__(self, response_pb2, payload_pb2): + self._condition = threading.Condition() + self._paused = False + self._fail = False + self._response_pb2 = response_pb2 + self._payload_pb2 = payload_pb2 + + @contextlib.contextmanager + def pause(self): # pylint: disable=invalid-name + with self._condition: + self._paused = True + yield + with self._condition: + self._paused = False + self._condition.notify_all() + + @contextlib.contextmanager + def fail(self): # pylint: disable=invalid-name + with self._condition: + self._fail = True + yield + with self._condition: + self._fail = False + + def _control(self): # pylint: disable=invalid-name + with self._condition: + if self._fail: + raise ValueError() + while self._paused: + self._condition.wait() + + def UnaryCall(self, request, unused_rpc_context): + response = self._response_pb2.SimpleResponse() + response.payload.payload_type = self._payload_pb2.COMPRESSABLE + response.payload.payload_compressable = 'a' * request.response_size + self._control() + return response + + def StreamingOutputCall(self, request, unused_rpc_context): + for parameter in request.response_parameters: + response = self._response_pb2.StreamingOutputCallResponse() + response.payload.payload_type = self._payload_pb2.COMPRESSABLE + response.payload.payload_compressable = 'a' * parameter.size + self._control() + yield response + + def StreamingInputCall(self, request_iter, unused_rpc_context): + response = self._response_pb2.StreamingInputCallResponse() + aggregated_payload_size = 0 + for request in request_iter: + aggregated_payload_size += len(request.payload.payload_compressable) + response.aggregated_payload_size = aggregated_payload_size + self._control() + return response + + def FullDuplexCall(self, request_iter, unused_rpc_context): + for request in request_iter: + for parameter in request.response_parameters: + response = self._response_pb2.StreamingOutputCallResponse() + response.payload.payload_type = self._payload_pb2.COMPRESSABLE + response.payload.payload_compressable = 'a' * parameter.size + self._control() + yield response + + def HalfDuplexCall(self, request_iter, unused_rpc_context): + responses = [] + for request in request_iter: + for parameter in request.response_parameters: + response = self._response_pb2.StreamingOutputCallResponse() + response.payload.payload_type = self._payload_pb2.COMPRESSABLE + response.payload.payload_compressable = 'a' * parameter.size + self._control() + responses.append(response) + for response in responses: + yield response + + +class _Service( + collections.namedtuple( + '_Service', ('servicer_methods', 'server', 'stub',))): + """A live and running service. + + Attributes: + servicer_methods: The _ServicerMethods servicing RPCs. + server: The grpc.Server servicing RPCs. + stub: A stub on which to invoke RPCs. + """ + + +def _CreateService(service_pb2, response_pb2, payload_pb2): + """Provides a servicer backend and a stub. + + Args: + service_pb2: The service_pb2 module generated by this test. + response_pb2: The response_pb2 module generated by this test. + payload_pb2: The payload_pb2 module generated by this test. + + Returns: + A _Service with which to test RPCs. + """ + servicer_methods = _ServicerMethods(response_pb2, payload_pb2) + + class Servicer(getattr(service_pb2, SERVICER_IDENTIFIER)): + + def UnaryCall(self, request, context): + return servicer_methods.UnaryCall(request, context) + + def StreamingOutputCall(self, request, context): + return servicer_methods.StreamingOutputCall(request, context) + + def StreamingInputCall(self, request_iter, context): + return servicer_methods.StreamingInputCall(request_iter, context) + + def FullDuplexCall(self, request_iter, context): + return servicer_methods.FullDuplexCall(request_iter, context) + + def HalfDuplexCall(self, request_iter, context): + return servicer_methods.HalfDuplexCall(request_iter, context) + + server = grpc.server( + (), futures.ThreadPoolExecutor(max_workers=test_constants.POOL_SIZE)) + getattr(service_pb2, ADD_SERVICER_TO_SERVER_IDENTIFIER)(Servicer(), server) + port = server.add_insecure_port('[::]:0') + server.start() + channel = grpc.insecure_channel('localhost:{}'.format(port)) + stub = getattr(service_pb2, STUB_IDENTIFIER)(channel) + return _Service(servicer_methods, server, stub) + + +def _CreateIncompleteService(service_pb2): + """Provides a servicer backend that fails to implement methods and its stub. + + Args: + service_pb2: The service_pb2 module generated by this test. + + Returns: + A _Service with which to test RPCs. The returned _Service's + servicer_methods implements none of the methods required of it. + """ + + class Servicer(getattr(service_pb2, SERVICER_IDENTIFIER)): + pass + + server = grpc.server( + (), futures.ThreadPoolExecutor(max_workers=test_constants.POOL_SIZE)) + getattr(service_pb2, ADD_SERVICER_TO_SERVER_IDENTIFIER)(Servicer(), server) + port = server.add_insecure_port('[::]:0') + server.start() + channel = grpc.insecure_channel('localhost:{}'.format(port)) + stub = getattr(service_pb2, STUB_IDENTIFIER)(channel) + return _Service(None, server, stub) + + +def _streaming_input_request_iterator(request_pb2, payload_pb2): + for _ in range(3): + request = request_pb2.StreamingInputCallRequest() + request.payload.payload_type = payload_pb2.COMPRESSABLE + request.payload.payload_compressable = 'a' + yield request + + +def _streaming_output_request(request_pb2): + request = request_pb2.StreamingOutputCallRequest() + sizes = [1, 2, 3] + request.response_parameters.add(size=sizes[0], interval_us=0) + request.response_parameters.add(size=sizes[1], interval_us=0) + request.response_parameters.add(size=sizes[2], interval_us=0) + return request + + +def _full_duplex_request_iterator(request_pb2): + request = request_pb2.StreamingOutputCallRequest() + request.response_parameters.add(size=1, interval_us=0) + yield request + request = request_pb2.StreamingOutputCallRequest() + request.response_parameters.add(size=2, interval_us=0) + request.response_parameters.add(size=3, interval_us=0) + yield request + + +class PythonPluginTest(unittest.TestCase): + """Test case for the gRPC Python protoc-plugin. + + While reading these tests, remember that the futures API + (`stub.method.future()`) only gives futures for the *response-unary* + methods and does not exist for response-streaming methods. + """ + + def setUp(self): + # Assume that the appropriate protoc and grpc_python_plugins are on the + # path. + protoc_command = 'protoc' + protoc_plugin_filename = distutils.spawn.find_executable( + 'grpc_python_plugin') + if not os.path.isfile(protoc_command): + # Assume that if we haven't built protoc that it's on the system. + protoc_command = 'protoc' + + # Ensure that the output directory exists. + self.outdir = tempfile.mkdtemp() + + # Find all proto files + paths = [] + root_dir = os.path.dirname(os.path.realpath(__file__)) + proto_dir = os.path.join(root_dir, 'protos') + for walk_root, _, filenames in os.walk(proto_dir): + for filename in filenames: + if filename.endswith('.proto'): + path = os.path.join(walk_root, filename) + paths.append(path) + + # Invoke protoc with the plugin. + cmd = [ + protoc_command, + '--plugin=protoc-gen-python-grpc=%s' % protoc_plugin_filename, + '-I %s' % root_dir, + '--python_out=%s' % self.outdir, + '--python-grpc_out=%s' % self.outdir + ] + paths + subprocess.check_call(' '.join(cmd), shell=True, env=os.environ, + cwd=os.path.dirname(os.path.realpath(__file__))) + + # Generated proto directories dont include __init__.py, but + # these are needed for python package resolution + for walk_root, _, _ in os.walk(os.path.join(self.outdir, 'protos')): + path = os.path.join(walk_root, '__init__.py') + open(path, 'a').close() + + sys.path.insert(0, self.outdir) + + import protos.payload.test_payload_pb2 as payload_pb2 + import protos.requests.r.test_requests_pb2 as request_pb2 + import protos.responses.test_responses_pb2 as response_pb2 + import protos.service.test_service_pb2 as service_pb2 + self._payload_pb2 = payload_pb2 + self._request_pb2 = request_pb2 + self._response_pb2 = response_pb2 + self._service_pb2 = service_pb2 + + def tearDown(self): + try: + shutil.rmtree(self.outdir) + except OSError as exc: + if exc.errno != errno.ENOENT: + raise + sys.path.remove(self.outdir) + + def testImportAttributes(self): + # check that we can access the generated module and its members. + self.assertIsNotNone( + getattr(self._service_pb2, STUB_IDENTIFIER, None)) + self.assertIsNotNone( + getattr(self._service_pb2, SERVICER_IDENTIFIER, None)) + self.assertIsNotNone( + getattr(self._service_pb2, ADD_SERVICER_TO_SERVER_IDENTIFIER, None)) + + def testUpDown(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + self.assertIsNotNone(service.servicer_methods) + self.assertIsNotNone(service.server) + self.assertIsNotNone(service.stub) + + def testIncompleteServicer(self): + service = _CreateIncompleteService(self._service_pb2) + request = self._request_pb2.SimpleRequest(response_size=13) + with self.assertRaises(grpc.RpcError) as exception_context: + service.stub.UnaryCall(request) + self.assertIs( + exception_context.exception.code(), grpc.StatusCode.UNIMPLEMENTED) + + def testUnaryCall(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = self._request_pb2.SimpleRequest(response_size=13) + response = service.stub.UnaryCall(request) + expected_response = service.servicer_methods.UnaryCall( + request, 'not a real context!') + self.assertEqual(expected_response, response) + + def testUnaryCallFuture(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = self._request_pb2.SimpleRequest(response_size=13) + # Check that the call does not block waiting for the server to respond. + with service.servicer_methods.pause(): + response_future = service.stub.UnaryCall.future(request) + response = response_future.result() + expected_response = service.servicer_methods.UnaryCall( + request, 'not a real RpcContext!') + self.assertEqual(expected_response, response) + + def testUnaryCallFutureExpired(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = self._request_pb2.SimpleRequest(response_size=13) + with service.servicer_methods.pause(): + response_future = service.stub.UnaryCall.future( + request, timeout=test_constants.SHORT_TIMEOUT) + with self.assertRaises(grpc.RpcError) as exception_context: + response_future.result() + self.assertIs( + exception_context.exception.code(), grpc.StatusCode.DEADLINE_EXCEEDED) + self.assertIs(response_future.code(), grpc.StatusCode.DEADLINE_EXCEEDED) + + def testUnaryCallFutureCancelled(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = self._request_pb2.SimpleRequest(response_size=13) + with service.servicer_methods.pause(): + response_future = service.stub.UnaryCall.future(request) + response_future.cancel() + self.assertTrue(response_future.cancelled()) + self.assertIs(response_future.code(), grpc.StatusCode.CANCELLED) + + def testUnaryCallFutureFailed(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = self._request_pb2.SimpleRequest(response_size=13) + with service.servicer_methods.fail(): + response_future = service.stub.UnaryCall.future(request) + self.assertIsNotNone(response_future.exception()) + self.assertIs(response_future.code(), grpc.StatusCode.UNKNOWN) + + def testStreamingOutputCall(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = _streaming_output_request(self._request_pb2) + responses = service.stub.StreamingOutputCall(request) + expected_responses = service.servicer_methods.StreamingOutputCall( + request, 'not a real RpcContext!') + for expected_response, response in moves.zip_longest( + expected_responses, responses): + self.assertEqual(expected_response, response) + + def testStreamingOutputCallExpired(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = _streaming_output_request(self._request_pb2) + with service.servicer_methods.pause(): + responses = service.stub.StreamingOutputCall( + request, timeout=test_constants.SHORT_TIMEOUT) + with self.assertRaises(grpc.RpcError) as exception_context: + list(responses) + self.assertIs( + exception_context.exception.code(), grpc.StatusCode.DEADLINE_EXCEEDED) + + def testStreamingOutputCallCancelled(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = _streaming_output_request(self._request_pb2) + responses = service.stub.StreamingOutputCall(request) + next(responses) + responses.cancel() + with self.assertRaises(grpc.RpcError) as exception_context: + next(responses) + self.assertIs(responses.code(), grpc.StatusCode.CANCELLED) + + def testStreamingOutputCallFailed(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request = _streaming_output_request(self._request_pb2) + with service.servicer_methods.fail(): + responses = service.stub.StreamingOutputCall(request) + self.assertIsNotNone(responses) + with self.assertRaises(grpc.RpcError) as exception_context: + next(responses) + self.assertIs(exception_context.exception.code(), grpc.StatusCode.UNKNOWN) + + def testStreamingInputCall(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + response = service.stub.StreamingInputCall( + _streaming_input_request_iterator( + self._request_pb2, self._payload_pb2)) + expected_response = service.servicer_methods.StreamingInputCall( + _streaming_input_request_iterator(self._request_pb2, self._payload_pb2), + 'not a real RpcContext!') + self.assertEqual(expected_response, response) + + def testStreamingInputCallFuture(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + with service.servicer_methods.pause(): + response_future = service.stub.StreamingInputCall.future( + _streaming_input_request_iterator( + self._request_pb2, self._payload_pb2)) + response = response_future.result() + expected_response = service.servicer_methods.StreamingInputCall( + _streaming_input_request_iterator(self._request_pb2, self._payload_pb2), + 'not a real RpcContext!') + self.assertEqual(expected_response, response) + + def testStreamingInputCallFutureExpired(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + with service.servicer_methods.pause(): + response_future = service.stub.StreamingInputCall.future( + _streaming_input_request_iterator( + self._request_pb2, self._payload_pb2), + timeout=test_constants.SHORT_TIMEOUT) + with self.assertRaises(grpc.RpcError) as exception_context: + response_future.result() + self.assertIsInstance(response_future.exception(), grpc.RpcError) + self.assertIs( + response_future.exception().code(), grpc.StatusCode.DEADLINE_EXCEEDED) + self.assertIs( + exception_context.exception.code(), grpc.StatusCode.DEADLINE_EXCEEDED) + + def testStreamingInputCallFutureCancelled(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + with service.servicer_methods.pause(): + response_future = service.stub.StreamingInputCall.future( + _streaming_input_request_iterator( + self._request_pb2, self._payload_pb2)) + response_future.cancel() + self.assertTrue(response_future.cancelled()) + with self.assertRaises(grpc.FutureCancelledError): + response_future.result() + + def testStreamingInputCallFutureFailed(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + with service.servicer_methods.fail(): + response_future = service.stub.StreamingInputCall.future( + _streaming_input_request_iterator( + self._request_pb2, self._payload_pb2)) + self.assertIsNotNone(response_future.exception()) + self.assertIs(response_future.code(), grpc.StatusCode.UNKNOWN) + + def testFullDuplexCall(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + responses = service.stub.FullDuplexCall( + _full_duplex_request_iterator(self._request_pb2)) + expected_responses = service.servicer_methods.FullDuplexCall( + _full_duplex_request_iterator(self._request_pb2), + 'not a real RpcContext!') + for expected_response, response in moves.zip_longest( + expected_responses, responses): + self.assertEqual(expected_response, response) + + def testFullDuplexCallExpired(self): + request_iterator = _full_duplex_request_iterator(self._request_pb2) + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + with service.servicer_methods.pause(): + responses = service.stub.FullDuplexCall( + request_iterator, timeout=test_constants.SHORT_TIMEOUT) + with self.assertRaises(grpc.RpcError) as exception_context: + list(responses) + self.assertIs( + exception_context.exception.code(), grpc.StatusCode.DEADLINE_EXCEEDED) + + def testFullDuplexCallCancelled(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + request_iterator = _full_duplex_request_iterator(self._request_pb2) + responses = service.stub.FullDuplexCall(request_iterator) + next(responses) + responses.cancel() + with self.assertRaises(grpc.RpcError) as exception_context: + next(responses) + self.assertIs( + exception_context.exception.code(), grpc.StatusCode.CANCELLED) + + def testFullDuplexCallFailed(self): + request_iterator = _full_duplex_request_iterator(self._request_pb2) + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + with service.servicer_methods.fail(): + responses = service.stub.FullDuplexCall(request_iterator) + with self.assertRaises(grpc.RpcError) as exception_context: + next(responses) + self.assertIs(exception_context.exception.code(), grpc.StatusCode.UNKNOWN) + + def testHalfDuplexCall(self): + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + def half_duplex_request_iterator(): + request = self._request_pb2.StreamingOutputCallRequest() + request.response_parameters.add(size=1, interval_us=0) + yield request + request = self._request_pb2.StreamingOutputCallRequest() + request.response_parameters.add(size=2, interval_us=0) + request.response_parameters.add(size=3, interval_us=0) + yield request + responses = service.stub.HalfDuplexCall(half_duplex_request_iterator()) + expected_responses = service.servicer_methods.HalfDuplexCall( + half_duplex_request_iterator(), 'not a real RpcContext!') + for expected_response, response in moves.zip_longest( + expected_responses, responses): + self.assertEqual(expected_response, response) + + def testHalfDuplexCallWedged(self): + condition = threading.Condition() + wait_cell = [False] + @contextlib.contextmanager + def wait(): # pylint: disable=invalid-name + # Where's Python 3's 'nonlocal' statement when you need it? + with condition: + wait_cell[0] = True + yield + with condition: + wait_cell[0] = False + condition.notify_all() + def half_duplex_request_iterator(): + request = self._request_pb2.StreamingOutputCallRequest() + request.response_parameters.add(size=1, interval_us=0) + yield request + with condition: + while wait_cell[0]: + condition.wait() + service = _CreateService( + self._service_pb2, self._response_pb2, self._payload_pb2) + with wait(): + responses = service.stub.HalfDuplexCall( + half_duplex_request_iterator(), timeout=test_constants.SHORT_TIMEOUT) + # half-duplex waits for the client to send all info + with self.assertRaises(grpc.RpcError) as exception_context: + next(responses) + self.assertIs( + exception_context.exception.code(), grpc.StatusCode.DEADLINE_EXCEEDED) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/src/python/grpcio/tests/tests.json b/src/python/grpcio/tests/tests.json index 53b2998b786..391bb39ef57 100644 --- a/src/python/grpcio/tests/tests.json +++ b/src/python/grpcio/tests/tests.json @@ -49,6 +49,7 @@ "_low_test.HangingServerShutdown", "_low_test.InsecureServerInsecureClient", "_not_found_test.NotFoundTest", + "_python_plugin_test.PythonPluginTest", "_read_some_but_not_all_responses_test.ReadSomeButNotAllResponsesTest", "_rpc_test.RPCTest", "_sanity_test.Sanity", From a8d0a5d5e7cc0795904827e0388a707db4fd70e6 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Mon, 13 Jun 2016 14:28:59 -0700 Subject: [PATCH 162/175] Added Python GA API metadata tests --- src/python/grpcio/tests/tests.json | 1 + .../grpcio/tests/unit/_metadata_test.py | 216 ++++++++++++++++++ 2 files changed, 217 insertions(+) create mode 100644 src/python/grpcio/tests/unit/_metadata_test.py diff --git a/src/python/grpcio/tests/tests.json b/src/python/grpcio/tests/tests.json index 8dc47bf69dd..3c38dfc9990 100644 --- a/src/python/grpcio/tests/tests.json +++ b/src/python/grpcio/tests/tests.json @@ -47,6 +47,7 @@ "_lonely_invocation_link_test.LonelyInvocationLinkTest", "_low_test.HangingServerShutdown", "_low_test.InsecureServerInsecureClient", + "_metadata_test.MetadataTest", "_not_found_test.NotFoundTest", "_read_some_but_not_all_responses_test.ReadSomeButNotAllResponsesTest", "_rpc_test.RPCTest", diff --git a/src/python/grpcio/tests/unit/_metadata_test.py b/src/python/grpcio/tests/unit/_metadata_test.py new file mode 100644 index 00000000000..77b39012619 --- /dev/null +++ b/src/python/grpcio/tests/unit/_metadata_test.py @@ -0,0 +1,216 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +"""Tests server and client side metadata API.""" + +import unittest +import weakref + +import grpc +from grpc import _grpcio_metadata +from grpc.framework.foundation import logging_pool + +from tests.unit import test_common +from tests.unit.framework.common import test_constants + +_CHANNEL_ARGS = (('grpc.primary_user_agent', 'primary-agent'), + ('grpc.secondary_user_agent', 'secondary-agent')) + +_REQUEST = b'\x00\x00\x00' +_RESPONSE = b'\x00\x00\x00' + +_UNARY_UNARY = b'/test/UnaryUnary' +_UNARY_STREAM = b'/test/UnaryStream' +_STREAM_UNARY = b'/test/StreamUnary' +_STREAM_STREAM = b'/test/StreamStream' + +_USER_AGENT = 'Python-gRPC-{}'.format(_grpcio_metadata.__version__) + +_CLIENT_METADATA = ( + (b'client-md-key', b'client-md-key'), + (b'client-md-key-bin', b'\x00\x01') +) + +_SERVER_INITIAL_METADATA = ( + (b'server-initial-md-key', b'server-initial-md-value'), + (b'server-initial-md-key-bin', b'\x00\x02') +) + +_SERVER_TRAILING_METADATA = ( + (b'server-trailing-md-key', b'server-trailing-md-value'), + (b'server-trailing-md-key-bin', b'\x00\x03') +) + + +def user_agent(metadata): + for key, val in metadata: + if key == b'user-agent': + return val.decode('ascii') + raise KeyError('No user agent!') + + +def validate_client_metadata(test, servicer_context): + test.assertTrue(test_common.metadata_transmitted( + _CLIENT_METADATA, servicer_context.invocation_metadata())) + test.assertTrue(user_agent(servicer_context.invocation_metadata()) + .startswith('primary-agent ' + _USER_AGENT)) + test.assertTrue(user_agent(servicer_context.invocation_metadata()) + .endswith('secondary-agent')) + + +def handle_unary_unary(test, request, servicer_context): + validate_client_metadata(test, servicer_context) + servicer_context.send_initial_metadata(_SERVER_INITIAL_METADATA) + servicer_context.set_trailing_metadata(_SERVER_TRAILING_METADATA) + return _RESPONSE + + +def handle_unary_stream(test, request, servicer_context): + validate_client_metadata(test, servicer_context) + servicer_context.send_initial_metadata(_SERVER_INITIAL_METADATA) + servicer_context.set_trailing_metadata(_SERVER_TRAILING_METADATA) + for _ in range(test_constants.STREAM_LENGTH): + yield _RESPONSE + + +def handle_stream_unary(test, request_iterator, servicer_context): + validate_client_metadata(test, servicer_context) + servicer_context.send_initial_metadata(_SERVER_INITIAL_METADATA) + servicer_context.set_trailing_metadata(_SERVER_TRAILING_METADATA) + # TODO(issue:#6891) We should be able to remove this loop + for request in request_iterator: + pass + return _RESPONSE + + +def handle_stream_stream(test, request_iterator, servicer_context): + validate_client_metadata(test, servicer_context) + servicer_context.send_initial_metadata(_SERVER_INITIAL_METADATA) + servicer_context.set_trailing_metadata(_SERVER_TRAILING_METADATA) + # TODO(issue:#6891) We should be able to remove this loop, + # and replace with return; yield + for request in request_iterator: + yield _RESPONSE + + +class _MethodHandler(grpc.RpcMethodHandler): + + def __init__(self, test, request_streaming, response_streaming): + self.request_streaming = request_streaming + self.response_streaming = response_streaming + self.request_deserializer = None + self.response_serializer = None + self.unary_unary = None + self.unary_stream = None + self.stream_unary = None + self.stream_stream = None + if self.request_streaming and self.response_streaming: + self.stream_stream = lambda x, y: handle_stream_stream(test, x, y) + elif self.request_streaming: + self.stream_unary = lambda x, y: handle_stream_unary(test, x, y) + elif self.response_streaming: + self.unary_stream = lambda x, y: handle_unary_stream(test, x, y) + else: + self.unary_unary = lambda x, y: handle_unary_unary(test, x, y) + + +class _GenericHandler(grpc.GenericRpcHandler): + + def __init__(self, test): + self._test = test + + def service(self, handler_call_details): + if handler_call_details.method == _UNARY_UNARY: + return _MethodHandler(self._test, False, False) + elif handler_call_details.method == _UNARY_STREAM: + return _MethodHandler(self._test, False, True) + elif handler_call_details.method == _STREAM_UNARY: + return _MethodHandler(self._test, True, False) + elif handler_call_details.method == _STREAM_STREAM: + return _MethodHandler(self._test, True, True) + else: + return None + + +class MetadataTest(unittest.TestCase): + + def setUp(self): + self._server_pool = logging_pool.pool(test_constants.THREAD_CONCURRENCY) + self._server = grpc.server((_GenericHandler(weakref.proxy(self)),), + self._server_pool) + port = self._server.add_insecure_port('[::]:0') + self._server.start() + self._channel = grpc.insecure_channel('localhost:%d' % port, + options=_CHANNEL_ARGS) + + def tearDown(self): + self._server.stop(0) + + def testUnaryUnary(self): + multi_callable = self._channel.unary_unary(_UNARY_UNARY) + unused_response, call = multi_callable( + _REQUEST, metadata=_CLIENT_METADATA, with_call=True) + self.assertTrue(test_common.metadata_transmitted( + _SERVER_INITIAL_METADATA, call.initial_metadata())) + self.assertTrue(test_common.metadata_transmitted( + _SERVER_TRAILING_METADATA, call.trailing_metadata())) + + def testUnaryStream(self): + multi_callable = self._channel.unary_stream(_UNARY_STREAM) + call = multi_callable(_REQUEST, metadata=_CLIENT_METADATA) + self.assertTrue(test_common.metadata_transmitted( + _SERVER_INITIAL_METADATA, call.initial_metadata())) + for _ in call: + pass + self.assertTrue(test_common.metadata_transmitted( + _SERVER_TRAILING_METADATA, call.trailing_metadata())) + + def testStreamUnary(self): + multi_callable = self._channel.stream_unary(_STREAM_UNARY) + unused_response, call = multi_callable( + [_REQUEST] * test_constants.STREAM_LENGTH, + metadata=_CLIENT_METADATA, with_call=True) + self.assertTrue(test_common.metadata_transmitted( + _SERVER_INITIAL_METADATA, call.initial_metadata())) + self.assertTrue(test_common.metadata_transmitted( + _SERVER_TRAILING_METADATA, call.trailing_metadata())) + + def testStreamStream(self): + multi_callable = self._channel.stream_stream(_STREAM_STREAM) + call = multi_callable([_REQUEST] * test_constants.STREAM_LENGTH, + metadata=_CLIENT_METADATA) + self.assertTrue(test_common.metadata_transmitted( + _SERVER_INITIAL_METADATA, call.initial_metadata())) + for _ in call: + pass + self.assertTrue(test_common.metadata_transmitted( + _SERVER_TRAILING_METADATA, call.trailing_metadata())) + + +if __name__ == '__main__': + unittest.main(verbosity=2) From f24665fdd8a69927c482902d9780e953f5a37a04 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Mon, 13 Jun 2016 09:27:40 -0700 Subject: [PATCH 163/175] Fix create_[secure/insecure]_channel argument order --- src/python/grpcio/grpc/__init__.py | 4 ++-- src/python/grpcio/tests/unit/beta/test_utilities.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 5ba5a4e1fdd..2cedb19b6dd 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1059,7 +1059,7 @@ def insecure_channel(target, options=None): A Channel to the target through which RPCs may be conducted. """ from grpc import _channel - return _channel.Channel(target, None, options) + return _channel.Channel(target, options, None) def secure_channel(target, credentials, options=None): @@ -1075,7 +1075,7 @@ def secure_channel(target, credentials, options=None): A Channel to the target through which RPCs may be conducted. """ from grpc import _channel - return _channel.Channel(target, credentials, options) + return _channel.Channel(target, options, credentials) def server(generic_rpc_handlers, thread_pool, options=None): diff --git a/src/python/grpcio/tests/unit/beta/test_utilities.py b/src/python/grpcio/tests/unit/beta/test_utilities.py index 66b5f72897c..e374b203ce9 100644 --- a/src/python/grpcio/tests/unit/beta/test_utilities.py +++ b/src/python/grpcio/tests/unit/beta/test_utilities.py @@ -50,6 +50,6 @@ def not_really_secure_channel( """ target = '%s:%d' % (host, port) channel = grpc.secure_channel( - target, ((b'grpc.ssl_target_name_override', server_host_override,),), - channel_credentials._credentials) + target, channel_credentials._credentials, + ((b'grpc.ssl_target_name_override', server_host_override,),)) return implementations.Channel(channel) From 46f4a681d255bf8352a0a9622e1c59a24ba30d08 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 13 Jun 2016 15:31:27 -0700 Subject: [PATCH 164/175] minor fixes --- test/distrib/cpp/run_distrib_test.sh | 8 ++++---- tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/distrib/cpp/run_distrib_test.sh b/test/distrib/cpp/run_distrib_test.sh index dfe9867a602..bc84b84b8f3 100755 --- a/test/distrib/cpp/run_distrib_test.sh +++ b/test/distrib/cpp/run_distrib_test.sh @@ -30,13 +30,13 @@ set -ex -git clone $EXTERNAL_GIT_ROOT -cd grpc && git submodule update --init +git clone --recursive $EXTERNAL_GIT_ROOT +cd grpc cd third_party/protobuf && ./autogen.sh && \ -./configure && make -j12 && make check && make install && ldconfig +./configure && make -j4 && make check && make install && ldconfig -cd ../.. && make -j12 && make install +cd ../.. && make -j4 && make install cd examples/cpp/helloworld diff --git a/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile b/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile index b02208faed1..c24b1c451d3 100644 --- a/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile +++ b/tools/dockerfile/distribtest/cpp_jessie_x64/Dockerfile @@ -29,7 +29,7 @@ FROM debian:jessie -# Install packages for gRPC and protobuf +# Install packages needed for gRPC and protobuf RUN apt-get update && apt-get install -y \ autoconf \ automake \ From ed7428526cea1f7b54a126ef9cdb2c1456c47f2c Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Fri, 10 Jun 2016 13:19:31 -0700 Subject: [PATCH 165/175] Added cleanup to the server thread's join method. When the Python Interpreter exits, it first attempts to join any outstanding threads. This is problematic if a server is created as a top-level variable or referenced by a reference cycle, as join() will hang. This adds cleanup behavior to the server thread's join(). --- src/python/grpcio/grpc/_common.py | 42 +++++++ src/python/grpcio/grpc/_server.py | 31 +++-- src/python/grpcio/tests/tests.json | 1 + src/python/grpcio/tests/unit/_rpc_test.py | 7 -- .../grpcio/tests/unit/_thread_cleanup_test.py | 117 ++++++++++++++++++ 5 files changed, 180 insertions(+), 18 deletions(-) create mode 100644 src/python/grpcio/tests/unit/_thread_cleanup_test.py diff --git a/src/python/grpcio/grpc/_common.py b/src/python/grpcio/grpc/_common.py index b8688a0149a..1fd1704f18b 100644 --- a/src/python/grpcio/grpc/_common.py +++ b/src/python/grpcio/grpc/_common.py @@ -30,6 +30,8 @@ """Shared implementation.""" import logging +import threading +import time import six @@ -110,3 +112,43 @@ def fully_qualified_method(group, method): group = _encode(group) method = _encode(method) return b'/' + group + b'/' + method + + +class CleanupThread(threading.Thread): + """A threading.Thread subclass supporting custom behavior on join(). + + On Python Interpreter exit, Python will attempt to join outstanding threads + prior to garbage collection. We may need to do additional cleanup, and + we accomplish this by overriding the join() method. + """ + + def __init__(self, behavior, group=None, target=None, name=None, + args=(), kwargs={}): + """Constructor. + + Args: + behavior (function): Function called on join() with a single + argument, timeout, indicating the maximum duration of + `behavior`, or None indicating `behavior` has no deadline. + `behavior` must be idempotent. + group (None): should be None. Reseved for future extensions + when ThreadGroup is implemented. + target (function): The function to invoke when this thread is + run. Defaults to None. + name (str): The name of this thread. Defaults to None. + args (tuple[object]): A tuple of arguments to pass to `target`. + kwargs (dict[str,object]): A dictionary of keyword arguments to + pass to `target`. + """ + super(CleanupThread, self).__init__(group=group, target=target, + name=name, args=args, kwargs=kwargs) + self._behavior = behavior + + def join(self, timeout=None): + start_time = time.time() + self._behavior(timeout) + end_time = time.time() + if timeout is not None: + timeout -= end_time - start_time + timeout = max(timeout, 0) + super(CleanupThread, self).join(timeout) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index f4f67204977..2d9b96afbfa 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -60,6 +60,8 @@ _CANCELLED = 'cancelled' _EMPTY_FLAGS = 0 _EMPTY_METADATA = cygrpc.Metadata(()) +_UNEXPECTED_EXIT_SERVER_GRACE = 1.0 + def _serialized_request(request_event): return request_event.batch_operations[0].received_message.bytes() @@ -670,17 +672,6 @@ def _serve(state): return -def _start(state): - with state.lock: - if state.stage is not _ServerStage.STOPPED: - raise ValueError('Cannot start already-started server!') - state.server.start() - state.stage = _ServerStage.STARTED - _request_call(state) - thread = threading.Thread(target=_serve, args=(state,)) - thread.start() - - def _stop(state, grace): with state.lock: if state.stage is _ServerStage.STOPPED: @@ -719,6 +710,24 @@ def _stop(state, grace): return shutdown_event +def _start(state): + with state.lock: + if state.stage is not _ServerStage.STOPPED: + raise ValueError('Cannot start already-started server!') + state.server.start() + state.stage = _ServerStage.STARTED + _request_call(state) + def cleanup_server(timeout): + if timeout is None: + _stop(state, _UNEXPECTED_EXIT_SERVER_GRACE).wait() + else: + _stop(state, timeout).wait() + + thread = _common.CleanupThread( + cleanup_server, target=_serve, args=(state,)) + thread.start() + + class Server(grpc.Server): def __init__(self, generic_handlers, thread_pool): diff --git a/src/python/grpcio/tests/tests.json b/src/python/grpcio/tests/tests.json index 8dc47bf69dd..fcf2001b806 100644 --- a/src/python/grpcio/tests/tests.json +++ b/src/python/grpcio/tests/tests.json @@ -52,6 +52,7 @@ "_rpc_test.RPCTest", "_sanity_test.Sanity", "_secure_interop_test.SecureInteropTest", + "_thread_cleanup_test.CleanupThreadTest", "_transmission_test.RoundTripTest", "_transmission_test.TransmissionTest", "_utilities_test.ChannelConnectivityTest", diff --git a/src/python/grpcio/tests/unit/_rpc_test.py b/src/python/grpcio/tests/unit/_rpc_test.py index b33bff490c7..8773e962847 100644 --- a/src/python/grpcio/tests/unit/_rpc_test.py +++ b/src/python/grpcio/tests/unit/_rpc_test.py @@ -193,13 +193,6 @@ class RPCTest(unittest.TestCase): self._channel = grpc.insecure_channel('localhost:%d' % port) - # TODO(nathaniel): Why is this necessary, and only in some development - # environments? - def tearDown(self): - del self._channel - del self._server - del self._server_pool - def testUnrecognizedMethod(self): request = b'abc' diff --git a/src/python/grpcio/tests/unit/_thread_cleanup_test.py b/src/python/grpcio/tests/unit/_thread_cleanup_test.py new file mode 100644 index 00000000000..3e4f317edcd --- /dev/null +++ b/src/python/grpcio/tests/unit/_thread_cleanup_test.py @@ -0,0 +1,117 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +"""Tests for CleanupThread.""" + +import threading +import time +import unittest + +from grpc import _common + +_SHORT_TIME = 0.5 +_LONG_TIME = 2.0 +_EPSILON = 0.1 + + +def cleanup(timeout): + if timeout is not None: + time.sleep(timeout) + else: + time.sleep(_LONG_TIME) + + +def slow_cleanup(timeout): + # Don't respect timeout + time.sleep(_LONG_TIME) + + +class CleanupThreadTest(unittest.TestCase): + + def testTargetInvocation(self): + event = threading.Event() + def target(arg1, arg2, arg3=None): + self.assertEqual('arg1', arg1) + self.assertEqual('arg2', arg2) + self.assertEqual('arg3', arg3) + event.set() + + cleanup_thread = _common.CleanupThread(behavior=lambda x: None, + target=target, name='test-name', + args=('arg1', 'arg2'), kwargs={'arg3': 'arg3'}) + cleanup_thread.start() + cleanup_thread.join() + self.assertEqual(cleanup_thread.name, 'test-name') + self.assertTrue(event.is_set()) + + def testJoinNoTimeout(self): + cleanup_thread = _common.CleanupThread(behavior=cleanup) + cleanup_thread.start() + start_time = time.time() + cleanup_thread.join() + end_time = time.time() + self.assertAlmostEqual(_LONG_TIME, end_time - start_time, delta=_EPSILON) + + def testJoinTimeout(self): + cleanup_thread = _common.CleanupThread(behavior=cleanup) + cleanup_thread.start() + start_time = time.time() + cleanup_thread.join(_SHORT_TIME) + end_time = time.time() + self.assertAlmostEqual(_SHORT_TIME, end_time - start_time, delta=_EPSILON) + + def testJoinTimeoutSlowBehavior(self): + cleanup_thread = _common.CleanupThread(behavior=slow_cleanup) + cleanup_thread.start() + start_time = time.time() + cleanup_thread.join(_SHORT_TIME) + end_time = time.time() + self.assertAlmostEqual(_LONG_TIME, end_time - start_time, delta=_EPSILON) + + def testJoinTimeoutSlowTarget(self): + event = threading.Event() + def target(): + event.wait(_LONG_TIME) + cleanup_thread = _common.CleanupThread(behavior=cleanup, target=target) + cleanup_thread.start() + start_time = time.time() + cleanup_thread.join(_SHORT_TIME) + end_time = time.time() + self.assertAlmostEqual(_SHORT_TIME, end_time - start_time, delta=_EPSILON) + event.set() + + def testJoinZeroTimeout(self): + cleanup_thread = _common.CleanupThread(behavior=cleanup) + cleanup_thread.start() + start_time = time.time() + cleanup_thread.join(0) + end_time = time.time() + self.assertAlmostEqual(0, end_time - start_time, delta=_EPSILON) + +if __name__ == '__main__': + unittest.main(verbosity=2) From 058c9de8b28275484d9eef3c7d4cab45a52ec53e Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Mon, 13 Jun 2016 19:04:43 -0700 Subject: [PATCH 166/175] Added to server's shutdown docstrings --- include/grpc++/impl/codegen/server_interface.h | 8 ++++++++ include/grpc++/server_builder.h | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 7b7d5aa90b6..3a3e052d9ef 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -62,6 +62,10 @@ class ServerInterface : public CallHook { /// Shutdown the server, blocking until all rpc processing finishes. /// Forcefully terminate pending calls after \a deadline expires. /// + /// All completion queue associated with the server (for example, for async + /// serving) must be shutdown *after* this method has returned: + /// See \a ServerBuilder::AddCompletionQueue for details. + /// /// \param deadline How long to wait until pending rpcs are forcefully /// terminated. template @@ -70,6 +74,10 @@ class ServerInterface : public CallHook { } /// Shutdown the server, waiting for all rpc processing to finish. + /// + /// All completion queue associated with the server (for example, for async + /// serving) must be shutdown *after* this method has returned: + /// See \a ServerBuilder::AddCompletionQueue for details. void Shutdown() { ShutdownInternal(gpr_inf_future(GPR_CLOCK_MONOTONIC)); } /// Block waiting for all work to complete. diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 54f01d11b5d..aa7588d34d3 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -119,9 +119,20 @@ class ServerBuilder { std::shared_ptr creds, int* selected_port = nullptr); - /// Add a completion queue for handling asynchronous services - /// Caller is required to keep this completion queue live until - /// the server is destroyed. + /// Add a completion queue for handling asynchronous services. + /// + /// Caller is required to shutdown the server prior to shutting down the + /// returned completion queue. A typical usage scenario: + /// + /// // While building the server: + /// ServerBuilder builder; + /// ... + /// cq_ = builder.AddCompletionQueue(); + /// server_ = builder.BuildAndStart(); + /// + /// // While shutting down the server; + /// server_->Shutdown(); + /// cq_->Shutdown(); // Always *after* the associated server's Shutdown()! /// /// \param is_frequently_polled This is an optional parameter to inform GRPC /// library about whether this completion queue would be frequently polled From 289dcb1b68c236d11a8f5a89827e95af94a7df12 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 13 Jun 2016 19:10:15 -0700 Subject: [PATCH 167/175] Rename gpr_strpad as gpr_leftpad --- .../chttp2/transport/chttp2_transport.c | 8 ++++---- src/core/lib/support/string.c | 2 +- src/core/lib/support/string.h | 2 +- test/core/support/string_test.c | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 6dbe9b70f3e..6e8640f1b32 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2024,7 +2024,7 @@ static char *format_flowctl_context_var(const char *context, const char *var, if (context == NULL) { *scope = NULL; gpr_asprintf(&buf, "%s(%" PRId64 ")", var, val); - result = gpr_strpad(buf, ' ', 40); + result = gpr_leftpad(buf, ' ', 40); gpr_free(buf); return result; } @@ -2037,7 +2037,7 @@ static char *format_flowctl_context_var(const char *context, const char *var, gpr_free(tmp); } gpr_asprintf(&buf, "%s.%s(%" PRId64 ")", underscore_pos + 1, var, val); - result = gpr_strpad(buf, ' ', 40); + result = gpr_leftpad(buf, ' ', 40); gpr_free(buf); return result; } @@ -2068,8 +2068,8 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *phase, char *clisvr = is_client ? "client" : "server"; char *prefix; - tmp_phase = gpr_strpad(phase, ' ', 8); - tmp_scope1 = gpr_strpad(scope1, ' ', 11); + tmp_phase = gpr_leftpad(phase, ' ', 8); + tmp_scope1 = gpr_leftpad(scope1, ' ', 11); gpr_asprintf(&prefix, "FLOW %s: %s %s ", phase, clisvr, scope1); gpr_free(tmp_phase); gpr_free(tmp_scope1); diff --git a/src/core/lib/support/string.c b/src/core/lib/support/string.c index 789bd6408be..30c1e67647a 100644 --- a/src/core/lib/support/string.c +++ b/src/core/lib/support/string.c @@ -194,7 +194,7 @@ int int64_ttoa(int64_t value, char *string) { return i; } -char *gpr_strpad(const char *str, char flag, size_t length) { +char *gpr_leftpad(const char *str, char flag, size_t length) { const size_t str_length = strlen(str); const size_t out_length = str_length > length ? str_length : length; char *out = gpr_malloc(out_length + 1); diff --git a/src/core/lib/support/string.h b/src/core/lib/support/string.h index 30f5aef7665..2b6bb3eec61 100644 --- a/src/core/lib/support/string.h +++ b/src/core/lib/support/string.h @@ -85,7 +85,7 @@ void gpr_reverse_bytes(char *str, int len); /* Pad a string with flag characters. The given length specifies the minimum field width. The input string is never truncated. */ -char *gpr_strpad(const char *str, char flag, size_t length); +char *gpr_leftpad(const char *str, char flag, size_t length); /* Join a set of strings, returning the resulting string. Total combined length (excluding null terminator) is returned in total_length diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c index 3380482787e..553a824b3fa 100644 --- a/test/core/support/string_test.c +++ b/test/core/support/string_test.c @@ -334,34 +334,34 @@ static void test_int64toa() { GPR_ASSERT(0 == strcmp("-9223372036854775808", buf)); } -static void test_strpad() { +static void test_leftpad() { char *padded; - padded = gpr_strpad("foo", ' ', 5); + padded = gpr_leftpad("foo", ' ', 5); GPR_ASSERT(0 == strcmp(" foo", padded)); gpr_free(padded); - padded = gpr_strpad("foo", ' ', 4); + padded = gpr_leftpad("foo", ' ', 4); GPR_ASSERT(0 == strcmp(" foo", padded)); gpr_free(padded); - padded = gpr_strpad("foo", ' ', 3); + padded = gpr_leftpad("foo", ' ', 3); GPR_ASSERT(0 == strcmp("foo", padded)); gpr_free(padded); - padded = gpr_strpad("foo", ' ', 2); + padded = gpr_leftpad("foo", ' ', 2); GPR_ASSERT(0 == strcmp("foo", padded)); gpr_free(padded); - padded = gpr_strpad("foo", ' ', 1); + padded = gpr_leftpad("foo", ' ', 1); GPR_ASSERT(0 == strcmp("foo", padded)); gpr_free(padded); - padded = gpr_strpad("foo", ' ', 0); + padded = gpr_leftpad("foo", ' ', 0); GPR_ASSERT(0 == strcmp("foo", padded)); gpr_free(padded); - padded = gpr_strpad("foo", '0', 5); + padded = gpr_leftpad("foo", '0', 5); GPR_ASSERT(0 == strcmp("00foo", padded)); gpr_free(padded); } @@ -378,6 +378,6 @@ int main(int argc, char **argv) { test_strsplit(); test_ltoa(); test_int64toa(); - test_strpad(); + test_leftpad(); return 0; } From 6668d51b3c6544ab988a503977e0e80475ac5d3e Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 18 May 2016 14:05:09 -0700 Subject: [PATCH 168/175] php: add call getTrailingMetadata API --- src/php/lib/Grpc/AbstractCall.php | 10 ++++++++++ src/php/lib/Grpc/BidiStreamingCall.php | 1 + src/php/lib/Grpc/ClientStreamingCall.php | 4 +++- src/php/lib/Grpc/ServerStreamingCall.php | 1 + src/php/lib/Grpc/UnaryCall.php | 4 +++- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index 712af91eb28..c86d2988055 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -39,6 +39,7 @@ abstract class AbstractCall protected $call; protected $deserialize; protected $metadata; + protected $trailing_metadata; /** * Create a new Call wrapper object. @@ -66,6 +67,7 @@ abstract class AbstractCall $this->call = new Call($channel, $method, $deadline); $this->deserialize = $deserialize; $this->metadata = null; + $this->trailing_metadata = null; if (isset($options['call_credentials_callback']) && is_callable($call_credentials_callback = $options['call_credentials_callback'])) { @@ -83,6 +85,14 @@ abstract class AbstractCall return $this->metadata; } + /** + * @return The trailing metadata sent by the server. + */ + public function getTrailingMetadata() + { + return $this->trailing_metadata; + } + /** * @return string The URI of the endpoint. */ diff --git a/src/php/lib/Grpc/BidiStreamingCall.php b/src/php/lib/Grpc/BidiStreamingCall.php index bf813c12e76..95e51c5088d 100644 --- a/src/php/lib/Grpc/BidiStreamingCall.php +++ b/src/php/lib/Grpc/BidiStreamingCall.php @@ -112,6 +112,7 @@ class BidiStreamingCall extends AbstractCall OP_RECV_STATUS_ON_CLIENT => true, ]); + $this->trailing_metadata = $status_event->status->metadata; return $status_event->status; } } diff --git a/src/php/lib/Grpc/ClientStreamingCall.php b/src/php/lib/Grpc/ClientStreamingCall.php index 500cfe0d7a0..315a406735f 100644 --- a/src/php/lib/Grpc/ClientStreamingCall.php +++ b/src/php/lib/Grpc/ClientStreamingCall.php @@ -86,6 +86,8 @@ class ClientStreamingCall extends AbstractCall ]); $this->metadata = $event->metadata; - return [$this->deserializeResponse($event->message), $event->status]; + $status = $event->status; + $this->trailing_metadata = $status->metadata; + return [$this->deserializeResponse($event->message), $status]; } } diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index da48523717e..53599fe4ae8 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -91,6 +91,7 @@ class ServerStreamingCall extends AbstractCall OP_RECV_STATUS_ON_CLIENT => true, ]); + $this->trailing_metadata = $status_event->status->metadata; return $status_event->status; } } diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index b57903d6d07..b114b771b84 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -75,6 +75,8 @@ class UnaryCall extends AbstractCall OP_RECV_STATUS_ON_CLIENT => true, ]); - return [$this->deserializeResponse($event->message), $event->status]; + $status = $event->status; + $this->trailing_metadata = $status->metadata; + return [$this->deserializeResponse($event->message), $status]; } } From 1e44766bfc3975af2f223a2e2442ba5794f86bc9 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Tue, 14 Jun 2016 19:09:49 +0000 Subject: [PATCH 169/175] Drop unnecessary future division import We only ever use floor division (//) in the module. --- src/python/grpcio/tests/unit/_rpc_test.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/python/grpcio/tests/unit/_rpc_test.py b/src/python/grpcio/tests/unit/_rpc_test.py index b33bff490c7..886ed87f251 100644 --- a/src/python/grpcio/tests/unit/_rpc_test.py +++ b/src/python/grpcio/tests/unit/_rpc_test.py @@ -29,8 +29,6 @@ """Test of gRPC Python's application-layer API.""" -from __future__ import division - import itertools import threading import unittest From 04422141292aefa489cd6cb5f05a1d2f2de7f20f Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Tue, 14 Jun 2016 20:10:52 +0000 Subject: [PATCH 170/175] UNIMPLEMENTED status for cardinality violation --- src/python/grpcio/grpc/_server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 2f99e5b4125..1d62292e90c 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -342,10 +342,9 @@ def _unary_request(rpc_event, state, request_deserializer): if state.client is _CLOSED: details = '"{}" requires exactly one request message.'.format( rpc_event.request_call_details.method) - # TODO(5992#issuecomment-220761992): really, what status code? _abort( state, rpc_event.operation_call, - cygrpc.StatusCode.unavailable, details) + cygrpc.StatusCode.unimplemented, details) return None elif state.client is _CANCELLED: return None From f2ce4307bfc639a1cde97b704c7df29246cf6ae3 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 14 Jun 2016 16:11:48 -0700 Subject: [PATCH 171/175] fix terminal encoding for cocoapods --- src/objective-c/tests/build_tests.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh index e7ad31e4031..8547bfd3a83 100755 --- a/src/objective-c/tests/build_tests.sh +++ b/src/objective-c/tests/build_tests.sh @@ -33,6 +33,9 @@ set -e +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 + cd $(dirname $0) hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } From b8d50af3a58f99a4c0d379d9a68f7bc4dd383f7e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 13 Jun 2016 17:24:15 -0700 Subject: [PATCH 172/175] deduplicate send finished handler --- src/csharp/Grpc.Core/Internal/AsyncCall.cs | 2 +- .../Grpc.Core/Internal/AsyncCallBase.cs | 27 +------------------ 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index 895be690a59..f549c528762 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -267,7 +267,7 @@ namespace Grpc.Core.Internal halfcloseRequested = true; return Task.FromResult(null); } - call.StartSendCloseFromClient(HandleSendCloseFromClientFinished); + call.StartSendCloseFromClient(HandleSendFinished); halfcloseRequested = true; streamingWriteTcs = new TaskCompletionSource(); diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index cb8366c2166..eb9c3ea62d1 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -248,7 +248,7 @@ namespace Grpc.Core.Internal } /// - /// Handles send completion. + /// Handles send completion (including SendCloseFromClient). /// protected void HandleSendFinished(bool success) { @@ -271,31 +271,6 @@ namespace Grpc.Core.Internal } } - /// - /// Handles halfclose (send close from client) completion. - /// - protected void HandleSendCloseFromClientFinished(bool success) - { - TaskCompletionSource origTcs = null; - lock (myLock) - { - origTcs = streamingWriteTcs; - streamingWriteTcs = null; - - ReleaseResourcesIfPossible(); - } - - if (!success) - { - // TODO(jtattermusch): this method is same as HandleSendFinished (only the error message differs). - origTcs.SetException(new InvalidOperationException("Sending close from client has failed.")); - } - else - { - origTcs.SetResult(null); - } - } - /// /// Handles send status from server completion. /// From 2eb09ee543e5ce9e34e895b5d2a6fbff79d6ddc6 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 14 Jun 2016 17:50:20 -0700 Subject: [PATCH 173/175] improve docs for IAsyncStreamReader --- src/csharp/Grpc.Core/IAsyncStreamReader.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/IAsyncStreamReader.cs b/src/csharp/Grpc.Core/IAsyncStreamReader.cs index 49e1ea78325..aa3b802a50f 100644 --- a/src/csharp/Grpc.Core/IAsyncStreamReader.cs +++ b/src/csharp/Grpc.Core/IAsyncStreamReader.cs @@ -41,10 +41,24 @@ namespace Grpc.Core { /// /// A stream of messages to be read. + /// Messages can be awaited await reader.MoveNext(), that returns true + /// if there is a message available and false if there are no more messages + /// (i.e. the stream has been closed). + /// + /// On the client side, the last invocation of MoveNext() either returns false + /// if the call has finished successfully or throws RpcException if call finished + /// with an error. Once the call finishes, subsequent invocations of MoveNext() will + /// continue yielding the same result (returning false or throwing an exception). + /// + /// + /// On the server side, MoveNext() does not throw exceptions. + /// In case of a failure, the request stream will appear to be finished + /// (MoveNext will return false) and the CancellationToken + /// associated with the call will be cancelled to signal the failure. + /// /// /// The message type. public interface IAsyncStreamReader : IAsyncEnumerator { - // TODO(jtattermusch): consider just using IAsyncEnumerator instead of this interface. } } From 2a6c68361adbf10af5e4971b064aaf61c20cdbfc Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 15 Jun 2016 18:11:08 -0700 Subject: [PATCH 174/175] Fixed printf/gpr_log format. The faulty line is behind a preprocessor define that isn't on by default. --- src/core/ext/client_config/lb_policy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/ext/client_config/lb_policy.c b/src/core/ext/client_config/lb_policy.c index 20535398d69..dc1612428ec 100644 --- a/src/core/ext/client_config/lb_policy.c +++ b/src/core/ext/client_config/lb_policy.c @@ -60,8 +60,9 @@ static gpr_atm ref_mutate(grpc_lb_policy *c, gpr_atm delta, : gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta); #ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "LB_POLICY: %p % 12s 0x%08x -> 0x%08x [%s]", c, purpose, old_val, - old_val + delta, reason); + "LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR + " [%s]", + (intptr_t)c, purpose, old_val, old_val + delta, reason); #endif return old_val; } From 3e1379a35d9af751cad6046c82cf5b0bfc782fa7 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 16 Jun 2016 21:11:06 +0000 Subject: [PATCH 175/175] grpc.__all__ definition --- src/python/grpcio/grpc/__init__.py | 46 ++++++++++ src/python/grpcio/tests/tests.json | 1 + src/python/grpcio/tests/unit/_api_test.py | 90 +++++++++++++++++++ .../tests/unit/_from_grpc_import_star.py | 38 ++++++++ 4 files changed, 175 insertions(+) create mode 100644 src/python/grpcio/tests/unit/_api_test.py create mode 100644 src/python/grpcio/tests/unit/_from_grpc_import_star.py diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 2fbb9f45e6f..1cc0c3a2505 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1193,3 +1193,49 @@ def server(generic_rpc_handlers, thread_pool, options=None): """ from grpc import _server return _server.Server(generic_rpc_handlers, thread_pool) + + +################################### __all__ ################################# + + +__all__ = ( + 'FutureTimeoutError', + 'FutureCancelledError', + 'Future', + 'ChannelConnectivity', + 'StatusCode', + 'RpcError', + 'RpcContext', + 'Call', + 'ChannelCredentials', + 'CallCredentials', + 'AuthMetadataContext', + 'AuthMetadataPluginCallback', + 'AuthMetadataPlugin', + 'ServerCredentials', + 'UnaryUnaryMultiCallable', + 'UnaryStreamMultiCallable', + 'StreamUnaryMultiCallable', + 'StreamStreamMultiCallable', + 'Channel', + 'ServicerContext', + 'RpcMethodHandler', + 'HandlerCallDetails', + 'GenericRpcHandler', + 'Server', + 'unary_unary_rpc_method_handler', + 'unary_stream_rpc_method_handler', + 'stream_unary_rpc_method_handler', + 'stream_stream_rpc_method_handler', + 'method_handlers_generic_handler', + 'ssl_channel_credentials', + 'metadata_call_credentials', + 'access_token_call_credentials', + 'composite_call_credentials', + 'composite_channel_credentials', + 'ssl_server_credentials', + 'channel_ready_future', + 'insecure_channel', + 'secure_channel', + 'server', +) diff --git a/src/python/grpcio/tests/tests.json b/src/python/grpcio/tests/tests.json index e64d2d04a78..c13031fa8ec 100644 --- a/src/python/grpcio/tests/tests.json +++ b/src/python/grpcio/tests/tests.json @@ -1,4 +1,5 @@ [ + "_api_test.AllTest", "_auth_test.AccessTokenCallCredentialsTest", "_auth_test.GoogleCallCredentialsTest", "_base_interface_test.AsyncEasyTest", diff --git a/src/python/grpcio/tests/unit/_api_test.py b/src/python/grpcio/tests/unit/_api_test.py new file mode 100644 index 00000000000..1d724c3ed4f --- /dev/null +++ b/src/python/grpcio/tests/unit/_api_test.py @@ -0,0 +1,90 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Test of gRPC Python's application-layer API.""" + +import unittest + +import six + +from tests.unit import _from_grpc_import_star + + +class AllTest(unittest.TestCase): + + def testAll(self): + expected_grpc_code_elements = ( + 'FutureTimeoutError', + 'FutureCancelledError', + 'Future', + 'ChannelConnectivity', + 'StatusCode', + 'RpcError', + 'RpcContext', + 'Call', + 'ChannelCredentials', + 'CallCredentials', + 'AuthMetadataContext', + 'AuthMetadataPluginCallback', + 'AuthMetadataPlugin', + 'ServerCredentials', + 'UnaryUnaryMultiCallable', + 'UnaryStreamMultiCallable', + 'StreamUnaryMultiCallable', + 'StreamStreamMultiCallable', + 'Channel', + 'ServicerContext', + 'RpcMethodHandler', + 'HandlerCallDetails', + 'GenericRpcHandler', + 'Server', + 'unary_unary_rpc_method_handler', + 'unary_stream_rpc_method_handler', + 'stream_unary_rpc_method_handler', + 'stream_stream_rpc_method_handler', + 'method_handlers_generic_handler', + 'ssl_channel_credentials', + 'metadata_call_credentials', + 'access_token_call_credentials', + 'composite_call_credentials', + 'composite_channel_credentials', + 'ssl_server_credentials', + 'channel_ready_future', + 'insecure_channel', + 'secure_channel', + 'server', + ) + + six.assertCountEqual( + self, expected_grpc_code_elements, + _from_grpc_import_star.GRPC_ELEMENTS) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/src/python/grpcio/tests/unit/_from_grpc_import_star.py b/src/python/grpcio/tests/unit/_from_grpc_import_star.py new file mode 100644 index 00000000000..78d2fb7dc56 --- /dev/null +++ b/src/python/grpcio/tests/unit/_from_grpc_import_star.py @@ -0,0 +1,38 @@ +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +_BEFORE_IMPORT = tuple(globals()) + +from grpc import * + +_AFTER_IMPORT = tuple(globals()) + +GRPC_ELEMENTS = tuple( + element for element in _AFTER_IMPORT + if element not in _BEFORE_IMPORT and element != '_BEFORE_IMPORT')