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.
- checksums.yaml +4 -4
- data/Makefile +1434 -399
- data/etc/roots.pem +34 -150
- data/include/grpc/grpc.h +71 -0
- data/include/grpc/impl/codegen/atm.h +5 -0
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +6 -0
- data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
- data/include/grpc/impl/codegen/atm_windows.h +11 -0
- data/include/grpc/impl/codegen/grpc_types.h +54 -13
- data/include/grpc/impl/codegen/port_platform.h +15 -1
- data/include/grpc/support/alloc.h +2 -1
- data/include/grpc/support/sync.h +4 -0
- data/include/grpc/support/tls.h +1 -1
- data/src/core/ext/census/gen/trace_context.pb.h +1 -1
- data/src/core/ext/census/grpc_filter.c +14 -10
- data/src/core/ext/census/grpc_plugin.c +3 -1
- data/src/core/ext/census/trace_label.h +1 -1
- data/src/core/ext/census/trace_propagation.h +1 -1
- data/src/core/ext/census/trace_status.h +1 -1
- data/src/core/ext/census/trace_string.h +1 -1
- data/src/core/ext/census/tracing.h +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/channel_connectivity.c +56 -27
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel.c +407 -202
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel.h +10 -6
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_plugin.c +12 -7
- data/src/core/ext/{client_channel → filters/client_channel}/connector.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/connector.h +3 -5
- data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.c +6 -6
- data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.c +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.h +4 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.c +22 -20
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.h +4 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel.h +5 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel_secure.c +2 -2
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.c +1 -1
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.h +6 -5
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +1 -1
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -0
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/pick_first/pick_first.c +20 -15
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/round_robin/round_robin.c +21 -16
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.h +5 -5
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/parse_address.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/parse_address.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.c +10 -4
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/resolver.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/resolver.h +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
- data/src/core/ext/{resolver → filters/client_channel/resolver}/dns/native/dns_resolver.c +21 -5
- data/src/core/ext/{resolver → filters/client_channel/resolver}/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.h +6 -6
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.c +1 -2
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.h +4 -4
- data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
- data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel.c +49 -43
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel.h +21 -7
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.h +5 -5
- data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.h +3 -3
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.c +4 -2
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.h +3 -3
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.c +17 -14
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.h +4 -4
- data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
- data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +6 -41
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +2 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +3 -3
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -5
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +2 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +449 -204
- data/src/core/ext/transport/chttp2/transport/frame_data.c +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +37 -7
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +18 -38
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -29
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +64 -37
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +11 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +60 -39
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +22 -43
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +8 -10
- data/src/core/ext/transport/chttp2/transport/internal.h +24 -2
- data/src/core/ext/transport/chttp2/transport/parsing.c +33 -15
- data/src/core/ext/transport/chttp2/transport/writing.c +56 -10
- data/src/core/lib/channel/channel_args.c +7 -0
- data/src/core/lib/channel/channel_args.h +2 -0
- data/src/core/lib/channel/channel_stack.c +20 -27
- data/src/core/lib/channel/channel_stack.h +18 -16
- data/src/core/lib/channel/compress_filter.c +20 -18
- data/src/core/lib/channel/connected_channel.c +9 -8
- data/src/core/lib/channel/deadline_filter.c +28 -24
- data/src/core/lib/channel/deadline_filter.h +3 -3
- data/src/core/lib/channel/handshaker.c +3 -2
- data/src/core/lib/channel/http_client_filter.c +119 -61
- data/src/core/lib/channel/http_server_filter.c +124 -69
- data/src/core/lib/channel/message_size_filter.c +23 -19
- data/src/core/lib/http/httpcli.c +8 -6
- data/src/core/lib/http/httpcli_security_connector.c +5 -5
- data/src/core/lib/http/parser.c +57 -31
- data/src/core/lib/iomgr/closure.c +15 -0
- data/src/core/lib/iomgr/closure.h +4 -0
- data/src/core/lib/iomgr/combiner.c +8 -0
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -7
- data/src/core/lib/iomgr/endpoint_pair_uv.c +2 -3
- data/src/core/lib/iomgr/endpoint_pair_windows.c +9 -6
- data/src/core/lib/iomgr/error.c +360 -177
- data/src/core/lib/iomgr/error.h +31 -33
- data/src/core/lib/iomgr/error_internal.h +30 -9
- data/src/core/lib/iomgr/ev_epoll_linux.c +25 -239
- data/src/core/lib/iomgr/ev_poll_posix.c +11 -7
- data/src/core/lib/iomgr/ev_posix.c +6 -0
- data/src/core/lib/iomgr/ev_posix.h +3 -0
- data/src/core/lib/iomgr/exec_ctx.c +6 -0
- data/src/core/lib/iomgr/executor.c +8 -2
- data/src/core/lib/iomgr/load_file.c +6 -3
- data/src/core/lib/iomgr/lockfree_event.c +238 -0
- data/src/core/{ext/client_channel/initial_connect_string.h → lib/iomgr/lockfree_event.h} +17 -13
- data/src/core/lib/iomgr/pollset.h +4 -0
- data/src/core/lib/iomgr/pollset_windows.c +2 -2
- data/src/core/lib/iomgr/port.h +9 -0
- data/src/core/lib/iomgr/resolve_address_posix.c +15 -9
- data/src/core/lib/iomgr/resolve_address_uv.c +8 -6
- data/src/core/lib/iomgr/resolve_address_windows.c +2 -2
- data/src/core/lib/iomgr/resource_quota.c +19 -4
- data/src/core/lib/iomgr/resource_quota.h +2 -0
- data/src/core/lib/iomgr/sockaddr_utils.c +3 -1
- data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
- data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.c +25 -9
- data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
- data/src/core/lib/iomgr/tcp_client.h +0 -4
- data/src/core/lib/iomgr/tcp_client_posix.c +15 -31
- data/src/core/lib/iomgr/tcp_client_uv.c +10 -6
- data/src/core/lib/iomgr/tcp_client_windows.c +9 -19
- data/src/core/lib/iomgr/tcp_posix.c +111 -22
- data/src/core/lib/iomgr/tcp_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_posix.c +39 -417
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
- data/src/core/lib/iomgr/tcp_server_uv.c +43 -16
- data/src/core/lib/iomgr/tcp_server_windows.c +10 -22
- data/src/core/lib/iomgr/tcp_uv.c +16 -13
- data/src/core/lib/iomgr/tcp_windows.c +24 -12
- data/src/core/lib/iomgr/tcp_windows.h +2 -2
- data/src/core/lib/iomgr/timer.h +3 -0
- data/src/core/lib/iomgr/timer_generic.c +257 -72
- data/src/core/lib/iomgr/timer_generic.h +1 -1
- data/src/core/lib/iomgr/timer_heap.c +8 -8
- data/src/core/lib/iomgr/udp_server.c +54 -24
- data/src/core/lib/iomgr/udp_server.h +7 -7
- data/src/core/lib/iomgr/unix_sockets_posix.c +1 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +2 -1
- data/src/core/lib/iomgr/wakeup_fd_posix.h +1 -1
- data/src/core/lib/profiling/basic_timers.c +1 -1
- data/src/core/lib/security/credentials/credentials.h +1 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +10 -9
- data/src/core/lib/security/credentials/jwt/json_token.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +2 -2
- data/src/core/lib/security/transport/client_auth_filter.c +33 -26
- data/src/core/lib/security/transport/secure_endpoint.c +8 -5
- data/src/core/lib/security/transport/security_connector.c +37 -37
- data/src/core/lib/security/transport/security_connector.h +1 -1
- data/src/core/lib/security/transport/security_handshaker.c +15 -12
- data/src/core/lib/security/transport/server_auth_filter.c +20 -18
- data/src/core/lib/security/transport/tsi_error.c +5 -3
- data/src/core/lib/security/transport/tsi_error.h +1 -1
- data/src/core/lib/{security/util → slice}/b64.c +21 -6
- data/src/core/lib/{security/util → slice}/b64.h +16 -4
- data/src/core/lib/slice/slice.c +4 -2
- data/src/core/lib/slice/slice_buffer.c +16 -14
- data/src/core/lib/support/arena.c +98 -0
- data/src/core/{ext/client_channel/initial_connect_string.c → lib/support/arena.h} +17 -15
- data/src/core/{ext/client_channel/default_initial_connect_string.c → lib/support/atm.c} +14 -5
- data/src/core/lib/support/cpu_linux.c +5 -0
- data/src/core/lib/support/sync.c +4 -0
- data/src/core/lib/support/time.c +4 -10
- data/src/core/lib/support/wrap_memcpy.c +3 -1
- data/src/core/lib/surface/call.c +252 -221
- data/src/core/lib/surface/channel.c +72 -21
- data/src/core/lib/surface/channel.h +8 -0
- data/src/core/lib/surface/completion_queue.c +2 -3
- data/src/core/lib/surface/completion_queue_factory.c +77 -0
- data/src/core/lib/surface/completion_queue_factory.h +51 -0
- data/src/core/lib/surface/init_secure.c +3 -1
- data/src/core/lib/surface/lame_client.c +18 -14
- data/src/core/lib/surface/server.c +43 -41
- data/src/core/lib/surface/validate_metadata.c +8 -4
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.h +1 -1
- data/src/core/lib/transport/connectivity_state.c +2 -1
- data/src/core/lib/transport/error_utils.c +17 -17
- data/src/core/lib/transport/error_utils.h +1 -1
- data/src/core/lib/transport/metadata_batch.c +6 -7
- data/src/core/lib/transport/pid_controller.c +1 -0
- data/src/core/lib/transport/service_config.c +12 -0
- data/src/core/lib/transport/service_config.h +6 -0
- data/src/core/lib/transport/transport.c +29 -17
- data/src/core/lib/transport/transport.h +85 -42
- data/src/core/lib/transport/transport_impl.h +5 -3
- data/src/core/lib/transport/transport_op_string.c +20 -14
- data/src/core/plugin_registry/grpc_plugin_registry.c +8 -0
- data/src/core/{lib/tsi → tsi}/fake_transport_security.c +2 -2
- data/src/core/{lib/tsi → tsi}/fake_transport_security.h +4 -4
- data/src/core/{lib/tsi → tsi}/ssl_transport_security.c +40 -79
- data/src/core/{lib/tsi → tsi}/ssl_transport_security.h +44 -21
- data/src/core/{lib/tsi → tsi}/ssl_types.h +3 -3
- data/src/core/{lib/tsi → tsi}/transport_security.c +2 -2
- data/src/core/{lib/tsi → tsi}/transport_security.h +4 -4
- data/src/core/{lib/tsi → tsi}/transport_security_interface.h +3 -3
- data/src/ruby/ext/grpc/extconf.rb +1 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
- data/src/ruby/ext/grpc/rb_channel.c +520 -93
- data/src/ruby/ext/grpc/rb_channel.h +2 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
- data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
- data/src/ruby/ext/grpc/rb_grpc.c +29 -7
- data/src/ruby/ext/grpc/rb_grpc.h +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
- data/src/ruby/ext/grpc/rb_server.c +5 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_connection_spec.rb +173 -0
- data/src/ruby/spec/channel_spec.rb +29 -0
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
- data/third_party/cares/ares_build.h +264 -0
- data/third_party/cares/cares/ares.h +636 -0
- data/third_party/cares/cares/ares__close_sockets.c +61 -0
- data/third_party/cares/cares/ares__get_hostent.c +261 -0
- data/third_party/cares/cares/ares__read_line.c +73 -0
- data/third_party/cares/cares/ares__timeval.c +111 -0
- data/third_party/cares/cares/ares_cancel.c +63 -0
- data/third_party/cares/cares/ares_create_query.c +202 -0
- data/third_party/cares/cares/ares_data.c +221 -0
- data/third_party/cares/cares/ares_data.h +72 -0
- data/third_party/cares/cares/ares_destroy.c +108 -0
- data/third_party/cares/cares/ares_dns.h +103 -0
- data/third_party/cares/cares/ares_expand_name.c +205 -0
- data/third_party/cares/cares/ares_expand_string.c +70 -0
- data/third_party/cares/cares/ares_fds.c +59 -0
- data/third_party/cares/cares/ares_free_hostent.c +41 -0
- data/third_party/cares/cares/ares_free_string.c +25 -0
- data/third_party/cares/cares/ares_getenv.c +30 -0
- data/third_party/cares/cares/ares_getenv.h +26 -0
- data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
- data/third_party/cares/cares/ares_gethostbyname.c +518 -0
- data/third_party/cares/cares/ares_getnameinfo.c +422 -0
- data/third_party/cares/cares/ares_getopt.c +122 -0
- data/third_party/cares/cares/ares_getopt.h +53 -0
- data/third_party/cares/cares/ares_getsock.c +66 -0
- data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
- data/third_party/cares/cares/ares_init.c +2146 -0
- data/third_party/cares/cares/ares_iphlpapi.h +221 -0
- data/third_party/cares/cares/ares_ipv6.h +78 -0
- data/third_party/cares/cares/ares_library_init.c +167 -0
- data/third_party/cares/cares/ares_library_init.h +42 -0
- data/third_party/cares/cares/ares_llist.c +63 -0
- data/third_party/cares/cares/ares_llist.h +39 -0
- data/third_party/cares/cares/ares_mkquery.c +24 -0
- data/third_party/cares/cares/ares_nowarn.c +260 -0
- data/third_party/cares/cares/ares_nowarn.h +61 -0
- data/third_party/cares/cares/ares_options.c +402 -0
- data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
- data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
- data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
- data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
- data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
- data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
- data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
- data/third_party/cares/cares/ares_platform.c +11035 -0
- data/third_party/cares/cares/ares_platform.h +43 -0
- data/third_party/cares/cares/ares_private.h +363 -0
- data/third_party/cares/cares/ares_process.c +1359 -0
- data/third_party/cares/cares/ares_query.c +186 -0
- data/third_party/cares/cares/ares_rules.h +125 -0
- data/third_party/cares/cares/ares_search.c +316 -0
- data/third_party/cares/cares/ares_send.c +131 -0
- data/third_party/cares/cares/ares_setup.h +217 -0
- data/third_party/cares/cares/ares_strcasecmp.c +66 -0
- data/third_party/cares/cares/ares_strcasecmp.h +30 -0
- data/third_party/cares/cares/ares_strdup.c +49 -0
- data/third_party/cares/cares/ares_strdup.h +24 -0
- data/third_party/cares/cares/ares_strerror.c +56 -0
- data/third_party/cares/cares/ares_timeout.c +88 -0
- data/third_party/cares/cares/ares_version.c +11 -0
- data/third_party/cares/cares/ares_version.h +24 -0
- data/third_party/cares/cares/ares_writev.c +79 -0
- data/third_party/cares/cares/bitncmp.c +59 -0
- data/third_party/cares/cares/bitncmp.h +26 -0
- data/third_party/cares/cares/config-win32.h +377 -0
- data/third_party/cares/cares/inet_net_pton.c +450 -0
- data/third_party/cares/cares/inet_ntop.c +208 -0
- data/third_party/cares/cares/setup_once.h +554 -0
- data/third_party/cares/cares/windows_port.c +22 -0
- data/third_party/cares/config_darwin/ares_config.h +523 -0
- data/third_party/cares/config_linux/ares_config.h +524 -0
- metadata +164 -68
@@ -75,6 +75,10 @@ void grpc_pollset_destroy(grpc_pollset *pollset);
|
|
75
75
|
and it is guaranteed that it will not be released by grpc_pollset_work
|
76
76
|
AFTER worker has been destroyed.
|
77
77
|
|
78
|
+
It's legal for worker to be NULL: in that case, this specific thread can not
|
79
|
+
be directly woken with a kick, but maybe be indirectly (with a kick against
|
80
|
+
the pollset as a whole).
|
81
|
+
|
78
82
|
Tries not to block past deadline.
|
79
83
|
May call grpc_closure_list_run on grpc_closure_list, without holding the
|
80
84
|
pollset
|
@@ -120,7 +120,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
|
120
120
|
grpc_pollset_worker **worker_hdl,
|
121
121
|
gpr_timespec now, gpr_timespec deadline) {
|
122
122
|
grpc_pollset_worker worker;
|
123
|
-
*worker_hdl = &worker;
|
123
|
+
if (worker_hdl) *worker_hdl = &worker;
|
124
124
|
|
125
125
|
int added_worker = 0;
|
126
126
|
worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next =
|
@@ -185,7 +185,7 @@ done:
|
|
185
185
|
remove_worker(&worker, GRPC_POLLSET_WORKER_LINK_POLLSET);
|
186
186
|
}
|
187
187
|
gpr_cv_destroy(&worker.cv);
|
188
|
-
*worker_hdl = NULL;
|
188
|
+
if (worker_hdl) *worker_hdl = NULL;
|
189
189
|
return GRPC_ERROR_NONE;
|
190
190
|
}
|
191
191
|
|
data/src/core/lib/iomgr/port.h
CHANGED
@@ -39,6 +39,7 @@
|
|
39
39
|
#if defined(GRPC_UV)
|
40
40
|
// Do nothing
|
41
41
|
#elif defined(GPR_MANYLINUX1)
|
42
|
+
#define GRPC_HAVE_IFADDRS 1
|
42
43
|
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
|
43
44
|
#define GRPC_HAVE_IP_PKTINFO 1
|
44
45
|
#define GRPC_HAVE_MSG_NOSIGNAL 1
|
@@ -65,6 +66,7 @@
|
|
65
66
|
#define GRPC_POSIX_WAKEUP_FD 1
|
66
67
|
#define GRPC_TIMER_USE_GENERIC 1
|
67
68
|
#elif defined(GPR_LINUX)
|
69
|
+
#define GRPC_HAVE_IFADDRS 1
|
68
70
|
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
|
69
71
|
#define GRPC_HAVE_IP_PKTINFO 1
|
70
72
|
#define GRPC_HAVE_MSG_NOSIGNAL 1
|
@@ -83,6 +85,11 @@
|
|
83
85
|
#define GRPC_LINUX_SOCKETUTILS 1
|
84
86
|
#endif
|
85
87
|
#endif
|
88
|
+
#ifndef __GLIBC__
|
89
|
+
#define GRPC_LINUX_EPOLL 1
|
90
|
+
#define GRPC_LINUX_EVENTFD 1
|
91
|
+
#define GRPC_MSG_IOVLEN_TYPE int
|
92
|
+
#endif
|
86
93
|
#ifndef GRPC_LINUX_EVENTFD
|
87
94
|
#define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1
|
88
95
|
#endif
|
@@ -90,6 +97,7 @@
|
|
90
97
|
#define GRPC_POSIX_SOCKETUTILS
|
91
98
|
#endif
|
92
99
|
#elif defined(GPR_APPLE)
|
100
|
+
#define GRPC_HAVE_IFADDRS 1
|
93
101
|
#define GRPC_HAVE_SO_NOSIGPIPE 1
|
94
102
|
#define GRPC_HAVE_UNIX_SOCKET 1
|
95
103
|
#define GRPC_MSG_IOVLEN_TYPE int
|
@@ -100,6 +108,7 @@
|
|
100
108
|
#define GRPC_POSIX_WAKEUP_FD 1
|
101
109
|
#define GRPC_TIMER_USE_GENERIC 1
|
102
110
|
#elif defined(GPR_FREEBSD)
|
111
|
+
#define GRPC_HAVE_IFADDRS 1
|
103
112
|
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
|
104
113
|
#define GRPC_HAVE_SO_NOSIGPIPE 1
|
105
114
|
#define GRPC_HAVE_UNIX_SOCKET 1
|
@@ -73,14 +73,16 @@ static grpc_error *blocking_resolve_address_impl(
|
|
73
73
|
/* parse name, splitting it into host and port parts */
|
74
74
|
gpr_split_host_port(name, &host, &port);
|
75
75
|
if (host == NULL) {
|
76
|
-
err = grpc_error_set_str(
|
77
|
-
|
76
|
+
err = grpc_error_set_str(
|
77
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("unparseable host:port"),
|
78
|
+
GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(name));
|
78
79
|
goto done;
|
79
80
|
}
|
80
81
|
if (port == NULL) {
|
81
82
|
if (default_port == NULL) {
|
82
|
-
err = grpc_error_set_str(
|
83
|
-
|
83
|
+
err = grpc_error_set_str(
|
84
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("no port in name"),
|
85
|
+
GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(name));
|
84
86
|
goto done;
|
85
87
|
}
|
86
88
|
port = gpr_strdup(default_port);
|
@@ -112,11 +114,15 @@ static grpc_error *blocking_resolve_address_impl(
|
|
112
114
|
if (s != 0) {
|
113
115
|
err = grpc_error_set_str(
|
114
116
|
grpc_error_set_str(
|
115
|
-
grpc_error_set_str(
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
grpc_error_set_str(
|
118
|
+
grpc_error_set_int(
|
119
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("OS Error"),
|
120
|
+
GRPC_ERROR_INT_ERRNO, s),
|
121
|
+
GRPC_ERROR_STR_OS_ERROR,
|
122
|
+
grpc_slice_from_static_string(gai_strerror(s))),
|
123
|
+
GRPC_ERROR_STR_SYSCALL,
|
124
|
+
grpc_slice_from_static_string("getaddrinfo")),
|
125
|
+
GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(name));
|
120
126
|
goto done;
|
121
127
|
}
|
122
128
|
|
@@ -93,9 +93,10 @@ static grpc_error *handle_addrinfo_result(int status, struct addrinfo *result,
|
|
93
93
|
if (status != 0) {
|
94
94
|
grpc_error *error;
|
95
95
|
*addresses = NULL;
|
96
|
-
error =
|
96
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("getaddrinfo failed");
|
97
97
|
error =
|
98
|
-
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
98
|
+
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
99
|
+
grpc_slice_from_static_string(uv_strerror(status)));
|
99
100
|
return error;
|
100
101
|
}
|
101
102
|
(*addresses) = gpr_malloc(sizeof(grpc_resolved_addresses));
|
@@ -154,7 +155,7 @@ static grpc_error *try_split_host_port(const char *name,
|
|
154
155
|
if (*host == NULL) {
|
155
156
|
char *msg;
|
156
157
|
gpr_asprintf(&msg, "unparseable host:port: '%s'", name);
|
157
|
-
error =
|
158
|
+
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
158
159
|
gpr_free(msg);
|
159
160
|
return error;
|
160
161
|
}
|
@@ -163,7 +164,7 @@ static grpc_error *try_split_host_port(const char *name,
|
|
163
164
|
if (default_port == NULL) {
|
164
165
|
char *msg;
|
165
166
|
gpr_asprintf(&msg, "no port in name '%s'", name);
|
166
|
-
error =
|
167
|
+
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
167
168
|
gpr_free(msg);
|
168
169
|
return error;
|
169
170
|
}
|
@@ -263,8 +264,9 @@ static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name,
|
|
263
264
|
|
264
265
|
if (s != 0) {
|
265
266
|
*addrs = NULL;
|
266
|
-
err =
|
267
|
-
err = grpc_error_set_str(err, GRPC_ERROR_STR_OS_ERROR,
|
267
|
+
err = GRPC_ERROR_CREATE_FROM_STATIC_STRING("getaddrinfo failed");
|
268
|
+
err = grpc_error_set_str(err, GRPC_ERROR_STR_OS_ERROR,
|
269
|
+
grpc_slice_from_static_string(uv_strerror(s)));
|
268
270
|
grpc_closure_sched(exec_ctx, on_done, err);
|
269
271
|
gpr_free(r);
|
270
272
|
gpr_free(req);
|
@@ -78,7 +78,7 @@ static grpc_error *blocking_resolve_address_impl(
|
|
78
78
|
if (host == NULL) {
|
79
79
|
char *msg;
|
80
80
|
gpr_asprintf(&msg, "unparseable host:port: '%s'", name);
|
81
|
-
error =
|
81
|
+
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
82
82
|
gpr_free(msg);
|
83
83
|
goto done;
|
84
84
|
}
|
@@ -86,7 +86,7 @@ static grpc_error *blocking_resolve_address_impl(
|
|
86
86
|
if (default_port == NULL) {
|
87
87
|
char *msg;
|
88
88
|
gpr_asprintf(&msg, "no port in name '%s'", name);
|
89
|
-
error =
|
89
|
+
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
90
90
|
gpr_free(msg);
|
91
91
|
goto done;
|
92
92
|
}
|
@@ -142,6 +142,8 @@ struct grpc_resource_quota {
|
|
142
142
|
/* Amount of free memory in the resource quota */
|
143
143
|
int64_t free_pool;
|
144
144
|
|
145
|
+
gpr_atm last_size;
|
146
|
+
|
145
147
|
/* Has rq_step been scheduled to occur? */
|
146
148
|
bool step_scheduled;
|
147
149
|
/* Are we currently reclaiming memory */
|
@@ -279,11 +281,17 @@ static void rq_step_sched(grpc_exec_ctx *exec_ctx,
|
|
279
281
|
/* update the atomically available resource estimate - use no barriers since
|
280
282
|
timeliness of delivery really doesn't matter much */
|
281
283
|
static void rq_update_estimate(grpc_resource_quota *resource_quota) {
|
284
|
+
gpr_atm memory_usage_estimation = MEMORY_USAGE_ESTIMATION_MAX;
|
285
|
+
if (resource_quota->size != 0) {
|
286
|
+
memory_usage_estimation =
|
287
|
+
GPR_CLAMP((gpr_atm)((1.0 -
|
288
|
+
((double)resource_quota->free_pool) /
|
289
|
+
((double)resource_quota->size)) *
|
290
|
+
MEMORY_USAGE_ESTIMATION_MAX),
|
291
|
+
0, MEMORY_USAGE_ESTIMATION_MAX);
|
292
|
+
}
|
282
293
|
gpr_atm_no_barrier_store(&resource_quota->memory_usage_estimation,
|
283
|
-
|
284
|
-
((double)resource_quota->free_pool) /
|
285
|
-
((double)resource_quota->size)) *
|
286
|
-
MEMORY_USAGE_ESTIMATION_MAX));
|
294
|
+
memory_usage_estimation);
|
287
295
|
}
|
288
296
|
|
289
297
|
/* returns true if all allocations are completed */
|
@@ -575,6 +583,7 @@ grpc_resource_quota *grpc_resource_quota_create(const char *name) {
|
|
575
583
|
resource_quota->combiner = grpc_combiner_create(NULL);
|
576
584
|
resource_quota->free_pool = INT64_MAX;
|
577
585
|
resource_quota->size = INT64_MAX;
|
586
|
+
gpr_atm_no_barrier_store(&resource_quota->last_size, GPR_ATM_MAX);
|
578
587
|
resource_quota->step_scheduled = false;
|
579
588
|
resource_quota->reclaiming = false;
|
580
589
|
gpr_atm_no_barrier_store(&resource_quota->memory_usage_estimation, 0);
|
@@ -637,11 +646,17 @@ void grpc_resource_quota_resize(grpc_resource_quota *resource_quota,
|
|
637
646
|
rq_resize_args *a = gpr_malloc(sizeof(*a));
|
638
647
|
a->resource_quota = grpc_resource_quota_ref_internal(resource_quota);
|
639
648
|
a->size = (int64_t)size;
|
649
|
+
gpr_atm_no_barrier_store(&resource_quota->last_size,
|
650
|
+
(gpr_atm)GPR_MIN((size_t)GPR_ATM_MAX, size));
|
640
651
|
grpc_closure_init(&a->closure, rq_resize, a, grpc_schedule_on_exec_ctx);
|
641
652
|
grpc_closure_sched(&exec_ctx, &a->closure, GRPC_ERROR_NONE);
|
642
653
|
grpc_exec_ctx_finish(&exec_ctx);
|
643
654
|
}
|
644
655
|
|
656
|
+
size_t grpc_resource_quota_peek_size(grpc_resource_quota *resource_quota) {
|
657
|
+
return (size_t)gpr_atm_no_barrier_load(&resource_quota->last_size);
|
658
|
+
}
|
659
|
+
|
645
660
|
/*******************************************************************************
|
646
661
|
* grpc_resource_user channel args api
|
647
662
|
*/
|
@@ -90,6 +90,8 @@ grpc_resource_quota *grpc_resource_quota_from_channel_args(
|
|
90
90
|
double grpc_resource_quota_get_memory_pressure(
|
91
91
|
grpc_resource_quota *resource_quota);
|
92
92
|
|
93
|
+
size_t grpc_resource_quota_peek_size(grpc_resource_quota *resource_quota);
|
94
|
+
|
93
95
|
typedef struct grpc_resource_user grpc_resource_user;
|
94
96
|
|
95
97
|
grpc_resource_user *grpc_resource_user_create(
|
@@ -55,7 +55,9 @@ int grpc_sockaddr_is_v4mapped(const grpc_resolved_address *resolved_addr,
|
|
55
55
|
GPR_ASSERT(resolved_addr != resolved_addr4_out);
|
56
56
|
const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr;
|
57
57
|
struct sockaddr_in *addr4_out =
|
58
|
-
|
58
|
+
resolved_addr4_out == NULL
|
59
|
+
? NULL
|
60
|
+
: (struct sockaddr_in *)resolved_addr4_out->addr;
|
59
61
|
if (addr->sa_family == AF_INET6) {
|
60
62
|
const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr;
|
61
63
|
if (memcmp(addr6->sin6_addr.s6_addr, kV4MappedPrefix,
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2017, 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/iomgr/port.h"
|
35
|
+
|
36
|
+
#ifdef GRPC_POSIX_SOCKET
|
37
|
+
|
38
|
+
#include "src/core/lib/iomgr/socket_factory_posix.h"
|
39
|
+
|
40
|
+
#include <grpc/impl/codegen/grpc_types.h>
|
41
|
+
#include <grpc/support/sync.h>
|
42
|
+
#include <grpc/support/useful.h>
|
43
|
+
|
44
|
+
void grpc_socket_factory_init(grpc_socket_factory *factory,
|
45
|
+
const grpc_socket_factory_vtable *vtable) {
|
46
|
+
factory->vtable = vtable;
|
47
|
+
gpr_ref_init(&factory->refcount, 1);
|
48
|
+
}
|
49
|
+
|
50
|
+
int grpc_socket_factory_socket(grpc_socket_factory *factory, int domain,
|
51
|
+
int type, int protocol) {
|
52
|
+
return factory->vtable->socket(factory, domain, type, protocol);
|
53
|
+
}
|
54
|
+
|
55
|
+
int grpc_socket_factory_bind(grpc_socket_factory *factory, int sockfd,
|
56
|
+
const grpc_resolved_address *addr) {
|
57
|
+
return factory->vtable->bind(factory, sockfd, addr);
|
58
|
+
}
|
59
|
+
|
60
|
+
int grpc_socket_factory_compare(grpc_socket_factory *a,
|
61
|
+
grpc_socket_factory *b) {
|
62
|
+
int c = GPR_ICMP(a, b);
|
63
|
+
if (c != 0) {
|
64
|
+
grpc_socket_factory *sma = a;
|
65
|
+
grpc_socket_factory *smb = b;
|
66
|
+
c = GPR_ICMP(sma->vtable, smb->vtable);
|
67
|
+
if (c == 0) {
|
68
|
+
c = sma->vtable->compare(sma, smb);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
return c;
|
72
|
+
}
|
73
|
+
|
74
|
+
grpc_socket_factory *grpc_socket_factory_ref(grpc_socket_factory *factory) {
|
75
|
+
gpr_ref(&factory->refcount);
|
76
|
+
return factory;
|
77
|
+
}
|
78
|
+
|
79
|
+
void grpc_socket_factory_unref(grpc_socket_factory *factory) {
|
80
|
+
if (gpr_unref(&factory->refcount)) {
|
81
|
+
factory->vtable->destroy(factory);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
static void *socket_factory_arg_copy(void *p) {
|
86
|
+
return grpc_socket_factory_ref(p);
|
87
|
+
}
|
88
|
+
|
89
|
+
static void socket_factory_arg_destroy(grpc_exec_ctx *exec_ctx, void *p) {
|
90
|
+
grpc_socket_factory_unref(p);
|
91
|
+
}
|
92
|
+
|
93
|
+
static int socket_factory_cmp(void *a, void *b) {
|
94
|
+
return grpc_socket_factory_compare((grpc_socket_factory *)a,
|
95
|
+
(grpc_socket_factory *)b);
|
96
|
+
}
|
97
|
+
|
98
|
+
static const grpc_arg_pointer_vtable socket_factory_arg_vtable = {
|
99
|
+
socket_factory_arg_copy, socket_factory_arg_destroy, socket_factory_cmp};
|
100
|
+
|
101
|
+
grpc_arg grpc_socket_factory_to_arg(grpc_socket_factory *factory) {
|
102
|
+
grpc_arg arg;
|
103
|
+
arg.type = GRPC_ARG_POINTER;
|
104
|
+
arg.key = GRPC_ARG_SOCKET_FACTORY;
|
105
|
+
arg.value.pointer.vtable = &socket_factory_arg_vtable;
|
106
|
+
arg.value.pointer.p = factory;
|
107
|
+
return arg;
|
108
|
+
}
|
109
|
+
|
110
|
+
#endif
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2017, 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_IOMGR_SOCKET_FACTORY_POSIX_H
|
35
|
+
#define GRPC_CORE_LIB_IOMGR_SOCKET_FACTORY_POSIX_H
|
36
|
+
|
37
|
+
#include <grpc/impl/codegen/grpc_types.h>
|
38
|
+
#include <grpc/support/sync.h>
|
39
|
+
#include "src/core/lib/iomgr/resolve_address.h"
|
40
|
+
|
41
|
+
#ifdef __cplusplus
|
42
|
+
extern "C" {
|
43
|
+
#endif
|
44
|
+
|
45
|
+
/** The virtual table of grpc_socket_factory */
|
46
|
+
typedef struct {
|
47
|
+
/** Replacement for socket(2) */
|
48
|
+
int (*socket)(grpc_socket_factory *factory, int domain, int type,
|
49
|
+
int protocol);
|
50
|
+
/** Replacement for bind(2) */
|
51
|
+
int (*bind)(grpc_socket_factory *factory, int sockfd,
|
52
|
+
const grpc_resolved_address *addr);
|
53
|
+
/** Compare socket factory \a a and \a b */
|
54
|
+
int (*compare)(grpc_socket_factory *a, grpc_socket_factory *b);
|
55
|
+
/** Destroys the socket factory instance */
|
56
|
+
void (*destroy)(grpc_socket_factory *factory);
|
57
|
+
} grpc_socket_factory_vtable;
|
58
|
+
|
59
|
+
/** The Socket Factory interface allows changes on socket options */
|
60
|
+
struct grpc_socket_factory {
|
61
|
+
const grpc_socket_factory_vtable *vtable;
|
62
|
+
gpr_refcount refcount;
|
63
|
+
};
|
64
|
+
|
65
|
+
/** called by concrete implementations to initialize the base struct */
|
66
|
+
void grpc_socket_factory_init(grpc_socket_factory *factory,
|
67
|
+
const grpc_socket_factory_vtable *vtable);
|
68
|
+
|
69
|
+
/** Wrap \a factory as a grpc_arg */
|
70
|
+
grpc_arg grpc_socket_factory_to_arg(grpc_socket_factory *factory);
|
71
|
+
|
72
|
+
/** Perform the equivalent of a socket(2) operation using \a factory */
|
73
|
+
int grpc_socket_factory_socket(grpc_socket_factory *factory, int domain,
|
74
|
+
int type, int protocol);
|
75
|
+
|
76
|
+
/** Perform the equivalent of a bind(2) operation using \a factory */
|
77
|
+
int grpc_socket_factory_bind(grpc_socket_factory *factory, int sockfd,
|
78
|
+
const grpc_resolved_address *addr);
|
79
|
+
|
80
|
+
/** Compare if \a a and \a b are the same factory or have same settings */
|
81
|
+
int grpc_socket_factory_compare(grpc_socket_factory *a, grpc_socket_factory *b);
|
82
|
+
|
83
|
+
grpc_socket_factory *grpc_socket_factory_ref(grpc_socket_factory *factory);
|
84
|
+
void grpc_socket_factory_unref(grpc_socket_factory *factory);
|
85
|
+
|
86
|
+
#ifdef __cplusplus
|
87
|
+
}
|
88
|
+
#endif
|
89
|
+
|
90
|
+
#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_FACTORY_POSIX_H */
|