grpc 1.2.5 → 1.3.4

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 (327) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1434 -399
  3. data/etc/roots.pem +34 -150
  4. data/include/grpc/grpc.h +71 -0
  5. data/include/grpc/impl/codegen/atm.h +5 -0
  6. data/include/grpc/impl/codegen/atm_gcc_atomic.h +6 -0
  7. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  8. data/include/grpc/impl/codegen/atm_windows.h +11 -0
  9. data/include/grpc/impl/codegen/grpc_types.h +54 -13
  10. data/include/grpc/impl/codegen/port_platform.h +15 -1
  11. data/include/grpc/support/alloc.h +2 -1
  12. data/include/grpc/support/sync.h +4 -0
  13. data/include/grpc/support/tls.h +1 -1
  14. data/src/core/ext/census/gen/trace_context.pb.h +1 -1
  15. data/src/core/ext/census/grpc_filter.c +14 -10
  16. data/src/core/ext/census/grpc_plugin.c +3 -1
  17. data/src/core/ext/census/trace_label.h +1 -1
  18. data/src/core/ext/census/trace_propagation.h +1 -1
  19. data/src/core/ext/census/trace_status.h +1 -1
  20. data/src/core/ext/census/trace_string.h +1 -1
  21. data/src/core/ext/census/tracing.h +1 -1
  22. data/src/core/ext/{client_channel → filters/client_channel}/channel_connectivity.c +56 -27
  23. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.c +407 -202
  24. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.h +10 -6
  25. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.c +1 -1
  26. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.h +4 -4
  27. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_plugin.c +12 -7
  28. data/src/core/ext/{client_channel → filters/client_channel}/connector.c +1 -1
  29. data/src/core/ext/{client_channel → filters/client_channel}/connector.h +3 -5
  30. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.c +6 -6
  31. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.h +3 -3
  32. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.c +4 -4
  33. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.h +3 -3
  34. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.c +1 -1
  35. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.h +4 -4
  36. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.c +22 -20
  37. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.h +4 -4
  38. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel.h +5 -4
  39. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel_secure.c +2 -2
  40. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.c +1 -1
  41. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.h +6 -5
  42. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +1 -1
  43. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -0
  44. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/pick_first/pick_first.c +20 -15
  45. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/round_robin/round_robin.c +21 -16
  46. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.c +1 -1
  47. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.h +5 -5
  48. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.c +1 -1
  49. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.h +4 -4
  50. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.c +1 -1
  51. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.h +4 -4
  52. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.c +1 -1
  53. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.h +3 -3
  54. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.c +10 -4
  55. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.h +4 -4
  56. data/src/core/ext/{client_channel → filters/client_channel}/resolver.c +1 -1
  57. data/src/core/ext/{client_channel → filters/client_channel}/resolver.h +4 -4
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
  59. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
  60. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
  61. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
  62. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
  63. data/src/core/ext/{resolver → filters/client_channel/resolver}/dns/native/dns_resolver.c +21 -5
  64. data/src/core/ext/{resolver → filters/client_channel/resolver}/sockaddr/sockaddr_resolver.c +3 -3
  65. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.c +1 -1
  66. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.h +6 -6
  67. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.c +1 -2
  68. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.h +4 -4
  69. data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
  70. data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
  71. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.c +49 -43
  72. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.h +21 -7
  73. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.c +1 -1
  74. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.h +5 -5
  75. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.c +1 -1
  76. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.h +3 -3
  77. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.c +4 -2
  78. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.h +3 -3
  79. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.c +17 -14
  80. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.h +4 -4
  81. data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
  82. data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
  83. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +6 -41
  84. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +1 -1
  85. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +2 -2
  86. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +3 -3
  87. data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
  88. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -5
  89. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +2 -2
  90. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +449 -204
  91. data/src/core/ext/transport/chttp2/transport/frame_data.c +10 -7
  92. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +3 -2
  93. data/src/core/ext/transport/chttp2/transport/frame_ping.c +37 -7
  94. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
  95. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +4 -3
  96. data/src/core/ext/transport/chttp2/transport/frame_settings.c +18 -38
  97. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -29
  98. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +2 -2
  99. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +64 -37
  100. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +11 -4
  101. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +60 -39
  102. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  103. data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
  104. data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
  105. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +22 -43
  106. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +8 -10
  107. data/src/core/ext/transport/chttp2/transport/internal.h +24 -2
  108. data/src/core/ext/transport/chttp2/transport/parsing.c +33 -15
  109. data/src/core/ext/transport/chttp2/transport/writing.c +56 -10
  110. data/src/core/lib/channel/channel_args.c +7 -0
  111. data/src/core/lib/channel/channel_args.h +2 -0
  112. data/src/core/lib/channel/channel_stack.c +20 -27
  113. data/src/core/lib/channel/channel_stack.h +18 -16
  114. data/src/core/lib/channel/compress_filter.c +20 -18
  115. data/src/core/lib/channel/connected_channel.c +9 -8
  116. data/src/core/lib/channel/deadline_filter.c +28 -24
  117. data/src/core/lib/channel/deadline_filter.h +3 -3
  118. data/src/core/lib/channel/handshaker.c +3 -2
  119. data/src/core/lib/channel/http_client_filter.c +119 -61
  120. data/src/core/lib/channel/http_server_filter.c +124 -69
  121. data/src/core/lib/channel/message_size_filter.c +23 -19
  122. data/src/core/lib/http/httpcli.c +8 -6
  123. data/src/core/lib/http/httpcli_security_connector.c +5 -5
  124. data/src/core/lib/http/parser.c +57 -31
  125. data/src/core/lib/iomgr/closure.c +15 -0
  126. data/src/core/lib/iomgr/closure.h +4 -0
  127. data/src/core/lib/iomgr/combiner.c +8 -0
  128. data/src/core/lib/iomgr/endpoint_pair.h +2 -3
  129. data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -7
  130. data/src/core/lib/iomgr/endpoint_pair_uv.c +2 -3
  131. data/src/core/lib/iomgr/endpoint_pair_windows.c +9 -6
  132. data/src/core/lib/iomgr/error.c +360 -177
  133. data/src/core/lib/iomgr/error.h +31 -33
  134. data/src/core/lib/iomgr/error_internal.h +30 -9
  135. data/src/core/lib/iomgr/ev_epoll_linux.c +25 -239
  136. data/src/core/lib/iomgr/ev_poll_posix.c +11 -7
  137. data/src/core/lib/iomgr/ev_posix.c +6 -0
  138. data/src/core/lib/iomgr/ev_posix.h +3 -0
  139. data/src/core/lib/iomgr/exec_ctx.c +6 -0
  140. data/src/core/lib/iomgr/executor.c +8 -2
  141. data/src/core/lib/iomgr/load_file.c +6 -3
  142. data/src/core/lib/iomgr/lockfree_event.c +238 -0
  143. data/src/core/{ext/client_channel/initial_connect_string.h → lib/iomgr/lockfree_event.h} +17 -13
  144. data/src/core/lib/iomgr/pollset.h +4 -0
  145. data/src/core/lib/iomgr/pollset_windows.c +2 -2
  146. data/src/core/lib/iomgr/port.h +9 -0
  147. data/src/core/lib/iomgr/resolve_address_posix.c +15 -9
  148. data/src/core/lib/iomgr/resolve_address_uv.c +8 -6
  149. data/src/core/lib/iomgr/resolve_address_windows.c +2 -2
  150. data/src/core/lib/iomgr/resource_quota.c +19 -4
  151. data/src/core/lib/iomgr/resource_quota.h +2 -0
  152. data/src/core/lib/iomgr/sockaddr_utils.c +3 -1
  153. data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
  154. data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
  155. data/src/core/lib/iomgr/socket_utils_common_posix.c +25 -9
  156. data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
  157. data/src/core/lib/iomgr/tcp_client.h +0 -4
  158. data/src/core/lib/iomgr/tcp_client_posix.c +15 -31
  159. data/src/core/lib/iomgr/tcp_client_uv.c +10 -6
  160. data/src/core/lib/iomgr/tcp_client_windows.c +9 -19
  161. data/src/core/lib/iomgr/tcp_posix.c +111 -22
  162. data/src/core/lib/iomgr/tcp_posix.h +3 -4
  163. data/src/core/lib/iomgr/tcp_server_posix.c +39 -417
  164. data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
  165. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
  166. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
  167. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
  168. data/src/core/lib/iomgr/tcp_server_uv.c +43 -16
  169. data/src/core/lib/iomgr/tcp_server_windows.c +10 -22
  170. data/src/core/lib/iomgr/tcp_uv.c +16 -13
  171. data/src/core/lib/iomgr/tcp_windows.c +24 -12
  172. data/src/core/lib/iomgr/tcp_windows.h +2 -2
  173. data/src/core/lib/iomgr/timer.h +3 -0
  174. data/src/core/lib/iomgr/timer_generic.c +257 -72
  175. data/src/core/lib/iomgr/timer_generic.h +1 -1
  176. data/src/core/lib/iomgr/timer_heap.c +8 -8
  177. data/src/core/lib/iomgr/udp_server.c +54 -24
  178. data/src/core/lib/iomgr/udp_server.h +7 -7
  179. data/src/core/lib/iomgr/unix_sockets_posix.c +1 -1
  180. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +2 -1
  181. data/src/core/lib/iomgr/wakeup_fd_posix.h +1 -1
  182. data/src/core/lib/profiling/basic_timers.c +1 -1
  183. data/src/core/lib/security/credentials/credentials.h +1 -1
  184. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +10 -9
  185. data/src/core/lib/security/credentials/jwt/json_token.c +1 -1
  186. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +2 -2
  187. data/src/core/lib/security/transport/client_auth_filter.c +33 -26
  188. data/src/core/lib/security/transport/secure_endpoint.c +8 -5
  189. data/src/core/lib/security/transport/security_connector.c +37 -37
  190. data/src/core/lib/security/transport/security_connector.h +1 -1
  191. data/src/core/lib/security/transport/security_handshaker.c +15 -12
  192. data/src/core/lib/security/transport/server_auth_filter.c +20 -18
  193. data/src/core/lib/security/transport/tsi_error.c +5 -3
  194. data/src/core/lib/security/transport/tsi_error.h +1 -1
  195. data/src/core/lib/{security/util → slice}/b64.c +21 -6
  196. data/src/core/lib/{security/util → slice}/b64.h +16 -4
  197. data/src/core/lib/slice/slice.c +4 -2
  198. data/src/core/lib/slice/slice_buffer.c +16 -14
  199. data/src/core/lib/support/arena.c +98 -0
  200. data/src/core/{ext/client_channel/initial_connect_string.c → lib/support/arena.h} +17 -15
  201. data/src/core/{ext/client_channel/default_initial_connect_string.c → lib/support/atm.c} +14 -5
  202. data/src/core/lib/support/cpu_linux.c +5 -0
  203. data/src/core/lib/support/sync.c +4 -0
  204. data/src/core/lib/support/time.c +4 -10
  205. data/src/core/lib/support/wrap_memcpy.c +3 -1
  206. data/src/core/lib/surface/call.c +252 -221
  207. data/src/core/lib/surface/channel.c +72 -21
  208. data/src/core/lib/surface/channel.h +8 -0
  209. data/src/core/lib/surface/completion_queue.c +2 -3
  210. data/src/core/lib/surface/completion_queue_factory.c +77 -0
  211. data/src/core/lib/surface/completion_queue_factory.h +51 -0
  212. data/src/core/lib/surface/init_secure.c +3 -1
  213. data/src/core/lib/surface/lame_client.c +18 -14
  214. data/src/core/lib/surface/server.c +43 -41
  215. data/src/core/lib/surface/validate_metadata.c +8 -4
  216. data/src/core/lib/surface/version.c +2 -2
  217. data/src/core/lib/transport/bdp_estimator.h +1 -1
  218. data/src/core/lib/transport/connectivity_state.c +2 -1
  219. data/src/core/lib/transport/error_utils.c +17 -17
  220. data/src/core/lib/transport/error_utils.h +1 -1
  221. data/src/core/lib/transport/metadata_batch.c +6 -7
  222. data/src/core/lib/transport/pid_controller.c +1 -0
  223. data/src/core/lib/transport/service_config.c +12 -0
  224. data/src/core/lib/transport/service_config.h +6 -0
  225. data/src/core/lib/transport/transport.c +29 -17
  226. data/src/core/lib/transport/transport.h +85 -42
  227. data/src/core/lib/transport/transport_impl.h +5 -3
  228. data/src/core/lib/transport/transport_op_string.c +20 -14
  229. data/src/core/plugin_registry/grpc_plugin_registry.c +8 -0
  230. data/src/core/{lib/tsi → tsi}/fake_transport_security.c +2 -2
  231. data/src/core/{lib/tsi → tsi}/fake_transport_security.h +4 -4
  232. data/src/core/{lib/tsi → tsi}/ssl_transport_security.c +40 -79
  233. data/src/core/{lib/tsi → tsi}/ssl_transport_security.h +44 -21
  234. data/src/core/{lib/tsi → tsi}/ssl_types.h +3 -3
  235. data/src/core/{lib/tsi → tsi}/transport_security.c +2 -2
  236. data/src/core/{lib/tsi → tsi}/transport_security.h +4 -4
  237. data/src/core/{lib/tsi → tsi}/transport_security_interface.h +3 -3
  238. data/src/ruby/ext/grpc/extconf.rb +1 -0
  239. data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
  240. data/src/ruby/ext/grpc/rb_channel.c +520 -93
  241. data/src/ruby/ext/grpc/rb_channel.h +2 -0
  242. data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
  243. data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
  244. data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
  245. data/src/ruby/ext/grpc/rb_grpc.c +29 -7
  246. data/src/ruby/ext/grpc/rb_grpc.h +2 -0
  247. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
  249. data/src/ruby/ext/grpc/rb_server.c +5 -3
  250. data/src/ruby/lib/grpc/version.rb +1 -1
  251. data/src/ruby/spec/channel_connection_spec.rb +173 -0
  252. data/src/ruby/spec/channel_spec.rb +29 -0
  253. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
  254. data/third_party/cares/ares_build.h +264 -0
  255. data/third_party/cares/cares/ares.h +636 -0
  256. data/third_party/cares/cares/ares__close_sockets.c +61 -0
  257. data/third_party/cares/cares/ares__get_hostent.c +261 -0
  258. data/third_party/cares/cares/ares__read_line.c +73 -0
  259. data/third_party/cares/cares/ares__timeval.c +111 -0
  260. data/third_party/cares/cares/ares_cancel.c +63 -0
  261. data/third_party/cares/cares/ares_create_query.c +202 -0
  262. data/third_party/cares/cares/ares_data.c +221 -0
  263. data/third_party/cares/cares/ares_data.h +72 -0
  264. data/third_party/cares/cares/ares_destroy.c +108 -0
  265. data/third_party/cares/cares/ares_dns.h +103 -0
  266. data/third_party/cares/cares/ares_expand_name.c +205 -0
  267. data/third_party/cares/cares/ares_expand_string.c +70 -0
  268. data/third_party/cares/cares/ares_fds.c +59 -0
  269. data/third_party/cares/cares/ares_free_hostent.c +41 -0
  270. data/third_party/cares/cares/ares_free_string.c +25 -0
  271. data/third_party/cares/cares/ares_getenv.c +30 -0
  272. data/third_party/cares/cares/ares_getenv.h +26 -0
  273. data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
  274. data/third_party/cares/cares/ares_gethostbyname.c +518 -0
  275. data/third_party/cares/cares/ares_getnameinfo.c +422 -0
  276. data/third_party/cares/cares/ares_getopt.c +122 -0
  277. data/third_party/cares/cares/ares_getopt.h +53 -0
  278. data/third_party/cares/cares/ares_getsock.c +66 -0
  279. data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
  280. data/third_party/cares/cares/ares_init.c +2146 -0
  281. data/third_party/cares/cares/ares_iphlpapi.h +221 -0
  282. data/third_party/cares/cares/ares_ipv6.h +78 -0
  283. data/third_party/cares/cares/ares_library_init.c +167 -0
  284. data/third_party/cares/cares/ares_library_init.h +42 -0
  285. data/third_party/cares/cares/ares_llist.c +63 -0
  286. data/third_party/cares/cares/ares_llist.h +39 -0
  287. data/third_party/cares/cares/ares_mkquery.c +24 -0
  288. data/third_party/cares/cares/ares_nowarn.c +260 -0
  289. data/third_party/cares/cares/ares_nowarn.h +61 -0
  290. data/third_party/cares/cares/ares_options.c +402 -0
  291. data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
  292. data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
  293. data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
  294. data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
  295. data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
  296. data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
  297. data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
  298. data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
  299. data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
  300. data/third_party/cares/cares/ares_platform.c +11035 -0
  301. data/third_party/cares/cares/ares_platform.h +43 -0
  302. data/third_party/cares/cares/ares_private.h +363 -0
  303. data/third_party/cares/cares/ares_process.c +1359 -0
  304. data/third_party/cares/cares/ares_query.c +186 -0
  305. data/third_party/cares/cares/ares_rules.h +125 -0
  306. data/third_party/cares/cares/ares_search.c +316 -0
  307. data/third_party/cares/cares/ares_send.c +131 -0
  308. data/third_party/cares/cares/ares_setup.h +217 -0
  309. data/third_party/cares/cares/ares_strcasecmp.c +66 -0
  310. data/third_party/cares/cares/ares_strcasecmp.h +30 -0
  311. data/third_party/cares/cares/ares_strdup.c +49 -0
  312. data/third_party/cares/cares/ares_strdup.h +24 -0
  313. data/third_party/cares/cares/ares_strerror.c +56 -0
  314. data/third_party/cares/cares/ares_timeout.c +88 -0
  315. data/third_party/cares/cares/ares_version.c +11 -0
  316. data/third_party/cares/cares/ares_version.h +24 -0
  317. data/third_party/cares/cares/ares_writev.c +79 -0
  318. data/third_party/cares/cares/bitncmp.c +59 -0
  319. data/third_party/cares/cares/bitncmp.h +26 -0
  320. data/third_party/cares/cares/config-win32.h +377 -0
  321. data/third_party/cares/cares/inet_net_pton.c +450 -0
  322. data/third_party/cares/cares/inet_ntop.c +208 -0
  323. data/third_party/cares/cares/setup_once.h +554 -0
  324. data/third_party/cares/cares/windows_port.c +22 -0
  325. data/third_party/cares/config_darwin/ares_config.h +523 -0
  326. data/third_party/cares/config_linux/ares_config.h +524 -0
  327. metadata +164 -68
@@ -47,7 +47,7 @@ typedef struct grpc_transport_vtable {
47
47
  /* implementation of grpc_transport_init_stream */
48
48
  int (*init_stream)(grpc_exec_ctx *exec_ctx, grpc_transport *self,
49
49
  grpc_stream *stream, grpc_stream_refcount *refcount,
50
- const void *server_data);
50
+ const void *server_data, gpr_arena *arena);
51
51
 
52
52
  /* implementation of grpc_transport_set_pollset */
53
53
  void (*set_pollset)(grpc_exec_ctx *exec_ctx, grpc_transport *self,
@@ -59,7 +59,8 @@ typedef struct grpc_transport_vtable {
59
59
 
60
60
  /* implementation of grpc_transport_perform_stream_op */
61
61
  void (*perform_stream_op)(grpc_exec_ctx *exec_ctx, grpc_transport *self,
62
- grpc_stream *stream, grpc_transport_stream_op *op);
62
+ grpc_stream *stream,
63
+ grpc_transport_stream_op_batch *op);
63
64
 
64
65
  /* implementation of grpc_transport_perform_op */
65
66
  void (*perform_op)(grpc_exec_ctx *exec_ctx, grpc_transport *self,
@@ -67,7 +68,8 @@ typedef struct grpc_transport_vtable {
67
68
 
68
69
  /* implementation of grpc_transport_destroy_stream */
69
70
  void (*destroy_stream)(grpc_exec_ctx *exec_ctx, grpc_transport *self,
70
- grpc_stream *stream, void *and_free_memory);
71
+ grpc_stream *stream,
72
+ grpc_closure *then_schedule_closure);
71
73
 
72
74
  /* implementation of grpc_transport_destroy */
73
75
  void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_transport *self);
@@ -71,7 +71,8 @@ static void put_metadata_list(gpr_strvec *b, grpc_metadata_batch md) {
71
71
  }
72
72
  }
73
73
 
74
- char *grpc_transport_stream_op_string(grpc_transport_stream_op *op) {
74
+ char *grpc_transport_stream_op_batch_string(
75
+ grpc_transport_stream_op_batch *op) {
75
76
  char *tmp;
76
77
  char *out;
77
78
 
@@ -81,45 +82,49 @@ char *grpc_transport_stream_op_string(grpc_transport_stream_op *op) {
81
82
  gpr_strvec_add(
82
83
  &b, gpr_strdup(op->covered_by_poller ? "[COVERED]" : "[UNCOVERED]"));
83
84
 
84
- if (op->send_initial_metadata != NULL) {
85
+ if (op->send_initial_metadata) {
85
86
  gpr_strvec_add(&b, gpr_strdup(" "));
86
87
  gpr_strvec_add(&b, gpr_strdup("SEND_INITIAL_METADATA{"));
87
- put_metadata_list(&b, *op->send_initial_metadata);
88
+ put_metadata_list(
89
+ &b, *op->payload->send_initial_metadata.send_initial_metadata);
88
90
  gpr_strvec_add(&b, gpr_strdup("}"));
89
91
  }
90
92
 
91
- if (op->send_message != NULL) {
93
+ if (op->send_message) {
92
94
  gpr_strvec_add(&b, gpr_strdup(" "));
93
95
  gpr_asprintf(&tmp, "SEND_MESSAGE:flags=0x%08x:len=%d",
94
- op->send_message->flags, op->send_message->length);
96
+ op->payload->send_message.send_message->flags,
97
+ op->payload->send_message.send_message->length);
95
98
  gpr_strvec_add(&b, tmp);
96
99
  }
97
100
 
98
- if (op->send_trailing_metadata != NULL) {
101
+ if (op->send_trailing_metadata) {
99
102
  gpr_strvec_add(&b, gpr_strdup(" "));
100
103
  gpr_strvec_add(&b, gpr_strdup("SEND_TRAILING_METADATA{"));
101
- put_metadata_list(&b, *op->send_trailing_metadata);
104
+ put_metadata_list(
105
+ &b, *op->payload->send_trailing_metadata.send_trailing_metadata);
102
106
  gpr_strvec_add(&b, gpr_strdup("}"));
103
107
  }
104
108
 
105
- if (op->recv_initial_metadata != NULL) {
109
+ if (op->recv_initial_metadata) {
106
110
  gpr_strvec_add(&b, gpr_strdup(" "));
107
111
  gpr_strvec_add(&b, gpr_strdup("RECV_INITIAL_METADATA"));
108
112
  }
109
113
 
110
- if (op->recv_message != NULL) {
114
+ if (op->recv_message) {
111
115
  gpr_strvec_add(&b, gpr_strdup(" "));
112
116
  gpr_strvec_add(&b, gpr_strdup("RECV_MESSAGE"));
113
117
  }
114
118
 
115
- if (op->recv_trailing_metadata != NULL) {
119
+ if (op->recv_trailing_metadata) {
116
120
  gpr_strvec_add(&b, gpr_strdup(" "));
117
121
  gpr_strvec_add(&b, gpr_strdup("RECV_TRAILING_METADATA"));
118
122
  }
119
123
 
120
- if (op->cancel_error != GRPC_ERROR_NONE) {
124
+ if (op->cancel_stream) {
121
125
  gpr_strvec_add(&b, gpr_strdup(" "));
122
- const char *msg = grpc_error_string(op->cancel_error);
126
+ const char *msg =
127
+ grpc_error_string(op->payload->cancel_stream.cancel_error);
123
128
  gpr_asprintf(&tmp, "CANCEL:%s", msg);
124
129
 
125
130
  gpr_strvec_add(&b, tmp);
@@ -204,8 +209,9 @@ char *grpc_transport_op_string(grpc_transport_op *op) {
204
209
  }
205
210
 
206
211
  void grpc_call_log_op(char *file, int line, gpr_log_severity severity,
207
- grpc_call_element *elem, grpc_transport_stream_op *op) {
208
- char *str = grpc_transport_stream_op_string(op);
212
+ grpc_call_element *elem,
213
+ grpc_transport_stream_op_batch *op) {
214
+ char *str = grpc_transport_stream_op_batch_string(op);
209
215
  gpr_log(file, line, severity, "OP[%s:%p]: %s", elem->filter->name, elem, str);
210
216
  gpr_free(str);
211
217
  }
@@ -43,6 +43,8 @@ extern void grpc_lb_policy_pick_first_init(void);
43
43
  extern void grpc_lb_policy_pick_first_shutdown(void);
44
44
  extern void grpc_lb_policy_round_robin_init(void);
45
45
  extern void grpc_lb_policy_round_robin_shutdown(void);
46
+ extern void grpc_resolver_dns_ares_init(void);
47
+ extern void grpc_resolver_dns_ares_shutdown(void);
46
48
  extern void grpc_resolver_dns_native_init(void);
47
49
  extern void grpc_resolver_dns_native_shutdown(void);
48
50
  extern void grpc_resolver_sockaddr_init(void);
@@ -51,6 +53,8 @@ extern void grpc_load_reporting_plugin_init(void);
51
53
  extern void grpc_load_reporting_plugin_shutdown(void);
52
54
  extern void census_grpc_plugin_init(void);
53
55
  extern void census_grpc_plugin_shutdown(void);
56
+ extern void grpc_max_age_filter_init(void);
57
+ extern void grpc_max_age_filter_shutdown(void);
54
58
 
55
59
  void grpc_register_built_in_plugins(void) {
56
60
  grpc_register_plugin(grpc_chttp2_plugin_init,
@@ -63,6 +67,8 @@ void grpc_register_built_in_plugins(void) {
63
67
  grpc_lb_policy_pick_first_shutdown);
64
68
  grpc_register_plugin(grpc_lb_policy_round_robin_init,
65
69
  grpc_lb_policy_round_robin_shutdown);
70
+ grpc_register_plugin(grpc_resolver_dns_ares_init,
71
+ grpc_resolver_dns_ares_shutdown);
66
72
  grpc_register_plugin(grpc_resolver_dns_native_init,
67
73
  grpc_resolver_dns_native_shutdown);
68
74
  grpc_register_plugin(grpc_resolver_sockaddr_init,
@@ -71,4 +77,6 @@ void grpc_register_built_in_plugins(void) {
71
77
  grpc_load_reporting_plugin_shutdown);
72
78
  grpc_register_plugin(census_grpc_plugin_init,
73
79
  census_grpc_plugin_shutdown);
80
+ grpc_register_plugin(grpc_max_age_filter_init,
81
+ grpc_max_age_filter_shutdown);
74
82
  }
@@ -31,7 +31,7 @@
31
31
  *
32
32
  */
33
33
 
34
- #include "src/core/lib/tsi/fake_transport_security.h"
34
+ #include "src/core/tsi/fake_transport_security.h"
35
35
 
36
36
  #include <stdlib.h>
37
37
  #include <string.h>
@@ -40,7 +40,7 @@
40
40
  #include <grpc/support/log.h>
41
41
  #include <grpc/support/port_platform.h>
42
42
  #include <grpc/support/useful.h>
43
- #include "src/core/lib/tsi/transport_security.h"
43
+ #include "src/core/tsi/transport_security.h"
44
44
 
45
45
  /* --- Constants. ---*/
46
46
  #define TSI_FAKE_FRAME_HEADER_SIZE 4
@@ -31,10 +31,10 @@
31
31
  *
32
32
  */
33
33
 
34
- #ifndef GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H
35
- #define GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H
34
+ #ifndef GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H
35
+ #define GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H
36
36
 
37
- #include "src/core/lib/tsi/transport_security_interface.h"
37
+ #include "src/core/tsi/transport_security_interface.h"
38
38
 
39
39
  #ifdef __cplusplus
40
40
  extern "C" {
@@ -58,4 +58,4 @@ tsi_frame_protector *tsi_create_fake_protector(
58
58
  }
59
59
  #endif
60
60
 
61
- #endif /* GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H */
61
+ #endif /* GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H */
@@ -31,7 +31,7 @@
31
31
  *
32
32
  */
33
33
 
34
- #include "src/core/lib/tsi/ssl_transport_security.h"
34
+ #include "src/core/tsi/ssl_transport_security.h"
35
35
 
36
36
  #include <grpc/support/port_platform.h>
37
37
 
@@ -60,8 +60,8 @@
60
60
  #include <openssl/x509.h>
61
61
  #include <openssl/x509v3.h>
62
62
 
63
- #include "src/core/lib/tsi/ssl_types.h"
64
- #include "src/core/lib/tsi/transport_security.h"
63
+ #include "src/core/tsi/ssl_types.h"
64
+ #include "src/core/tsi/transport_security.h"
65
65
 
66
66
  /* --- Constants. ---*/
67
67
 
@@ -81,23 +81,13 @@
81
81
 
82
82
  /* --- Structure definitions. ---*/
83
83
 
84
- struct tsi_ssl_handshaker_factory {
85
- tsi_result (*create_handshaker)(tsi_ssl_handshaker_factory *self,
86
- const char *server_name_indication,
87
- tsi_handshaker **handshaker);
88
- void (*destroy)(tsi_ssl_handshaker_factory *self);
89
- };
90
-
91
- typedef struct {
92
- tsi_ssl_handshaker_factory base;
84
+ struct tsi_ssl_client_handshaker_factory {
93
85
  SSL_CTX *ssl_context;
94
86
  unsigned char *alpn_protocol_list;
95
87
  size_t alpn_protocol_list_length;
96
- } tsi_ssl_client_handshaker_factory;
97
-
98
- typedef struct {
99
- tsi_ssl_handshaker_factory base;
88
+ };
100
89
 
90
+ struct tsi_ssl_server_handshaker_factory {
101
91
  /* Several contexts to support SNI.
102
92
  The tsi_peer array contains the subject names of the server certificates
103
93
  associated with the contexts at the same index. */
@@ -106,7 +96,7 @@ typedef struct {
106
96
  size_t ssl_context_count;
107
97
  unsigned char *alpn_protocol_list;
108
98
  size_t alpn_protocol_list_length;
109
- } tsi_ssl_server_handshaker_factory;
99
+ };
110
100
 
111
101
  typedef struct {
112
102
  tsi_handshaker base;
@@ -1053,18 +1043,6 @@ static const tsi_handshaker_vtable handshaker_vtable = {
1053
1043
 
1054
1044
  /* --- tsi_ssl_handshaker_factory common methods. --- */
1055
1045
 
1056
- tsi_result tsi_ssl_handshaker_factory_create_handshaker(
1057
- tsi_ssl_handshaker_factory *self, const char *server_name_indication,
1058
- tsi_handshaker **handshaker) {
1059
- if (self == NULL || handshaker == NULL) return TSI_INVALID_ARGUMENT;
1060
- return self->create_handshaker(self, server_name_indication, handshaker);
1061
- }
1062
-
1063
- void tsi_ssl_handshaker_factory_destroy(tsi_ssl_handshaker_factory *self) {
1064
- if (self == NULL) return;
1065
- self->destroy(self);
1066
- }
1067
-
1068
1046
  static tsi_result create_tsi_ssl_handshaker(SSL_CTX *ctx, int is_client,
1069
1047
  const char *server_name_indication,
1070
1048
  tsi_handshaker **handshaker) {
@@ -1152,24 +1130,20 @@ static int select_protocol_list(const unsigned char **out,
1152
1130
  return SSL_TLSEXT_ERR_NOACK;
1153
1131
  }
1154
1132
 
1155
- /* --- tsi_ssl__client_handshaker_factory methods implementation. --- */
1133
+ /* --- tsi_ssl_client_handshaker_factory methods implementation. --- */
1156
1134
 
1157
- static tsi_result ssl_client_handshaker_factory_create_handshaker(
1158
- tsi_ssl_handshaker_factory *self, const char *server_name_indication,
1135
+ tsi_result tsi_ssl_client_handshaker_factory_create_handshaker(
1136
+ tsi_ssl_client_handshaker_factory *self, const char *server_name_indication,
1159
1137
  tsi_handshaker **handshaker) {
1160
- tsi_ssl_client_handshaker_factory *impl =
1161
- (tsi_ssl_client_handshaker_factory *)self;
1162
- return create_tsi_ssl_handshaker(impl->ssl_context, 1, server_name_indication,
1138
+ return create_tsi_ssl_handshaker(self->ssl_context, 1, server_name_indication,
1163
1139
  handshaker);
1164
1140
  }
1165
1141
 
1166
- static void ssl_client_handshaker_factory_destroy(
1167
- tsi_ssl_handshaker_factory *self) {
1168
- tsi_ssl_client_handshaker_factory *impl =
1169
- (tsi_ssl_client_handshaker_factory *)self;
1170
- if (impl->ssl_context != NULL) SSL_CTX_free(impl->ssl_context);
1171
- if (impl->alpn_protocol_list != NULL) gpr_free(impl->alpn_protocol_list);
1172
- gpr_free(impl);
1142
+ void tsi_ssl_client_handshaker_factory_destroy(
1143
+ tsi_ssl_client_handshaker_factory *self) {
1144
+ if (self->ssl_context != NULL) SSL_CTX_free(self->ssl_context);
1145
+ if (self->alpn_protocol_list != NULL) gpr_free(self->alpn_protocol_list);
1146
+ gpr_free(self);
1173
1147
  }
1174
1148
 
1175
1149
  static int client_handshaker_factory_npn_callback(SSL *ssl, unsigned char **out,
@@ -1186,36 +1160,29 @@ static int client_handshaker_factory_npn_callback(SSL *ssl, unsigned char **out,
1186
1160
 
1187
1161
  /* --- tsi_ssl_server_handshaker_factory methods implementation. --- */
1188
1162
 
1189
- static tsi_result ssl_server_handshaker_factory_create_handshaker(
1190
- tsi_ssl_handshaker_factory *self, const char *server_name_indication,
1191
- tsi_handshaker **handshaker) {
1192
- tsi_ssl_server_handshaker_factory *impl =
1193
- (tsi_ssl_server_handshaker_factory *)self;
1194
- if (impl->ssl_context_count == 0 || server_name_indication != NULL) {
1195
- return TSI_INVALID_ARGUMENT;
1196
- }
1163
+ tsi_result tsi_ssl_server_handshaker_factory_create_handshaker(
1164
+ tsi_ssl_server_handshaker_factory *self, tsi_handshaker **handshaker) {
1165
+ if (self->ssl_context_count == 0) return TSI_INVALID_ARGUMENT;
1197
1166
  /* Create the handshaker with the first context. We will switch if needed
1198
1167
  because of SNI in ssl_server_handshaker_factory_servername_callback. */
1199
- return create_tsi_ssl_handshaker(impl->ssl_contexts[0], 0, NULL, handshaker);
1168
+ return create_tsi_ssl_handshaker(self->ssl_contexts[0], 0, NULL, handshaker);
1200
1169
  }
1201
1170
 
1202
- static void ssl_server_handshaker_factory_destroy(
1203
- tsi_ssl_handshaker_factory *self) {
1204
- tsi_ssl_server_handshaker_factory *impl =
1205
- (tsi_ssl_server_handshaker_factory *)self;
1171
+ void tsi_ssl_server_handshaker_factory_destroy(
1172
+ tsi_ssl_server_handshaker_factory *self) {
1206
1173
  size_t i;
1207
- for (i = 0; i < impl->ssl_context_count; i++) {
1208
- if (impl->ssl_contexts[i] != NULL) {
1209
- SSL_CTX_free(impl->ssl_contexts[i]);
1210
- tsi_peer_destruct(&impl->ssl_context_x509_subject_names[i]);
1174
+ for (i = 0; i < self->ssl_context_count; i++) {
1175
+ if (self->ssl_contexts[i] != NULL) {
1176
+ SSL_CTX_free(self->ssl_contexts[i]);
1177
+ tsi_peer_destruct(&self->ssl_context_x509_subject_names[i]);
1211
1178
  }
1212
1179
  }
1213
- if (impl->ssl_contexts != NULL) gpr_free(impl->ssl_contexts);
1214
- if (impl->ssl_context_x509_subject_names != NULL) {
1215
- gpr_free(impl->ssl_context_x509_subject_names);
1180
+ if (self->ssl_contexts != NULL) gpr_free(self->ssl_contexts);
1181
+ if (self->ssl_context_x509_subject_names != NULL) {
1182
+ gpr_free(self->ssl_context_x509_subject_names);
1216
1183
  }
1217
- if (impl->alpn_protocol_list != NULL) gpr_free(impl->alpn_protocol_list);
1218
- gpr_free(impl);
1184
+ if (self->alpn_protocol_list != NULL) gpr_free(self->alpn_protocol_list);
1185
+ gpr_free(self);
1219
1186
  }
1220
1187
 
1221
1188
  static int does_entry_match_name(const char *entry, size_t entry_length,
@@ -1317,7 +1284,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
1317
1284
  const unsigned char *pem_root_certs, size_t pem_root_certs_size,
1318
1285
  const char *cipher_list, const unsigned char **alpn_protocols,
1319
1286
  const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
1320
- tsi_ssl_handshaker_factory **factory) {
1287
+ tsi_ssl_client_handshaker_factory **factory) {
1321
1288
  SSL_CTX *ssl_context = NULL;
1322
1289
  tsi_ssl_client_handshaker_factory *impl = NULL;
1323
1290
  tsi_result result = TSI_OK;
@@ -1373,16 +1340,13 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
1373
1340
  }
1374
1341
  } while (0);
1375
1342
  if (result != TSI_OK) {
1376
- ssl_client_handshaker_factory_destroy(&impl->base);
1343
+ tsi_ssl_client_handshaker_factory_destroy(impl);
1377
1344
  return result;
1378
1345
  }
1379
1346
  SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER, NULL);
1380
1347
  /* TODO(jboeuf): Add revocation verification. */
1381
1348
 
1382
- impl->base.create_handshaker =
1383
- ssl_client_handshaker_factory_create_handshaker;
1384
- impl->base.destroy = ssl_client_handshaker_factory_destroy;
1385
- *factory = &impl->base;
1349
+ *factory = impl;
1386
1350
  return TSI_OK;
1387
1351
  }
1388
1352
 
@@ -1394,7 +1358,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
1394
1358
  size_t pem_client_root_certs_size, int force_client_auth,
1395
1359
  const char *cipher_list, const unsigned char **alpn_protocols,
1396
1360
  const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
1397
- tsi_ssl_handshaker_factory **factory) {
1361
+ tsi_ssl_server_handshaker_factory **factory) {
1398
1362
  return tsi_create_ssl_server_handshaker_factory_ex(
1399
1363
  pem_private_keys, pem_private_keys_sizes, pem_cert_chains,
1400
1364
  pem_cert_chains_sizes, key_cert_pair_count, pem_client_root_certs,
@@ -1414,7 +1378,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
1414
1378
  tsi_client_certificate_request_type client_certificate_request,
1415
1379
  const char *cipher_list, const unsigned char **alpn_protocols,
1416
1380
  const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
1417
- tsi_ssl_handshaker_factory **factory) {
1381
+ tsi_ssl_server_handshaker_factory **factory) {
1418
1382
  tsi_ssl_server_handshaker_factory *impl = NULL;
1419
1383
  tsi_result result = TSI_OK;
1420
1384
  size_t i = 0;
@@ -1429,15 +1393,12 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
1429
1393
  }
1430
1394
 
1431
1395
  impl = gpr_zalloc(sizeof(*impl));
1432
- impl->base.create_handshaker =
1433
- ssl_server_handshaker_factory_create_handshaker;
1434
- impl->base.destroy = ssl_server_handshaker_factory_destroy;
1435
1396
  impl->ssl_contexts = gpr_zalloc(key_cert_pair_count * sizeof(SSL_CTX *));
1436
1397
  impl->ssl_context_x509_subject_names =
1437
1398
  gpr_zalloc(key_cert_pair_count * sizeof(tsi_peer));
1438
1399
  if (impl->ssl_contexts == NULL ||
1439
1400
  impl->ssl_context_x509_subject_names == NULL) {
1440
- tsi_ssl_handshaker_factory_destroy(&impl->base);
1401
+ tsi_ssl_server_handshaker_factory_destroy(impl);
1441
1402
  return TSI_OUT_OF_RESOURCES;
1442
1403
  }
1443
1404
  impl->ssl_context_count = key_cert_pair_count;
@@ -1447,7 +1408,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
1447
1408
  alpn_protocols, alpn_protocols_lengths, num_alpn_protocols,
1448
1409
  &impl->alpn_protocol_list, &impl->alpn_protocol_list_length);
1449
1410
  if (result != TSI_OK) {
1450
- tsi_ssl_handshaker_factory_destroy(&impl->base);
1411
+ tsi_ssl_server_handshaker_factory_destroy(impl);
1451
1412
  return result;
1452
1413
  }
1453
1414
  }
@@ -1520,11 +1481,11 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
1520
1481
  } while (0);
1521
1482
 
1522
1483
  if (result != TSI_OK) {
1523
- tsi_ssl_handshaker_factory_destroy(&impl->base);
1484
+ tsi_ssl_server_handshaker_factory_destroy(impl);
1524
1485
  return result;
1525
1486
  }
1526
1487
  }
1527
- *factory = &impl->base;
1488
+ *factory = impl;
1528
1489
  return TSI_OK;
1529
1490
  }
1530
1491
 
@@ -31,10 +31,10 @@
31
31
  *
32
32
  */
33
33
 
34
- #ifndef GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H
35
- #define GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H
34
+ #ifndef GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H
35
+ #define GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H
36
36
 
37
- #include "src/core/lib/tsi/transport_security_interface.h"
37
+ #include "src/core/tsi/transport_security_interface.h"
38
38
 
39
39
  #ifdef __cplusplus
40
40
  extern "C" {
@@ -52,12 +52,13 @@ extern "C" {
52
52
 
53
53
  #define TSI_SSL_ALPN_SELECTED_PROTOCOL "ssl_alpn_selected_protocol"
54
54
 
55
- /* --- tsi_ssl_handshaker_factory object ---
55
+ /* --- tsi_ssl_client_handshaker_factory object ---
56
56
 
57
- This object creates tsi_handshaker objects implemented in terms of the
58
- TLS 1.2 specificiation. */
57
+ This object creates a client tsi_handshaker objects implemented in terms of
58
+ the TLS 1.2 specificiation. */
59
59
 
60
- typedef struct tsi_ssl_handshaker_factory tsi_ssl_handshaker_factory;
60
+ typedef struct tsi_ssl_client_handshaker_factory
61
+ tsi_ssl_client_handshaker_factory;
61
62
 
62
63
  /* Creates a client handshaker factory.
63
64
  - pem_private_key is the buffer containing the PEM encoding of the client's
@@ -92,7 +93,33 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
92
93
  const unsigned char *pem_root_certs, size_t pem_root_certs_size,
93
94
  const char *cipher_suites, const unsigned char **alpn_protocols,
94
95
  const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
95
- tsi_ssl_handshaker_factory **factory);
96
+ tsi_ssl_client_handshaker_factory **factory);
97
+
98
+ /* Creates a client handshaker.
99
+ - self is the factory from which the handshaker will be created.
100
+ - server_name_indication indicates the name of the server the client is
101
+ trying to connect to which will be relayed to the server using the SNI
102
+ extension.
103
+ - handshaker is the address of the handshaker pointer to be created.
104
+
105
+ - This method returns TSI_OK on success or TSI_INVALID_PARAMETER in the case
106
+ where a parameter is invalid. */
107
+ tsi_result tsi_ssl_client_handshaker_factory_create_handshaker(
108
+ tsi_ssl_client_handshaker_factory *self, const char *server_name_indication,
109
+ tsi_handshaker **handshaker);
110
+
111
+ /* Destroys the handshaker factory. WARNING: it is unsafe to destroy a factory
112
+ while handshakers created with this factory are still in use. */
113
+ void tsi_ssl_client_handshaker_factory_destroy(
114
+ tsi_ssl_client_handshaker_factory *self);
115
+
116
+ /* --- tsi_ssl_server_handshaker_factory object ---
117
+
118
+ This object creates a client tsi_handshaker objects implemented in terms of
119
+ the TLS 1.2 specificiation. */
120
+
121
+ typedef struct tsi_ssl_server_handshaker_factory
122
+ tsi_ssl_server_handshaker_factory;
96
123
 
97
124
  /* Creates a server handshaker factory.
98
125
  - version indicates which version of the specification to use.
@@ -140,7 +167,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
140
167
  size_t pem_client_root_certs_size, int force_client_auth,
141
168
  const char *cipher_suites, const unsigned char **alpn_protocols,
142
169
  const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
143
- tsi_ssl_handshaker_factory **factory);
170
+ tsi_ssl_server_handshaker_factory **factory);
144
171
 
145
172
  /* Same as tsi_create_ssl_server_handshaker_factory method except uses
146
173
  tsi_client_certificate_request_type to support more ways to handle client
@@ -157,25 +184,21 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
157
184
  tsi_client_certificate_request_type client_certificate_request,
158
185
  const char *cipher_suites, const unsigned char **alpn_protocols,
159
186
  const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
160
- tsi_ssl_handshaker_factory **factory);
187
+ tsi_ssl_server_handshaker_factory **factory);
161
188
 
162
- /* Creates a handshaker.
189
+ /* Creates a server handshaker.
163
190
  - self is the factory from which the handshaker will be created.
164
- - server_name_indication indicates the name of the server the client is
165
- trying to connect to which will be relayed to the server using the SNI
166
- extension.
167
- This parameter must be NULL for a server handshaker factory.
168
- - handhshaker is the address of the handshaker pointer to be created.
191
+ - handshaker is the address of the handshaker pointer to be created.
169
192
 
170
193
  - This method returns TSI_OK on success or TSI_INVALID_PARAMETER in the case
171
194
  where a parameter is invalid. */
172
- tsi_result tsi_ssl_handshaker_factory_create_handshaker(
173
- tsi_ssl_handshaker_factory *self, const char *server_name_indication,
174
- tsi_handshaker **handshaker);
195
+ tsi_result tsi_ssl_server_handshaker_factory_create_handshaker(
196
+ tsi_ssl_server_handshaker_factory *self, tsi_handshaker **handshaker);
175
197
 
176
198
  /* Destroys the handshaker factory. WARNING: it is unsafe to destroy a factory
177
199
  while handshakers created with this factory are still in use. */
178
- void tsi_ssl_handshaker_factory_destroy(tsi_ssl_handshaker_factory *self);
200
+ void tsi_ssl_server_handshaker_factory_destroy(
201
+ tsi_ssl_server_handshaker_factory *self);
179
202
 
180
203
  /* Util that checks that an ssl peer matches a specific name.
181
204
  Still TODO(jboeuf):
@@ -188,4 +211,4 @@ int tsi_ssl_peer_matches_name(const tsi_peer *peer, const char *name);
188
211
  }
189
212
  #endif
190
213
 
191
- #endif /* GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H */
214
+ #endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */