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
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
3
|
+
*
|
4
|
+
* Permission to use, copy, modify, and distribute this
|
5
|
+
* software and its documentation for any purpose and without
|
6
|
+
* fee is hereby granted, provided that the above copyright
|
7
|
+
* notice appear in all copies and that both that copyright
|
8
|
+
* notice and this permission notice appear in supporting
|
9
|
+
* documentation, and that the name of M.I.T. not be used in
|
10
|
+
* advertising or publicity pertaining to distribution of the
|
11
|
+
* software without specific, written prior permission.
|
12
|
+
* M.I.T. makes no representations about the suitability of
|
13
|
+
* this software for any purpose. It is provided "as is"
|
14
|
+
* without express or implied warranty.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#include "ares_setup.h"
|
18
|
+
|
19
|
+
#include "ares.h"
|
20
|
+
#include "ares_private.h"
|
21
|
+
|
22
|
+
void ares__close_sockets(ares_channel channel, struct server_state *server)
|
23
|
+
{
|
24
|
+
struct send_request *sendreq;
|
25
|
+
|
26
|
+
/* Free all pending output buffers. */
|
27
|
+
while (server->qhead)
|
28
|
+
{
|
29
|
+
/* Advance server->qhead; pull out query as we go. */
|
30
|
+
sendreq = server->qhead;
|
31
|
+
server->qhead = sendreq->next;
|
32
|
+
if (sendreq->data_storage != NULL)
|
33
|
+
ares_free(sendreq->data_storage);
|
34
|
+
ares_free(sendreq);
|
35
|
+
}
|
36
|
+
server->qtail = NULL;
|
37
|
+
|
38
|
+
/* Reset any existing input buffer. */
|
39
|
+
if (server->tcp_buffer)
|
40
|
+
ares_free(server->tcp_buffer);
|
41
|
+
server->tcp_buffer = NULL;
|
42
|
+
server->tcp_lenbuf_pos = 0;
|
43
|
+
|
44
|
+
/* Reset brokenness */
|
45
|
+
server->is_broken = 0;
|
46
|
+
|
47
|
+
/* Close the TCP and UDP sockets. */
|
48
|
+
if (server->tcp_socket != ARES_SOCKET_BAD)
|
49
|
+
{
|
50
|
+
SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0);
|
51
|
+
sclose(server->tcp_socket);
|
52
|
+
server->tcp_socket = ARES_SOCKET_BAD;
|
53
|
+
server->tcp_connection_generation = ++channel->tcp_connection_generation;
|
54
|
+
}
|
55
|
+
if (server->udp_socket != ARES_SOCKET_BAD)
|
56
|
+
{
|
57
|
+
SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0);
|
58
|
+
sclose(server->udp_socket);
|
59
|
+
server->udp_socket = ARES_SOCKET_BAD;
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,261 @@
|
|
1
|
+
|
2
|
+
/* Copyright 1998, 2011 by the Massachusetts Institute of Technology.
|
3
|
+
*
|
4
|
+
* Permission to use, copy, modify, and distribute this
|
5
|
+
* software and its documentation for any purpose and without
|
6
|
+
* fee is hereby granted, provided that the above copyright
|
7
|
+
* notice appear in all copies and that both that copyright
|
8
|
+
* notice and this permission notice appear in supporting
|
9
|
+
* documentation, and that the name of M.I.T. not be used in
|
10
|
+
* advertising or publicity pertaining to distribution of the
|
11
|
+
* software without specific, written prior permission.
|
12
|
+
* M.I.T. makes no representations about the suitability of
|
13
|
+
* this software for any purpose. It is provided "as is"
|
14
|
+
* without express or implied warranty.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#include "ares_setup.h"
|
18
|
+
|
19
|
+
#ifdef HAVE_NETINET_IN_H
|
20
|
+
# include <netinet/in.h>
|
21
|
+
#endif
|
22
|
+
#ifdef HAVE_NETDB_H
|
23
|
+
# include <netdb.h>
|
24
|
+
#endif
|
25
|
+
#ifdef HAVE_ARPA_INET_H
|
26
|
+
# include <arpa/inet.h>
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include "ares.h"
|
30
|
+
#include "ares_inet_net_pton.h"
|
31
|
+
#include "ares_nowarn.h"
|
32
|
+
#include "ares_private.h"
|
33
|
+
|
34
|
+
int ares__get_hostent(FILE *fp, int family, struct hostent **host)
|
35
|
+
{
|
36
|
+
char *line = NULL, *p, *q, **alias;
|
37
|
+
char *txtaddr, *txthost, *txtalias;
|
38
|
+
int status;
|
39
|
+
size_t addrlen, linesize, naliases;
|
40
|
+
struct ares_addr addr;
|
41
|
+
struct hostent *hostent = NULL;
|
42
|
+
|
43
|
+
*host = NULL; /* Assume failure */
|
44
|
+
|
45
|
+
/* Validate family */
|
46
|
+
switch (family) {
|
47
|
+
case AF_INET:
|
48
|
+
case AF_INET6:
|
49
|
+
case AF_UNSPEC:
|
50
|
+
break;
|
51
|
+
default:
|
52
|
+
return ARES_EBADFAMILY;
|
53
|
+
}
|
54
|
+
|
55
|
+
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
|
56
|
+
{
|
57
|
+
|
58
|
+
/* Trim line comment. */
|
59
|
+
p = line;
|
60
|
+
while (*p && (*p != '#'))
|
61
|
+
p++;
|
62
|
+
*p = '\0';
|
63
|
+
|
64
|
+
/* Trim trailing whitespace. */
|
65
|
+
q = p - 1;
|
66
|
+
while ((q >= line) && ISSPACE(*q))
|
67
|
+
q--;
|
68
|
+
*++q = '\0';
|
69
|
+
|
70
|
+
/* Skip leading whitespace. */
|
71
|
+
p = line;
|
72
|
+
while (*p && ISSPACE(*p))
|
73
|
+
p++;
|
74
|
+
if (!*p)
|
75
|
+
/* Ignore line if empty. */
|
76
|
+
continue;
|
77
|
+
|
78
|
+
/* Pointer to start of IPv4 or IPv6 address part. */
|
79
|
+
txtaddr = p;
|
80
|
+
|
81
|
+
/* Advance past address part. */
|
82
|
+
while (*p && !ISSPACE(*p))
|
83
|
+
p++;
|
84
|
+
if (!*p)
|
85
|
+
/* Ignore line if reached end of line. */
|
86
|
+
continue;
|
87
|
+
|
88
|
+
/* Null terminate address part. */
|
89
|
+
*p = '\0';
|
90
|
+
|
91
|
+
/* Advance to host name */
|
92
|
+
p++;
|
93
|
+
while (*p && ISSPACE(*p))
|
94
|
+
p++;
|
95
|
+
if (!*p)
|
96
|
+
/* Ignore line if reached end of line. */
|
97
|
+
continue; /* LCOV_EXCL_LINE: trailing whitespace already stripped */
|
98
|
+
|
99
|
+
/* Pointer to start of host name. */
|
100
|
+
txthost = p;
|
101
|
+
|
102
|
+
/* Advance past host name. */
|
103
|
+
while (*p && !ISSPACE(*p))
|
104
|
+
p++;
|
105
|
+
|
106
|
+
/* Pointer to start of first alias. */
|
107
|
+
txtalias = NULL;
|
108
|
+
if (*p)
|
109
|
+
{
|
110
|
+
q = p + 1;
|
111
|
+
while (*q && ISSPACE(*q))
|
112
|
+
q++;
|
113
|
+
if (*q)
|
114
|
+
txtalias = q;
|
115
|
+
}
|
116
|
+
|
117
|
+
/* Null terminate host name. */
|
118
|
+
*p = '\0';
|
119
|
+
|
120
|
+
/* find out number of aliases. */
|
121
|
+
naliases = 0;
|
122
|
+
if (txtalias)
|
123
|
+
{
|
124
|
+
p = txtalias;
|
125
|
+
while (*p)
|
126
|
+
{
|
127
|
+
while (*p && !ISSPACE(*p))
|
128
|
+
p++;
|
129
|
+
while (*p && ISSPACE(*p))
|
130
|
+
p++;
|
131
|
+
naliases++;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
/* Convert address string to network address for the requested family. */
|
136
|
+
addrlen = 0;
|
137
|
+
addr.family = AF_UNSPEC;
|
138
|
+
addr.addrV4.s_addr = INADDR_NONE;
|
139
|
+
if ((family == AF_INET) || (family == AF_UNSPEC))
|
140
|
+
{
|
141
|
+
addr.addrV4.s_addr = inet_addr(txtaddr);
|
142
|
+
if (addr.addrV4.s_addr != INADDR_NONE)
|
143
|
+
{
|
144
|
+
/* Actual network address family and length. */
|
145
|
+
addr.family = AF_INET;
|
146
|
+
addrlen = sizeof(addr.addrV4);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
if ((family == AF_INET6) || ((family == AF_UNSPEC) && (!addrlen)))
|
150
|
+
{
|
151
|
+
if (ares_inet_pton(AF_INET6, txtaddr, &addr.addrV6) > 0)
|
152
|
+
{
|
153
|
+
/* Actual network address family and length. */
|
154
|
+
addr.family = AF_INET6;
|
155
|
+
addrlen = sizeof(addr.addrV6);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
if (!addrlen)
|
159
|
+
/* Ignore line if invalid address string for the requested family. */
|
160
|
+
continue;
|
161
|
+
|
162
|
+
/*
|
163
|
+
** Actual address family possible values are AF_INET and AF_INET6 only.
|
164
|
+
*/
|
165
|
+
|
166
|
+
/* Allocate memory for the hostent structure. */
|
167
|
+
hostent = ares_malloc(sizeof(struct hostent));
|
168
|
+
if (!hostent)
|
169
|
+
break;
|
170
|
+
|
171
|
+
/* Initialize fields for out of memory condition. */
|
172
|
+
hostent->h_aliases = NULL;
|
173
|
+
hostent->h_addr_list = NULL;
|
174
|
+
|
175
|
+
/* Copy official host name. */
|
176
|
+
hostent->h_name = ares_strdup(txthost);
|
177
|
+
if (!hostent->h_name)
|
178
|
+
break;
|
179
|
+
|
180
|
+
/* Copy network address. */
|
181
|
+
hostent->h_addr_list = ares_malloc(2 * sizeof(char *));
|
182
|
+
if (!hostent->h_addr_list)
|
183
|
+
break;
|
184
|
+
hostent->h_addr_list[1] = NULL;
|
185
|
+
hostent->h_addr_list[0] = ares_malloc(addrlen);
|
186
|
+
if (!hostent->h_addr_list[0])
|
187
|
+
break;
|
188
|
+
if (addr.family == AF_INET)
|
189
|
+
memcpy(hostent->h_addr_list[0], &addr.addrV4, sizeof(addr.addrV4));
|
190
|
+
else
|
191
|
+
memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6));
|
192
|
+
|
193
|
+
/* Copy aliases. */
|
194
|
+
hostent->h_aliases = ares_malloc((naliases + 1) * sizeof(char *));
|
195
|
+
if (!hostent->h_aliases)
|
196
|
+
break;
|
197
|
+
alias = hostent->h_aliases;
|
198
|
+
while (naliases)
|
199
|
+
*(alias + naliases--) = NULL;
|
200
|
+
*alias = NULL;
|
201
|
+
while (txtalias)
|
202
|
+
{
|
203
|
+
p = txtalias;
|
204
|
+
while (*p && !ISSPACE(*p))
|
205
|
+
p++;
|
206
|
+
q = p;
|
207
|
+
while (*q && ISSPACE(*q))
|
208
|
+
q++;
|
209
|
+
*p = '\0';
|
210
|
+
if ((*alias = ares_strdup(txtalias)) == NULL)
|
211
|
+
break;
|
212
|
+
alias++;
|
213
|
+
txtalias = *q ? q : NULL;
|
214
|
+
}
|
215
|
+
if (txtalias)
|
216
|
+
/* Alias memory allocation failure. */
|
217
|
+
break;
|
218
|
+
|
219
|
+
/* Copy actual network address family and length. */
|
220
|
+
hostent->h_addrtype = aresx_sitoss(addr.family);
|
221
|
+
hostent->h_length = aresx_uztoss(addrlen);
|
222
|
+
|
223
|
+
/* Free line buffer. */
|
224
|
+
ares_free(line);
|
225
|
+
|
226
|
+
/* Return hostent successfully */
|
227
|
+
*host = hostent;
|
228
|
+
return ARES_SUCCESS;
|
229
|
+
|
230
|
+
}
|
231
|
+
|
232
|
+
/* If allocated, free line buffer. */
|
233
|
+
if (line)
|
234
|
+
ares_free(line);
|
235
|
+
|
236
|
+
if (status == ARES_SUCCESS)
|
237
|
+
{
|
238
|
+
/* Memory allocation failure; clean up. */
|
239
|
+
if (hostent)
|
240
|
+
{
|
241
|
+
if (hostent->h_name)
|
242
|
+
ares_free((char *) hostent->h_name);
|
243
|
+
if (hostent->h_aliases)
|
244
|
+
{
|
245
|
+
for (alias = hostent->h_aliases; *alias; alias++)
|
246
|
+
ares_free(*alias);
|
247
|
+
ares_free(hostent->h_aliases);
|
248
|
+
}
|
249
|
+
if (hostent->h_addr_list)
|
250
|
+
{
|
251
|
+
if (hostent->h_addr_list[0])
|
252
|
+
ares_free(hostent->h_addr_list[0]);
|
253
|
+
ares_free(hostent->h_addr_list);
|
254
|
+
}
|
255
|
+
ares_free(hostent);
|
256
|
+
}
|
257
|
+
return ARES_ENOMEM;
|
258
|
+
}
|
259
|
+
|
260
|
+
return status;
|
261
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
3
|
+
*
|
4
|
+
* Permission to use, copy, modify, and distribute this
|
5
|
+
* software and its documentation for any purpose and without
|
6
|
+
* fee is hereby granted, provided that the above copyright
|
7
|
+
* notice appear in all copies and that both that copyright
|
8
|
+
* notice and this permission notice appear in supporting
|
9
|
+
* documentation, and that the name of M.I.T. not be used in
|
10
|
+
* advertising or publicity pertaining to distribution of the
|
11
|
+
* software without specific, written prior permission.
|
12
|
+
* M.I.T. makes no representations about the suitability of
|
13
|
+
* this software for any purpose. It is provided "as is"
|
14
|
+
* without express or implied warranty.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#include "ares_setup.h"
|
18
|
+
|
19
|
+
#include "ares.h"
|
20
|
+
#include "ares_nowarn.h"
|
21
|
+
#include "ares_private.h"
|
22
|
+
|
23
|
+
/* This is an internal function. Its contract is to read a line from
|
24
|
+
* a file into a dynamically allocated buffer, zeroing the trailing
|
25
|
+
* newline if there is one. The calling routine may call
|
26
|
+
* ares__read_line multiple times with the same buf and bufsize
|
27
|
+
* pointers; *buf will be reallocated and *bufsize adjusted as
|
28
|
+
* appropriate. The initial value of *buf should be NULL. After the
|
29
|
+
* calling routine is done reading lines, it should free *buf.
|
30
|
+
*/
|
31
|
+
int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
|
32
|
+
{
|
33
|
+
char *newbuf;
|
34
|
+
size_t offset = 0;
|
35
|
+
size_t len;
|
36
|
+
|
37
|
+
if (*buf == NULL)
|
38
|
+
{
|
39
|
+
*buf = ares_malloc(128);
|
40
|
+
if (!*buf)
|
41
|
+
return ARES_ENOMEM;
|
42
|
+
*bufsize = 128;
|
43
|
+
}
|
44
|
+
|
45
|
+
for (;;)
|
46
|
+
{
|
47
|
+
int bytestoread = aresx_uztosi(*bufsize - offset);
|
48
|
+
|
49
|
+
if (!fgets(*buf + offset, bytestoread, fp))
|
50
|
+
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
|
51
|
+
len = offset + strlen(*buf + offset);
|
52
|
+
if ((*buf)[len - 1] == '\n')
|
53
|
+
{
|
54
|
+
(*buf)[len - 1] = 0;
|
55
|
+
break;
|
56
|
+
}
|
57
|
+
offset = len;
|
58
|
+
if(len < *bufsize - 1)
|
59
|
+
continue;
|
60
|
+
|
61
|
+
/* Allocate more space. */
|
62
|
+
newbuf = ares_realloc(*buf, *bufsize * 2);
|
63
|
+
if (!newbuf)
|
64
|
+
{
|
65
|
+
ares_free(*buf);
|
66
|
+
*buf = NULL;
|
67
|
+
return ARES_ENOMEM;
|
68
|
+
}
|
69
|
+
*buf = newbuf;
|
70
|
+
*bufsize *= 2;
|
71
|
+
}
|
72
|
+
return ARES_SUCCESS;
|
73
|
+
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
|
2
|
+
/* Copyright (C) 2008 by Daniel Stenberg et al
|
3
|
+
*
|
4
|
+
* Permission to use, copy, modify, and distribute this software and its
|
5
|
+
* documentation for any purpose and without fee is hereby granted, provided
|
6
|
+
* that the above copyright notice appear in all copies and that both that
|
7
|
+
* copyright notice and this permission notice appear in supporting
|
8
|
+
* documentation, and that the name of M.I.T. not be used in advertising or
|
9
|
+
* publicity pertaining to distribution of the software without specific,
|
10
|
+
* written prior permission. M.I.T. makes no representations about the
|
11
|
+
* suitability of this software for any purpose. It is provided "as is"
|
12
|
+
* without express or implied warranty.
|
13
|
+
*/
|
14
|
+
|
15
|
+
#include "ares_setup.h"
|
16
|
+
#include "ares.h"
|
17
|
+
#include "ares_private.h"
|
18
|
+
|
19
|
+
#if defined(WIN32) && !defined(MSDOS)
|
20
|
+
|
21
|
+
struct timeval ares__tvnow(void)
|
22
|
+
{
|
23
|
+
/*
|
24
|
+
** GetTickCount() is available on _all_ Windows versions from W95 up
|
25
|
+
** to nowadays. Returns milliseconds elapsed since last system boot,
|
26
|
+
** increases monotonically and wraps once 49.7 days have elapsed.
|
27
|
+
*/
|
28
|
+
struct timeval now;
|
29
|
+
DWORD milliseconds = GetTickCount();
|
30
|
+
now.tv_sec = milliseconds / 1000;
|
31
|
+
now.tv_usec = (milliseconds % 1000) * 1000;
|
32
|
+
return now;
|
33
|
+
}
|
34
|
+
|
35
|
+
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
|
36
|
+
|
37
|
+
struct timeval ares__tvnow(void)
|
38
|
+
{
|
39
|
+
/*
|
40
|
+
** clock_gettime() is granted to be increased monotonically when the
|
41
|
+
** monotonic clock is queried. Time starting point is unspecified, it
|
42
|
+
** could be the system start-up time, the Epoch, or something else,
|
43
|
+
** in any case the time starting point does not change once that the
|
44
|
+
** system has started up.
|
45
|
+
*/
|
46
|
+
struct timeval now;
|
47
|
+
struct timespec tsnow;
|
48
|
+
if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
|
49
|
+
now.tv_sec = tsnow.tv_sec;
|
50
|
+
now.tv_usec = tsnow.tv_nsec / 1000;
|
51
|
+
}
|
52
|
+
/*
|
53
|
+
** Even when the configure process has truly detected monotonic clock
|
54
|
+
** availability, it might happen that it is not actually available at
|
55
|
+
** run-time. When this occurs simply fallback to other time source.
|
56
|
+
*/
|
57
|
+
#ifdef HAVE_GETTIMEOFDAY
|
58
|
+
else
|
59
|
+
(void)gettimeofday(&now, NULL); /* LCOV_EXCL_LINE */
|
60
|
+
#else
|
61
|
+
else {
|
62
|
+
now.tv_sec = (long)time(NULL);
|
63
|
+
now.tv_usec = 0;
|
64
|
+
}
|
65
|
+
#endif
|
66
|
+
return now;
|
67
|
+
}
|
68
|
+
|
69
|
+
#elif defined(HAVE_GETTIMEOFDAY)
|
70
|
+
|
71
|
+
struct timeval ares__tvnow(void)
|
72
|
+
{
|
73
|
+
/*
|
74
|
+
** gettimeofday() is not granted to be increased monotonically, due to
|
75
|
+
** clock drifting and external source time synchronization it can jump
|
76
|
+
** forward or backward in time.
|
77
|
+
*/
|
78
|
+
struct timeval now;
|
79
|
+
(void)gettimeofday(&now, NULL);
|
80
|
+
return now;
|
81
|
+
}
|
82
|
+
|
83
|
+
#else
|
84
|
+
|
85
|
+
struct timeval ares__tvnow(void)
|
86
|
+
{
|
87
|
+
/*
|
88
|
+
** time() returns the value of time in seconds since the Epoch.
|
89
|
+
*/
|
90
|
+
struct timeval now;
|
91
|
+
now.tv_sec = (long)time(NULL);
|
92
|
+
now.tv_usec = 0;
|
93
|
+
return now;
|
94
|
+
}
|
95
|
+
|
96
|
+
#endif
|
97
|
+
|
98
|
+
#if 0 /* Not used */
|
99
|
+
/*
|
100
|
+
* Make sure that the first argument is the more recent time, as otherwise
|
101
|
+
* we'll get a weird negative time-diff back...
|
102
|
+
*
|
103
|
+
* Returns: the time difference in number of milliseconds.
|
104
|
+
*/
|
105
|
+
long ares__tvdiff(struct timeval newer, struct timeval older)
|
106
|
+
{
|
107
|
+
return (newer.tv_sec-older.tv_sec)*1000+
|
108
|
+
(newer.tv_usec-older.tv_usec)/1000;
|
109
|
+
}
|
110
|
+
#endif
|
111
|
+
|