grpc 1.6.7 → 1.7.0.pre1

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.

Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +579 -77
  3. data/include/grpc/byte_buffer.h +1 -63
  4. data/include/grpc/compression.h +27 -5
  5. data/include/grpc/fork.h +24 -0
  6. data/include/grpc/grpc.h +12 -6
  7. data/include/grpc/grpc_security.h +28 -7
  8. data/include/grpc/impl/codegen/atm.h +1 -0
  9. data/include/grpc/impl/codegen/byte_buffer.h +86 -0
  10. data/include/grpc/impl/codegen/compression_types.h +63 -5
  11. data/include/grpc/impl/codegen/fork.h +48 -0
  12. data/include/grpc/impl/codegen/grpc_types.h +26 -9
  13. data/include/grpc/impl/codegen/port_platform.h +11 -4
  14. data/include/grpc/impl/codegen/slice.h +6 -1
  15. data/include/grpc/impl/codegen/sync.h +3 -1
  16. data/include/grpc/impl/codegen/sync_custom.h +36 -0
  17. data/include/grpc/module.modulemap +75 -3
  18. data/include/grpc/slice.h +1 -5
  19. data/include/grpc/support/sync_custom.h +24 -0
  20. data/src/core/ext/census/base_resources.c +14 -14
  21. data/src/core/ext/census/context.c +7 -5
  22. data/src/core/ext/census/grpc_filter.c +12 -14
  23. data/src/core/ext/census/mlog.c +2 -1
  24. data/src/core/ext/census/resource.c +13 -9
  25. data/src/core/ext/filters/client_channel/channel_connectivity.c +15 -8
  26. data/src/core/ext/filters/client_channel/client_channel.c +418 -439
  27. data/src/core/ext/filters/client_channel/client_channel_factory.c +4 -5
  28. data/src/core/ext/filters/client_channel/client_channel_plugin.c +2 -2
  29. data/src/core/ext/filters/client_channel/http_connect_handshaker.c +7 -5
  30. data/src/core/ext/filters/client_channel/http_proxy.c +17 -21
  31. data/src/core/ext/filters/client_channel/lb_policy.c +1 -1
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +7 -7
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +371 -257
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +7 -5
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +25 -14
  36. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +16 -16
  37. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +33 -28
  38. data/src/core/ext/filters/client_channel/lb_policy_factory.c +10 -8
  39. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
  40. data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +1 -1
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +7 -6
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +62 -28
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +29 -23
  44. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +25 -14
  45. data/src/core/ext/filters/client_channel/retry_throttle.c +9 -6
  46. data/src/core/ext/filters/client_channel/subchannel.c +30 -30
  47. data/src/core/ext/filters/client_channel/subchannel.h +1 -4
  48. data/src/core/ext/filters/client_channel/subchannel_index.c +31 -15
  49. data/src/core/ext/filters/client_channel/subchannel_index.h +7 -0
  50. data/src/core/ext/filters/client_channel/uri_parser.c +4 -3
  51. data/src/core/ext/filters/deadline/deadline_filter.c +78 -39
  52. data/src/core/ext/filters/deadline/deadline_filter.h +7 -1
  53. data/src/core/ext/filters/http/client/http_client_filter.c +14 -14
  54. data/src/core/ext/filters/http/http_filters_plugin.c +1 -1
  55. data/src/core/ext/filters/http/message_compress/message_compress_filter.c +240 -175
  56. data/src/core/ext/filters/http/server/http_server_filter.c +48 -36
  57. data/src/core/ext/filters/load_reporting/{load_reporting_filter.c → server_load_reporting_filter.c} +11 -12
  58. data/src/core/ext/filters/load_reporting/{load_reporting_filter.h → server_load_reporting_filter.h} +6 -5
  59. data/src/core/ext/filters/load_reporting/{load_reporting.c → server_load_reporting_plugin.c} +19 -13
  60. data/src/core/ext/filters/load_reporting/{load_reporting.h → server_load_reporting_plugin.h} +4 -3
  61. data/src/core/ext/filters/max_age/max_age_filter.c +2 -3
  62. data/src/core/ext/filters/message_size/message_size_filter.c +4 -2
  63. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +0 -1
  64. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +5 -5
  65. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
  66. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +1 -1
  67. data/src/core/ext/transport/chttp2/server/chttp2_server.c +20 -18
  68. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +1 -0
  69. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +493 -210
  70. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  71. data/src/core/ext/transport/chttp2/transport/flow_control.c +9 -8
  72. data/src/core/ext/transport/chttp2/transport/frame_data.c +2 -2
  73. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +2 -2
  74. data/src/core/ext/transport/chttp2/transport/frame_ping.c +5 -4
  75. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
  76. data/src/core/ext/transport/chttp2/transport/frame_settings.c +10 -9
  77. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +9 -5
  78. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +62 -41
  79. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +52 -8
  80. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  81. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +3 -2
  82. data/src/core/ext/transport/chttp2/transport/internal.h +60 -30
  83. data/src/core/ext/transport/chttp2/transport/parsing.c +16 -5
  84. data/src/core/ext/transport/chttp2/transport/stream_lists.c +36 -16
  85. data/src/core/ext/transport/chttp2/transport/stream_map.c +6 -4
  86. data/src/core/ext/transport/chttp2/transport/writing.c +133 -105
  87. data/src/core/ext/transport/inproc/inproc_transport.c +61 -65
  88. data/src/core/lib/channel/channel_args.c +112 -12
  89. data/src/core/lib/channel/channel_args.h +31 -0
  90. data/src/core/lib/channel/channel_stack.c +1 -15
  91. data/src/core/lib/channel/channel_stack.h +3 -10
  92. data/src/core/lib/channel/channel_stack_builder.c +41 -10
  93. data/src/core/lib/channel/channel_stack_builder.h +10 -0
  94. data/src/core/lib/channel/connected_channel.c +94 -23
  95. data/src/core/lib/channel/handshaker.c +8 -6
  96. data/src/core/lib/channel/handshaker_registry.c +1 -1
  97. data/src/core/lib/compression/algorithm_metadata.h +14 -0
  98. data/src/core/lib/compression/compression.c +101 -1
  99. data/src/core/lib/compression/stream_compression.c +32 -146
  100. data/src/core/lib/compression/stream_compression.h +28 -4
  101. data/src/core/lib/compression/stream_compression_gzip.c +228 -0
  102. data/src/core/lib/{iomgr/ev_epoll_thread_pool_linux.h → compression/stream_compression_gzip.h} +5 -7
  103. data/src/core/lib/compression/stream_compression_identity.c +94 -0
  104. data/src/core/lib/{iomgr/ev_epoll_limited_pollers_linux.h → compression/stream_compression_identity.h} +7 -8
  105. data/src/core/lib/debug/stats.c +174 -0
  106. data/src/core/lib/debug/stats.h +61 -0
  107. data/src/core/lib/debug/stats_data.c +687 -0
  108. data/src/core/lib/debug/stats_data.h +470 -0
  109. data/src/core/lib/debug/trace.c +3 -3
  110. data/src/core/lib/debug/trace.h +1 -1
  111. data/src/core/lib/http/format_request.c +1 -1
  112. data/src/core/lib/http/httpcli.c +8 -7
  113. data/src/core/lib/http/httpcli_security_connector.c +2 -1
  114. data/src/core/lib/http/parser.c +4 -3
  115. data/src/core/lib/iomgr/call_combiner.c +202 -0
  116. data/src/core/lib/iomgr/call_combiner.h +121 -0
  117. data/src/core/lib/iomgr/closure.c +18 -4
  118. data/src/core/lib/iomgr/combiner.c +11 -4
  119. data/src/core/lib/iomgr/error.c +26 -24
  120. data/src/core/lib/iomgr/ev_epoll1_linux.c +395 -212
  121. data/src/core/lib/iomgr/ev_epollex_linux.c +141 -128
  122. data/src/core/lib/iomgr/ev_epollsig_linux.c +44 -41
  123. data/src/core/lib/iomgr/ev_poll_posix.c +99 -75
  124. data/src/core/lib/iomgr/ev_posix.c +5 -9
  125. data/src/core/lib/iomgr/ev_posix.h +1 -1
  126. data/src/core/lib/iomgr/exec_ctx.h +6 -1
  127. data/src/core/lib/iomgr/executor.c +142 -36
  128. data/src/core/lib/iomgr/executor.h +6 -1
  129. data/src/core/lib/iomgr/fork_posix.c +88 -0
  130. data/src/core/lib/iomgr/fork_windows.c +39 -0
  131. data/src/core/lib/iomgr/iocp_windows.c +2 -0
  132. data/src/core/lib/iomgr/iomgr.c +2 -8
  133. data/src/core/lib/iomgr/is_epollexclusive_available.c +6 -6
  134. data/src/core/lib/iomgr/load_file.c +2 -1
  135. data/src/core/lib/iomgr/polling_entity.c +9 -9
  136. data/src/core/lib/iomgr/polling_entity.h +7 -1
  137. data/src/core/lib/iomgr/pollset.h +1 -1
  138. data/src/core/lib/iomgr/pollset_uv.c +1 -1
  139. data/src/core/lib/iomgr/pollset_windows.c +3 -3
  140. data/src/core/lib/iomgr/port.h +4 -0
  141. data/src/core/lib/iomgr/resolve_address_posix.c +8 -7
  142. data/src/core/lib/iomgr/resolve_address_windows.c +1 -1
  143. data/src/core/lib/iomgr/resource_quota.c +24 -19
  144. data/src/core/lib/iomgr/socket_factory_posix.c +4 -4
  145. data/src/core/lib/iomgr/socket_mutator.c +4 -4
  146. data/src/core/lib/iomgr/socket_utils_windows.c +0 -4
  147. data/src/core/lib/iomgr/tcp_client_posix.c +5 -4
  148. data/src/core/lib/iomgr/tcp_posix.c +181 -20
  149. data/src/core/lib/iomgr/tcp_server_posix.c +8 -7
  150. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +1 -1
  151. data/src/core/lib/iomgr/timer.h +4 -0
  152. data/src/core/lib/iomgr/timer_generic.c +138 -3
  153. data/src/core/lib/iomgr/timer_generic.h +3 -0
  154. data/src/core/lib/iomgr/timer_heap.c +4 -4
  155. data/src/core/lib/iomgr/timer_manager.c +2 -2
  156. data/src/core/lib/iomgr/timer_uv.c +2 -0
  157. data/src/core/lib/iomgr/udp_server.c +10 -8
  158. data/src/core/lib/iomgr/unix_sockets_posix.c +4 -2
  159. data/src/core/lib/iomgr/wakeup_fd_cv.c +9 -8
  160. data/src/core/lib/iomgr/wakeup_fd_cv.h +2 -2
  161. data/src/core/lib/json/json.c +1 -1
  162. data/src/core/lib/json/json_string.c +13 -13
  163. data/src/core/lib/profiling/timers.h +18 -8
  164. data/src/core/lib/security/credentials/composite/composite_credentials.c +4 -10
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +2 -1
  166. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +11 -6
  167. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +4 -4
  168. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +132 -50
  169. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
  170. data/src/core/lib/security/transport/client_auth_filter.c +68 -135
  171. data/src/core/lib/security/transport/secure_endpoint.c +110 -90
  172. data/src/core/lib/security/transport/secure_endpoint.h +8 -3
  173. data/src/core/lib/security/transport/security_connector.c +10 -12
  174. data/src/core/lib/security/transport/security_handshaker.c +45 -24
  175. data/src/core/lib/security/transport/server_auth_filter.c +71 -20
  176. data/src/core/lib/slice/b64.c +2 -2
  177. data/src/core/lib/slice/slice.c +16 -14
  178. data/src/core/lib/slice/slice_buffer.c +5 -4
  179. data/src/core/lib/slice/slice_hash_table.c +3 -2
  180. data/src/core/lib/slice/slice_intern.c +8 -5
  181. data/src/core/lib/support/block_annotate.h +22 -0
  182. data/src/core/lib/support/fork.c +62 -0
  183. data/src/core/lib/support/fork.h +35 -0
  184. data/src/core/lib/support/log_linux.c +1 -1
  185. data/src/core/lib/support/string.c +15 -1
  186. data/src/core/lib/support/string.h +3 -0
  187. data/src/core/lib/support/thd_internal.h +6 -0
  188. data/src/core/lib/support/thd_posix.c +56 -0
  189. data/src/core/lib/support/thd_windows.c +2 -0
  190. data/src/core/lib/surface/alarm.c +22 -15
  191. data/src/core/lib/surface/byte_buffer.c +4 -2
  192. data/src/core/lib/surface/call.c +442 -141
  193. data/src/core/lib/surface/call.h +6 -6
  194. data/src/core/lib/surface/call_log_batch.c +1 -1
  195. data/src/core/lib/surface/call_test_only.h +12 -0
  196. data/src/core/lib/surface/channel.c +39 -4
  197. data/src/core/lib/surface/channel_init.c +6 -6
  198. data/src/core/lib/surface/channel_ping.c +2 -2
  199. data/src/core/lib/surface/completion_queue.c +56 -57
  200. data/src/core/lib/surface/init.c +17 -3
  201. data/src/core/lib/surface/init_secure.c +5 -1
  202. data/src/core/lib/surface/lame_client.cc +9 -10
  203. data/src/core/lib/surface/server.c +81 -72
  204. data/src/core/lib/surface/version.c +2 -2
  205. data/src/core/lib/transport/byte_stream.c +1 -0
  206. data/src/core/lib/transport/byte_stream.h +3 -1
  207. data/src/core/lib/transport/connectivity_state.c +2 -1
  208. data/src/core/lib/transport/metadata.c +7 -4
  209. data/src/core/lib/transport/metadata_batch.c +18 -16
  210. data/src/core/lib/transport/metadata_batch.h +1 -0
  211. data/src/core/lib/transport/service_config.c +5 -3
  212. data/src/core/lib/transport/static_metadata.c +395 -614
  213. data/src/core/lib/transport/static_metadata.h +165 -133
  214. data/src/core/lib/transport/status_conversion.c +1 -1
  215. data/src/core/lib/transport/transport.c +20 -20
  216. data/src/core/lib/transport/transport.h +8 -5
  217. data/src/core/lib/transport/transport_impl.h +0 -3
  218. data/src/core/lib/transport/transport_op_string.c +8 -1
  219. data/src/core/plugin_registry/grpc_plugin_registry.c +4 -4
  220. data/src/core/tsi/fake_transport_security.c +133 -2
  221. data/src/core/tsi/fake_transport_security.h +5 -0
  222. data/src/core/tsi/ssl_transport_security.c +105 -8
  223. data/src/core/tsi/ssl_transport_security.h +30 -7
  224. data/src/core/tsi/transport_security.h +8 -2
  225. data/src/core/tsi/transport_security_grpc.c +20 -13
  226. data/src/core/tsi/transport_security_grpc.h +13 -9
  227. data/src/ruby/ext/grpc/rb_call_credentials.c +6 -2
  228. data/src/ruby/ext/grpc/rb_grpc.c +1 -1
  229. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +30 -20
  230. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +50 -35
  231. data/src/ruby/lib/grpc.rb +1 -0
  232. data/src/ruby/lib/grpc/generic/active_call.rb +34 -9
  233. data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -10
  234. data/src/ruby/lib/grpc/generic/client_stub.rb +95 -38
  235. data/src/ruby/lib/grpc/generic/interceptor_registry.rb +53 -0
  236. data/src/ruby/lib/grpc/generic/interceptors.rb +186 -0
  237. data/src/ruby/lib/grpc/generic/rpc_desc.rb +66 -20
  238. data/src/ruby/lib/grpc/generic/rpc_server.rb +15 -3
  239. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +1 -2
  240. data/src/ruby/lib/grpc/version.rb +1 -1
  241. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +1 -0
  242. data/src/ruby/spec/channel_connection_spec.rb +1 -34
  243. data/src/ruby/spec/client_server_spec.rb +188 -82
  244. data/src/ruby/spec/generic/active_call_spec.rb +65 -11
  245. data/src/ruby/spec/generic/client_interceptors_spec.rb +153 -0
  246. data/src/ruby/spec/generic/interceptor_registry_spec.rb +65 -0
  247. data/src/ruby/spec/generic/rpc_desc_spec.rb +38 -0
  248. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -34
  249. data/src/ruby/spec/generic/server_interceptors_spec.rb +218 -0
  250. data/src/ruby/spec/spec_helper.rb +4 -0
  251. data/src/ruby/spec/support/helpers.rb +73 -0
  252. data/src/ruby/spec/support/services.rb +147 -0
  253. data/third_party/cares/ares_build.h +21 -62
  254. data/third_party/cares/cares/ares.h +23 -1
  255. data/third_party/cares/cares/ares__close_sockets.c +2 -2
  256. data/third_party/cares/cares/ares_create_query.c +3 -3
  257. data/third_party/cares/cares/ares_expand_name.c +6 -2
  258. data/third_party/cares/cares/ares_expand_string.c +1 -1
  259. data/third_party/cares/cares/ares_getnameinfo.c +27 -7
  260. data/third_party/cares/cares/ares_init.c +407 -39
  261. data/third_party/cares/cares/ares_library_init.c +10 -0
  262. data/third_party/cares/cares/ares_library_init.h +2 -1
  263. data/third_party/cares/cares/ares_nowarn.c +6 -6
  264. data/third_party/cares/cares/ares_nowarn.h +2 -2
  265. data/third_party/cares/cares/ares_parse_naptr_reply.c +6 -1
  266. data/third_party/cares/cares/ares_private.h +11 -0
  267. data/third_party/cares/cares/ares_process.c +126 -37
  268. data/third_party/cares/cares/ares_version.h +2 -2
  269. data/third_party/cares/cares/ares_writev.c +2 -2
  270. data/third_party/cares/cares/config-win32.h +8 -34
  271. data/third_party/cares/cares/inet_net_pton.c +2 -2
  272. data/third_party/cares/cares/setup_once.h +5 -5
  273. data/third_party/cares/config_darwin/ares_config.h +98 -196
  274. data/third_party/cares/config_linux/ares_config.h +103 -203
  275. metadata +47 -20
  276. data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +0 -1957
  277. data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +0 -1182
@@ -96,10 +96,10 @@ tsi_result tsi_ssl_client_handshaker_factory_create_handshaker(
96
96
  tsi_ssl_client_handshaker_factory *self, const char *server_name_indication,
97
97
  tsi_handshaker **handshaker);
98
98
 
99
- /* Destroys the handshaker factory. WARNING: it is unsafe to destroy a factory
100
- while handshakers created with this factory are still in use. */
101
- void tsi_ssl_client_handshaker_factory_destroy(
102
- tsi_ssl_client_handshaker_factory *self);
99
+ /* Decrements reference count of the handshaker factory. Handshaker factory will
100
+ * be destroyed once no references exist. */
101
+ void tsi_ssl_client_handshaker_factory_unref(
102
+ tsi_ssl_client_handshaker_factory *factory);
103
103
 
104
104
  /* --- tsi_ssl_server_handshaker_factory object ---
105
105
 
@@ -158,9 +158,9 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
158
158
  tsi_result tsi_ssl_server_handshaker_factory_create_handshaker(
159
159
  tsi_ssl_server_handshaker_factory *self, tsi_handshaker **handshaker);
160
160
 
161
- /* Destroys the handshaker factory. WARNING: it is unsafe to destroy a factory
162
- while handshakers created with this factory are still in use. */
163
- void tsi_ssl_server_handshaker_factory_destroy(
161
+ /* Decrements reference count of the handshaker factory. Handshaker factory will
162
+ * be destroyed once no references exist. */
163
+ void tsi_ssl_server_handshaker_factory_unref(
164
164
  tsi_ssl_server_handshaker_factory *self);
165
165
 
166
166
  /* Util that checks that an ssl peer matches a specific name.
@@ -170,6 +170,29 @@ void tsi_ssl_server_handshaker_factory_destroy(
170
170
  - handle public suffix wildchar more strictly (e.g. *.co.uk) */
171
171
  int tsi_ssl_peer_matches_name(const tsi_peer *peer, const char *name);
172
172
 
173
+ /* --- Testing support. ---
174
+
175
+ These functions and typedefs are not intended to be used outside of testing.
176
+ */
177
+
178
+ /* Base type of client and server handshaker factories. */
179
+ typedef struct tsi_ssl_handshaker_factory tsi_ssl_handshaker_factory;
180
+
181
+ /* Function pointer to handshaker_factory destructor. */
182
+ typedef void (*tsi_ssl_handshaker_factory_destructor)(
183
+ tsi_ssl_handshaker_factory *factory);
184
+
185
+ /* Virtual table for tsi_ssl_handshaker_factory. */
186
+ typedef struct {
187
+ tsi_ssl_handshaker_factory_destructor destroy;
188
+ } tsi_ssl_handshaker_factory_vtable;
189
+
190
+ /* Set destructor of handshaker_factory to new_destructor, returns previous
191
+ destructor. */
192
+ const tsi_ssl_handshaker_factory_vtable *tsi_ssl_handshaker_factory_swap_vtable(
193
+ tsi_ssl_handshaker_factory *factory,
194
+ tsi_ssl_handshaker_factory_vtable *new_vtable);
195
+
173
196
  #ifdef __cplusplus
174
197
  }
175
198
  #endif
@@ -84,11 +84,17 @@ struct tsi_handshaker {
84
84
  };
85
85
 
86
86
  /* Base for tsi_handshaker_result implementations.
87
- See transport_security_interface.h for documentation. */
87
+ See transport_security_interface.h for documentation.
88
+ The exec_ctx parameter in create_zero_copy_grpc_protector is supposed to be
89
+ of type grpc_exec_ctx*, but we're using void* instead to avoid making the TSI
90
+ API depend on grpc. The create_zero_copy_grpc_protector() method is only used
91
+ in grpc, where we do need the exec_ctx passed through, but the API still
92
+ needs to compile in other applications, where grpc_exec_ctx is not defined.
93
+ */
88
94
  typedef struct {
89
95
  tsi_result (*extract_peer)(const tsi_handshaker_result *self, tsi_peer *peer);
90
96
  tsi_result (*create_zero_copy_grpc_protector)(
91
- const tsi_handshaker_result *self,
97
+ void *exec_ctx, const tsi_handshaker_result *self,
92
98
  size_t *max_output_protected_frame_size,
93
99
  tsi_zero_copy_grpc_protector **protector);
94
100
  tsi_result (*create_frame_protector)(const tsi_handshaker_result *self,
@@ -20,16 +20,18 @@
20
20
 
21
21
  /* This method creates a tsi_zero_copy_grpc_protector object. */
22
22
  tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector(
23
- const tsi_handshaker_result *self, size_t *max_output_protected_frame_size,
23
+ grpc_exec_ctx *exec_ctx, const tsi_handshaker_result *self,
24
+ size_t *max_output_protected_frame_size,
24
25
  tsi_zero_copy_grpc_protector **protector) {
25
- if (self == NULL || self->vtable == NULL || protector == NULL) {
26
+ if (exec_ctx == NULL || self == NULL || self->vtable == NULL ||
27
+ protector == NULL) {
26
28
  return TSI_INVALID_ARGUMENT;
27
29
  }
28
30
  if (self->vtable->create_zero_copy_grpc_protector == NULL) {
29
31
  return TSI_UNIMPLEMENTED;
30
32
  }
31
33
  return self->vtable->create_zero_copy_grpc_protector(
32
- self, max_output_protected_frame_size, protector);
34
+ exec_ctx, self, max_output_protected_frame_size, protector);
33
35
  }
34
36
 
35
37
  /* --- tsi_zero_copy_grpc_protector common implementation. ---
@@ -37,28 +39,33 @@ tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector(
37
39
  Calls specific implementation after state/input validation. */
38
40
 
39
41
  tsi_result tsi_zero_copy_grpc_protector_protect(
40
- tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *unprotected_slices,
42
+ grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self,
43
+ grpc_slice_buffer *unprotected_slices,
41
44
  grpc_slice_buffer *protected_slices) {
42
- if (self == NULL || self->vtable == NULL || unprotected_slices == NULL ||
43
- protected_slices == NULL) {
45
+ if (exec_ctx == NULL || self == NULL || self->vtable == NULL ||
46
+ unprotected_slices == NULL || protected_slices == NULL) {
44
47
  return TSI_INVALID_ARGUMENT;
45
48
  }
46
49
  if (self->vtable->protect == NULL) return TSI_UNIMPLEMENTED;
47
- return self->vtable->protect(self, unprotected_slices, protected_slices);
50
+ return self->vtable->protect(exec_ctx, self, unprotected_slices,
51
+ protected_slices);
48
52
  }
49
53
 
50
54
  tsi_result tsi_zero_copy_grpc_protector_unprotect(
51
- tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *protected_slices,
55
+ grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self,
56
+ grpc_slice_buffer *protected_slices,
52
57
  grpc_slice_buffer *unprotected_slices) {
53
- if (self == NULL || self->vtable == NULL || protected_slices == NULL ||
54
- unprotected_slices == NULL) {
58
+ if (exec_ctx == NULL || self == NULL || self->vtable == NULL ||
59
+ protected_slices == NULL || unprotected_slices == NULL) {
55
60
  return TSI_INVALID_ARGUMENT;
56
61
  }
57
62
  if (self->vtable->unprotect == NULL) return TSI_UNIMPLEMENTED;
58
- return self->vtable->unprotect(self, protected_slices, unprotected_slices);
63
+ return self->vtable->unprotect(exec_ctx, self, protected_slices,
64
+ unprotected_slices);
59
65
  }
60
66
 
61
- void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector *self) {
67
+ void tsi_zero_copy_grpc_protector_destroy(grpc_exec_ctx *exec_ctx,
68
+ tsi_zero_copy_grpc_protector *self) {
62
69
  if (self == NULL) return;
63
- self->vtable->destroy(self);
70
+ self->vtable->destroy(exec_ctx, self);
64
71
  }
@@ -30,7 +30,8 @@ extern "C" {
30
30
  assuming there is no fatal error.
31
31
  The caller is responsible for destroying the protector. */
32
32
  tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector(
33
- const tsi_handshaker_result *self, size_t *max_output_protected_frame_size,
33
+ grpc_exec_ctx *exec_ctx, const tsi_handshaker_result *self,
34
+ size_t *max_output_protected_frame_size,
34
35
  tsi_zero_copy_grpc_protector **protector);
35
36
 
36
37
  /* -- tsi_zero_copy_grpc_protector object -- */
@@ -42,8 +43,8 @@ tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector(
42
43
  - This method returns TSI_OK in case of success or a specific error code in
43
44
  case of failure. */
44
45
  tsi_result tsi_zero_copy_grpc_protector_protect(
45
- tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *unprotected_slices,
46
- grpc_slice_buffer *protected_slices);
46
+ grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self,
47
+ grpc_slice_buffer *unprotected_slices, grpc_slice_buffer *protected_slices);
47
48
 
48
49
  /* Outputs unprotected bytes.
49
50
  - protected_slices is the bytes of protected frames.
@@ -52,21 +53,24 @@ tsi_result tsi_zero_copy_grpc_protector_protect(
52
53
  there is not enough data to output in which case unprotected_slices has 0
53
54
  bytes. */
54
55
  tsi_result tsi_zero_copy_grpc_protector_unprotect(
55
- tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *protected_slices,
56
- grpc_slice_buffer *unprotected_slices);
56
+ grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self,
57
+ grpc_slice_buffer *protected_slices, grpc_slice_buffer *unprotected_slices);
57
58
 
58
59
  /* Destroys the tsi_zero_copy_grpc_protector object. */
59
- void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector *self);
60
+ void tsi_zero_copy_grpc_protector_destroy(grpc_exec_ctx *exec_ctx,
61
+ tsi_zero_copy_grpc_protector *self);
60
62
 
61
63
  /* Base for tsi_zero_copy_grpc_protector implementations. */
62
64
  typedef struct {
63
- tsi_result (*protect)(tsi_zero_copy_grpc_protector *self,
65
+ tsi_result (*protect)(grpc_exec_ctx *exec_ctx,
66
+ tsi_zero_copy_grpc_protector *self,
64
67
  grpc_slice_buffer *unprotected_slices,
65
68
  grpc_slice_buffer *protected_slices);
66
- tsi_result (*unprotect)(tsi_zero_copy_grpc_protector *self,
69
+ tsi_result (*unprotect)(grpc_exec_ctx *exec_ctx,
70
+ tsi_zero_copy_grpc_protector *self,
67
71
  grpc_slice_buffer *protected_slices,
68
72
  grpc_slice_buffer *unprotected_slices);
69
- void (*destroy)(tsi_zero_copy_grpc_protector *self);
73
+ void (*destroy)(grpc_exec_ctx *exec_ctx, tsi_zero_copy_grpc_protector *self);
70
74
  } tsi_zero_copy_grpc_protector_vtable;
71
75
 
72
76
  struct tsi_zero_copy_grpc_protector {
@@ -112,9 +112,12 @@ static void grpc_rb_call_credentials_callback_with_gil(void *param) {
112
112
  gpr_free(params);
113
113
  }
114
114
 
115
- static void grpc_rb_call_credentials_plugin_get_metadata(
115
+ static int grpc_rb_call_credentials_plugin_get_metadata(
116
116
  void *state, grpc_auth_metadata_context context,
117
- grpc_credentials_plugin_metadata_cb cb, void *user_data) {
117
+ grpc_credentials_plugin_metadata_cb cb, void *user_data,
118
+ grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
119
+ size_t *num_creds_md, grpc_status_code *status,
120
+ const char **error_details) {
118
121
  callback_params *params = gpr_malloc(sizeof(callback_params));
119
122
  params->get_metadata = (VALUE)state;
120
123
  params->context = context;
@@ -123,6 +126,7 @@ static void grpc_rb_call_credentials_plugin_get_metadata(
123
126
 
124
127
  grpc_rb_event_queue_enqueue(grpc_rb_call_credentials_callback_with_gil,
125
128
  (void *)(params));
129
+ return 0; // Async return.
126
130
  }
127
131
 
128
132
  static void grpc_rb_call_credentials_plugin_destroy(void *state) {
@@ -315,8 +315,8 @@ void Init_grpc_c() {
315
315
  return;
316
316
  }
317
317
 
318
- rb_global_variable(&bg_thread_init_rb_mu);
319
318
  bg_thread_init_rb_mu = rb_mutex_new();
319
+ rb_global_variable(&bg_thread_init_rb_mu);
320
320
 
321
321
  grpc_rb_mGRPC = rb_define_module("GRPC");
322
322
  grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core");
@@ -22,16 +22,6 @@
22
22
 
23
23
  #include "rb_grpc_imports.generated.h"
24
24
 
25
- grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
26
- grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
27
- grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
28
- grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
29
- grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
30
- grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import;
31
- grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import;
32
- grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import;
33
- grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import;
34
- grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import;
35
25
  census_initialize_type census_initialize_import;
36
26
  census_shutdown_type census_shutdown_import;
37
27
  census_supported_type census_supported_import;
@@ -62,11 +52,14 @@ census_resource_id_type census_resource_id_import;
62
52
  census_record_values_type census_record_values_import;
63
53
  grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import;
64
54
  grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import;
55
+ grpc_stream_compression_algorithm_name_type grpc_stream_compression_algorithm_name_import;
65
56
  grpc_compression_algorithm_for_level_type grpc_compression_algorithm_for_level_import;
57
+ grpc_stream_compression_algorithm_for_level_type grpc_stream_compression_algorithm_for_level_import;
66
58
  grpc_compression_options_init_type grpc_compression_options_init_import;
67
59
  grpc_compression_options_enable_algorithm_type grpc_compression_options_enable_algorithm_import;
68
60
  grpc_compression_options_disable_algorithm_type grpc_compression_options_disable_algorithm_import;
69
61
  grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import;
62
+ grpc_compression_options_is_stream_compression_algorithm_enabled_type grpc_compression_options_is_stream_compression_algorithm_enabled_import;
70
63
  grpc_metadata_array_init_type grpc_metadata_array_init_import;
71
64
  grpc_metadata_array_destroy_type grpc_metadata_array_destroy_import;
72
65
  grpc_call_details_init_type grpc_call_details_init_import;
@@ -85,11 +78,13 @@ grpc_completion_queue_pluck_type grpc_completion_queue_pluck_import;
85
78
  grpc_completion_queue_shutdown_type grpc_completion_queue_shutdown_import;
86
79
  grpc_completion_queue_destroy_type grpc_completion_queue_destroy_import;
87
80
  grpc_alarm_create_type grpc_alarm_create_import;
81
+ grpc_alarm_set_type grpc_alarm_set_import;
88
82
  grpc_alarm_cancel_type grpc_alarm_cancel_import;
89
83
  grpc_alarm_destroy_type grpc_alarm_destroy_import;
90
84
  grpc_channel_check_connectivity_state_type grpc_channel_check_connectivity_state_import;
91
85
  grpc_channel_num_external_connectivity_watchers_type grpc_channel_num_external_connectivity_watchers_import;
92
86
  grpc_channel_watch_connectivity_state_type grpc_channel_watch_connectivity_state_import;
87
+ grpc_channel_support_connectivity_watcher_type grpc_channel_support_connectivity_watcher_import;
93
88
  grpc_channel_create_call_type grpc_channel_create_call_import;
94
89
  grpc_channel_ping_type grpc_channel_ping_import;
95
90
  grpc_channel_register_call_type grpc_channel_register_call_import;
@@ -163,6 +158,16 @@ grpc_ssl_server_credentials_create_ex_type grpc_ssl_server_credentials_create_ex
163
158
  grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import;
164
159
  grpc_call_set_credentials_type grpc_call_set_credentials_import;
165
160
  grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
161
+ grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
162
+ grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
163
+ grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
164
+ grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
165
+ grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
166
+ grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import;
167
+ grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import;
168
+ grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import;
169
+ grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import;
170
+ grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import;
166
171
  grpc_slice_ref_type grpc_slice_ref_import;
167
172
  grpc_slice_unref_type grpc_slice_unref_import;
168
173
  grpc_slice_copy_type grpc_slice_copy_import;
@@ -325,16 +330,6 @@ gpr_sleep_until_type gpr_sleep_until_import;
325
330
  gpr_timespec_to_micros_type gpr_timespec_to_micros_import;
326
331
 
327
332
  void grpc_rb_load_imports(HMODULE library) {
328
- grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
329
- grpc_raw_compressed_byte_buffer_create_import = (grpc_raw_compressed_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_compressed_byte_buffer_create");
330
- grpc_byte_buffer_copy_import = (grpc_byte_buffer_copy_type) GetProcAddress(library, "grpc_byte_buffer_copy");
331
- grpc_byte_buffer_length_import = (grpc_byte_buffer_length_type) GetProcAddress(library, "grpc_byte_buffer_length");
332
- grpc_byte_buffer_destroy_import = (grpc_byte_buffer_destroy_type) GetProcAddress(library, "grpc_byte_buffer_destroy");
333
- grpc_byte_buffer_reader_init_import = (grpc_byte_buffer_reader_init_type) GetProcAddress(library, "grpc_byte_buffer_reader_init");
334
- grpc_byte_buffer_reader_destroy_import = (grpc_byte_buffer_reader_destroy_type) GetProcAddress(library, "grpc_byte_buffer_reader_destroy");
335
- grpc_byte_buffer_reader_next_import = (grpc_byte_buffer_reader_next_type) GetProcAddress(library, "grpc_byte_buffer_reader_next");
336
- grpc_byte_buffer_reader_readall_import = (grpc_byte_buffer_reader_readall_type) GetProcAddress(library, "grpc_byte_buffer_reader_readall");
337
- grpc_raw_byte_buffer_from_reader_import = (grpc_raw_byte_buffer_from_reader_type) GetProcAddress(library, "grpc_raw_byte_buffer_from_reader");
338
333
  census_initialize_import = (census_initialize_type) GetProcAddress(library, "census_initialize");
339
334
  census_shutdown_import = (census_shutdown_type) GetProcAddress(library, "census_shutdown");
340
335
  census_supported_import = (census_supported_type) GetProcAddress(library, "census_supported");
@@ -365,11 +360,14 @@ void grpc_rb_load_imports(HMODULE library) {
365
360
  census_record_values_import = (census_record_values_type) GetProcAddress(library, "census_record_values");
366
361
  grpc_compression_algorithm_parse_import = (grpc_compression_algorithm_parse_type) GetProcAddress(library, "grpc_compression_algorithm_parse");
367
362
  grpc_compression_algorithm_name_import = (grpc_compression_algorithm_name_type) GetProcAddress(library, "grpc_compression_algorithm_name");
363
+ grpc_stream_compression_algorithm_name_import = (grpc_stream_compression_algorithm_name_type) GetProcAddress(library, "grpc_stream_compression_algorithm_name");
368
364
  grpc_compression_algorithm_for_level_import = (grpc_compression_algorithm_for_level_type) GetProcAddress(library, "grpc_compression_algorithm_for_level");
365
+ grpc_stream_compression_algorithm_for_level_import = (grpc_stream_compression_algorithm_for_level_type) GetProcAddress(library, "grpc_stream_compression_algorithm_for_level");
369
366
  grpc_compression_options_init_import = (grpc_compression_options_init_type) GetProcAddress(library, "grpc_compression_options_init");
370
367
  grpc_compression_options_enable_algorithm_import = (grpc_compression_options_enable_algorithm_type) GetProcAddress(library, "grpc_compression_options_enable_algorithm");
371
368
  grpc_compression_options_disable_algorithm_import = (grpc_compression_options_disable_algorithm_type) GetProcAddress(library, "grpc_compression_options_disable_algorithm");
372
369
  grpc_compression_options_is_algorithm_enabled_import = (grpc_compression_options_is_algorithm_enabled_type) GetProcAddress(library, "grpc_compression_options_is_algorithm_enabled");
370
+ grpc_compression_options_is_stream_compression_algorithm_enabled_import = (grpc_compression_options_is_stream_compression_algorithm_enabled_type) GetProcAddress(library, "grpc_compression_options_is_stream_compression_algorithm_enabled");
373
371
  grpc_metadata_array_init_import = (grpc_metadata_array_init_type) GetProcAddress(library, "grpc_metadata_array_init");
374
372
  grpc_metadata_array_destroy_import = (grpc_metadata_array_destroy_type) GetProcAddress(library, "grpc_metadata_array_destroy");
375
373
  grpc_call_details_init_import = (grpc_call_details_init_type) GetProcAddress(library, "grpc_call_details_init");
@@ -388,11 +386,13 @@ void grpc_rb_load_imports(HMODULE library) {
388
386
  grpc_completion_queue_shutdown_import = (grpc_completion_queue_shutdown_type) GetProcAddress(library, "grpc_completion_queue_shutdown");
389
387
  grpc_completion_queue_destroy_import = (grpc_completion_queue_destroy_type) GetProcAddress(library, "grpc_completion_queue_destroy");
390
388
  grpc_alarm_create_import = (grpc_alarm_create_type) GetProcAddress(library, "grpc_alarm_create");
389
+ grpc_alarm_set_import = (grpc_alarm_set_type) GetProcAddress(library, "grpc_alarm_set");
391
390
  grpc_alarm_cancel_import = (grpc_alarm_cancel_type) GetProcAddress(library, "grpc_alarm_cancel");
392
391
  grpc_alarm_destroy_import = (grpc_alarm_destroy_type) GetProcAddress(library, "grpc_alarm_destroy");
393
392
  grpc_channel_check_connectivity_state_import = (grpc_channel_check_connectivity_state_type) GetProcAddress(library, "grpc_channel_check_connectivity_state");
394
393
  grpc_channel_num_external_connectivity_watchers_import = (grpc_channel_num_external_connectivity_watchers_type) GetProcAddress(library, "grpc_channel_num_external_connectivity_watchers");
395
394
  grpc_channel_watch_connectivity_state_import = (grpc_channel_watch_connectivity_state_type) GetProcAddress(library, "grpc_channel_watch_connectivity_state");
395
+ grpc_channel_support_connectivity_watcher_import = (grpc_channel_support_connectivity_watcher_type) GetProcAddress(library, "grpc_channel_support_connectivity_watcher");
396
396
  grpc_channel_create_call_import = (grpc_channel_create_call_type) GetProcAddress(library, "grpc_channel_create_call");
397
397
  grpc_channel_ping_import = (grpc_channel_ping_type) GetProcAddress(library, "grpc_channel_ping");
398
398
  grpc_channel_register_call_import = (grpc_channel_register_call_type) GetProcAddress(library, "grpc_channel_register_call");
@@ -466,6 +466,16 @@ void grpc_rb_load_imports(HMODULE library) {
466
466
  grpc_server_add_secure_http2_port_import = (grpc_server_add_secure_http2_port_type) GetProcAddress(library, "grpc_server_add_secure_http2_port");
467
467
  grpc_call_set_credentials_import = (grpc_call_set_credentials_type) GetProcAddress(library, "grpc_call_set_credentials");
468
468
  grpc_server_credentials_set_auth_metadata_processor_import = (grpc_server_credentials_set_auth_metadata_processor_type) GetProcAddress(library, "grpc_server_credentials_set_auth_metadata_processor");
469
+ grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
470
+ grpc_raw_compressed_byte_buffer_create_import = (grpc_raw_compressed_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_compressed_byte_buffer_create");
471
+ grpc_byte_buffer_copy_import = (grpc_byte_buffer_copy_type) GetProcAddress(library, "grpc_byte_buffer_copy");
472
+ grpc_byte_buffer_length_import = (grpc_byte_buffer_length_type) GetProcAddress(library, "grpc_byte_buffer_length");
473
+ grpc_byte_buffer_destroy_import = (grpc_byte_buffer_destroy_type) GetProcAddress(library, "grpc_byte_buffer_destroy");
474
+ grpc_byte_buffer_reader_init_import = (grpc_byte_buffer_reader_init_type) GetProcAddress(library, "grpc_byte_buffer_reader_init");
475
+ grpc_byte_buffer_reader_destroy_import = (grpc_byte_buffer_reader_destroy_type) GetProcAddress(library, "grpc_byte_buffer_reader_destroy");
476
+ grpc_byte_buffer_reader_next_import = (grpc_byte_buffer_reader_next_type) GetProcAddress(library, "grpc_byte_buffer_reader_next");
477
+ grpc_byte_buffer_reader_readall_import = (grpc_byte_buffer_reader_readall_type) GetProcAddress(library, "grpc_byte_buffer_reader_readall");
478
+ grpc_raw_byte_buffer_from_reader_import = (grpc_raw_byte_buffer_from_reader_type) GetProcAddress(library, "grpc_raw_byte_buffer_from_reader");
469
479
  grpc_slice_ref_import = (grpc_slice_ref_type) GetProcAddress(library, "grpc_slice_ref");
470
480
  grpc_slice_unref_import = (grpc_slice_unref_type) GetProcAddress(library, "grpc_slice_unref");
471
481
  grpc_slice_copy_import = (grpc_slice_copy_type) GetProcAddress(library, "grpc_slice_copy");
@@ -25,12 +25,12 @@
25
25
 
26
26
  #include <windows.h>
27
27
 
28
- #include <grpc/byte_buffer.h>
29
28
  #include <grpc/census.h>
30
29
  #include <grpc/compression.h>
31
30
  #include <grpc/grpc.h>
32
31
  #include <grpc/grpc_posix.h>
33
32
  #include <grpc/grpc_security.h>
33
+ #include <grpc/impl/codegen/byte_buffer.h>
34
34
  #include <grpc/slice.h>
35
35
  #include <grpc/slice_buffer.h>
36
36
  #include <grpc/support/alloc.h>
@@ -47,36 +47,6 @@
47
47
  #include <grpc/support/thd.h>
48
48
  #include <grpc/support/time.h>
49
49
 
50
- typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_create_type)(grpc_slice *slices, size_t nslices);
51
- extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
52
- #define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
53
- typedef grpc_byte_buffer *(*grpc_raw_compressed_byte_buffer_create_type)(grpc_slice *slices, size_t nslices, grpc_compression_algorithm compression);
54
- extern grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
55
- #define grpc_raw_compressed_byte_buffer_create grpc_raw_compressed_byte_buffer_create_import
56
- typedef grpc_byte_buffer *(*grpc_byte_buffer_copy_type)(grpc_byte_buffer *bb);
57
- extern grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
58
- #define grpc_byte_buffer_copy grpc_byte_buffer_copy_import
59
- typedef size_t(*grpc_byte_buffer_length_type)(grpc_byte_buffer *bb);
60
- extern grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
61
- #define grpc_byte_buffer_length grpc_byte_buffer_length_import
62
- typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer *byte_buffer);
63
- extern grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
64
- #define grpc_byte_buffer_destroy grpc_byte_buffer_destroy_import
65
- typedef int(*grpc_byte_buffer_reader_init_type)(grpc_byte_buffer_reader *reader, grpc_byte_buffer *buffer);
66
- extern grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import;
67
- #define grpc_byte_buffer_reader_init grpc_byte_buffer_reader_init_import
68
- typedef void(*grpc_byte_buffer_reader_destroy_type)(grpc_byte_buffer_reader *reader);
69
- extern grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import;
70
- #define grpc_byte_buffer_reader_destroy grpc_byte_buffer_reader_destroy_import
71
- typedef int(*grpc_byte_buffer_reader_next_type)(grpc_byte_buffer_reader *reader, grpc_slice *slice);
72
- extern grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import;
73
- #define grpc_byte_buffer_reader_next grpc_byte_buffer_reader_next_import
74
- typedef grpc_slice(*grpc_byte_buffer_reader_readall_type)(grpc_byte_buffer_reader *reader);
75
- extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import;
76
- #define grpc_byte_buffer_reader_readall grpc_byte_buffer_reader_readall_import
77
- typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_from_reader_type)(grpc_byte_buffer_reader *reader);
78
- extern grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import;
79
- #define grpc_raw_byte_buffer_from_reader grpc_raw_byte_buffer_from_reader_import
80
50
  typedef int(*census_initialize_type)(int features);
81
51
  extern census_initialize_type census_initialize_import;
82
52
  #define census_initialize census_initialize_import
@@ -164,12 +134,18 @@ extern census_record_values_type census_record_values_import;
164
134
  typedef int(*grpc_compression_algorithm_parse_type)(grpc_slice value, grpc_compression_algorithm *algorithm);
165
135
  extern grpc_compression_algorithm_parse_type grpc_compression_algorithm_parse_import;
166
136
  #define grpc_compression_algorithm_parse grpc_compression_algorithm_parse_import
167
- typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, char **name);
137
+ typedef int(*grpc_compression_algorithm_name_type)(grpc_compression_algorithm algorithm, const char **name);
168
138
  extern grpc_compression_algorithm_name_type grpc_compression_algorithm_name_import;
169
139
  #define grpc_compression_algorithm_name grpc_compression_algorithm_name_import
140
+ typedef int(*grpc_stream_compression_algorithm_name_type)(grpc_stream_compression_algorithm algorithm, const char **name);
141
+ extern grpc_stream_compression_algorithm_name_type grpc_stream_compression_algorithm_name_import;
142
+ #define grpc_stream_compression_algorithm_name grpc_stream_compression_algorithm_name_import
170
143
  typedef grpc_compression_algorithm(*grpc_compression_algorithm_for_level_type)(grpc_compression_level level, uint32_t accepted_encodings);
171
144
  extern grpc_compression_algorithm_for_level_type grpc_compression_algorithm_for_level_import;
172
145
  #define grpc_compression_algorithm_for_level grpc_compression_algorithm_for_level_import
146
+ typedef grpc_stream_compression_algorithm(*grpc_stream_compression_algorithm_for_level_type)(grpc_stream_compression_level level, uint32_t accepted_stream_encodings);
147
+ extern grpc_stream_compression_algorithm_for_level_type grpc_stream_compression_algorithm_for_level_import;
148
+ #define grpc_stream_compression_algorithm_for_level grpc_stream_compression_algorithm_for_level_import
173
149
  typedef void(*grpc_compression_options_init_type)(grpc_compression_options *opts);
174
150
  extern grpc_compression_options_init_type grpc_compression_options_init_import;
175
151
  #define grpc_compression_options_init grpc_compression_options_init_import
@@ -182,6 +158,9 @@ extern grpc_compression_options_disable_algorithm_type grpc_compression_options_
182
158
  typedef int(*grpc_compression_options_is_algorithm_enabled_type)(const grpc_compression_options *opts, grpc_compression_algorithm algorithm);
183
159
  extern grpc_compression_options_is_algorithm_enabled_type grpc_compression_options_is_algorithm_enabled_import;
184
160
  #define grpc_compression_options_is_algorithm_enabled grpc_compression_options_is_algorithm_enabled_import
161
+ typedef int(*grpc_compression_options_is_stream_compression_algorithm_enabled_type)(const grpc_compression_options *opts, grpc_stream_compression_algorithm algorithm);
162
+ extern grpc_compression_options_is_stream_compression_algorithm_enabled_type grpc_compression_options_is_stream_compression_algorithm_enabled_import;
163
+ #define grpc_compression_options_is_stream_compression_algorithm_enabled grpc_compression_options_is_stream_compression_algorithm_enabled_import
185
164
  typedef void(*grpc_metadata_array_init_type)(grpc_metadata_array *array);
186
165
  extern grpc_metadata_array_init_type grpc_metadata_array_init_import;
187
166
  #define grpc_metadata_array_init grpc_metadata_array_init_import
@@ -233,13 +212,16 @@ extern grpc_completion_queue_shutdown_type grpc_completion_queue_shutdown_import
233
212
  typedef void(*grpc_completion_queue_destroy_type)(grpc_completion_queue *cq);
234
213
  extern grpc_completion_queue_destroy_type grpc_completion_queue_destroy_import;
235
214
  #define grpc_completion_queue_destroy grpc_completion_queue_destroy_import
236
- typedef grpc_alarm *(*grpc_alarm_create_type)(grpc_completion_queue *cq, gpr_timespec deadline, void *tag);
215
+ typedef grpc_alarm *(*grpc_alarm_create_type)(void *reserved);
237
216
  extern grpc_alarm_create_type grpc_alarm_create_import;
238
217
  #define grpc_alarm_create grpc_alarm_create_import
239
- typedef void(*grpc_alarm_cancel_type)(grpc_alarm *alarm);
218
+ typedef void(*grpc_alarm_set_type)(grpc_alarm *alarm, grpc_completion_queue *cq, gpr_timespec deadline, void *tag, void *reserved);
219
+ extern grpc_alarm_set_type grpc_alarm_set_import;
220
+ #define grpc_alarm_set grpc_alarm_set_import
221
+ typedef void(*grpc_alarm_cancel_type)(grpc_alarm *alarm, void *reserved);
240
222
  extern grpc_alarm_cancel_type grpc_alarm_cancel_import;
241
223
  #define grpc_alarm_cancel grpc_alarm_cancel_import
242
- typedef void(*grpc_alarm_destroy_type)(grpc_alarm *alarm);
224
+ typedef void(*grpc_alarm_destroy_type)(grpc_alarm *alarm, void *reserved);
243
225
  extern grpc_alarm_destroy_type grpc_alarm_destroy_import;
244
226
  #define grpc_alarm_destroy grpc_alarm_destroy_import
245
227
  typedef grpc_connectivity_state(*grpc_channel_check_connectivity_state_type)(grpc_channel *channel, int try_to_connect);
@@ -251,6 +233,9 @@ extern grpc_channel_num_external_connectivity_watchers_type grpc_channel_num_ext
251
233
  typedef void(*grpc_channel_watch_connectivity_state_type)(grpc_channel *channel, grpc_connectivity_state last_observed_state, gpr_timespec deadline, grpc_completion_queue *cq, void *tag);
252
234
  extern grpc_channel_watch_connectivity_state_type grpc_channel_watch_connectivity_state_import;
253
235
  #define grpc_channel_watch_connectivity_state grpc_channel_watch_connectivity_state_import
236
+ typedef int(*grpc_channel_support_connectivity_watcher_type)(grpc_channel *channel);
237
+ extern grpc_channel_support_connectivity_watcher_type grpc_channel_support_connectivity_watcher_import;
238
+ #define grpc_channel_support_connectivity_watcher grpc_channel_support_connectivity_watcher_import
254
239
  typedef grpc_call *(*grpc_channel_create_call_type)(grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, grpc_slice method, const grpc_slice *host, gpr_timespec deadline, void *reserved);
255
240
  extern grpc_channel_create_call_type grpc_channel_create_call_import;
256
241
  #define grpc_channel_create_call grpc_channel_create_call_import
@@ -470,6 +455,36 @@ extern grpc_call_set_credentials_type grpc_call_set_credentials_import;
470
455
  typedef void(*grpc_server_credentials_set_auth_metadata_processor_type)(grpc_server_credentials *creds, grpc_auth_metadata_processor processor);
471
456
  extern grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
472
457
  #define grpc_server_credentials_set_auth_metadata_processor grpc_server_credentials_set_auth_metadata_processor_import
458
+ typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_create_type)(grpc_slice *slices, size_t nslices);
459
+ extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
460
+ #define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
461
+ typedef grpc_byte_buffer *(*grpc_raw_compressed_byte_buffer_create_type)(grpc_slice *slices, size_t nslices, grpc_compression_algorithm compression);
462
+ extern grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
463
+ #define grpc_raw_compressed_byte_buffer_create grpc_raw_compressed_byte_buffer_create_import
464
+ typedef grpc_byte_buffer *(*grpc_byte_buffer_copy_type)(grpc_byte_buffer *bb);
465
+ extern grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
466
+ #define grpc_byte_buffer_copy grpc_byte_buffer_copy_import
467
+ typedef size_t(*grpc_byte_buffer_length_type)(grpc_byte_buffer *bb);
468
+ extern grpc_byte_buffer_length_type grpc_byte_buffer_length_import;
469
+ #define grpc_byte_buffer_length grpc_byte_buffer_length_import
470
+ typedef void(*grpc_byte_buffer_destroy_type)(grpc_byte_buffer *byte_buffer);
471
+ extern grpc_byte_buffer_destroy_type grpc_byte_buffer_destroy_import;
472
+ #define grpc_byte_buffer_destroy grpc_byte_buffer_destroy_import
473
+ typedef int(*grpc_byte_buffer_reader_init_type)(grpc_byte_buffer_reader *reader, grpc_byte_buffer *buffer);
474
+ extern grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import;
475
+ #define grpc_byte_buffer_reader_init grpc_byte_buffer_reader_init_import
476
+ typedef void(*grpc_byte_buffer_reader_destroy_type)(grpc_byte_buffer_reader *reader);
477
+ extern grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import;
478
+ #define grpc_byte_buffer_reader_destroy grpc_byte_buffer_reader_destroy_import
479
+ typedef int(*grpc_byte_buffer_reader_next_type)(grpc_byte_buffer_reader *reader, grpc_slice *slice);
480
+ extern grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import;
481
+ #define grpc_byte_buffer_reader_next grpc_byte_buffer_reader_next_import
482
+ typedef grpc_slice(*grpc_byte_buffer_reader_readall_type)(grpc_byte_buffer_reader *reader);
483
+ extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import;
484
+ #define grpc_byte_buffer_reader_readall grpc_byte_buffer_reader_readall_import
485
+ typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_from_reader_type)(grpc_byte_buffer_reader *reader);
486
+ extern grpc_raw_byte_buffer_from_reader_type grpc_raw_byte_buffer_from_reader_import;
487
+ #define grpc_raw_byte_buffer_from_reader grpc_raw_byte_buffer_from_reader_import
473
488
  typedef grpc_slice(*grpc_slice_ref_type)(grpc_slice s);
474
489
  extern grpc_slice_ref_type grpc_slice_ref_import;
475
490
  #define grpc_slice_ref grpc_slice_ref_import