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
@@ -51,7 +51,8 @@ GRPCAPI int grpc_compression_algorithm_parse(
51
51
  grpc_compression_algorithm *algorithm);
52
52
 
53
53
  /** Updates \a name with the encoding name corresponding to a valid \a
54
- * algorithm. Returns 1 upon success, 0 otherwise. */
54
+ * algorithm. Note that \a name is statically allocated and must *not* be freed.
55
+ * Returns 1 upon success, 0 otherwise. */
55
56
  GRPCAPI int grpc_compression_algorithm_name(
56
57
  grpc_compression_algorithm algorithm, char **name);
57
58
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  *
3
- * Copyright 2015, Google Inc.
3
+ * Copyright 2015-2016, Google Inc.
4
4
  * All rights reserved.
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
@@ -334,6 +334,15 @@ GRPCAPI void grpc_server_register_completion_queue(grpc_server *server,
334
334
  grpc_completion_queue *cq,
335
335
  void *reserved);
336
336
 
337
+ /** Register a non-listening completion queue with the server. This API is
338
+ similar to grpc_server_register_completion_queue except that the server will
339
+ not use this completion_queue to listen to any incoming channels.
340
+
341
+ Registering a non-listening completion queue will have negative performance
342
+ impact and hence this API is not recommended for production use cases. */
343
+ GRPCAPI void grpc_server_register_non_listening_completion_queue(
344
+ grpc_server *server, grpc_completion_queue *q, void *reserved);
345
+
337
346
  /** Add a HTTP2 over plaintext over tcp listener.
338
347
  Returns bound port number on success, 0 on failure.
339
348
  REQUIRES: server not started */
@@ -0,0 +1,51 @@
1
+ /*
2
+ *
3
+ * Copyright 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
+ #ifndef GRPC_GRPC_CRONET_H
35
+ #define GRPC_GRPC_CRONET_H
36
+
37
+ #include <grpc/grpc.h>
38
+
39
+ #ifdef __cplusplus
40
+ extern "C" {
41
+ #endif
42
+
43
+ GRPCAPI grpc_channel *grpc_cronet_secure_channel_create(
44
+ void *engine, const char *target, const grpc_channel_args *args,
45
+ void *reserved);
46
+
47
+ #ifdef __cplusplus
48
+ }
49
+ #endif
50
+
51
+ #endif /* GRPC_GRPC_CRONET_H */
@@ -0,0 +1,70 @@
1
+ /*
2
+ *
3
+ * Copyright 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
+ #ifndef GRPC_GRPC_POSIX_H
35
+ #define GRPC_GRPC_POSIX_H
36
+
37
+ #include <grpc/impl/codegen/grpc_types.h>
38
+ #include <grpc/support/port_platform.h>
39
+
40
+ #include <stddef.h>
41
+
42
+ #ifdef __cplusplus
43
+ extern "C" {
44
+ #endif
45
+
46
+ /*! \mainpage GRPC Core POSIX
47
+ *
48
+ * The GRPC Core POSIX library provides some POSIX-specific low-level
49
+ * functionality on top of GRPC Core.
50
+ */
51
+
52
+ /** Create a client channel to 'target' using file descriptor 'fd'. The 'target'
53
+ argument will be used to indicate the name for this channel. See the comment
54
+ for grpc_insecure_channel_create for description of 'args' argument. */
55
+ GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd(
56
+ const char *target, int fd, const grpc_channel_args *args);
57
+
58
+ /** Add the connected communication channel based on file descriptor 'fd' to the
59
+ 'server'. The 'fd' must be an open file descriptor corresponding to a
60
+ connected socket. The 'cq' is a completion queue that will be getting events
61
+ from that descriptor. */
62
+ GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
63
+ grpc_completion_queue *cq,
64
+ int fd);
65
+
66
+ #ifdef __cplusplus
67
+ }
68
+ #endif
69
+
70
+ #endif /* GRPC_GRPC_POSIX_H */
@@ -83,8 +83,8 @@
83
83
  #include <grpc/impl/codegen/atm_gcc_atomic.h>
84
84
  #elif defined(GPR_GCC_SYNC)
85
85
  #include <grpc/impl/codegen/atm_gcc_sync.h>
86
- #elif defined(GPR_WIN32_ATOMIC)
87
- #include <grpc/impl/codegen/atm_win32.h>
86
+ #elif defined(GPR_WINDOWS_ATOMIC)
87
+ #include <grpc/impl/codegen/atm_windows.h>
88
88
  #else
89
89
  #error could not determine platform for atm
90
90
  #endif
@@ -31,8 +31,8 @@
31
31
  *
32
32
  */
33
33
 
34
- #ifndef GRPC_IMPL_CODEGEN_ATM_WIN32_H
35
- #define GRPC_IMPL_CODEGEN_ATM_WIN32_H
34
+ #ifndef GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
35
+ #define GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
36
36
 
37
37
  /* Win32 variant of atm_platform.h */
38
38
  #include <grpc/impl/codegen/port_platform.h>
@@ -122,4 +122,4 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) {
122
122
  return old;
123
123
  }
124
124
 
125
- #endif /* GRPC_IMPL_CODEGEN_ATM_WIN32_H */
125
+ #endif /* GRPC_IMPL_CODEGEN_ATM_WINDOWS_H */
@@ -35,16 +35,25 @@
35
35
  #define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
36
36
 
37
37
  #include <grpc/impl/codegen/port_platform.h>
38
+ #include <stdbool.h>
38
39
 
39
40
  #ifdef __cplusplus
40
41
  extern "C" {
41
42
  #endif
42
43
 
44
+ /** To be used as initial metadata key for the request of a concrete compression
45
+ * algorithm */
46
+ #define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
47
+ "grpc-internal-encoding-request"
48
+
43
49
  /** To be used in channel arguments */
44
- #define GRPC_COMPRESSION_ALGORITHM_ARG "grpc.compression_algorithm"
45
- #define GRPC_COMPRESSION_ALGORITHM_STATE_ARG "grpc.compression_algorithm_state"
50
+ #define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
51
+ "grpc.default_compression_algorithm"
52
+ #define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
53
+ #define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
54
+ "grpc.compression_enabled_algorithms_bitset"
46
55
 
47
- /* The various compression algorithms supported by GRPC */
56
+ /* The various compression algorithms supported by gRPC */
48
57
  typedef enum {
49
58
  GRPC_COMPRESS_NONE = 0,
50
59
  GRPC_COMPRESS_DEFLATE,
@@ -53,6 +62,10 @@ typedef enum {
53
62
  GRPC_COMPRESS_ALGORITHMS_COUNT
54
63
  } grpc_compression_algorithm;
55
64
 
65
+ /** Compression levels allow a party with knowledge of its peer's accepted
66
+ * encodings to request compression in an abstract way. The level-algorithm
67
+ * mapping is performed internally and depends on the peer's supported
68
+ * compression algorithms. */
56
69
  typedef enum {
57
70
  GRPC_COMPRESS_LEVEL_NONE = 0,
58
71
  GRPC_COMPRESS_LEVEL_LOW,
@@ -62,8 +75,29 @@ typedef enum {
62
75
  } grpc_compression_level;
63
76
 
64
77
  typedef struct grpc_compression_options {
65
- uint32_t enabled_algorithms_bitset; /**< All algs are enabled by default */
66
- grpc_compression_algorithm default_compression_algorithm; /**< for channel */
78
+ /** All algs are enabled by default. This option corresponds to the channel
79
+ * argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
80
+ */
81
+ uint32_t enabled_algorithms_bitset;
82
+
83
+ /** The default channel compression level. It'll be used in the absence of
84
+ * call specific settings. This option corresponds to the channel argument key
85
+ * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present, takes
86
+ * precedence over \a default_algorithm.
87
+ * TODO(dgq): currently only available for server channels. */
88
+ struct {
89
+ bool is_set;
90
+ grpc_compression_level level;
91
+ } default_level;
92
+
93
+ /** The default channel compression algorithm. It'll be used in the absence of
94
+ * call specific settings. This option corresponds to the channel argument key
95
+ * behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
96
+ struct {
97
+ bool is_set;
98
+ grpc_compression_algorithm algorithm;
99
+ } default_algorithm;
100
+
67
101
  } grpc_compression_options;
68
102
 
69
103
  #ifdef __cplusplus
@@ -49,7 +49,7 @@ typedef enum {
49
49
  /** channel has seen a failure but expects to recover */
50
50
  GRPC_CHANNEL_TRANSIENT_FAILURE,
51
51
  /** channel has seen a failure that it cannot recover from */
52
- GRPC_CHANNEL_FATAL_FAILURE
52
+ GRPC_CHANNEL_SHUTDOWN
53
53
  } grpc_connectivity_state;
54
54
 
55
55
  #ifdef __cplusplus
@@ -115,6 +115,8 @@ typedef struct {
115
115
  /* Channel argument keys: */
116
116
  /** Enable census for tracing and stats collection */
117
117
  #define GRPC_ARG_ENABLE_CENSUS "grpc.census"
118
+ /** Enable load reporting */
119
+ #define GRPC_ARG_ENABLE_LOAD_REPORTING "grpc.loadreporting"
118
120
  /** Maximum number of concurrent incoming streams to allow on a http2
119
121
  connection */
120
122
  #define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams"
@@ -152,6 +154,8 @@ typedef struct {
152
154
  channel). If this parameter is specified and the underlying is not an SSL
153
155
  channel, it will just be ignored. */
154
156
  #define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override"
157
+ /* Maximum metadata size */
158
+ #define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size"
155
159
 
156
160
  /** Result of a grpc call. If the caller satisfies the prerequisites of a
157
161
  particular operation, the grpc_call_error returned will be GRPC_CALL_OK.
@@ -330,6 +334,12 @@ typedef struct grpc_op {
330
334
  struct {
331
335
  size_t count;
332
336
  grpc_metadata *metadata;
337
+ /** If \a is_set, \a compression_level will be used for the call.
338
+ * Otherwise, \a compression_level won't be considered */
339
+ struct {
340
+ uint8_t is_set;
341
+ grpc_compression_level level;
342
+ } maybe_compression_level;
333
343
  } send_initial_metadata;
334
344
  grpc_byte_buffer *send_message;
335
345
  struct {
@@ -34,6 +34,7 @@
34
34
  #ifndef GRPC_IMPL_CODEGEN_LOG_H
35
35
  #define GRPC_IMPL_CODEGEN_LOG_H
36
36
 
37
+ #include <inttypes.h>
37
38
  #include <stdarg.h>
38
39
  #include <stdlib.h> /* for abort() */
39
40
 
@@ -74,7 +75,7 @@ const char *gpr_log_severity_string(gpr_log_severity severity);
74
75
  /* Log a message. It's advised to use GPR_xxx above to generate the context
75
76
  * for each message */
76
77
  GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity,
77
- const char *format, ...);
78
+ const char *format, ...) GPRC_PRINT_FORMAT_CHECK(4, 5);
78
79
 
79
80
  GPRAPI void gpr_log_message(const char *file, int line,
80
81
  gpr_log_severity severity, const char *message);
@@ -89,10 +89,10 @@
89
89
  #define GPR_ARCH_32 1
90
90
  #endif
91
91
  #define GPR_PLATFORM_STRING "windows"
92
- #define GPR_WIN32 1
92
+ #define GPR_WINDOWS 1
93
93
  #define GPR_WINSOCK_SOCKET 1
94
94
  #define GPR_WINDOWS_SUBPROCESS 1
95
- #define GPR_WIN32_ENV
95
+ #define GPR_WINDOWS_ENV
96
96
  #ifdef __MSYS__
97
97
  #define GPR_GETPID_IN_UNISTD_H 1
98
98
  #define GPR_MSYS_TMPFILE
@@ -101,17 +101,17 @@
101
101
  #define GPR_POSIX_TIME
102
102
  #else
103
103
  #define GPR_GETPID_IN_PROCESS_H 1
104
- #define GPR_WIN32_TMPFILE
105
- #define GPR_WIN32_LOG
104
+ #define GPR_WINDOWS_TMPFILE
105
+ #define GPR_WINDOWS_LOG
106
106
  #define GPR_WINDOWS_CRASH_HANDLER 1
107
- #define GPR_WIN32_STRING
108
- #define GPR_WIN32_TIME
107
+ #define GPR_WINDOWS_STRING
108
+ #define GPR_WINDOWS_TIME
109
109
  #endif
110
110
  #ifdef __GNUC__
111
111
  #define GPR_GCC_ATOMIC 1
112
112
  #define GPR_GCC_TLS 1
113
113
  #else
114
- #define GPR_WIN32_ATOMIC 1
114
+ #define GPR_WINDOWS_ATOMIC 1
115
115
  #define GPR_MSVC_TLS 1
116
116
  #endif
117
117
  #elif defined(GPR_MANYLINUX1)
@@ -129,6 +129,7 @@
129
129
  #define GPR_POSIX_SOCKETADDR 1
130
130
  #define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1
131
131
  #define GPR_POSIX_SOCKETUTILS 1
132
+ #define GPR_SUPPORT_CHANNELS_FROM_FD 1
132
133
  #define GPR_HAVE_UNIX_SOCKET 1
133
134
  #define GPR_HAVE_IP_PKTINFO 1
134
135
  #define GPR_HAVE_IPV6_RECVPKTINFO 1
@@ -149,7 +150,11 @@
149
150
  #elif defined(ANDROID) || defined(__ANDROID__)
150
151
  #define GPR_PLATFORM_STRING "android"
151
152
  #define GPR_ANDROID 1
153
+ #ifdef _LP64
154
+ #define GPR_ARCH_64 1
155
+ #else /* _LP64 */
152
156
  #define GPR_ARCH_32 1
157
+ #endif /* _LP64 */
153
158
  #define GPR_CPU_LINUX 1
154
159
  #define GPR_GCC_SYNC 1
155
160
  #define GPR_GCC_TLS 1
@@ -168,6 +173,7 @@
168
173
  #define GPR_POSIX_SYNC 1
169
174
  #define GPR_POSIX_TIME 1
170
175
  #define GPR_GETPID_IN_UNISTD_H 1
176
+ #define GPR_SUPPORT_CHANNELS_FROM_FD 1
171
177
  #define GPR_HAVE_MSG_NOSIGNAL 1
172
178
  #define GPR_HAVE_UNIX_SOCKET 1
173
179
  #define GPR_HAVE_IP_PKTINFO 1
@@ -194,6 +200,7 @@
194
200
  #define GPR_POSIX_WAKEUP_FD 1
195
201
  #define GPR_POSIX_SOCKET 1
196
202
  #define GPR_POSIX_SOCKETADDR 1
203
+ #define GPR_SUPPORT_CHANNELS_FROM_FD 1
197
204
  #define GPR_HAVE_UNIX_SOCKET 1
198
205
  #define GPR_HAVE_IP_PKTINFO 1
199
206
  #define GPR_HAVE_IPV6_RECVPKTINFO 1
@@ -258,6 +265,7 @@
258
265
  #define GPR_POSIX_SYNC 1
259
266
  #define GPR_POSIX_TIME 1
260
267
  #define GPR_GETPID_IN_UNISTD_H 1
268
+ #define GPR_SUPPORT_CHANNELS_FROM_FD 1
261
269
  #define GPR_HAVE_SO_NOSIGPIPE 1
262
270
  #define GPR_HAVE_UNIX_SOCKET 1
263
271
  #define GPR_HAVE_IP_PKTINFO 1
@@ -289,6 +297,7 @@
289
297
  #define GPR_POSIX_SYNC 1
290
298
  #define GPR_POSIX_TIME 1
291
299
  #define GPR_GETPID_IN_UNISTD_H 1
300
+ #define GPR_SUPPORT_CHANNELS_FROM_FD 1
292
301
  #define GPR_HAVE_SO_NOSIGPIPE 1
293
302
  #define GPR_HAVE_UNIX_SOCKET 1
294
303
  #define GPR_HAVE_IP_PKTINFO 1
@@ -386,19 +395,19 @@ typedef unsigned __int64 uint64_t;
386
395
 
387
396
  /* Validate platform combinations */
388
397
  #if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \
389
- defined(GPR_WIN32_ATOMIC) != \
398
+ defined(GPR_WINDOWS_ATOMIC) != \
390
399
  1
391
- #error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WIN32_ATOMIC
400
+ #error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WINDOWS_ATOMIC
392
401
  #endif
393
402
 
394
403
  #if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1
395
404
  #error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64
396
405
  #endif
397
406
 
398
- #if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + \
399
- defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
407
+ #if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WINDOWS) + \
408
+ defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
400
409
  1
401
- #error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
410
+ #error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WINDOWS, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
402
411
  #endif
403
412
 
404
413
  #if defined(GPR_POSIX_MULTIPOLL_WITH_POLL) && !defined(GPR_POSIX_SOCKET)
@@ -429,6 +438,15 @@ typedef unsigned __int64 uint64_t;
429
438
  #endif
430
439
  #endif
431
440
 
441
+ #ifndef GPRC_PRINT_FORMAT_CHECK
442
+ #ifdef __GNUC__
443
+ #define GPRC_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) \
444
+ __attribute__((format(printf, FORMAT_STR, ARGS)))
445
+ #else
446
+ #define GPRC_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
447
+ #endif
448
+ #endif /* GPRC_PRINT_FORMAT_CHECK */
449
+
432
450
  #if GPR_FORBID_UNREACHABLE_CODE
433
451
  #define GPR_UNREACHABLE_CODE(STATEMENT)
434
452
  #else
@@ -42,9 +42,8 @@ extern "C" {
42
42
 
43
43
  #define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
44
44
 
45
- /* Represents an expandable array of slices, to be interpreted as a single item
46
- TODO(ctiller): inline some small number of elements into the struct, to
47
- avoid per-call allocations */
45
+ /* Represents an expandable array of slices, to be interpreted as a
46
+ single item. */
48
47
  typedef struct {
49
48
  /* slices in the array */
50
49
  gpr_slice *slices;