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,70 @@
|
|
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
|
+
#ifdef HAVE_NETINET_IN_H
|
20
|
+
# include <netinet/in.h>
|
21
|
+
#endif
|
22
|
+
#ifdef HAVE_ARPA_NAMESER_H
|
23
|
+
# include <arpa/nameser.h>
|
24
|
+
#else
|
25
|
+
# include "nameser.h"
|
26
|
+
#endif
|
27
|
+
|
28
|
+
#include "ares.h"
|
29
|
+
#include "ares_private.h" /* for the memdebug */
|
30
|
+
|
31
|
+
/* Simply decodes a length-encoded character string. The first byte of the
|
32
|
+
* input is the length of the string to be returned and the bytes thereafter
|
33
|
+
* are the characters of the string. The returned result will be NULL
|
34
|
+
* terminated.
|
35
|
+
*/
|
36
|
+
int ares_expand_string(const unsigned char *encoded,
|
37
|
+
const unsigned char *abuf,
|
38
|
+
int alen,
|
39
|
+
unsigned char **s,
|
40
|
+
long *enclen)
|
41
|
+
{
|
42
|
+
unsigned char *q;
|
43
|
+
union {
|
44
|
+
ssize_t sig;
|
45
|
+
size_t uns;
|
46
|
+
} elen;
|
47
|
+
|
48
|
+
if (encoded == abuf+alen)
|
49
|
+
return ARES_EBADSTR;
|
50
|
+
|
51
|
+
elen.uns = *encoded;
|
52
|
+
if (encoded+elen.sig+1 > abuf+alen)
|
53
|
+
return ARES_EBADSTR;
|
54
|
+
|
55
|
+
encoded++;
|
56
|
+
|
57
|
+
*s = ares_malloc(elen.uns+1);
|
58
|
+
if (*s == NULL)
|
59
|
+
return ARES_ENOMEM;
|
60
|
+
q = *s;
|
61
|
+
strncpy((char *)q, (char *)encoded, elen.uns);
|
62
|
+
q[elen.uns] = '\0';
|
63
|
+
|
64
|
+
*s = q;
|
65
|
+
|
66
|
+
*enclen = (long)(elen.sig+1);
|
67
|
+
|
68
|
+
return ARES_SUCCESS;
|
69
|
+
}
|
70
|
+
|
@@ -0,0 +1,59 @@
|
|
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
|
+
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
|
24
|
+
{
|
25
|
+
struct server_state *server;
|
26
|
+
ares_socket_t nfds;
|
27
|
+
int i;
|
28
|
+
|
29
|
+
/* Are there any active queries? */
|
30
|
+
int active_queries = !ares__is_list_empty(&(channel->all_queries));
|
31
|
+
|
32
|
+
nfds = 0;
|
33
|
+
for (i = 0; i < channel->nservers; i++)
|
34
|
+
{
|
35
|
+
server = &channel->servers[i];
|
36
|
+
/* We only need to register interest in UDP sockets if we have
|
37
|
+
* outstanding queries.
|
38
|
+
*/
|
39
|
+
if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
|
40
|
+
{
|
41
|
+
FD_SET(server->udp_socket, read_fds);
|
42
|
+
if (server->udp_socket >= nfds)
|
43
|
+
nfds = server->udp_socket + 1;
|
44
|
+
}
|
45
|
+
/* We always register for TCP events, because we want to know
|
46
|
+
* when the other side closes the connection, so we don't waste
|
47
|
+
* time trying to use a broken connection.
|
48
|
+
*/
|
49
|
+
if (server->tcp_socket != ARES_SOCKET_BAD)
|
50
|
+
{
|
51
|
+
FD_SET(server->tcp_socket, read_fds);
|
52
|
+
if (server->qhead)
|
53
|
+
FD_SET(server->tcp_socket, write_fds);
|
54
|
+
if (server->tcp_socket >= nfds)
|
55
|
+
nfds = server->tcp_socket + 1;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
return (int)nfds;
|
59
|
+
}
|
@@ -0,0 +1,41 @@
|
|
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
|
+
#ifdef HAVE_NETDB_H
|
20
|
+
#include <netdb.h>
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#include "ares.h"
|
24
|
+
#include "ares_private.h" /* for memdebug */
|
25
|
+
|
26
|
+
void ares_free_hostent(struct hostent *host)
|
27
|
+
{
|
28
|
+
char **p;
|
29
|
+
|
30
|
+
if (!host)
|
31
|
+
return;
|
32
|
+
|
33
|
+
ares_free((char *)(host->h_name));
|
34
|
+
for (p = host->h_aliases; *p; p++)
|
35
|
+
ares_free(*p);
|
36
|
+
ares_free(host->h_aliases);
|
37
|
+
ares_free(host->h_addr_list[0]); /* no matter if there is one or many entries,
|
38
|
+
there is only one malloc for all of them */
|
39
|
+
ares_free(host->h_addr_list);
|
40
|
+
ares_free(host);
|
41
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
/* Copyright 2000 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_free_string(void *str)
|
23
|
+
{
|
24
|
+
ares_free(str);
|
25
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
4
|
+
*
|
5
|
+
* Permission to use, copy, modify, and distribute this
|
6
|
+
* software and its documentation for any purpose and without
|
7
|
+
* fee is hereby granted, provided that the above copyright
|
8
|
+
* notice appear in all copies and that both that copyright
|
9
|
+
* notice and this permission notice appear in supporting
|
10
|
+
* documentation, and that the name of M.I.T. not be used in
|
11
|
+
* advertising or publicity pertaining to distribution of the
|
12
|
+
* software without specific, written prior permission.
|
13
|
+
* M.I.T. makes no representations about the suitability of
|
14
|
+
* this software for any purpose. It is provided "as is"
|
15
|
+
* without express or implied warranty.
|
16
|
+
*/
|
17
|
+
|
18
|
+
#include "ares_setup.h"
|
19
|
+
#include "ares_getenv.h"
|
20
|
+
|
21
|
+
#ifndef HAVE_GETENV
|
22
|
+
|
23
|
+
char *ares_getenv(const char *name)
|
24
|
+
{
|
25
|
+
#ifdef _WIN32_WCE
|
26
|
+
return NULL;
|
27
|
+
#endif
|
28
|
+
}
|
29
|
+
|
30
|
+
#endif
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#ifndef HEADER_CARES_GETENV_H
|
2
|
+
#define HEADER_CARES_GETENV_H
|
3
|
+
|
4
|
+
|
5
|
+
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
6
|
+
*
|
7
|
+
* Permission to use, copy, modify, and distribute this
|
8
|
+
* software and its documentation for any purpose and without
|
9
|
+
* fee is hereby granted, provided that the above copyright
|
10
|
+
* notice appear in all copies and that both that copyright
|
11
|
+
* notice and this permission notice appear in supporting
|
12
|
+
* documentation, and that the name of M.I.T. not be used in
|
13
|
+
* advertising or publicity pertaining to distribution of the
|
14
|
+
* software without specific, written prior permission.
|
15
|
+
* M.I.T. makes no representations about the suitability of
|
16
|
+
* this software for any purpose. It is provided "as is"
|
17
|
+
* without express or implied warranty.
|
18
|
+
*/
|
19
|
+
|
20
|
+
#include "ares_setup.h"
|
21
|
+
|
22
|
+
#ifndef HAVE_GETENV
|
23
|
+
extern char *ares_getenv(const char *name);
|
24
|
+
#endif
|
25
|
+
|
26
|
+
#endif /* HEADER_CARES_GETENV_H */
|
@@ -0,0 +1,294 @@
|
|
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
|
+
#include "ares_setup.h"
|
17
|
+
|
18
|
+
#ifdef HAVE_NETINET_IN_H
|
19
|
+
# include <netinet/in.h>
|
20
|
+
#endif
|
21
|
+
#ifdef HAVE_NETDB_H
|
22
|
+
# include <netdb.h>
|
23
|
+
#endif
|
24
|
+
#ifdef HAVE_ARPA_INET_H
|
25
|
+
# include <arpa/inet.h>
|
26
|
+
#endif
|
27
|
+
#ifdef HAVE_ARPA_NAMESER_H
|
28
|
+
# include <arpa/nameser.h>
|
29
|
+
#else
|
30
|
+
# include "nameser.h"
|
31
|
+
#endif
|
32
|
+
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
|
33
|
+
# include <arpa/nameser_compat.h>
|
34
|
+
#endif
|
35
|
+
|
36
|
+
#include "ares.h"
|
37
|
+
#include "ares_inet_net_pton.h"
|
38
|
+
#include "ares_platform.h"
|
39
|
+
#include "ares_private.h"
|
40
|
+
|
41
|
+
#ifdef WATT32
|
42
|
+
#undef WIN32
|
43
|
+
#endif
|
44
|
+
|
45
|
+
struct addr_query {
|
46
|
+
/* Arguments passed to ares_gethostbyaddr() */
|
47
|
+
ares_channel channel;
|
48
|
+
struct ares_addr addr;
|
49
|
+
ares_host_callback callback;
|
50
|
+
void *arg;
|
51
|
+
|
52
|
+
const char *remaining_lookups;
|
53
|
+
int timeouts;
|
54
|
+
};
|
55
|
+
|
56
|
+
static void next_lookup(struct addr_query *aquery);
|
57
|
+
static void addr_callback(void *arg, int status, int timeouts,
|
58
|
+
unsigned char *abuf, int alen);
|
59
|
+
static void end_aquery(struct addr_query *aquery, int status,
|
60
|
+
struct hostent *host);
|
61
|
+
static int file_lookup(struct ares_addr *addr, struct hostent **host);
|
62
|
+
static void ptr_rr_name(char *name, const struct ares_addr *addr);
|
63
|
+
|
64
|
+
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
|
65
|
+
int family, ares_host_callback callback, void *arg)
|
66
|
+
{
|
67
|
+
struct addr_query *aquery;
|
68
|
+
|
69
|
+
if (family != AF_INET && family != AF_INET6)
|
70
|
+
{
|
71
|
+
callback(arg, ARES_ENOTIMP, 0, NULL);
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
|
75
|
+
if ((family == AF_INET && addrlen != sizeof(aquery->addr.addrV4)) ||
|
76
|
+
(family == AF_INET6 && addrlen != sizeof(aquery->addr.addrV6)))
|
77
|
+
{
|
78
|
+
callback(arg, ARES_ENOTIMP, 0, NULL);
|
79
|
+
return;
|
80
|
+
}
|
81
|
+
|
82
|
+
aquery = ares_malloc(sizeof(struct addr_query));
|
83
|
+
if (!aquery)
|
84
|
+
{
|
85
|
+
callback(arg, ARES_ENOMEM, 0, NULL);
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
aquery->channel = channel;
|
89
|
+
if (family == AF_INET)
|
90
|
+
memcpy(&aquery->addr.addrV4, addr, sizeof(aquery->addr.addrV4));
|
91
|
+
else
|
92
|
+
memcpy(&aquery->addr.addrV6, addr, sizeof(aquery->addr.addrV6));
|
93
|
+
aquery->addr.family = family;
|
94
|
+
aquery->callback = callback;
|
95
|
+
aquery->arg = arg;
|
96
|
+
aquery->remaining_lookups = channel->lookups;
|
97
|
+
aquery->timeouts = 0;
|
98
|
+
|
99
|
+
next_lookup(aquery);
|
100
|
+
}
|
101
|
+
|
102
|
+
static void next_lookup(struct addr_query *aquery)
|
103
|
+
{
|
104
|
+
const char *p;
|
105
|
+
char name[128];
|
106
|
+
int status;
|
107
|
+
struct hostent *host;
|
108
|
+
|
109
|
+
for (p = aquery->remaining_lookups; *p; p++)
|
110
|
+
{
|
111
|
+
switch (*p)
|
112
|
+
{
|
113
|
+
case 'b':
|
114
|
+
ptr_rr_name(name, &aquery->addr);
|
115
|
+
aquery->remaining_lookups = p + 1;
|
116
|
+
ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback,
|
117
|
+
aquery);
|
118
|
+
return;
|
119
|
+
case 'f':
|
120
|
+
status = file_lookup(&aquery->addr, &host);
|
121
|
+
|
122
|
+
/* this status check below previously checked for !ARES_ENOTFOUND,
|
123
|
+
but we should not assume that this single error code is the one
|
124
|
+
that can occur, as that is in fact no longer the case */
|
125
|
+
if (status == ARES_SUCCESS)
|
126
|
+
{
|
127
|
+
end_aquery(aquery, status, host);
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
end_aquery(aquery, ARES_ENOTFOUND, NULL);
|
134
|
+
}
|
135
|
+
|
136
|
+
static void addr_callback(void *arg, int status, int timeouts,
|
137
|
+
unsigned char *abuf, int alen)
|
138
|
+
{
|
139
|
+
struct addr_query *aquery = (struct addr_query *) arg;
|
140
|
+
struct hostent *host;
|
141
|
+
size_t addrlen;
|
142
|
+
|
143
|
+
aquery->timeouts += timeouts;
|
144
|
+
if (status == ARES_SUCCESS)
|
145
|
+
{
|
146
|
+
if (aquery->addr.family == AF_INET)
|
147
|
+
{
|
148
|
+
addrlen = sizeof(aquery->addr.addrV4);
|
149
|
+
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4,
|
150
|
+
(int)addrlen, AF_INET, &host);
|
151
|
+
}
|
152
|
+
else
|
153
|
+
{
|
154
|
+
addrlen = sizeof(aquery->addr.addrV6);
|
155
|
+
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6,
|
156
|
+
(int)addrlen, AF_INET6, &host);
|
157
|
+
}
|
158
|
+
end_aquery(aquery, status, host);
|
159
|
+
}
|
160
|
+
else if (status == ARES_EDESTRUCTION)
|
161
|
+
end_aquery(aquery, status, NULL);
|
162
|
+
else
|
163
|
+
next_lookup(aquery);
|
164
|
+
}
|
165
|
+
|
166
|
+
static void end_aquery(struct addr_query *aquery, int status,
|
167
|
+
struct hostent *host)
|
168
|
+
{
|
169
|
+
aquery->callback(aquery->arg, status, aquery->timeouts, host);
|
170
|
+
if (host)
|
171
|
+
ares_free_hostent(host);
|
172
|
+
ares_free(aquery);
|
173
|
+
}
|
174
|
+
|
175
|
+
static int file_lookup(struct ares_addr *addr, struct hostent **host)
|
176
|
+
{
|
177
|
+
FILE *fp;
|
178
|
+
int status;
|
179
|
+
int error;
|
180
|
+
|
181
|
+
#ifdef WIN32
|
182
|
+
char PATH_HOSTS[MAX_PATH];
|
183
|
+
win_platform platform;
|
184
|
+
|
185
|
+
PATH_HOSTS[0] = '\0';
|
186
|
+
|
187
|
+
platform = ares__getplatform();
|
188
|
+
|
189
|
+
if (platform == WIN_NT) {
|
190
|
+
char tmp[MAX_PATH];
|
191
|
+
HKEY hkeyHosts;
|
192
|
+
|
193
|
+
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
|
194
|
+
&hkeyHosts) == ERROR_SUCCESS)
|
195
|
+
{
|
196
|
+
DWORD dwLength = MAX_PATH;
|
197
|
+
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
|
198
|
+
&dwLength);
|
199
|
+
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
|
200
|
+
RegCloseKey(hkeyHosts);
|
201
|
+
}
|
202
|
+
}
|
203
|
+
else if (platform == WIN_9X)
|
204
|
+
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
|
205
|
+
else
|
206
|
+
return ARES_ENOTFOUND;
|
207
|
+
|
208
|
+
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
|
209
|
+
|
210
|
+
#elif defined(WATT32)
|
211
|
+
extern const char *_w32_GetHostsFile (void);
|
212
|
+
const char *PATH_HOSTS = _w32_GetHostsFile();
|
213
|
+
|
214
|
+
if (!PATH_HOSTS)
|
215
|
+
return ARES_ENOTFOUND;
|
216
|
+
#endif
|
217
|
+
|
218
|
+
fp = fopen(PATH_HOSTS, "r");
|
219
|
+
if (!fp)
|
220
|
+
{
|
221
|
+
error = ERRNO;
|
222
|
+
switch(error)
|
223
|
+
{
|
224
|
+
case ENOENT:
|
225
|
+
case ESRCH:
|
226
|
+
return ARES_ENOTFOUND;
|
227
|
+
default:
|
228
|
+
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
229
|
+
error, strerror(error)));
|
230
|
+
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
|
231
|
+
PATH_HOSTS));
|
232
|
+
*host = NULL;
|
233
|
+
return ARES_EFILE;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
while ((status = ares__get_hostent(fp, addr->family, host)) == ARES_SUCCESS)
|
237
|
+
{
|
238
|
+
if (addr->family != (*host)->h_addrtype)
|
239
|
+
{
|
240
|
+
ares_free_hostent(*host);
|
241
|
+
continue;
|
242
|
+
}
|
243
|
+
if (addr->family == AF_INET)
|
244
|
+
{
|
245
|
+
if (memcmp((*host)->h_addr, &addr->addrV4,
|
246
|
+
sizeof(addr->addrV4)) == 0)
|
247
|
+
break;
|
248
|
+
}
|
249
|
+
else if (addr->family == AF_INET6)
|
250
|
+
{
|
251
|
+
if (memcmp((*host)->h_addr, &addr->addrV6,
|
252
|
+
sizeof(addr->addrV6)) == 0)
|
253
|
+
break;
|
254
|
+
}
|
255
|
+
ares_free_hostent(*host);
|
256
|
+
}
|
257
|
+
fclose(fp);
|
258
|
+
if (status == ARES_EOF)
|
259
|
+
status = ARES_ENOTFOUND;
|
260
|
+
if (status != ARES_SUCCESS)
|
261
|
+
*host = NULL;
|
262
|
+
return status;
|
263
|
+
}
|
264
|
+
|
265
|
+
static void ptr_rr_name(char *name, const struct ares_addr *addr)
|
266
|
+
{
|
267
|
+
if (addr->family == AF_INET)
|
268
|
+
{
|
269
|
+
unsigned long laddr = ntohl(addr->addrV4.s_addr);
|
270
|
+
unsigned long a1 = (laddr >> 24UL) & 0xFFUL;
|
271
|
+
unsigned long a2 = (laddr >> 16UL) & 0xFFUL;
|
272
|
+
unsigned long a3 = (laddr >> 8UL) & 0xFFUL;
|
273
|
+
unsigned long a4 = laddr & 0xFFUL;
|
274
|
+
sprintf(name, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1);
|
275
|
+
}
|
276
|
+
else
|
277
|
+
{
|
278
|
+
unsigned char *bytes = (unsigned char *)&addr->addrV6;
|
279
|
+
/* There are too many arguments to do this in one line using
|
280
|
+
* minimally C89-compliant compilers */
|
281
|
+
sprintf(name,
|
282
|
+
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.",
|
283
|
+
bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4,
|
284
|
+
bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4,
|
285
|
+
bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4,
|
286
|
+
bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4);
|
287
|
+
sprintf(name+strlen(name),
|
288
|
+
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
|
289
|
+
bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4,
|
290
|
+
bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4,
|
291
|
+
bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4,
|
292
|
+
bytes[1]&0xf, bytes[1] >> 4, bytes[0]&0xf, bytes[0] >> 4);
|
293
|
+
}
|
294
|
+
}
|