asyncengine 0.0.1.testing
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +0 -0
- data/asyncengine.gemspec +26 -0
- data/ext/asyncengine_ext/asyncengine_ruby.c +82 -0
- data/ext/asyncengine_ext/extconf.rb +47 -0
- data/ext/asyncengine_ext/libuv/AUTHORS +45 -0
- data/ext/asyncengine_ext/libuv/LICENSE +42 -0
- data/ext/asyncengine_ext/libuv/Makefile +119 -0
- data/ext/asyncengine_ext/libuv/README.md +88 -0
- data/ext/asyncengine_ext/libuv/build/gcc_version.py +20 -0
- data/ext/asyncengine_ext/libuv/common.gypi +176 -0
- data/ext/asyncengine_ext/libuv/config-mingw.mk +61 -0
- data/ext/asyncengine_ext/libuv/config-unix.mk +173 -0
- data/ext/asyncengine_ext/libuv/gyp_uv +60 -0
- data/ext/asyncengine_ext/libuv/include/ares.h +591 -0
- data/ext/asyncengine_ext/libuv/include/ares_version.h +24 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/eio.h +403 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ev.h +838 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ngx-queue.h +106 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/tree.h +768 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-unix.h +256 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-win.h +458 -0
- data/ext/asyncengine_ext/libuv/include/uv.h +1556 -0
- data/ext/asyncengine_ext/libuv/src/ares/AUTHORS +37 -0
- data/ext/asyncengine_ext/libuv/src/ares/CHANGES +1218 -0
- data/ext/asyncengine_ext/libuv/src/ares/CMakeLists.txt +22 -0
- data/ext/asyncengine_ext/libuv/src/ares/NEWS +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/README +60 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.cares +13 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.msvc +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.node +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/RELEASE-NOTES +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/TODO +23 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__close_sockets.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__get_hostent.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__read_line.c +71 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__timeval.c +111 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_cancel.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.c +190 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.h +65 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_destroy.c +105 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_dns.h +90 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_name.c +200 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_string.c +75 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_fds.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_hostent.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_string.c +25 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.c +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyaddr.c +301 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyname.c +523 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getnameinfo.c +427 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.c +122 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.h +53 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getsock.c +72 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_init.c +1809 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_iphlpapi.h +221 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_ipv6.h +78 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.c +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.c +86 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_mkquery.c +195 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.c +181 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.h +55 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_options.c +248 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_a_reply.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_aaaa_reply.c +259 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_mx_reply.c +170 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ns_reply.c +182 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ptr_reply.c +217 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_srv_reply.c +179 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_txt_reply.c +201 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.c +11035 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.h +43 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_private.h +355 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_process.c +1295 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_query.c +183 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_rules.h +144 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_search.c +321 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_send.c +134 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_setup.h +199 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.h +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strerror.c +56 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_timeout.c +80 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_version.c +11 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.c +79 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.h +36 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.c +59 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_cygwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_darwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_freebsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_linux/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_netbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_openbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_sunos/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_win32/ares_config.h +369 -0
- data/ext/asyncengine_ext/libuv/src/ares/get_ver.awk +35 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.c +451 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.h +31 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.c +208 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/nameser.h +203 -0
- data/ext/asyncengine_ext/libuv/src/ares/setup_once.h +504 -0
- data/ext/asyncengine_ext/libuv/src/ares/windows_port.c +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/async.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/cares.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/check.c +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/core.c +588 -0
- data/ext/asyncengine_ext/libuv/src/unix/cygwin.c +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/darwin.c +341 -0
- data/ext/asyncengine_ext/libuv/src/unix/dl.c +91 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Changes +63 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Makefile.am +15 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/autogen.sh +3 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config.h.in +86 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_cygwin.h +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_darwin.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_freebsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_linux.h +94 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_netbsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_openbsd.h +137 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_sunos.h +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/configure.ac +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/demo.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/ecb.h +370 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.3 +3428 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.c +2593 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.pod +969 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/libeio.m4 +195 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/xthread.h +164 -0
- data/ext/asyncengine_ext/libuv/src/unix/error.c +98 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Changes +388 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.am +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.in +771 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/README +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/autogen.sh +6 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.guess +1526 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.h.in +125 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.sub +1658 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_cygwin.h +123 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_darwin.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_freebsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_linux.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_netbsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_openbsd.h +126 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_sunos.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure +13037 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure.ac +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/depcomp +630 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev++.h +816 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.3 +5311 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.c +3921 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.pod +5243 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_epoll.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_kqueue.c +235 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_poll.c +148 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_port.c +179 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_select.c +310 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_vars.h +203 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_win32.c +153 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_wrap.h +196 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.c +402 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.h +170 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/install-sh +294 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/libev.m4 +39 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ltmain.sh +8413 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/missing +336 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/mkinstalldirs +111 -0
- data/ext/asyncengine_ext/libuv/src/unix/freebsd.c +312 -0
- data/ext/asyncengine_ext/libuv/src/unix/fs.c +707 -0
- data/ext/asyncengine_ext/libuv/src/unix/idle.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/internal.h +161 -0
- data/ext/asyncengine_ext/libuv/src/unix/kqueue.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/core.c +474 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/inotify.c +211 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.c +230 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.h +87 -0
- data/ext/asyncengine_ext/libuv/src/unix/loop.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/netbsd.c +108 -0
- data/ext/asyncengine_ext/libuv/src/unix/openbsd.c +295 -0
- data/ext/asyncengine_ext/libuv/src/unix/pipe.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/prepare.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/process.c +369 -0
- data/ext/asyncengine_ext/libuv/src/unix/stream.c +1033 -0
- data/ext/asyncengine_ext/libuv/src/unix/sunos.c +466 -0
- data/ext/asyncengine_ext/libuv/src/unix/tcp.c +327 -0
- data/ext/asyncengine_ext/libuv/src/unix/thread.c +154 -0
- data/ext/asyncengine_ext/libuv/src/unix/timer.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/tty.c +146 -0
- data/ext/asyncengine_ext/libuv/src/unix/udp.c +670 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.c +124 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.h +13 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.c +354 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.h +87 -0
- data/ext/asyncengine_ext/libuv/src/win/async.c +127 -0
- data/ext/asyncengine_ext/libuv/src/win/cares.c +290 -0
- data/ext/asyncengine_ext/libuv/src/win/core.c +270 -0
- data/ext/asyncengine_ext/libuv/src/win/dl.c +82 -0
- data/ext/asyncengine_ext/libuv/src/win/error.c +132 -0
- data/ext/asyncengine_ext/libuv/src/win/fs-event.c +514 -0
- data/ext/asyncengine_ext/libuv/src/win/fs.c +1576 -0
- data/ext/asyncengine_ext/libuv/src/win/getaddrinfo.c +372 -0
- data/ext/asyncengine_ext/libuv/src/win/handle.c +225 -0
- data/ext/asyncengine_ext/libuv/src/win/internal.h +352 -0
- data/ext/asyncengine_ext/libuv/src/win/loop-watcher.c +131 -0
- data/ext/asyncengine_ext/libuv/src/win/pipe.c +1661 -0
- data/ext/asyncengine_ext/libuv/src/win/process.c +1140 -0
- data/ext/asyncengine_ext/libuv/src/win/req.c +174 -0
- data/ext/asyncengine_ext/libuv/src/win/stream.c +201 -0
- data/ext/asyncengine_ext/libuv/src/win/tcp.c +1282 -0
- data/ext/asyncengine_ext/libuv/src/win/thread.c +332 -0
- data/ext/asyncengine_ext/libuv/src/win/threadpool.c +73 -0
- data/ext/asyncengine_ext/libuv/src/win/timer.c +276 -0
- data/ext/asyncengine_ext/libuv/src/win/tty.c +1795 -0
- data/ext/asyncengine_ext/libuv/src/win/udp.c +709 -0
- data/ext/asyncengine_ext/libuv/src/win/util.c +719 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.c +117 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.h +4419 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.c +470 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.h +138 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ares.c +118 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-getaddrinfo.c +94 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-list.h +105 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ping-pongs.c +213 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pound.c +324 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pump.c +462 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-sizes.c +40 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-spawn.c +156 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-tcp-write-batch.c +140 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-thread.c +64 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-udp-packet-storm.c +247 -0
- data/ext/asyncengine_ext/libuv/test/blackhole-server.c +118 -0
- data/ext/asyncengine_ext/libuv/test/dns-server.c +321 -0
- data/ext/asyncengine_ext/libuv/test/echo-server.c +370 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/empty_file +0 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/load_error.node +1 -0
- data/ext/asyncengine_ext/libuv/test/run-benchmarks.c +64 -0
- data/ext/asyncengine_ext/libuv/test/run-tests.c +108 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.c +315 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.h +36 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.c +343 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.h +42 -0
- data/ext/asyncengine_ext/libuv/test/runner.c +317 -0
- data/ext/asyncengine_ext/libuv/test/runner.h +159 -0
- data/ext/asyncengine_ext/libuv/test/task.h +117 -0
- data/ext/asyncengine_ext/libuv/test/test-async.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-callback-stack.c +203 -0
- data/ext/asyncengine_ext/libuv/test/test-connection-fail.c +148 -0
- data/ext/asyncengine_ext/libuv/test/test-counters-init.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-cwd-and-chdir.c +64 -0
- data/ext/asyncengine_ext/libuv/test/test-delayed-accept.c +197 -0
- data/ext/asyncengine_ext/libuv/test/test-dlerror.c +49 -0
- data/ext/asyncengine_ext/libuv/test/test-eio-overflow.c +90 -0
- data/ext/asyncengine_ext/libuv/test/test-error.c +59 -0
- data/ext/asyncengine_ext/libuv/test/test-fail-always.c +29 -0
- data/ext/asyncengine_ext/libuv/test/test-fs-event.c +442 -0
- data/ext/asyncengine_ext/libuv/test/test-fs.c +1731 -0
- data/ext/asyncengine_ext/libuv/test/test-get-currentexe.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-get-loadavg.c +36 -0
- data/ext/asyncengine_ext/libuv/test/test-get-memory.c +38 -0
- data/ext/asyncengine_ext/libuv/test/test-getaddrinfo.c +122 -0
- data/ext/asyncengine_ext/libuv/test/test-gethostbyname.c +189 -0
- data/ext/asyncengine_ext/libuv/test/test-getsockname.c +342 -0
- data/ext/asyncengine_ext/libuv/test/test-hrtime.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-idle.c +81 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc-send-recv.c +209 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc.c +614 -0
- data/ext/asyncengine_ext/libuv/test/test-list.h +371 -0
- data/ext/asyncengine_ext/libuv/test/test-loop-handles.c +359 -0
- data/ext/asyncengine_ext/libuv/test/test-multiple-listen.c +102 -0
- data/ext/asyncengine_ext/libuv/test/test-mutexes.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-pass-always.c +28 -0
- data/ext/asyncengine_ext/libuv/test/test-ping-pong.c +253 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-bind-error.c +140 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-connect-error.c +96 -0
- data/ext/asyncengine_ext/libuv/test/test-platform-output.c +87 -0
- data/ext/asyncengine_ext/libuv/test/test-process-title.c +42 -0
- data/ext/asyncengine_ext/libuv/test/test-ref.c +322 -0
- data/ext/asyncengine_ext/libuv/test/test-run-once.c +44 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-close.c +103 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-eof.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-spawn.c +499 -0
- data/ext/asyncengine_ext/libuv/test/test-stdio-over-pipes.c +256 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind-error.c +191 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind6-error.c +154 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-close.c +129 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect-error.c +70 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect6-error.c +68 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-flags.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-error.c +168 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-to-half-open-connection.c +135 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-writealot.c +195 -0
- data/ext/asyncengine_ext/libuv/test/test-thread.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-threadpool.c +57 -0
- data/ext/asyncengine_ext/libuv/test/test-timer-again.c +141 -0
- data/ext/asyncengine_ext/libuv/test/test-timer.c +130 -0
- data/ext/asyncengine_ext/libuv/test/test-tty.c +110 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-dgram-too-big.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-ipv6.c +156 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-join.c +139 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-ttl.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-options.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-send-and-recv.c +208 -0
- data/ext/asyncengine_ext/libuv/test/test-util.c +97 -0
- data/ext/asyncengine_ext/libuv/uv.gyp +435 -0
- data/ext/asyncengine_ext/libuv/vcbuild.bat +105 -0
- data/lib/asyncengine/version.rb +3 -0
- data/lib/asyncengine.rb +41 -0
- metadata +384 -0
@@ -0,0 +1,182 @@
|
|
1
|
+
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
2
|
+
*
|
3
|
+
* Permission to use, copy, modify, and distribute this
|
4
|
+
* software and its documentation for any purpose and without
|
5
|
+
* fee is hereby granted, provided that the above copyright
|
6
|
+
* notice appear in all copies and that both that copyright
|
7
|
+
* notice and this permission notice appear in supporting
|
8
|
+
* documentation, and that the name of M.I.T. not be used in
|
9
|
+
* advertising or publicity pertaining to distribution of the
|
10
|
+
* software without specific, written prior permission.
|
11
|
+
* M.I.T. makes no representations about the suitability of
|
12
|
+
* this software for any purpose. It is provided "as is"
|
13
|
+
* without express or implied warranty.
|
14
|
+
*/
|
15
|
+
|
16
|
+
/*
|
17
|
+
* ares_parse_ns_reply created by Vlad Dinulescu <vlad.dinulescu@avira.com>
|
18
|
+
* on behalf of AVIRA Gmbh - http://www.avira.com
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "ares_setup.h"
|
22
|
+
|
23
|
+
#ifdef HAVE_SYS_SOCKET_H
|
24
|
+
# include <sys/socket.h>
|
25
|
+
#endif
|
26
|
+
#ifdef HAVE_NETINET_IN_H
|
27
|
+
# include <netinet/in.h>
|
28
|
+
#endif
|
29
|
+
#ifdef HAVE_NETDB_H
|
30
|
+
# include <netdb.h>
|
31
|
+
#endif
|
32
|
+
#ifdef HAVE_ARPA_INET_H
|
33
|
+
# include <arpa/inet.h>
|
34
|
+
#endif
|
35
|
+
#ifdef HAVE_ARPA_NAMESER_H
|
36
|
+
# include <arpa/nameser.h>
|
37
|
+
#else
|
38
|
+
# include "nameser.h"
|
39
|
+
#endif
|
40
|
+
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
|
41
|
+
# include <arpa/nameser_compat.h>
|
42
|
+
#endif
|
43
|
+
|
44
|
+
#include <stdlib.h>
|
45
|
+
#include <string.h>
|
46
|
+
#include "ares.h"
|
47
|
+
#include "ares_dns.h"
|
48
|
+
#include "ares_private.h"
|
49
|
+
|
50
|
+
int ares_parse_ns_reply( const unsigned char* abuf, int alen,
|
51
|
+
struct hostent** host )
|
52
|
+
{
|
53
|
+
unsigned int qdcount, ancount;
|
54
|
+
int status, i, rr_type, rr_class, rr_len;
|
55
|
+
int nameservers_num;
|
56
|
+
long len;
|
57
|
+
const unsigned char *aptr;
|
58
|
+
char* hostname, *rr_name, *rr_data, **nameservers;
|
59
|
+
struct hostent *hostent;
|
60
|
+
|
61
|
+
/* Set *host to NULL for all failure cases. */
|
62
|
+
*host = NULL;
|
63
|
+
|
64
|
+
/* Give up if abuf doesn't have room for a header. */
|
65
|
+
if ( alen < HFIXEDSZ )
|
66
|
+
return ARES_EBADRESP;
|
67
|
+
|
68
|
+
/* Fetch the question and answer count from the header. */
|
69
|
+
qdcount = DNS_HEADER_QDCOUNT( abuf );
|
70
|
+
ancount = DNS_HEADER_ANCOUNT( abuf );
|
71
|
+
if ( qdcount != 1 )
|
72
|
+
return ARES_EBADRESP;
|
73
|
+
|
74
|
+
/* Expand the name from the question, and skip past the question. */
|
75
|
+
aptr = abuf + HFIXEDSZ;
|
76
|
+
status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len);
|
77
|
+
if ( status != ARES_SUCCESS )
|
78
|
+
return status;
|
79
|
+
if ( aptr + len + QFIXEDSZ > abuf + alen )
|
80
|
+
{
|
81
|
+
free( hostname );
|
82
|
+
return ARES_EBADRESP;
|
83
|
+
}
|
84
|
+
aptr += len + QFIXEDSZ;
|
85
|
+
|
86
|
+
/* Allocate nameservers array; ancount gives an upper bound */
|
87
|
+
nameservers = malloc( ( ancount + 1 ) * sizeof( char * ) );
|
88
|
+
if ( !nameservers )
|
89
|
+
{
|
90
|
+
free( hostname );
|
91
|
+
return ARES_ENOMEM;
|
92
|
+
}
|
93
|
+
nameservers_num = 0;
|
94
|
+
|
95
|
+
/* Examine each answer resource record (RR) in turn. */
|
96
|
+
for ( i = 0; i < ( int ) ancount; i++ )
|
97
|
+
{
|
98
|
+
/* Decode the RR up to the data field. */
|
99
|
+
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len );
|
100
|
+
if ( status != ARES_SUCCESS )
|
101
|
+
break;
|
102
|
+
aptr += len;
|
103
|
+
if ( aptr + RRFIXEDSZ > abuf + alen )
|
104
|
+
{
|
105
|
+
status = ARES_EBADRESP;
|
106
|
+
free(rr_name);
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
rr_type = DNS_RR_TYPE( aptr );
|
110
|
+
rr_class = DNS_RR_CLASS( aptr );
|
111
|
+
rr_len = DNS_RR_LEN( aptr );
|
112
|
+
aptr += RRFIXEDSZ;
|
113
|
+
|
114
|
+
if ( rr_class == C_IN && rr_type == T_NS )
|
115
|
+
{
|
116
|
+
/* Decode the RR data and add it to the nameservers list */
|
117
|
+
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data,
|
118
|
+
&len);
|
119
|
+
if ( status != ARES_SUCCESS )
|
120
|
+
{
|
121
|
+
free(rr_name);
|
122
|
+
break;
|
123
|
+
}
|
124
|
+
|
125
|
+
nameservers[nameservers_num] = malloc(strlen(rr_data)+1);
|
126
|
+
|
127
|
+
if (nameservers[nameservers_num]==NULL)
|
128
|
+
{
|
129
|
+
free(rr_name);
|
130
|
+
free(rr_data);
|
131
|
+
status=ARES_ENOMEM;
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
strcpy(nameservers[nameservers_num],rr_data);
|
135
|
+
free(rr_data);
|
136
|
+
|
137
|
+
nameservers_num++;
|
138
|
+
}
|
139
|
+
|
140
|
+
free( rr_name );
|
141
|
+
|
142
|
+
aptr += rr_len;
|
143
|
+
if ( aptr > abuf + alen )
|
144
|
+
{
|
145
|
+
status = ARES_EBADRESP;
|
146
|
+
break;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
if ( status == ARES_SUCCESS && nameservers_num == 0 )
|
151
|
+
{
|
152
|
+
status = ARES_ENODATA;
|
153
|
+
}
|
154
|
+
if ( status == ARES_SUCCESS )
|
155
|
+
{
|
156
|
+
/* We got our answer. Allocate memory to build the host entry. */
|
157
|
+
nameservers[nameservers_num] = NULL;
|
158
|
+
hostent = malloc( sizeof( struct hostent ) );
|
159
|
+
if ( hostent )
|
160
|
+
{
|
161
|
+
hostent->h_addr_list = malloc( 1 * sizeof( char * ) );
|
162
|
+
if ( hostent->h_addr_list )
|
163
|
+
{
|
164
|
+
/* Fill in the hostent and return successfully. */
|
165
|
+
hostent->h_name = hostname;
|
166
|
+
hostent->h_aliases = nameservers;
|
167
|
+
hostent->h_addrtype = AF_INET;
|
168
|
+
hostent->h_length = sizeof( struct in_addr );
|
169
|
+
hostent->h_addr_list[0] = NULL;
|
170
|
+
*host = hostent;
|
171
|
+
return ARES_SUCCESS;
|
172
|
+
}
|
173
|
+
free( hostent );
|
174
|
+
}
|
175
|
+
status = ARES_ENOMEM;
|
176
|
+
}
|
177
|
+
for ( i = 0; i < nameservers_num; i++ )
|
178
|
+
free( nameservers[i] );
|
179
|
+
free( nameservers );
|
180
|
+
free( hostname );
|
181
|
+
return status;
|
182
|
+
}
|
@@ -0,0 +1,217 @@
|
|
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_SYS_SOCKET_H
|
20
|
+
# include <sys/socket.h>
|
21
|
+
#endif
|
22
|
+
#ifdef HAVE_NETINET_IN_H
|
23
|
+
# include <netinet/in.h>
|
24
|
+
#endif
|
25
|
+
#ifdef HAVE_NETDB_H
|
26
|
+
# include <netdb.h>
|
27
|
+
#endif
|
28
|
+
#ifdef HAVE_ARPA_NAMESER_H
|
29
|
+
# include <arpa/nameser.h>
|
30
|
+
#else
|
31
|
+
# include "nameser.h"
|
32
|
+
#endif
|
33
|
+
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
|
34
|
+
# include <arpa/nameser_compat.h>
|
35
|
+
#endif
|
36
|
+
|
37
|
+
#ifdef HAVE_STRINGS_H
|
38
|
+
# include <strings.h>
|
39
|
+
#endif
|
40
|
+
|
41
|
+
#include <stdlib.h>
|
42
|
+
#include <string.h>
|
43
|
+
#include "ares.h"
|
44
|
+
#include "ares_dns.h"
|
45
|
+
#include "ares_private.h"
|
46
|
+
|
47
|
+
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
48
|
+
int addrlen, int family, struct hostent **host)
|
49
|
+
{
|
50
|
+
unsigned int qdcount, ancount;
|
51
|
+
int status, i, rr_type, rr_class, rr_len;
|
52
|
+
long len;
|
53
|
+
const unsigned char *aptr;
|
54
|
+
char *ptrname, *hostname, *rr_name, *rr_data;
|
55
|
+
struct hostent *hostent;
|
56
|
+
int aliascnt = 0;
|
57
|
+
int alias_alloc = 8;
|
58
|
+
char ** aliases;
|
59
|
+
|
60
|
+
/* Set *host to NULL for all failure cases. */
|
61
|
+
*host = NULL;
|
62
|
+
|
63
|
+
/* Give up if abuf doesn't have room for a header. */
|
64
|
+
if (alen < HFIXEDSZ)
|
65
|
+
return ARES_EBADRESP;
|
66
|
+
|
67
|
+
/* Fetch the question and answer count from the header. */
|
68
|
+
qdcount = DNS_HEADER_QDCOUNT(abuf);
|
69
|
+
ancount = DNS_HEADER_ANCOUNT(abuf);
|
70
|
+
if (qdcount != 1)
|
71
|
+
return ARES_EBADRESP;
|
72
|
+
|
73
|
+
/* Expand the name from the question, and skip past the question. */
|
74
|
+
aptr = abuf + HFIXEDSZ;
|
75
|
+
status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len);
|
76
|
+
if (status != ARES_SUCCESS)
|
77
|
+
return status;
|
78
|
+
if (aptr + len + QFIXEDSZ > abuf + alen)
|
79
|
+
{
|
80
|
+
free(ptrname);
|
81
|
+
return ARES_EBADRESP;
|
82
|
+
}
|
83
|
+
aptr += len + QFIXEDSZ;
|
84
|
+
|
85
|
+
/* Examine each answer resource record (RR) in turn. */
|
86
|
+
hostname = NULL;
|
87
|
+
aliases = malloc(alias_alloc * sizeof(char *));
|
88
|
+
if (!aliases)
|
89
|
+
{
|
90
|
+
free(ptrname);
|
91
|
+
return ARES_ENOMEM;
|
92
|
+
}
|
93
|
+
for (i = 0; i < (int)ancount; i++)
|
94
|
+
{
|
95
|
+
/* Decode the RR up to the data field. */
|
96
|
+
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
|
97
|
+
if (status != ARES_SUCCESS)
|
98
|
+
break;
|
99
|
+
aptr += len;
|
100
|
+
if (aptr + RRFIXEDSZ > abuf + alen)
|
101
|
+
{
|
102
|
+
free(rr_name);
|
103
|
+
status = ARES_EBADRESP;
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
rr_type = DNS_RR_TYPE(aptr);
|
107
|
+
rr_class = DNS_RR_CLASS(aptr);
|
108
|
+
rr_len = DNS_RR_LEN(aptr);
|
109
|
+
aptr += RRFIXEDSZ;
|
110
|
+
|
111
|
+
if (rr_class == C_IN && rr_type == T_PTR
|
112
|
+
&& strcasecmp(rr_name, ptrname) == 0)
|
113
|
+
{
|
114
|
+
/* Decode the RR data and set hostname to it. */
|
115
|
+
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
116
|
+
&len);
|
117
|
+
if (status != ARES_SUCCESS)
|
118
|
+
{
|
119
|
+
free(rr_name);
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
if (hostname)
|
123
|
+
free(hostname);
|
124
|
+
hostname = rr_data;
|
125
|
+
aliases[aliascnt] = malloc((strlen(rr_data)+1) * sizeof(char));
|
126
|
+
if (!aliases[aliascnt])
|
127
|
+
{
|
128
|
+
free(rr_name);
|
129
|
+
status = ARES_ENOMEM;
|
130
|
+
break;
|
131
|
+
}
|
132
|
+
strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1);
|
133
|
+
aliascnt++;
|
134
|
+
if (aliascnt >= alias_alloc) {
|
135
|
+
char **ptr;
|
136
|
+
alias_alloc *= 2;
|
137
|
+
ptr = realloc(aliases, alias_alloc * sizeof(char *));
|
138
|
+
if(!ptr) {
|
139
|
+
free(rr_name);
|
140
|
+
status = ARES_ENOMEM;
|
141
|
+
break;
|
142
|
+
}
|
143
|
+
aliases = ptr;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
if (rr_class == C_IN && rr_type == T_CNAME)
|
148
|
+
{
|
149
|
+
/* Decode the RR data and replace ptrname with it. */
|
150
|
+
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
151
|
+
&len);
|
152
|
+
if (status != ARES_SUCCESS)
|
153
|
+
{
|
154
|
+
free(rr_name);
|
155
|
+
break;
|
156
|
+
}
|
157
|
+
free(ptrname);
|
158
|
+
ptrname = rr_data;
|
159
|
+
}
|
160
|
+
|
161
|
+
free(rr_name);
|
162
|
+
aptr += rr_len;
|
163
|
+
if (aptr > abuf + alen)
|
164
|
+
{
|
165
|
+
status = ARES_EBADRESP;
|
166
|
+
break;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
if (status == ARES_SUCCESS && !hostname)
|
171
|
+
status = ARES_ENODATA;
|
172
|
+
if (status == ARES_SUCCESS)
|
173
|
+
{
|
174
|
+
/* We got our answer. Allocate memory to build the host entry. */
|
175
|
+
hostent = malloc(sizeof(struct hostent));
|
176
|
+
if (hostent)
|
177
|
+
{
|
178
|
+
hostent->h_addr_list = malloc(2 * sizeof(char *));
|
179
|
+
if (hostent->h_addr_list)
|
180
|
+
{
|
181
|
+
hostent->h_addr_list[0] = malloc(addrlen);
|
182
|
+
if (hostent->h_addr_list[0])
|
183
|
+
{
|
184
|
+
hostent->h_aliases = malloc((aliascnt+1) * sizeof (char *));
|
185
|
+
if (hostent->h_aliases)
|
186
|
+
{
|
187
|
+
/* Fill in the hostent and return successfully. */
|
188
|
+
hostent->h_name = hostname;
|
189
|
+
for (i=0 ; i<aliascnt ; i++)
|
190
|
+
hostent->h_aliases[i] = aliases[i];
|
191
|
+
hostent->h_aliases[aliascnt] = NULL;
|
192
|
+
hostent->h_addrtype = family;
|
193
|
+
hostent->h_length = addrlen;
|
194
|
+
memcpy(hostent->h_addr_list[0], addr, addrlen);
|
195
|
+
hostent->h_addr_list[1] = NULL;
|
196
|
+
*host = hostent;
|
197
|
+
free(aliases);
|
198
|
+
free(ptrname);
|
199
|
+
return ARES_SUCCESS;
|
200
|
+
}
|
201
|
+
free(hostent->h_addr_list[0]);
|
202
|
+
}
|
203
|
+
free(hostent->h_addr_list);
|
204
|
+
}
|
205
|
+
free(hostent);
|
206
|
+
}
|
207
|
+
status = ARES_ENOMEM;
|
208
|
+
}
|
209
|
+
for (i=0 ; i<aliascnt ; i++)
|
210
|
+
if (aliases[i])
|
211
|
+
free(aliases[i]);
|
212
|
+
free(aliases);
|
213
|
+
if (hostname)
|
214
|
+
free(hostname);
|
215
|
+
free(ptrname);
|
216
|
+
return status;
|
217
|
+
}
|
@@ -0,0 +1,179 @@
|
|
1
|
+
|
2
|
+
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
3
|
+
* Copyright (C) 2009 by Jakub Hrozek <jhrozek@redhat.com>
|
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
|
+
|
20
|
+
#ifdef HAVE_SYS_SOCKET_H
|
21
|
+
# include <sys/socket.h>
|
22
|
+
#endif
|
23
|
+
#ifdef HAVE_NETINET_IN_H
|
24
|
+
# include <netinet/in.h>
|
25
|
+
#endif
|
26
|
+
#ifdef HAVE_NETDB_H
|
27
|
+
# include <netdb.h>
|
28
|
+
#endif
|
29
|
+
#ifdef HAVE_ARPA_INET_H
|
30
|
+
# include <arpa/inet.h>
|
31
|
+
#endif
|
32
|
+
#ifdef HAVE_ARPA_NAMESER_H
|
33
|
+
# include <arpa/nameser.h>
|
34
|
+
#else
|
35
|
+
# include "nameser.h"
|
36
|
+
#endif
|
37
|
+
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
|
38
|
+
# include <arpa/nameser_compat.h>
|
39
|
+
#endif
|
40
|
+
|
41
|
+
#include <stdlib.h>
|
42
|
+
#include <string.h>
|
43
|
+
#include "ares.h"
|
44
|
+
#include "ares_dns.h"
|
45
|
+
#include "ares_data.h"
|
46
|
+
#include "ares_private.h"
|
47
|
+
|
48
|
+
/* AIX portability check */
|
49
|
+
#ifndef T_SRV
|
50
|
+
# define T_SRV 33 /* server selection */
|
51
|
+
#endif
|
52
|
+
|
53
|
+
int
|
54
|
+
ares_parse_srv_reply (const unsigned char *abuf, int alen,
|
55
|
+
struct ares_srv_reply **srv_out)
|
56
|
+
{
|
57
|
+
unsigned int qdcount, ancount, i;
|
58
|
+
const unsigned char *aptr, *vptr;
|
59
|
+
int status, rr_type, rr_class, rr_len;
|
60
|
+
long len;
|
61
|
+
char *hostname = NULL, *rr_name = NULL;
|
62
|
+
struct ares_srv_reply *srv_head = NULL;
|
63
|
+
struct ares_srv_reply *srv_last = NULL;
|
64
|
+
struct ares_srv_reply *srv_curr;
|
65
|
+
|
66
|
+
/* Set *srv_out to NULL for all failure cases. */
|
67
|
+
*srv_out = NULL;
|
68
|
+
|
69
|
+
/* Give up if abuf doesn't have room for a header. */
|
70
|
+
if (alen < HFIXEDSZ)
|
71
|
+
return ARES_EBADRESP;
|
72
|
+
|
73
|
+
/* Fetch the question and answer count from the header. */
|
74
|
+
qdcount = DNS_HEADER_QDCOUNT (abuf);
|
75
|
+
ancount = DNS_HEADER_ANCOUNT (abuf);
|
76
|
+
if (qdcount != 1)
|
77
|
+
return ARES_EBADRESP;
|
78
|
+
if (ancount == 0)
|
79
|
+
return ARES_ENODATA;
|
80
|
+
|
81
|
+
/* Expand the name from the question, and skip past the question. */
|
82
|
+
aptr = abuf + HFIXEDSZ;
|
83
|
+
status = ares_expand_name (aptr, abuf, alen, &hostname, &len);
|
84
|
+
if (status != ARES_SUCCESS)
|
85
|
+
return status;
|
86
|
+
|
87
|
+
if (aptr + len + QFIXEDSZ > abuf + alen)
|
88
|
+
{
|
89
|
+
free (hostname);
|
90
|
+
return ARES_EBADRESP;
|
91
|
+
}
|
92
|
+
aptr += len + QFIXEDSZ;
|
93
|
+
|
94
|
+
/* Examine each answer resource record (RR) in turn. */
|
95
|
+
for (i = 0; i < ancount; i++)
|
96
|
+
{
|
97
|
+
/* Decode the RR up to the data field. */
|
98
|
+
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len);
|
99
|
+
if (status != ARES_SUCCESS)
|
100
|
+
{
|
101
|
+
break;
|
102
|
+
}
|
103
|
+
aptr += len;
|
104
|
+
if (aptr + RRFIXEDSZ > abuf + alen)
|
105
|
+
{
|
106
|
+
status = ARES_EBADRESP;
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
rr_type = DNS_RR_TYPE (aptr);
|
110
|
+
rr_class = DNS_RR_CLASS (aptr);
|
111
|
+
rr_len = DNS_RR_LEN (aptr);
|
112
|
+
aptr += RRFIXEDSZ;
|
113
|
+
|
114
|
+
/* Check if we are really looking at a SRV record */
|
115
|
+
if (rr_class == C_IN && rr_type == T_SRV)
|
116
|
+
{
|
117
|
+
/* parse the SRV record itself */
|
118
|
+
if (rr_len < 6)
|
119
|
+
{
|
120
|
+
status = ARES_EBADRESP;
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
|
124
|
+
/* Allocate storage for this SRV answer appending it to the list */
|
125
|
+
srv_curr = ares_malloc_data(ARES_DATATYPE_SRV_REPLY);
|
126
|
+
if (!srv_curr)
|
127
|
+
{
|
128
|
+
status = ARES_ENOMEM;
|
129
|
+
break;
|
130
|
+
}
|
131
|
+
if (srv_last)
|
132
|
+
{
|
133
|
+
srv_last->next = srv_curr;
|
134
|
+
}
|
135
|
+
else
|
136
|
+
{
|
137
|
+
srv_head = srv_curr;
|
138
|
+
}
|
139
|
+
srv_last = srv_curr;
|
140
|
+
|
141
|
+
vptr = aptr;
|
142
|
+
srv_curr->priority = DNS__16BIT(vptr);
|
143
|
+
vptr += sizeof(unsigned short);
|
144
|
+
srv_curr->weight = DNS__16BIT(vptr);
|
145
|
+
vptr += sizeof(unsigned short);
|
146
|
+
srv_curr->port = DNS__16BIT(vptr);
|
147
|
+
vptr += sizeof(unsigned short);
|
148
|
+
|
149
|
+
status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len);
|
150
|
+
if (status != ARES_SUCCESS)
|
151
|
+
break;
|
152
|
+
}
|
153
|
+
|
154
|
+
/* Don't lose memory in the next iteration */
|
155
|
+
free (rr_name);
|
156
|
+
rr_name = NULL;
|
157
|
+
|
158
|
+
/* Move on to the next record */
|
159
|
+
aptr += rr_len;
|
160
|
+
}
|
161
|
+
|
162
|
+
if (hostname)
|
163
|
+
free (hostname);
|
164
|
+
if (rr_name)
|
165
|
+
free (rr_name);
|
166
|
+
|
167
|
+
/* clean up on error */
|
168
|
+
if (status != ARES_SUCCESS)
|
169
|
+
{
|
170
|
+
if (srv_head)
|
171
|
+
ares_free_data (srv_head);
|
172
|
+
return status;
|
173
|
+
}
|
174
|
+
|
175
|
+
/* everything looks fine, return the data */
|
176
|
+
*srv_out = srv_head;
|
177
|
+
|
178
|
+
return ARES_SUCCESS;
|
179
|
+
}
|