grpc 1.34.0-x86-linux → 1.37.0-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/etc/roots.pem +257 -573
- data/src/ruby/ext/grpc/extconf.rb +9 -1
- data/src/ruby/ext/grpc/rb_channel.c +10 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +14 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +34 -13
- data/src/ruby/ext/grpc/rb_server.c +13 -1
- data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
- data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
- data/src/ruby/lib/grpc/2.4/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +35 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +18 -0
- data/src/ruby/pb/test/xds_client.rb +166 -25
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +32 -0
- data/src/ruby/spec/channel_spec.rb +17 -6
- data/src/ruby/spec/client_auth_spec.rb +27 -1
- data/src/ruby/spec/errors_spec.rb +1 -1
- data/src/ruby/spec/generic/active_call_spec.rb +2 -2
- data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
- data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
- data/src/ruby/spec/server_credentials_spec.rb +25 -0
- data/src/ruby/spec/server_spec.rb +22 -0
- metadata +39 -35
- data/src/ruby/lib/grpc/2.3/grpc_c.so +0 -0
@@ -45,8 +45,16 @@ if RUBY_PLATFORM =~ /darwin/
|
|
45
45
|
ENV['EMBED_OPENSSL'] = 'true'
|
46
46
|
ENV['EMBED_ZLIB'] = 'true'
|
47
47
|
ENV['EMBED_CARES'] = 'true'
|
48
|
+
|
48
49
|
ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
|
49
|
-
|
50
|
+
if RUBY_PLATFORM =~ /darwin/
|
51
|
+
if RUBY_PLATFORM =~ /arm64/
|
52
|
+
ENV['ARCH_FLAGS'] = '-arch arm64'
|
53
|
+
else
|
54
|
+
ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
50
58
|
ENV['CPPFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
|
51
59
|
|
52
60
|
output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
|
@@ -34,6 +34,7 @@
|
|
34
34
|
#include "rb_completion_queue.h"
|
35
35
|
#include "rb_grpc.h"
|
36
36
|
#include "rb_server.h"
|
37
|
+
#include "rb_xds_channel_credentials.h"
|
37
38
|
|
38
39
|
/* id_channel is the name of the hidden ivar that preserves a reference to the
|
39
40
|
* channel on a call, so that calls are not GCed before their channel. */
|
@@ -242,7 +243,15 @@ static VALUE grpc_rb_channel_init(int argc, VALUE* argv, VALUE self) {
|
|
242
243
|
ch = grpc_insecure_channel_create(target_chars, &args, NULL);
|
243
244
|
} else {
|
244
245
|
wrapper->credentials = credentials;
|
245
|
-
|
246
|
+
if (grpc_rb_is_channel_credentials(credentials)) {
|
247
|
+
creds = grpc_rb_get_wrapped_channel_credentials(credentials);
|
248
|
+
} else if (grpc_rb_is_xds_channel_credentials(credentials)) {
|
249
|
+
creds = grpc_rb_get_wrapped_xds_channel_credentials(credentials);
|
250
|
+
} else {
|
251
|
+
rb_raise(rb_eTypeError,
|
252
|
+
"bad creds, want ChannelCredentials or XdsChannelCredentials");
|
253
|
+
return Qnil;
|
254
|
+
}
|
246
255
|
ch = grpc_secure_channel_create(creds, target_chars, &args, NULL);
|
247
256
|
}
|
248
257
|
|
@@ -180,7 +180,11 @@ static VALUE grpc_rb_channel_credentials_init(int argc, VALUE* argv,
|
|
180
180
|
NULL, NULL);
|
181
181
|
}
|
182
182
|
if (creds == NULL) {
|
183
|
-
rb_raise(rb_eRuntimeError,
|
183
|
+
rb_raise(rb_eRuntimeError,
|
184
|
+
"the call to grpc_ssl_credentials_create() failed, could not "
|
185
|
+
"create a credentials, see "
|
186
|
+
"https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md for "
|
187
|
+
"debugging tips");
|
184
188
|
return Qnil;
|
185
189
|
}
|
186
190
|
wrapper->wrapped = creds;
|
@@ -270,7 +274,13 @@ void Init_grpc_channel_credentials() {
|
|
270
274
|
/* Gets the wrapped grpc_channel_credentials from the ruby wrapper */
|
271
275
|
grpc_channel_credentials* grpc_rb_get_wrapped_channel_credentials(VALUE v) {
|
272
276
|
grpc_rb_channel_credentials* wrapper = NULL;
|
277
|
+
Check_TypedStruct(v, &grpc_rb_channel_credentials_data_type);
|
273
278
|
TypedData_Get_Struct(v, grpc_rb_channel_credentials,
|
274
279
|
&grpc_rb_channel_credentials_data_type, wrapper);
|
275
280
|
return wrapper->wrapped;
|
276
281
|
}
|
282
|
+
|
283
|
+
/* Check if v is kind of ChannelCredentials */
|
284
|
+
bool grpc_rb_is_channel_credentials(VALUE v) {
|
285
|
+
return rb_typeddata_is_kind_of(v, &grpc_rb_channel_credentials_data_type);
|
286
|
+
}
|
@@ -20,6 +20,7 @@
|
|
20
20
|
#define GRPC_RB_CREDENTIALS_H_
|
21
21
|
|
22
22
|
#include <ruby/ruby.h>
|
23
|
+
#include <stdbool.h>
|
23
24
|
|
24
25
|
#include <grpc/grpc_security.h>
|
25
26
|
|
@@ -29,4 +30,7 @@ void Init_grpc_channel_credentials();
|
|
29
30
|
/* Gets the wrapped credentials from the ruby wrapper */
|
30
31
|
grpc_channel_credentials* grpc_rb_get_wrapped_channel_credentials(VALUE v);
|
31
32
|
|
33
|
+
/* Check if v is kind of ChannelCredentials */
|
34
|
+
bool grpc_rb_is_channel_credentials(VALUE v);
|
35
|
+
|
32
36
|
#endif /* GRPC_RB_CREDENTIALS_H_ */
|
@@ -142,7 +142,7 @@ grpc_compression_level grpc_rb_compression_options_level_name_to_value_internal(
|
|
142
142
|
"Unrecognized compression level name."
|
143
143
|
"Valid compression level names are none, low, medium, and high.");
|
144
144
|
|
145
|
-
/*
|
145
|
+
/* Phony return statement. */
|
146
146
|
return GRPC_COMPRESS_LEVEL_NONE;
|
147
147
|
}
|
148
148
|
|
data/src/ruby/ext/grpc/rb_grpc.c
CHANGED
@@ -40,6 +40,8 @@
|
|
40
40
|
#include "rb_loader.h"
|
41
41
|
#include "rb_server.h"
|
42
42
|
#include "rb_server_credentials.h"
|
43
|
+
#include "rb_xds_channel_credentials.h"
|
44
|
+
#include "rb_xds_server_credentials.h"
|
43
45
|
|
44
46
|
static VALUE grpc_rb_cTimeVal = Qnil;
|
45
47
|
|
@@ -321,8 +323,10 @@ void Init_grpc_c() {
|
|
321
323
|
Init_grpc_call();
|
322
324
|
Init_grpc_call_credentials();
|
323
325
|
Init_grpc_channel_credentials();
|
326
|
+
Init_grpc_xds_channel_credentials();
|
324
327
|
Init_grpc_server();
|
325
328
|
Init_grpc_server_credentials();
|
329
|
+
Init_grpc_xds_server_credentials();
|
326
330
|
Init_grpc_time_consts();
|
327
331
|
Init_grpc_compression_options();
|
328
332
|
}
|
@@ -80,6 +80,9 @@ grpc_server_register_method_type grpc_server_register_method_import;
|
|
80
80
|
grpc_server_request_registered_call_type grpc_server_request_registered_call_import;
|
81
81
|
grpc_server_create_type grpc_server_create_import;
|
82
82
|
grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import;
|
83
|
+
grpc_server_config_fetcher_xds_create_type grpc_server_config_fetcher_xds_create_import;
|
84
|
+
grpc_server_config_fetcher_destroy_type grpc_server_config_fetcher_destroy_import;
|
85
|
+
grpc_server_set_config_fetcher_type grpc_server_set_config_fetcher_import;
|
83
86
|
grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
|
84
87
|
grpc_server_start_type grpc_server_start_import;
|
85
88
|
grpc_server_shutdown_and_notify_type grpc_server_shutdown_and_notify_import;
|
@@ -95,6 +98,7 @@ grpc_resource_quota_ref_type grpc_resource_quota_ref_import;
|
|
95
98
|
grpc_resource_quota_unref_type grpc_resource_quota_unref_import;
|
96
99
|
grpc_resource_quota_resize_type grpc_resource_quota_resize_import;
|
97
100
|
grpc_resource_quota_set_max_threads_type grpc_resource_quota_set_max_threads_import;
|
101
|
+
grpc_dump_xds_configs_type grpc_dump_xds_configs_import;
|
98
102
|
grpc_resource_quota_arg_vtable_type grpc_resource_quota_arg_vtable_import;
|
99
103
|
grpc_channelz_get_top_channels_type grpc_channelz_get_top_channels_import;
|
100
104
|
grpc_channelz_get_servers_type grpc_channelz_get_servers_import;
|
@@ -130,6 +134,7 @@ grpc_composite_call_credentials_create_type grpc_composite_call_credentials_crea
|
|
130
134
|
grpc_google_compute_engine_credentials_create_type grpc_google_compute_engine_credentials_create_import;
|
131
135
|
grpc_max_auth_token_lifetime_type grpc_max_auth_token_lifetime_import;
|
132
136
|
grpc_service_account_jwt_access_credentials_create_type grpc_service_account_jwt_access_credentials_create_import;
|
137
|
+
grpc_external_account_credentials_create_type grpc_external_account_credentials_create_import;
|
133
138
|
grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
|
134
139
|
grpc_access_token_credentials_create_type grpc_access_token_credentials_create_import;
|
135
140
|
grpc_google_iam_credentials_create_type grpc_google_iam_credentials_create_import;
|
@@ -162,6 +167,7 @@ grpc_tls_identity_pairs_create_type grpc_tls_identity_pairs_create_import;
|
|
162
167
|
grpc_tls_identity_pairs_add_pair_type grpc_tls_identity_pairs_add_pair_import;
|
163
168
|
grpc_tls_identity_pairs_destroy_type grpc_tls_identity_pairs_destroy_import;
|
164
169
|
grpc_tls_certificate_provider_static_data_create_type grpc_tls_certificate_provider_static_data_create_import;
|
170
|
+
grpc_tls_certificate_provider_file_watcher_create_type grpc_tls_certificate_provider_file_watcher_create_import;
|
165
171
|
grpc_tls_certificate_provider_release_type grpc_tls_certificate_provider_release_import;
|
166
172
|
grpc_tls_credentials_options_create_type grpc_tls_credentials_options_create_import;
|
167
173
|
grpc_tls_credentials_options_set_cert_request_type_type grpc_tls_credentials_options_set_cert_request_type_import;
|
@@ -175,6 +181,7 @@ grpc_tls_credentials_options_set_server_authorization_check_config_type grpc_tls
|
|
175
181
|
grpc_tls_server_authorization_check_config_create_type grpc_tls_server_authorization_check_config_create_import;
|
176
182
|
grpc_tls_server_authorization_check_config_release_type grpc_tls_server_authorization_check_config_release_import;
|
177
183
|
grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
|
184
|
+
grpc_xds_server_credentials_create_type grpc_xds_server_credentials_create_import;
|
178
185
|
grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
|
179
186
|
grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
|
180
187
|
grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
|
@@ -358,6 +365,9 @@ void grpc_rb_load_imports(HMODULE library) {
|
|
358
365
|
grpc_server_request_registered_call_import = (grpc_server_request_registered_call_type) GetProcAddress(library, "grpc_server_request_registered_call");
|
359
366
|
grpc_server_create_import = (grpc_server_create_type) GetProcAddress(library, "grpc_server_create");
|
360
367
|
grpc_server_register_completion_queue_import = (grpc_server_register_completion_queue_type) GetProcAddress(library, "grpc_server_register_completion_queue");
|
368
|
+
grpc_server_config_fetcher_xds_create_import = (grpc_server_config_fetcher_xds_create_type) GetProcAddress(library, "grpc_server_config_fetcher_xds_create");
|
369
|
+
grpc_server_config_fetcher_destroy_import = (grpc_server_config_fetcher_destroy_type) GetProcAddress(library, "grpc_server_config_fetcher_destroy");
|
370
|
+
grpc_server_set_config_fetcher_import = (grpc_server_set_config_fetcher_type) GetProcAddress(library, "grpc_server_set_config_fetcher");
|
361
371
|
grpc_server_add_insecure_http2_port_import = (grpc_server_add_insecure_http2_port_type) GetProcAddress(library, "grpc_server_add_insecure_http2_port");
|
362
372
|
grpc_server_start_import = (grpc_server_start_type) GetProcAddress(library, "grpc_server_start");
|
363
373
|
grpc_server_shutdown_and_notify_import = (grpc_server_shutdown_and_notify_type) GetProcAddress(library, "grpc_server_shutdown_and_notify");
|
@@ -373,6 +383,7 @@ void grpc_rb_load_imports(HMODULE library) {
|
|
373
383
|
grpc_resource_quota_unref_import = (grpc_resource_quota_unref_type) GetProcAddress(library, "grpc_resource_quota_unref");
|
374
384
|
grpc_resource_quota_resize_import = (grpc_resource_quota_resize_type) GetProcAddress(library, "grpc_resource_quota_resize");
|
375
385
|
grpc_resource_quota_set_max_threads_import = (grpc_resource_quota_set_max_threads_type) GetProcAddress(library, "grpc_resource_quota_set_max_threads");
|
386
|
+
grpc_dump_xds_configs_import = (grpc_dump_xds_configs_type) GetProcAddress(library, "grpc_dump_xds_configs");
|
376
387
|
grpc_resource_quota_arg_vtable_import = (grpc_resource_quota_arg_vtable_type) GetProcAddress(library, "grpc_resource_quota_arg_vtable");
|
377
388
|
grpc_channelz_get_top_channels_import = (grpc_channelz_get_top_channels_type) GetProcAddress(library, "grpc_channelz_get_top_channels");
|
378
389
|
grpc_channelz_get_servers_import = (grpc_channelz_get_servers_type) GetProcAddress(library, "grpc_channelz_get_servers");
|
@@ -408,6 +419,7 @@ void grpc_rb_load_imports(HMODULE library) {
|
|
408
419
|
grpc_google_compute_engine_credentials_create_import = (grpc_google_compute_engine_credentials_create_type) GetProcAddress(library, "grpc_google_compute_engine_credentials_create");
|
409
420
|
grpc_max_auth_token_lifetime_import = (grpc_max_auth_token_lifetime_type) GetProcAddress(library, "grpc_max_auth_token_lifetime");
|
410
421
|
grpc_service_account_jwt_access_credentials_create_import = (grpc_service_account_jwt_access_credentials_create_type) GetProcAddress(library, "grpc_service_account_jwt_access_credentials_create");
|
422
|
+
grpc_external_account_credentials_create_import = (grpc_external_account_credentials_create_type) GetProcAddress(library, "grpc_external_account_credentials_create");
|
411
423
|
grpc_google_refresh_token_credentials_create_import = (grpc_google_refresh_token_credentials_create_type) GetProcAddress(library, "grpc_google_refresh_token_credentials_create");
|
412
424
|
grpc_access_token_credentials_create_import = (grpc_access_token_credentials_create_type) GetProcAddress(library, "grpc_access_token_credentials_create");
|
413
425
|
grpc_google_iam_credentials_create_import = (grpc_google_iam_credentials_create_type) GetProcAddress(library, "grpc_google_iam_credentials_create");
|
@@ -440,6 +452,7 @@ void grpc_rb_load_imports(HMODULE library) {
|
|
440
452
|
grpc_tls_identity_pairs_add_pair_import = (grpc_tls_identity_pairs_add_pair_type) GetProcAddress(library, "grpc_tls_identity_pairs_add_pair");
|
441
453
|
grpc_tls_identity_pairs_destroy_import = (grpc_tls_identity_pairs_destroy_type) GetProcAddress(library, "grpc_tls_identity_pairs_destroy");
|
442
454
|
grpc_tls_certificate_provider_static_data_create_import = (grpc_tls_certificate_provider_static_data_create_type) GetProcAddress(library, "grpc_tls_certificate_provider_static_data_create");
|
455
|
+
grpc_tls_certificate_provider_file_watcher_create_import = (grpc_tls_certificate_provider_file_watcher_create_type) GetProcAddress(library, "grpc_tls_certificate_provider_file_watcher_create");
|
443
456
|
grpc_tls_certificate_provider_release_import = (grpc_tls_certificate_provider_release_type) GetProcAddress(library, "grpc_tls_certificate_provider_release");
|
444
457
|
grpc_tls_credentials_options_create_import = (grpc_tls_credentials_options_create_type) GetProcAddress(library, "grpc_tls_credentials_options_create");
|
445
458
|
grpc_tls_credentials_options_set_cert_request_type_import = (grpc_tls_credentials_options_set_cert_request_type_type) GetProcAddress(library, "grpc_tls_credentials_options_set_cert_request_type");
|
@@ -453,6 +466,7 @@ void grpc_rb_load_imports(HMODULE library) {
|
|
453
466
|
grpc_tls_server_authorization_check_config_create_import = (grpc_tls_server_authorization_check_config_create_type) GetProcAddress(library, "grpc_tls_server_authorization_check_config_create");
|
454
467
|
grpc_tls_server_authorization_check_config_release_import = (grpc_tls_server_authorization_check_config_release_type) GetProcAddress(library, "grpc_tls_server_authorization_check_config_release");
|
455
468
|
grpc_xds_credentials_create_import = (grpc_xds_credentials_create_type) GetProcAddress(library, "grpc_xds_credentials_create");
|
469
|
+
grpc_xds_server_credentials_create_import = (grpc_xds_server_credentials_create_type) GetProcAddress(library, "grpc_xds_server_credentials_create");
|
456
470
|
grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
|
457
471
|
grpc_raw_compressed_byte_buffer_create_import = (grpc_raw_compressed_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_compressed_byte_buffer_create");
|
458
472
|
grpc_byte_buffer_copy_import = (grpc_byte_buffer_copy_type) GetProcAddress(library, "grpc_byte_buffer_copy");
|
@@ -47,7 +47,7 @@ extern grpc_compression_algorithm_is_message_type grpc_compression_algorithm_is_
|
|
47
47
|
typedef int(*grpc_compression_algorithm_is_stream_type)(grpc_compression_algorithm algorithm);
|
48
48
|
extern grpc_compression_algorithm_is_stream_type grpc_compression_algorithm_is_stream_import;
|
49
49
|
#define grpc_compression_algorithm_is_stream grpc_compression_algorithm_is_stream_import
|
50
|
-
typedef int(*grpc_compression_algorithm_parse_type)(grpc_slice
|
50
|
+
typedef int(*grpc_compression_algorithm_parse_type)(grpc_slice name, grpc_compression_algorithm* algorithm);
|
51
51
|
extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import;
|
52
52
|
#define grpc_compression_algorithm_parse grpc_compression_algorithm_parse_import
|
53
53
|
typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, const char** name);
|
@@ -215,6 +215,15 @@ extern grpc_server_create_type grpc_server_create_import;
|
|
215
215
|
typedef void(*grpc_server_register_completion_queue_type)(grpc_server* server, grpc_completion_queue* cq, void* reserved);
|
216
216
|
extern grpc_server_register_completion_queue_type grpc_server_register_completion_queue_import;
|
217
217
|
#define grpc_server_register_completion_queue grpc_server_register_completion_queue_import
|
218
|
+
typedef grpc_server_config_fetcher*(*grpc_server_config_fetcher_xds_create_type)(grpc_server_xds_status_notifier notifier);
|
219
|
+
extern grpc_server_config_fetcher_xds_create_type grpc_server_config_fetcher_xds_create_import;
|
220
|
+
#define grpc_server_config_fetcher_xds_create grpc_server_config_fetcher_xds_create_import
|
221
|
+
typedef void(*grpc_server_config_fetcher_destroy_type)(grpc_server_config_fetcher* config_fetcher);
|
222
|
+
extern grpc_server_config_fetcher_destroy_type grpc_server_config_fetcher_destroy_import;
|
223
|
+
#define grpc_server_config_fetcher_destroy grpc_server_config_fetcher_destroy_import
|
224
|
+
typedef void(*grpc_server_set_config_fetcher_type)(grpc_server* server, grpc_server_config_fetcher* config_fetcher);
|
225
|
+
extern grpc_server_set_config_fetcher_type grpc_server_set_config_fetcher_import;
|
226
|
+
#define grpc_server_set_config_fetcher grpc_server_set_config_fetcher_import
|
218
227
|
typedef int(*grpc_server_add_insecure_http2_port_type)(grpc_server* server, const char* addr);
|
219
228
|
extern grpc_server_add_insecure_http2_port_type grpc_server_add_insecure_http2_port_import;
|
220
229
|
#define grpc_server_add_insecure_http2_port grpc_server_add_insecure_http2_port_import
|
@@ -260,6 +269,9 @@ extern grpc_resource_quota_resize_type grpc_resource_quota_resize_import;
|
|
260
269
|
typedef void(*grpc_resource_quota_set_max_threads_type)(grpc_resource_quota* resource_quota, int new_max_threads);
|
261
270
|
extern grpc_resource_quota_set_max_threads_type grpc_resource_quota_set_max_threads_import;
|
262
271
|
#define grpc_resource_quota_set_max_threads grpc_resource_quota_set_max_threads_import
|
272
|
+
typedef grpc_slice(*grpc_dump_xds_configs_type)();
|
273
|
+
extern grpc_dump_xds_configs_type grpc_dump_xds_configs_import;
|
274
|
+
#define grpc_dump_xds_configs grpc_dump_xds_configs_import
|
263
275
|
typedef const grpc_arg_pointer_vtable*(*grpc_resource_quota_arg_vtable_type)(void);
|
264
276
|
extern grpc_resource_quota_arg_vtable_type grpc_resource_quota_arg_vtable_import;
|
265
277
|
#define grpc_resource_quota_arg_vtable grpc_resource_quota_arg_vtable_import
|
@@ -365,6 +377,9 @@ extern grpc_max_auth_token_lifetime_type grpc_max_auth_token_lifetime_import;
|
|
365
377
|
typedef grpc_call_credentials*(*grpc_service_account_jwt_access_credentials_create_type)(const char* json_key, gpr_timespec token_lifetime, void* reserved);
|
366
378
|
extern grpc_service_account_jwt_access_credentials_create_type grpc_service_account_jwt_access_credentials_create_import;
|
367
379
|
#define grpc_service_account_jwt_access_credentials_create grpc_service_account_jwt_access_credentials_create_import
|
380
|
+
typedef grpc_call_credentials*(*grpc_external_account_credentials_create_type)(const char* json_string, const char* scopes_string);
|
381
|
+
extern grpc_external_account_credentials_create_type grpc_external_account_credentials_create_import;
|
382
|
+
#define grpc_external_account_credentials_create grpc_external_account_credentials_create_import
|
368
383
|
typedef grpc_call_credentials*(*grpc_google_refresh_token_credentials_create_type)(const char* json_refresh_token, void* reserved);
|
369
384
|
extern grpc_google_refresh_token_credentials_create_type grpc_google_refresh_token_credentials_create_import;
|
370
385
|
#define grpc_google_refresh_token_credentials_create grpc_google_refresh_token_credentials_create_import
|
@@ -461,6 +476,9 @@ extern grpc_tls_identity_pairs_destroy_type grpc_tls_identity_pairs_destroy_impo
|
|
461
476
|
typedef grpc_tls_certificate_provider*(*grpc_tls_certificate_provider_static_data_create_type)(const char* root_certificate, grpc_tls_identity_pairs* pem_key_cert_pairs);
|
462
477
|
extern grpc_tls_certificate_provider_static_data_create_type grpc_tls_certificate_provider_static_data_create_import;
|
463
478
|
#define grpc_tls_certificate_provider_static_data_create grpc_tls_certificate_provider_static_data_create_import
|
479
|
+
typedef grpc_tls_certificate_provider*(*grpc_tls_certificate_provider_file_watcher_create_type)(const char* private_key_path, const char* identity_certificate_path, const char* root_cert_path, unsigned int refresh_interval_sec);
|
480
|
+
extern grpc_tls_certificate_provider_file_watcher_create_type grpc_tls_certificate_provider_file_watcher_create_import;
|
481
|
+
#define grpc_tls_certificate_provider_file_watcher_create grpc_tls_certificate_provider_file_watcher_create_import
|
464
482
|
typedef void(*grpc_tls_certificate_provider_release_type)(grpc_tls_certificate_provider* provider);
|
465
483
|
extern grpc_tls_certificate_provider_release_type grpc_tls_certificate_provider_release_import;
|
466
484
|
#define grpc_tls_certificate_provider_release grpc_tls_certificate_provider_release_import
|
@@ -500,6 +518,9 @@ extern grpc_tls_server_authorization_check_config_release_type grpc_tls_server_a
|
|
500
518
|
typedef grpc_channel_credentials*(*grpc_xds_credentials_create_type)(grpc_channel_credentials* fallback_credentials);
|
501
519
|
extern grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
|
502
520
|
#define grpc_xds_credentials_create grpc_xds_credentials_create_import
|
521
|
+
typedef grpc_server_credentials*(*grpc_xds_server_credentials_create_type)(grpc_server_credentials* fallback_credentials);
|
522
|
+
extern grpc_xds_server_credentials_create_type grpc_xds_server_credentials_create_import;
|
523
|
+
#define grpc_xds_server_credentials_create grpc_xds_server_credentials_create_import
|
503
524
|
typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_create_type)(grpc_slice* slices, size_t nslices);
|
504
525
|
extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
|
505
526
|
#define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
|
@@ -512,7 +533,7 @@ extern grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
|
|
512
533
|
typedef size_t(*grpc_byte_buffer_length_type)(grpc_byte_buffer* bb);
|
513
534
|
extern grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
|
514
535
|
#define grpc_byte_buffer_length grpc_byte_buffer_length_import
|
515
|
-
typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer*
|
536
|
+
typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer* bb);
|
516
537
|
extern grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
|
517
538
|
#define grpc_byte_buffer_destroy grpc_byte_buffer_destroy_import
|
518
539
|
typedef int(*grpc_byte_buffer_reader_init_type)(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer);
|
@@ -680,7 +701,7 @@ extern grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import;
|
|
680
701
|
typedef void(*grpc_slice_buffer_move_into_type)(grpc_slice_buffer* src, grpc_slice_buffer* dst);
|
681
702
|
extern grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import;
|
682
703
|
#define grpc_slice_buffer_move_into grpc_slice_buffer_move_into_import
|
683
|
-
typedef void(*grpc_slice_buffer_trim_end_type)(grpc_slice_buffer*
|
704
|
+
typedef void(*grpc_slice_buffer_trim_end_type)(grpc_slice_buffer* sb, size_t n, grpc_slice_buffer* garbage);
|
684
705
|
extern grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import;
|
685
706
|
#define grpc_slice_buffer_trim_end grpc_slice_buffer_trim_end_import
|
686
707
|
typedef void(*grpc_slice_buffer_move_first_type)(grpc_slice_buffer* src, size_t n, grpc_slice_buffer* dst);
|
@@ -692,10 +713,10 @@ extern grpc_slice_buffer_move_first_no_ref_type grpc_slice_buffer_move_first_no_
|
|
692
713
|
typedef void(*grpc_slice_buffer_move_first_into_buffer_type)(grpc_slice_buffer* src, size_t n, void* dst);
|
693
714
|
extern grpc_slice_buffer_move_first_into_buffer_type grpc_slice_buffer_move_first_into_buffer_import;
|
694
715
|
#define grpc_slice_buffer_move_first_into_buffer grpc_slice_buffer_move_first_into_buffer_import
|
695
|
-
typedef grpc_slice(*grpc_slice_buffer_take_first_type)(grpc_slice_buffer*
|
716
|
+
typedef grpc_slice(*grpc_slice_buffer_take_first_type)(grpc_slice_buffer* sb);
|
696
717
|
extern grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import;
|
697
718
|
#define grpc_slice_buffer_take_first grpc_slice_buffer_take_first_import
|
698
|
-
typedef void(*grpc_slice_buffer_undo_take_first_type)(grpc_slice_buffer*
|
719
|
+
typedef void(*grpc_slice_buffer_undo_take_first_type)(grpc_slice_buffer* sb, grpc_slice slice);
|
699
720
|
extern grpc_slice_buffer_undo_take_first_type grpc_slice_buffer_undo_take_first_import;
|
700
721
|
#define grpc_slice_buffer_undo_take_first grpc_slice_buffer_undo_take_first_import
|
701
722
|
typedef void*(*gpr_malloc_type)(size_t size);
|
@@ -761,7 +782,7 @@ extern gpr_cv_signal_type gpr_cv_signal_import;
|
|
761
782
|
typedef void(*gpr_cv_broadcast_type)(gpr_cv* cv);
|
762
783
|
extern gpr_cv_broadcast_type gpr_cv_broadcast_import;
|
763
784
|
#define gpr_cv_broadcast gpr_cv_broadcast_import
|
764
|
-
typedef void(*gpr_once_init_type)(gpr_once* once, void (*
|
785
|
+
typedef void(*gpr_once_init_type)(gpr_once* once, void (*init_function)(void));
|
765
786
|
extern gpr_once_init_type gpr_once_init_import;
|
766
787
|
#define gpr_once_init gpr_once_init_import
|
767
788
|
typedef void(*gpr_event_init_type)(gpr_event* ev);
|
@@ -821,7 +842,7 @@ extern gpr_time_init_type gpr_time_init_import;
|
|
821
842
|
typedef gpr_timespec(*gpr_now_type)(gpr_clock_type clock);
|
822
843
|
extern gpr_now_type gpr_now_import;
|
823
844
|
#define gpr_now gpr_now_import
|
824
|
-
typedef gpr_timespec(*gpr_convert_clock_type_type)(gpr_timespec t, gpr_clock_type
|
845
|
+
typedef gpr_timespec(*gpr_convert_clock_type_type)(gpr_timespec t, gpr_clock_type clock_type);
|
825
846
|
extern gpr_convert_clock_type_type gpr_convert_clock_type_import;
|
826
847
|
#define gpr_convert_clock_type gpr_convert_clock_type_import
|
827
848
|
typedef int(*gpr_time_cmp_type)(gpr_timespec a, gpr_timespec b);
|
@@ -839,22 +860,22 @@ extern gpr_time_add_type gpr_time_add_import;
|
|
839
860
|
typedef gpr_timespec(*gpr_time_sub_type)(gpr_timespec a, gpr_timespec b);
|
840
861
|
extern gpr_time_sub_type gpr_time_sub_import;
|
841
862
|
#define gpr_time_sub gpr_time_sub_import
|
842
|
-
typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t
|
863
|
+
typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t us, gpr_clock_type clock_type);
|
843
864
|
extern gpr_time_from_micros_type gpr_time_from_micros_import;
|
844
865
|
#define gpr_time_from_micros gpr_time_from_micros_import
|
845
|
-
typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t
|
866
|
+
typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t ns, gpr_clock_type clock_type);
|
846
867
|
extern gpr_time_from_nanos_type gpr_time_from_nanos_import;
|
847
868
|
#define gpr_time_from_nanos gpr_time_from_nanos_import
|
848
|
-
typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t
|
869
|
+
typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t ms, gpr_clock_type clock_type);
|
849
870
|
extern gpr_time_from_millis_type gpr_time_from_millis_import;
|
850
871
|
#define gpr_time_from_millis gpr_time_from_millis_import
|
851
|
-
typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t
|
872
|
+
typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t s, gpr_clock_type clock_type);
|
852
873
|
extern gpr_time_from_seconds_type gpr_time_from_seconds_import;
|
853
874
|
#define gpr_time_from_seconds gpr_time_from_seconds_import
|
854
|
-
typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t
|
875
|
+
typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t m, gpr_clock_type clock_type);
|
855
876
|
extern gpr_time_from_minutes_type gpr_time_from_minutes_import;
|
856
877
|
#define gpr_time_from_minutes gpr_time_from_minutes_import
|
857
|
-
typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t
|
878
|
+
typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t h, gpr_clock_type clock_type);
|
858
879
|
extern gpr_time_from_hours_type gpr_time_from_hours_import;
|
859
880
|
#define gpr_time_from_hours gpr_time_from_hours_import
|
860
881
|
typedef int32_t(*gpr_time_to_millis_type)(gpr_timespec timespec);
|
@@ -31,6 +31,7 @@
|
|
31
31
|
#include "rb_completion_queue.h"
|
32
32
|
#include "rb_grpc.h"
|
33
33
|
#include "rb_server_credentials.h"
|
34
|
+
#include "rb_xds_server_credentials.h"
|
34
35
|
|
35
36
|
/* grpc_rb_cServer is the ruby class that proxies grpc_server. */
|
36
37
|
static VALUE grpc_rb_cServer = Qnil;
|
@@ -326,7 +327,18 @@ static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port,
|
|
326
327
|
StringValueCStr(port));
|
327
328
|
}
|
328
329
|
} else {
|
329
|
-
|
330
|
+
// TODO: create a common parent class for all server-side credentials,
|
331
|
+
// then we can have a single method to retrieve the underlying
|
332
|
+
// grpc_server_credentials object, and avoid the need for this reflection
|
333
|
+
if (grpc_rb_is_server_credentials(rb_creds)) {
|
334
|
+
creds = grpc_rb_get_wrapped_server_credentials(rb_creds);
|
335
|
+
} else if (grpc_rb_is_xds_server_credentials(rb_creds)) {
|
336
|
+
creds = grpc_rb_get_wrapped_xds_server_credentials(rb_creds);
|
337
|
+
} else {
|
338
|
+
rb_raise(rb_eTypeError,
|
339
|
+
"failed to create server because credentials parameter has an "
|
340
|
+
"invalid type, want ServerCredentials or XdsServerCredentials");
|
341
|
+
}
|
330
342
|
recvd_port = grpc_server_add_secure_http2_port(
|
331
343
|
s->wrapped, StringValueCStr(port), creds);
|
332
344
|
if (recvd_port == 0) {
|
@@ -42,7 +42,7 @@ typedef struct grpc_rb_server_credentials {
|
|
42
42
|
} grpc_rb_server_credentials;
|
43
43
|
|
44
44
|
/* Destroys the server credentials instances. */
|
45
|
-
static void
|
45
|
+
static void grpc_rb_server_credentials_free_internal(void* p) {
|
46
46
|
grpc_rb_server_credentials* wrapper = NULL;
|
47
47
|
if (p == NULL) {
|
48
48
|
return;
|
@@ -59,6 +59,12 @@ static void grpc_rb_server_credentials_free(void* p) {
|
|
59
59
|
xfree(p);
|
60
60
|
}
|
61
61
|
|
62
|
+
/* Destroys the server credentials instances. */
|
63
|
+
static void grpc_rb_server_credentials_free(void* p) {
|
64
|
+
grpc_rb_server_credentials_free_internal(p);
|
65
|
+
grpc_ruby_shutdown();
|
66
|
+
}
|
67
|
+
|
62
68
|
/* Protects the mark object from GC */
|
63
69
|
static void grpc_rb_server_credentials_mark(void* p) {
|
64
70
|
grpc_rb_server_credentials* wrapper = NULL;
|
@@ -87,9 +93,9 @@ static const rb_data_type_t grpc_rb_server_credentials_data_type = {
|
|
87
93
|
};
|
88
94
|
|
89
95
|
/* Allocates ServerCredential instances.
|
90
|
-
|
91
96
|
Provides safe initial defaults for the instance fields. */
|
92
97
|
static VALUE grpc_rb_server_credentials_alloc(VALUE cls) {
|
98
|
+
grpc_ruby_init();
|
93
99
|
grpc_rb_server_credentials* wrapper = ALLOC(grpc_rb_server_credentials);
|
94
100
|
wrapper->wrapped = NULL;
|
95
101
|
wrapper->mark = Qnil;
|
@@ -202,7 +208,11 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs,
|
|
202
208
|
}
|
203
209
|
xfree(key_cert_pairs);
|
204
210
|
if (creds == NULL) {
|
205
|
-
rb_raise(rb_eRuntimeError,
|
211
|
+
rb_raise(rb_eRuntimeError,
|
212
|
+
"the call to grpc_ssl_server_credentials_create_ex() failed, "
|
213
|
+
"could not create a credentials, see "
|
214
|
+
"https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md for "
|
215
|
+
"debugging tips");
|
206
216
|
return Qnil;
|
207
217
|
}
|
208
218
|
wrapper->wrapped = creds;
|
@@ -237,7 +247,13 @@ void Init_grpc_server_credentials() {
|
|
237
247
|
/* Gets the wrapped grpc_server_credentials from the ruby wrapper */
|
238
248
|
grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v) {
|
239
249
|
grpc_rb_server_credentials* wrapper = NULL;
|
250
|
+
Check_TypedStruct(v, &grpc_rb_server_credentials_data_type);
|
240
251
|
TypedData_Get_Struct(v, grpc_rb_server_credentials,
|
241
252
|
&grpc_rb_server_credentials_data_type, wrapper);
|
242
253
|
return wrapper->wrapped;
|
243
254
|
}
|
255
|
+
|
256
|
+
/* Check if v is kind of ServerCredentials */
|
257
|
+
bool grpc_rb_is_server_credentials(VALUE v) {
|
258
|
+
return rb_typeddata_is_kind_of(v, &grpc_rb_server_credentials_data_type);
|
259
|
+
}
|
@@ -20,6 +20,7 @@
|
|
20
20
|
#define GRPC_RB_SERVER_CREDENTIALS_H_
|
21
21
|
|
22
22
|
#include <ruby/ruby.h>
|
23
|
+
#include <stdbool.h>
|
23
24
|
|
24
25
|
#include <grpc/grpc_security.h>
|
25
26
|
|
@@ -29,4 +30,7 @@ void Init_grpc_server_credentials();
|
|
29
30
|
/* Gets the wrapped server_credentials from the ruby wrapper */
|
30
31
|
grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v);
|
31
32
|
|
33
|
+
/* Check if v is kind of ServerCredentials */
|
34
|
+
bool grpc_rb_is_server_credentials(VALUE v);
|
35
|
+
|
32
36
|
#endif /* GRPC_RB_SERVER_CREDENTIALS_H_ */
|