grpc 0.14.1 → 0.15.0

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 +1398 -817
  3. data/include/grpc/compression.h +2 -1
  4. data/include/grpc/grpc.h +10 -1
  5. data/include/grpc/grpc_cronet.h +51 -0
  6. data/include/grpc/grpc_posix.h +70 -0
  7. data/include/grpc/impl/codegen/atm.h +2 -2
  8. data/include/grpc/impl/codegen/{atm_win32.h → atm_windows.h} +3 -3
  9. data/include/grpc/impl/codegen/compression_types.h +39 -5
  10. data/include/grpc/impl/codegen/connectivity_state.h +1 -1
  11. data/include/grpc/impl/codegen/grpc_types.h +10 -0
  12. data/include/grpc/impl/codegen/log.h +2 -1
  13. data/include/grpc/impl/codegen/port_platform.h +30 -12
  14. data/include/grpc/impl/codegen/slice_buffer.h +2 -3
  15. data/include/grpc/impl/codegen/sync.h +2 -2
  16. data/include/grpc/impl/codegen/{sync_win32.h → sync_windows.h} +3 -3
  17. data/include/grpc/support/{sync_win32.h → atm_windows.h} +4 -4
  18. data/include/grpc/support/avl.h +5 -0
  19. data/include/grpc/support/{log_win32.h → log_windows.h} +3 -3
  20. data/include/grpc/support/string_util.h +2 -1
  21. data/include/grpc/support/{atm_win32.h → sync_windows.h} +4 -4
  22. data/src/core/ext/census/gen/census.pb.c +179 -0
  23. data/src/core/ext/census/gen/census.pb.h +294 -0
  24. data/src/core/ext/census/grpc_filter.c +11 -7
  25. data/src/core/ext/client_config/channel_connectivity.c +28 -14
  26. data/src/core/ext/client_config/client_channel.c +77 -53
  27. data/src/core/ext/client_config/connector.h +1 -1
  28. data/src/core/ext/client_config/lb_policy.c +9 -6
  29. data/src/core/ext/client_config/lb_policy.h +9 -5
  30. data/src/core/ext/client_config/subchannel.c +58 -39
  31. data/src/core/ext/client_config/subchannel.h +3 -2
  32. data/src/core/ext/client_config/subchannel_call_holder.c +34 -19
  33. data/src/core/ext/client_config/subchannel_call_holder.h +2 -1
  34. data/src/core/ext/client_config/subchannel_index.c +20 -9
  35. data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +7 -7
  36. data/src/core/ext/lb_policy/grpclb/load_balancer_api.h +5 -5
  37. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/{v0 → v1}/load_balancer.pb.c +29 -30
  38. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +178 -0
  39. data/src/core/ext/lb_policy/pick_first/pick_first.c +65 -45
  40. data/src/core/ext/lb_policy/round_robin/round_robin.c +84 -43
  41. data/src/core/ext/load_reporting/load_reporting.c +133 -0
  42. data/src/core/ext/load_reporting/load_reporting.h +75 -0
  43. data/src/core/ext/load_reporting/load_reporting_filter.c +151 -0
  44. data/src/core/ext/load_reporting/load_reporting_filter.h +41 -0
  45. data/src/core/ext/resolver/dns/native/dns_resolver.c +22 -8
  46. data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +2 -2
  47. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +4 -4
  48. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +95 -0
  49. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +14 -18
  50. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +49 -24
  51. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +82 -0
  52. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +104 -60
  53. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +232 -0
  54. data/src/{ruby/ext/grpc/rb_signal.c → core/ext/transport/chttp2/transport/bin_decoder.h} +27 -31
  55. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +481 -260
  56. data/src/core/ext/transport/chttp2/transport/frame.h +1 -7
  57. data/src/core/ext/transport/chttp2/transport/frame_data.c +44 -27
  58. data/src/core/ext/transport/chttp2/transport/frame_data.h +6 -5
  59. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +23 -17
  60. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -2
  61. data/src/core/ext/transport/chttp2/transport/frame_ping.c +12 -7
  62. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
  63. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +25 -12
  64. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -2
  65. data/src/core/ext/transport/chttp2/transport/frame_settings.c +23 -21
  66. data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -2
  67. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -9
  68. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -2
  69. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +365 -287
  70. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -6
  71. data/src/core/ext/transport/chttp2/transport/hpack_table.c +24 -20
  72. data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -4
  73. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +1 -0
  74. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +1 -0
  75. data/src/core/ext/transport/chttp2/transport/internal.h +34 -32
  76. data/src/core/ext/transport/chttp2/transport/parsing.c +296 -212
  77. data/src/core/ext/transport/chttp2/transport/writing.c +12 -9
  78. data/src/core/lib/channel/channel_args.c +26 -12
  79. data/src/core/lib/channel/channel_args.h +1 -1
  80. data/src/core/lib/channel/channel_stack.c +12 -8
  81. data/src/core/lib/channel/channel_stack.h +27 -11
  82. data/src/core/lib/channel/channel_stack_builder.c +2 -2
  83. data/src/core/lib/channel/compress_filter.c +26 -31
  84. data/src/core/lib/channel/compress_filter.h +4 -4
  85. data/src/core/lib/channel/connected_channel.c +7 -5
  86. data/src/core/lib/channel/http_client_filter.c +34 -8
  87. data/src/core/lib/channel/http_client_filter.h +1 -1
  88. data/src/core/lib/channel/http_server_filter.c +21 -12
  89. data/src/core/lib/compression/{compression_algorithm.c → compression.c} +22 -21
  90. data/src/core/lib/http/httpcli.c +81 -59
  91. data/src/core/lib/http/httpcli.h +11 -15
  92. data/src/core/lib/http/httpcli_security_connector.c +5 -3
  93. data/src/core/lib/http/parser.c +127 -118
  94. data/src/core/lib/http/parser.h +11 -6
  95. data/src/core/lib/iomgr/closure.c +20 -16
  96. data/src/core/lib/iomgr/closure.h +19 -15
  97. data/src/core/lib/iomgr/endpoint.h +1 -1
  98. data/src/core/lib/iomgr/endpoint_pair_posix.c +2 -2
  99. data/src/core/lib/iomgr/error.c +535 -0
  100. data/src/core/lib/iomgr/error.h +192 -0
  101. data/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +190 -83
  102. data/src/core/lib/iomgr/ev_poll_posix.c +1267 -0
  103. data/src/{ruby/ext/grpc/rb_signal.h → core/lib/iomgr/ev_poll_posix.h} +7 -5
  104. data/src/core/lib/iomgr/ev_posix.c +104 -14
  105. data/src/core/lib/iomgr/ev_posix.h +17 -7
  106. data/src/core/lib/iomgr/exec_ctx.c +25 -7
  107. data/src/core/lib/iomgr/exec_ctx.h +27 -8
  108. data/src/core/lib/iomgr/executor.c +2 -2
  109. data/src/core/lib/iomgr/executor.h +1 -1
  110. data/src/core/lib/iomgr/iocp_windows.c +2 -41
  111. data/src/core/lib/iomgr/iocp_windows.h +0 -8
  112. data/src/core/lib/iomgr/iomgr.c +5 -4
  113. data/src/core/lib/iomgr/iomgr_posix.c +5 -1
  114. data/src/core/lib/iomgr/iomgr_windows.c +1 -1
  115. data/src/core/lib/{support → iomgr}/load_file.c +15 -17
  116. data/src/core/lib/{support → iomgr}/load_file.h +8 -7
  117. data/src/core/lib/iomgr/polling_entity.c +104 -0
  118. data/src/core/lib/iomgr/polling_entity.h +81 -0
  119. data/src/core/lib/iomgr/pollset.h +6 -5
  120. data/src/core/lib/iomgr/pollset_set_windows.c +4 -1
  121. data/src/core/lib/iomgr/pollset_windows.c +10 -6
  122. data/src/core/lib/iomgr/resolve_address.h +5 -9
  123. data/src/core/lib/iomgr/resolve_address_posix.c +55 -38
  124. data/src/core/lib/iomgr/resolve_address_windows.c +51 -37
  125. data/src/core/lib/iomgr/sockaddr.h +2 -2
  126. data/src/core/lib/iomgr/{sockaddr_win32.h → sockaddr_windows.h} +3 -3
  127. data/src/core/lib/iomgr/socket_utils_common_posix.c +92 -45
  128. data/src/core/lib/iomgr/socket_utils_posix.h +19 -12
  129. data/src/core/lib/iomgr/socket_windows.c +61 -2
  130. data/src/core/lib/iomgr/socket_windows.h +13 -0
  131. data/src/core/lib/iomgr/tcp_client_posix.c +54 -39
  132. data/src/core/lib/iomgr/tcp_client_windows.c +34 -34
  133. data/src/core/lib/iomgr/tcp_posix.c +43 -39
  134. data/src/core/lib/iomgr/tcp_server.h +5 -3
  135. data/src/core/lib/iomgr/tcp_server_posix.c +103 -64
  136. data/src/core/lib/iomgr/tcp_server_windows.c +114 -101
  137. data/src/core/lib/iomgr/tcp_windows.c +45 -50
  138. data/src/core/lib/iomgr/tcp_windows.h +1 -1
  139. data/src/core/lib/iomgr/timer.c +26 -13
  140. data/src/core/lib/iomgr/udp_server.c +28 -4
  141. data/src/core/lib/iomgr/udp_server.h +5 -1
  142. data/src/core/lib/iomgr/unix_sockets_posix.c +8 -7
  143. data/src/core/lib/iomgr/unix_sockets_posix.h +2 -1
  144. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +4 -2
  145. data/src/core/lib/iomgr/wakeup_fd_eventfd.c +15 -5
  146. data/src/core/lib/iomgr/wakeup_fd_pipe.c +13 -9
  147. data/src/core/lib/iomgr/wakeup_fd_posix.c +6 -6
  148. data/src/core/lib/iomgr/wakeup_fd_posix.h +9 -6
  149. data/src/core/lib/iomgr/workqueue.h +5 -4
  150. data/src/core/lib/iomgr/workqueue_posix.c +40 -26
  151. data/src/core/lib/iomgr/workqueue_windows.c +2 -2
  152. data/src/core/lib/profiling/basic_timers.c +2 -2
  153. data/src/core/lib/security/{security_context.c → context/security_context.c} +1 -1
  154. data/src/core/lib/security/{security_context.h → context/security_context.h} +4 -4
  155. data/src/core/lib/security/credentials/composite/composite_credentials.c +263 -0
  156. data/src/core/lib/security/credentials/composite/composite_credentials.h +72 -0
  157. data/src/core/lib/security/credentials/credentials.c +233 -0
  158. data/src/core/lib/security/{credentials.h → credentials/credentials.h} +19 -157
  159. data/src/core/lib/security/{credentials_metadata.c → credentials/credentials_metadata.c} +1 -1
  160. data/src/core/lib/security/credentials/fake/fake_credentials.c +139 -0
  161. data/src/core/lib/security/credentials/fake/fake_credentials.h +56 -0
  162. data/src/core/lib/security/{credentials_posix.c → credentials/google_default/credentials_posix.c} +1 -1
  163. data/src/core/lib/security/{credentials_win32.c → credentials/google_default/credentials_windows.c} +3 -3
  164. data/src/core/lib/security/{google_default_credentials.c → credentials/google_default/google_default_credentials.c} +93 -35
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +46 -0
  166. data/src/core/lib/security/credentials/iam/iam_credentials.c +85 -0
  167. data/src/core/lib/security/credentials/iam/iam_credentials.h +44 -0
  168. data/src/core/lib/security/{json_token.c → credentials/jwt/json_token.c} +10 -101
  169. data/src/core/lib/security/{json_token.h → credentials/jwt/json_token.h} +3 -33
  170. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +160 -0
  171. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +62 -0
  172. data/src/core/lib/security/{jwt_verifier.c → credentials/jwt/jwt_verifier.c} +35 -15
  173. data/src/core/lib/security/{jwt_verifier.h → credentials/jwt/jwt_verifier.h} +3 -3
  174. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +433 -0
  175. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +109 -0
  176. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +129 -0
  177. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +45 -0
  178. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +240 -0
  179. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +48 -0
  180. data/src/core/lib/security/{auth_filters.h → transport/auth_filters.h} +3 -3
  181. data/src/core/lib/security/{client_auth_filter.c → transport/client_auth_filter.c} +27 -20
  182. data/src/core/lib/security/{handshake.c → transport/handshake.c} +77 -45
  183. data/src/core/lib/security/{handshake.h → transport/handshake.h} +9 -11
  184. data/src/core/lib/security/{secure_endpoint.c → transport/secure_endpoint.c} +19 -12
  185. data/src/core/lib/security/{secure_endpoint.h → transport/secure_endpoint.h} +3 -3
  186. data/src/core/lib/security/{security_connector.c → transport/security_connector.c} +26 -17
  187. data/src/core/lib/security/{security_connector.h → transport/security_connector.h} +8 -8
  188. data/src/core/lib/security/{server_auth_filter.c → transport/server_auth_filter.c} +24 -16
  189. data/src/core/lib/security/transport/tsi_error.c +40 -0
  190. data/src/core/lib/security/transport/tsi_error.h +42 -0
  191. data/src/core/lib/security/{b64.c → util/b64.c} +1 -1
  192. data/src/core/lib/security/{b64.h → util/b64.h} +3 -3
  193. data/src/core/lib/security/util/json_util.c +61 -0
  194. data/src/core/lib/security/util/json_util.h +55 -0
  195. data/src/core/lib/support/avl.c +11 -0
  196. data/src/core/lib/support/cpu_windows.c +2 -2
  197. data/src/core/lib/support/{env_win32.c → env_windows.c} +3 -3
  198. data/src/core/lib/support/log.c +3 -1
  199. data/src/core/lib/support/log_linux.c +2 -2
  200. data/src/core/lib/support/{log_win32.c → log_windows.c} +4 -4
  201. data/src/core/lib/support/murmur_hash.c +3 -5
  202. data/src/core/lib/support/string.c +10 -0
  203. data/src/core/lib/support/string.h +4 -0
  204. data/src/core/lib/support/{string_util_win32.c → string_util_windows.c} +3 -3
  205. data/src/core/lib/support/{string_win32.c → string_windows.c} +2 -2
  206. data/src/core/lib/support/{string_win32.h → string_windows.h} +5 -5
  207. data/src/core/lib/support/subprocess_windows.c +1 -1
  208. data/src/core/lib/support/{sync_win32.c → sync_windows.c} +2 -2
  209. data/src/core/lib/support/{thd_win32.c → thd_windows.c} +2 -2
  210. data/src/core/lib/support/{time_win32.c → time_windows.c} +2 -2
  211. data/src/core/lib/support/tmpfile_msys.c +1 -1
  212. data/src/core/lib/support/{tmpfile_win32.c → tmpfile_windows.c} +3 -3
  213. data/src/core/lib/surface/alarm.c +2 -2
  214. data/src/core/lib/surface/byte_buffer_reader.c +13 -6
  215. data/src/core/lib/surface/call.c +323 -123
  216. data/src/core/lib/surface/call.h +2 -0
  217. data/src/core/lib/surface/call_log_batch.c +1 -1
  218. data/src/core/lib/surface/channel.c +64 -15
  219. data/src/core/lib/surface/channel.h +9 -0
  220. data/src/core/lib/surface/channel_ping.c +3 -3
  221. data/src/core/lib/surface/completion_queue.c +75 -19
  222. data/src/core/lib/surface/completion_queue.h +7 -2
  223. data/src/core/lib/surface/init.c +2 -1
  224. data/src/core/lib/surface/init_secure.c +4 -4
  225. data/src/core/lib/surface/lame_client.c +12 -8
  226. data/src/core/lib/surface/server.c +213 -120
  227. data/src/core/lib/surface/server.h +1 -0
  228. data/src/core/lib/surface/version.c +1 -1
  229. data/src/core/lib/transport/connectivity_state.c +40 -18
  230. data/src/core/lib/transport/connectivity_state.h +4 -1
  231. data/src/core/lib/transport/metadata.c +23 -23
  232. data/src/core/lib/transport/metadata.h +4 -0
  233. data/src/core/lib/transport/metadata_batch.c +9 -0
  234. data/src/core/lib/transport/metadata_batch.h +3 -0
  235. data/src/core/lib/transport/static_metadata.c +6 -5
  236. data/src/core/lib/transport/static_metadata.h +64 -60
  237. data/src/core/lib/transport/transport.c +24 -12
  238. data/src/core/lib/transport/transport.h +6 -5
  239. data/src/core/lib/transport/transport_impl.h +4 -0
  240. data/src/core/lib/transport/transport_op_string.c +2 -2
  241. data/src/core/plugin_registry/grpc_plugin_registry.c +4 -0
  242. data/src/ruby/bin/math_services.rb +41 -2
  243. data/src/ruby/ext/grpc/rb_call.c +42 -40
  244. data/src/ruby/ext/grpc/rb_channel.c +1 -1
  245. data/src/ruby/ext/grpc/rb_completion_queue.c +59 -6
  246. data/src/ruby/ext/grpc/rb_completion_queue.h +1 -1
  247. data/src/ruby/ext/grpc/rb_grpc.c +1 -3
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -2
  249. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +21 -5
  250. data/src/ruby/ext/grpc/rb_loader.c +1 -1
  251. data/src/ruby/ext/grpc/rb_server.c +5 -3
  252. data/src/ruby/lib/grpc.rb +0 -3
  253. data/src/ruby/lib/grpc/errors.rb +3 -2
  254. data/src/ruby/lib/grpc/generic/active_call.rb +32 -42
  255. data/src/ruby/lib/grpc/generic/bidi_call.rb +20 -0
  256. data/src/ruby/lib/grpc/generic/client_stub.rb +31 -54
  257. data/src/ruby/lib/grpc/generic/rpc_desc.rb +4 -4
  258. data/src/ruby/lib/grpc/generic/rpc_server.rb +12 -23
  259. data/src/ruby/lib/grpc/generic/service.rb +8 -8
  260. data/src/ruby/lib/grpc/version.rb +1 -1
  261. data/src/ruby/pb/grpc/health/v1/health_services.rb +30 -2
  262. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services.rb +34 -4
  263. data/src/ruby/pb/grpc/testing/metrics_services.rb +39 -2
  264. data/src/ruby/pb/src/proto/grpc/testing/empty.rb +15 -0
  265. data/src/ruby/pb/src/proto/grpc/testing/messages.rb +84 -0
  266. data/src/ruby/pb/src/proto/grpc/testing/test.rb +14 -0
  267. data/src/ruby/pb/src/proto/grpc/testing/test_services.rb +110 -0
  268. data/src/ruby/pb/test/client.rb +5 -2
  269. data/src/ruby/spec/generic/active_call_spec.rb +3 -2
  270. data/src/ruby/spec/generic/client_stub_spec.rb +27 -24
  271. data/src/ruby/spec/generic/rpc_desc_spec.rb +11 -11
  272. data/src/ruby/spec/generic/rpc_server_spec.rb +42 -61
  273. data/src/ruby/spec/pb/health/checker_spec.rb +3 -5
  274. metadata +86 -48
  275. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h +0 -182
  276. data/src/core/lib/security/credentials.c +0 -1296
  277. data/src/ruby/lib/grpc/signals.rb +0 -69
@@ -43,14 +43,15 @@
43
43
  #include "src/core/lib/iomgr/workqueue_posix.h"
44
44
  #endif
45
45
 
46
- #ifdef GPR_WIN32
46
+ #ifdef GPR_WINDOWS
47
47
  #include "src/core/lib/iomgr/workqueue_windows.h"
48
48
  #endif
49
49
 
50
50
  /* grpc_workqueue is forward declared in exec_ctx.h */
51
51
 
52
52
  /** Create a work queue */
53
- grpc_workqueue *grpc_workqueue_create(grpc_exec_ctx *exec_ctx);
53
+ grpc_error *grpc_workqueue_create(grpc_exec_ctx *exec_ctx,
54
+ grpc_workqueue **workqueue);
54
55
 
55
56
  void grpc_workqueue_flush(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue);
56
57
 
@@ -77,7 +78,7 @@ void grpc_workqueue_add_to_pollset(grpc_exec_ctx *exec_ctx,
77
78
  grpc_pollset *pollset);
78
79
 
79
80
  /** Add a work item to a workqueue */
80
- void grpc_workqueue_push(grpc_workqueue *workqueue, grpc_closure *closure,
81
- int success);
81
+ void grpc_workqueue_enqueue(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue,
82
+ grpc_closure *closure, grpc_error *error);
82
83
 
83
84
  #endif /* GRPC_CORE_LIB_IOMGR_WORKQUEUE_H */
@@ -45,22 +45,27 @@
45
45
 
46
46
  #include "src/core/lib/iomgr/ev_posix.h"
47
47
 
48
- static void on_readable(grpc_exec_ctx *exec_ctx, void *arg, bool success);
48
+ static void on_readable(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error);
49
49
 
50
- grpc_workqueue *grpc_workqueue_create(grpc_exec_ctx *exec_ctx) {
50
+ grpc_error *grpc_workqueue_create(grpc_exec_ctx *exec_ctx,
51
+ grpc_workqueue **workqueue) {
51
52
  char name[32];
52
- grpc_workqueue *workqueue = gpr_malloc(sizeof(grpc_workqueue));
53
- gpr_ref_init(&workqueue->refs, 1);
54
- gpr_mu_init(&workqueue->mu);
55
- workqueue->closure_list.head = workqueue->closure_list.tail = NULL;
56
- grpc_wakeup_fd_init(&workqueue->wakeup_fd);
57
- sprintf(name, "workqueue:%p", (void *)workqueue);
58
- workqueue->wakeup_read_fd =
59
- grpc_fd_create(GRPC_WAKEUP_FD_GET_READ_FD(&workqueue->wakeup_fd), name);
60
- grpc_closure_init(&workqueue->read_closure, on_readable, workqueue);
61
- grpc_fd_notify_on_read(exec_ctx, workqueue->wakeup_read_fd,
62
- &workqueue->read_closure);
63
- return workqueue;
53
+ *workqueue = gpr_malloc(sizeof(grpc_workqueue));
54
+ gpr_ref_init(&(*workqueue)->refs, 1);
55
+ gpr_mu_init(&(*workqueue)->mu);
56
+ (*workqueue)->closure_list.head = (*workqueue)->closure_list.tail = NULL;
57
+ grpc_error *err = grpc_wakeup_fd_init(&(*workqueue)->wakeup_fd);
58
+ if (err != GRPC_ERROR_NONE) {
59
+ gpr_free(*workqueue);
60
+ return err;
61
+ }
62
+ sprintf(name, "workqueue:%p", (void *)(*workqueue));
63
+ (*workqueue)->wakeup_read_fd = grpc_fd_create(
64
+ GRPC_WAKEUP_FD_GET_READ_FD(&(*workqueue)->wakeup_fd), name);
65
+ grpc_closure_init(&(*workqueue)->read_closure, on_readable, *workqueue);
66
+ grpc_fd_notify_on_read(exec_ctx, (*workqueue)->wakeup_read_fd,
67
+ &(*workqueue)->read_closure);
68
+ return GRPC_ERROR_NONE;
64
69
  }
65
70
 
66
71
  static void workqueue_destroy(grpc_exec_ctx *exec_ctx,
@@ -103,17 +108,14 @@ void grpc_workqueue_add_to_pollset(grpc_exec_ctx *exec_ctx,
103
108
 
104
109
  void grpc_workqueue_flush(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue) {
105
110
  gpr_mu_lock(&workqueue->mu);
106
- if (grpc_closure_list_empty(workqueue->closure_list)) {
107
- grpc_wakeup_fd_wakeup(&workqueue->wakeup_fd);
108
- }
109
111
  grpc_exec_ctx_enqueue_list(exec_ctx, &workqueue->closure_list, NULL);
110
112
  gpr_mu_unlock(&workqueue->mu);
111
113
  }
112
114
 
113
- static void on_readable(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
115
+ static void on_readable(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
114
116
  grpc_workqueue *workqueue = arg;
115
117
 
116
- if (!success) {
118
+ if (error != GRPC_ERROR_NONE) {
117
119
  gpr_mu_destroy(&workqueue->mu);
118
120
  /* HACK: let wakeup_fd code know that we stole the fd */
119
121
  workqueue->wakeup_fd.read_fd = 0;
@@ -123,20 +125,32 @@ static void on_readable(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
123
125
  } else {
124
126
  gpr_mu_lock(&workqueue->mu);
125
127
  grpc_exec_ctx_enqueue_list(exec_ctx, &workqueue->closure_list, NULL);
126
- grpc_wakeup_fd_consume_wakeup(&workqueue->wakeup_fd);
128
+ error = grpc_wakeup_fd_consume_wakeup(&workqueue->wakeup_fd);
127
129
  gpr_mu_unlock(&workqueue->mu);
128
- grpc_fd_notify_on_read(exec_ctx, workqueue->wakeup_read_fd,
129
- &workqueue->read_closure);
130
+ if (error == GRPC_ERROR_NONE) {
131
+ grpc_fd_notify_on_read(exec_ctx, workqueue->wakeup_read_fd,
132
+ &workqueue->read_closure);
133
+ } else {
134
+ /* recurse to get error handling */
135
+ on_readable(exec_ctx, arg, error);
136
+ }
130
137
  }
131
138
  }
132
139
 
133
- void grpc_workqueue_push(grpc_workqueue *workqueue, grpc_closure *closure,
134
- int success) {
140
+ void grpc_workqueue_enqueue(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue,
141
+ grpc_closure *closure, grpc_error *error) {
142
+ grpc_error *push_error = GRPC_ERROR_NONE;
135
143
  gpr_mu_lock(&workqueue->mu);
136
144
  if (grpc_closure_list_empty(workqueue->closure_list)) {
137
- grpc_wakeup_fd_wakeup(&workqueue->wakeup_fd);
145
+ push_error = grpc_wakeup_fd_wakeup(&workqueue->wakeup_fd);
146
+ }
147
+ grpc_closure_list_append(&workqueue->closure_list, closure, error);
148
+ if (push_error != GRPC_ERROR_NONE) {
149
+ const char *msg = grpc_error_string(push_error);
150
+ gpr_log(GPR_ERROR, "Failed to push to workqueue: %s", msg);
151
+ grpc_error_free_string(msg);
152
+ grpc_exec_ctx_enqueue_list(exec_ctx, &workqueue->closure_list, NULL);
138
153
  }
139
- grpc_closure_list_add(&workqueue->closure_list, closure, success);
140
154
  gpr_mu_unlock(&workqueue->mu);
141
155
  }
142
156
 
@@ -33,8 +33,8 @@
33
33
 
34
34
  #include <grpc/support/port_platform.h>
35
35
 
36
- #ifdef GPR_WIN32
36
+ #ifdef GPR_WINDOWS
37
37
 
38
38
  #include "src/core/lib/iomgr/workqueue.h"
39
39
 
40
- #endif /* GPR_WIN32 */
40
+ #endif /* GPR_WINDOWS */
@@ -141,9 +141,9 @@ static void write_log(gpr_timer_log *log) {
141
141
  entry->tm = gpr_time_0(entry->tm.clock_type);
142
142
  }
143
143
  fprintf(output_file,
144
- "{\"t\": %lld.%09d, \"thd\": \"%d\", \"type\": \"%c\", \"tag\": "
144
+ "{\"t\": %"PRId64".%09d, \"thd\": \"%d\", \"type\": \"%c\", \"tag\": "
145
145
  "\"%s\", \"file\": \"%s\", \"line\": %d, \"imp\": %d}\n",
146
- (long long)entry->tm.tv_sec, (int)entry->tm.tv_nsec, entry->thd,
146
+ entry->tm.tv_sec, entry->tm.tv_nsec, entry->thd,
147
147
  entry->type, entry->tagstr, entry->file, entry->line,
148
148
  entry->important);
149
149
  }
@@ -33,7 +33,7 @@
33
33
 
34
34
  #include <string.h>
35
35
 
36
- #include "src/core/lib/security/security_context.h"
36
+ #include "src/core/lib/security/context/security_context.h"
37
37
  #include "src/core/lib/support/string.h"
38
38
  #include "src/core/lib/surface/api_trace.h"
39
39
  #include "src/core/lib/surface/call.h"
@@ -31,11 +31,11 @@
31
31
  *
32
32
  */
33
33
 
34
- #ifndef GRPC_CORE_LIB_SECURITY_SECURITY_CONTEXT_H
35
- #define GRPC_CORE_LIB_SECURITY_SECURITY_CONTEXT_H
34
+ #ifndef GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
35
+ #define GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
36
36
 
37
37
  #include "src/core/lib/iomgr/pollset.h"
38
- #include "src/core/lib/security/credentials.h"
38
+ #include "src/core/lib/security/credentials/credentials.h"
39
39
 
40
40
  /* --- grpc_auth_context ---
41
41
 
@@ -111,4 +111,4 @@ grpc_auth_context *grpc_auth_context_from_arg(const grpc_arg *arg);
111
111
  grpc_auth_context *grpc_find_auth_context_in_args(
112
112
  const grpc_channel_args *args);
113
113
 
114
- #endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONTEXT_H */
114
+ #endif /* GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H */
@@ -0,0 +1,263 @@
1
+ /*
2
+ *
3
+ * Copyright 2015-2016, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #include "src/core/lib/security/credentials/composite/composite_credentials.h"
35
+
36
+ #include <string.h>
37
+
38
+ #include "src/core/lib/iomgr/polling_entity.h"
39
+ #include "src/core/lib/surface/api_trace.h"
40
+
41
+ #include <grpc/support/alloc.h>
42
+ #include <grpc/support/log.h>
43
+ #include <grpc/support/string_util.h>
44
+
45
+ /* -- Composite call credentials. -- */
46
+
47
+ typedef struct {
48
+ grpc_composite_call_credentials *composite_creds;
49
+ size_t creds_index;
50
+ grpc_credentials_md_store *md_elems;
51
+ grpc_auth_metadata_context auth_md_context;
52
+ void *user_data;
53
+ grpc_polling_entity *pollent;
54
+ grpc_credentials_metadata_cb cb;
55
+ } grpc_composite_call_credentials_metadata_context;
56
+
57
+ static void composite_call_destruct(grpc_call_credentials *creds) {
58
+ grpc_composite_call_credentials *c = (grpc_composite_call_credentials *)creds;
59
+ size_t i;
60
+ for (i = 0; i < c->inner.num_creds; i++) {
61
+ grpc_call_credentials_unref(c->inner.creds_array[i]);
62
+ }
63
+ gpr_free(c->inner.creds_array);
64
+ }
65
+
66
+ static void composite_call_md_context_destroy(
67
+ grpc_composite_call_credentials_metadata_context *ctx) {
68
+ grpc_credentials_md_store_unref(ctx->md_elems);
69
+ gpr_free(ctx);
70
+ }
71
+
72
+ static void composite_call_metadata_cb(grpc_exec_ctx *exec_ctx, void *user_data,
73
+ grpc_credentials_md *md_elems,
74
+ size_t num_md,
75
+ grpc_credentials_status status) {
76
+ grpc_composite_call_credentials_metadata_context *ctx =
77
+ (grpc_composite_call_credentials_metadata_context *)user_data;
78
+ if (status != GRPC_CREDENTIALS_OK) {
79
+ ctx->cb(exec_ctx, ctx->user_data, NULL, 0, status);
80
+ return;
81
+ }
82
+
83
+ /* Copy the metadata in the context. */
84
+ if (num_md > 0) {
85
+ size_t i;
86
+ for (i = 0; i < num_md; i++) {
87
+ grpc_credentials_md_store_add(ctx->md_elems, md_elems[i].key,
88
+ md_elems[i].value);
89
+ }
90
+ }
91
+
92
+ /* See if we need to get some more metadata. */
93
+ if (ctx->creds_index < ctx->composite_creds->inner.num_creds) {
94
+ grpc_call_credentials *inner_creds =
95
+ ctx->composite_creds->inner.creds_array[ctx->creds_index++];
96
+ grpc_call_credentials_get_request_metadata(
97
+ exec_ctx, inner_creds, ctx->pollent, ctx->auth_md_context,
98
+ composite_call_metadata_cb, ctx);
99
+ return;
100
+ }
101
+
102
+ /* We're done!. */
103
+ ctx->cb(exec_ctx, ctx->user_data, ctx->md_elems->entries,
104
+ ctx->md_elems->num_entries, GRPC_CREDENTIALS_OK);
105
+ composite_call_md_context_destroy(ctx);
106
+ }
107
+
108
+ static void composite_call_get_request_metadata(
109
+ grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
110
+ grpc_polling_entity *pollent, grpc_auth_metadata_context auth_md_context,
111
+ grpc_credentials_metadata_cb cb, void *user_data) {
112
+ grpc_composite_call_credentials *c = (grpc_composite_call_credentials *)creds;
113
+ grpc_composite_call_credentials_metadata_context *ctx;
114
+
115
+ ctx = gpr_malloc(sizeof(grpc_composite_call_credentials_metadata_context));
116
+ memset(ctx, 0, sizeof(grpc_composite_call_credentials_metadata_context));
117
+ ctx->auth_md_context = auth_md_context;
118
+ ctx->user_data = user_data;
119
+ ctx->cb = cb;
120
+ ctx->composite_creds = c;
121
+ ctx->pollent = pollent;
122
+ ctx->md_elems = grpc_credentials_md_store_create(c->inner.num_creds);
123
+ grpc_call_credentials_get_request_metadata(
124
+ exec_ctx, c->inner.creds_array[ctx->creds_index++], ctx->pollent,
125
+ auth_md_context, composite_call_metadata_cb, ctx);
126
+ }
127
+
128
+ static grpc_call_credentials_vtable composite_call_credentials_vtable = {
129
+ composite_call_destruct, composite_call_get_request_metadata};
130
+
131
+ static grpc_call_credentials_array get_creds_array(
132
+ grpc_call_credentials **creds_addr) {
133
+ grpc_call_credentials_array result;
134
+ grpc_call_credentials *creds = *creds_addr;
135
+ result.creds_array = creds_addr;
136
+ result.num_creds = 1;
137
+ if (strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE) == 0) {
138
+ result = *grpc_composite_call_credentials_get_credentials(creds);
139
+ }
140
+ return result;
141
+ }
142
+
143
+ grpc_call_credentials *grpc_composite_call_credentials_create(
144
+ grpc_call_credentials *creds1, grpc_call_credentials *creds2,
145
+ void *reserved) {
146
+ size_t i;
147
+ size_t creds_array_byte_size;
148
+ grpc_call_credentials_array creds1_array;
149
+ grpc_call_credentials_array creds2_array;
150
+ grpc_composite_call_credentials *c;
151
+ GRPC_API_TRACE(
152
+ "grpc_composite_call_credentials_create(creds1=%p, creds2=%p, "
153
+ "reserved=%p)",
154
+ 3, (creds1, creds2, reserved));
155
+ GPR_ASSERT(reserved == NULL);
156
+ GPR_ASSERT(creds1 != NULL);
157
+ GPR_ASSERT(creds2 != NULL);
158
+ c = gpr_malloc(sizeof(grpc_composite_call_credentials));
159
+ memset(c, 0, sizeof(grpc_composite_call_credentials));
160
+ c->base.type = GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE;
161
+ c->base.vtable = &composite_call_credentials_vtable;
162
+ gpr_ref_init(&c->base.refcount, 1);
163
+ creds1_array = get_creds_array(&creds1);
164
+ creds2_array = get_creds_array(&creds2);
165
+ c->inner.num_creds = creds1_array.num_creds + creds2_array.num_creds;
166
+ creds_array_byte_size = c->inner.num_creds * sizeof(grpc_call_credentials *);
167
+ c->inner.creds_array = gpr_malloc(creds_array_byte_size);
168
+ memset(c->inner.creds_array, 0, creds_array_byte_size);
169
+ for (i = 0; i < creds1_array.num_creds; i++) {
170
+ grpc_call_credentials *cur_creds = creds1_array.creds_array[i];
171
+ c->inner.creds_array[i] = grpc_call_credentials_ref(cur_creds);
172
+ }
173
+ for (i = 0; i < creds2_array.num_creds; i++) {
174
+ grpc_call_credentials *cur_creds = creds2_array.creds_array[i];
175
+ c->inner.creds_array[i + creds1_array.num_creds] =
176
+ grpc_call_credentials_ref(cur_creds);
177
+ }
178
+ return &c->base;
179
+ }
180
+
181
+ const grpc_call_credentials_array *
182
+ grpc_composite_call_credentials_get_credentials(grpc_call_credentials *creds) {
183
+ const grpc_composite_call_credentials *c =
184
+ (const grpc_composite_call_credentials *)creds;
185
+ GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE) == 0);
186
+ return &c->inner;
187
+ }
188
+
189
+ grpc_call_credentials *grpc_credentials_contains_type(
190
+ grpc_call_credentials *creds, const char *type,
191
+ grpc_call_credentials **composite_creds) {
192
+ size_t i;
193
+ if (strcmp(creds->type, type) == 0) {
194
+ if (composite_creds != NULL) *composite_creds = NULL;
195
+ return creds;
196
+ } else if (strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE) == 0) {
197
+ const grpc_call_credentials_array *inner_creds_array =
198
+ grpc_composite_call_credentials_get_credentials(creds);
199
+ for (i = 0; i < inner_creds_array->num_creds; i++) {
200
+ if (strcmp(type, inner_creds_array->creds_array[i]->type) == 0) {
201
+ if (composite_creds != NULL) *composite_creds = creds;
202
+ return inner_creds_array->creds_array[i];
203
+ }
204
+ }
205
+ }
206
+ return NULL;
207
+ }
208
+
209
+ /* -- Composite channel credentials. -- */
210
+
211
+ static void composite_channel_destruct(grpc_channel_credentials *creds) {
212
+ grpc_composite_channel_credentials *c =
213
+ (grpc_composite_channel_credentials *)creds;
214
+ grpc_channel_credentials_unref(c->inner_creds);
215
+ grpc_call_credentials_unref(c->call_creds);
216
+ }
217
+
218
+ static grpc_security_status composite_channel_create_security_connector(
219
+ grpc_channel_credentials *creds, grpc_call_credentials *call_creds,
220
+ const char *target, const grpc_channel_args *args,
221
+ grpc_channel_security_connector **sc, grpc_channel_args **new_args) {
222
+ grpc_composite_channel_credentials *c =
223
+ (grpc_composite_channel_credentials *)creds;
224
+ grpc_security_status status = GRPC_SECURITY_ERROR;
225
+
226
+ GPR_ASSERT(c->inner_creds != NULL && c->call_creds != NULL &&
227
+ c->inner_creds->vtable != NULL &&
228
+ c->inner_creds->vtable->create_security_connector != NULL);
229
+ /* If we are passed a call_creds, create a call composite to pass it
230
+ downstream. */
231
+ if (call_creds != NULL) {
232
+ grpc_call_credentials *composite_call_creds =
233
+ grpc_composite_call_credentials_create(c->call_creds, call_creds, NULL);
234
+ status = c->inner_creds->vtable->create_security_connector(
235
+ c->inner_creds, composite_call_creds, target, args, sc, new_args);
236
+ grpc_call_credentials_unref(composite_call_creds);
237
+ } else {
238
+ status = c->inner_creds->vtable->create_security_connector(
239
+ c->inner_creds, c->call_creds, target, args, sc, new_args);
240
+ }
241
+ return status;
242
+ }
243
+
244
+ static grpc_channel_credentials_vtable composite_channel_credentials_vtable = {
245
+ composite_channel_destruct, composite_channel_create_security_connector};
246
+
247
+ grpc_channel_credentials *grpc_composite_channel_credentials_create(
248
+ grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds,
249
+ void *reserved) {
250
+ grpc_composite_channel_credentials *c = gpr_malloc(sizeof(*c));
251
+ memset(c, 0, sizeof(*c));
252
+ GPR_ASSERT(channel_creds != NULL && call_creds != NULL && reserved == NULL);
253
+ GRPC_API_TRACE(
254
+ "grpc_composite_channel_credentials_create(channel_creds=%p, "
255
+ "call_creds=%p, reserved=%p)",
256
+ 3, (channel_creds, call_creds, reserved));
257
+ c->base.type = channel_creds->type;
258
+ c->base.vtable = &composite_channel_credentials_vtable;
259
+ gpr_ref_init(&c->base.refcount, 1);
260
+ c->inner_creds = grpc_channel_credentials_ref(channel_creds);
261
+ c->call_creds = grpc_call_credentials_ref(call_creds);
262
+ return &c->base;
263
+ }
@@ -0,0 +1,72 @@
1
+ /*
2
+ *
3
+ * Copyright 2015, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
35
+ #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
36
+
37
+ #include "src/core/lib/security/credentials/credentials.h"
38
+
39
+ typedef struct {
40
+ grpc_call_credentials **creds_array;
41
+ size_t num_creds;
42
+ } grpc_call_credentials_array;
43
+
44
+ const grpc_call_credentials_array *
45
+ grpc_composite_call_credentials_get_credentials(
46
+ grpc_call_credentials *composite_creds);
47
+
48
+ /* Returns creds if creds is of the specified type or the inner creds of the
49
+ specified type (if found), if the creds is of type COMPOSITE.
50
+ If composite_creds is not NULL, *composite_creds will point to creds if of
51
+ type COMPOSITE in case of success. */
52
+ grpc_call_credentials *grpc_credentials_contains_type(
53
+ grpc_call_credentials *creds, const char *type,
54
+ grpc_call_credentials **composite_creds);
55
+
56
+ /* -- Channel composite credentials. -- */
57
+
58
+ typedef struct {
59
+ grpc_channel_credentials base;
60
+ grpc_channel_credentials *inner_creds;
61
+ grpc_call_credentials *call_creds;
62
+ } grpc_composite_channel_credentials;
63
+
64
+ /* -- Composite credentials. -- */
65
+
66
+ typedef struct {
67
+ grpc_call_credentials base;
68
+ grpc_call_credentials_array inner;
69
+ } grpc_composite_call_credentials;
70
+
71
+ #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \
72
+ */